TextUtils { public static boolean isRepeatingNumber(String text) { return text.matches("\\b(\\d)\\1+\\b"); } private  TextUtils(); static boolean isDigitOnly(String text); static boolean isRepeatingNumber(String text); static boolean isRepeatPatternNumber(String text); static boolean isEmpty(String text);  }
@Test public void isRepeatNumber() { assertFalse("not repeating number must return false", TextUtils.isRepeatingNumber("029209355")); assertTrue("repeating number must return true", TextUtils.isRepeatingNumber("111111111")); assertTrue("repeating number must return true", TextUtils.isRepeatingNumber("222222222")); }