[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

@@ -0,0 +1,24 @@
// 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.util;
import static edu.wpi.first.util.ErrorMessages.requireNonNullParam;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
class ErrorMessagesTest {
@Test
void requireNonNullParamNullTest() {
assertThrows(
NullPointerException.class, () -> requireNonNullParam(null, "testParam", "testMethod"));
}
@Test
void requireNonNullParamNotNullTest() {
assertDoesNotThrow(() -> requireNonNullParam("null", "testParam", "testMethod"));
}
}