@Test public void testFailedValidation() { String firstValue = "-1"; String secondValue = "0"; String thirdValue = "2"; assertFalse(validator.isValid(firstValue)); assertFalse(validator.isValid(secondValue)); assertFalse(validator.isValid(thirdValue)); }
@Test public void testSuccessfulValidation() { int[] powerValues = {0, 1, 2, 3}; int[] multipliers = {1, 5}; int base = 10; for (int multiplier : multipliers) { for (int power : powerValues) { int value = (int) (multiplier * Math.pow(base, power)); assertTrue(validator.isValid(Integer.toString(value))); } } }