mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpilibj] Consistently use ErrorMessages.requireNonNullParam (#4776)
Also remove wpilibj version of ErrorMessages and consistently use static import.
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.first.math.util;
|
||||
|
||||
import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import edu.wpi.first.wpilibj.UtilityClassTest;
|
||||
import edu.wpi.first.wpilibj.util.ErrorMessages;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ErrorMessagesTest extends UtilityClassTest<ErrorMessages> {
|
||||
ErrorMessagesTest() {
|
||||
super(ErrorMessages.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void requireNonNullParamNullTest() {
|
||||
assertThrows(
|
||||
NullPointerException.class, () -> requireNonNullParam(null, "testParam", "testMethod"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void requireNonNullParamNotNullTest() {
|
||||
assertDoesNotThrow(() -> requireNonNullParam("null", "testParam", "testMethod"));
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import edu.wpi.first.networktables.NetworkTableEntry;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -25,6 +26,11 @@ class SuppliedValueWidgetTest {
|
||||
m_instance = new ShuffleboardInstance(m_ntInstance);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
m_ntInstance.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAddString() {
|
||||
AtomicInteger count = new AtomicInteger(0);
|
||||
|
||||
Reference in New Issue
Block a user