ParametersValidator { public static void checkRange(int value, int min, int max, String errorMessage) throws ParametersException { if (value < min || value > max) { throw new ParametersException(errorMessage); } } private  ParametersValidator(); static void checkRange(int value, int min, int max, String errorMessage); static void checkNotBlank(String value, String errorMessage); static void checkAtLeastOneNotBlank(String errorMessage, String... values); static void checkParameter(boolean expression, String errorMessage);  }
@Test(expected = ParametersException.class) public void testCheckRange_lessThanMin() throws Exception { ParametersValidator.checkRange(-1, 0, 100, "Error"); }
@Test(expected = ParametersException.class) public void testCheckRange_greaterThanMax() throws Exception { ParametersValidator.checkRange(101, 0, 100, "Error"); }
@Test public void testCheckRange_valid() throws Exception { ParametersValidator.checkRange(0, 0, 100, "Error"); ParametersValidator.checkRange(50, 0, 100, "Error"); ParametersValidator.checkRange(100, 0, 100, "Error"); }