### Question:
ValidNumber { public static boolean isValid(String number) { if (number == null || number.isEmpty()) { throw new IllegalArgumentException( "Input string should be not null and not empty"); } if (number.length() == 1 && number.charAt(0) - '0' >= 0 && number.charAt(0) - '0' <= 9) { return true; } int illegalSymbol = -1; boolean invalid = false; boolean[] digits = new boolean[10]; for (int i = 0; i < number.length(); i++) { int digit = number.charAt(i) - '0'; if (digit < 0 || digit > 9) { illegalSymbol = i; break; } invalid |= digit == 0 || digit == 1 || digits[digit]; digits[digit] = true; } if (illegalSymbol > -1) { throw new IllegalArgumentException("Digit #" + illegalSymbol + " is not valid"); } if (invalid) { return false; } return !(digits[2] && digits[3] && digits[6]) && !(digits[2] && digits[4] && digits[8]) && !(digits[3] && digits[4] && digits[6] && digits[8]); }  static boolean isValid(String number);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testIsValidNullString() { isValid(null); }
@Test(expected = IllegalArgumentException.class) public void testIsValidEmptyNull() { isValid(""); }
@Test(expected = IllegalArgumentException.class) public void testIsValidStringIsNotANumber1() { isValid(" "); }
@Test(expected = IllegalArgumentException.class) public void testIsValidStringIsNotANumber2() { isValid("2342 23"); }
@Test(expected = IllegalArgumentException.class) public void testIsValidStringIsNotANumber3() { isValid("2342s23"); }
@Test public void testIsValidString() { assertTrue(isValid("0")); assertTrue(isValid("1")); assertFalse(isValid("12")); assertTrue(isValid("2")); assertFalse(isValid("1248")); assertFalse(isValid("248")); assertTrue(isValid("48")); assertFalse(isValid("77")); assertTrue(isValid("75468")); assertFalse(isValid("375468")); assertFalse(isValid("3625")); assertFalse(isValid("3525")); assertTrue(isValid("3425")); }