[wpilibj] Consistently use ErrorMessages.requireNonNullParam (#4776)

Also remove wpilibj version of ErrorMessages and consistently use static import.
This commit is contained in:
Peter Johnson
2022-12-07 21:46:26 -08:00
committed by GitHub
parent b9772214d9
commit b390cad095
48 changed files with 92 additions and 128 deletions

View File

@@ -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"));
}
}

View File

@@ -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);