TextUtils { public static boolean isRepeatPatternNumber(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 isRepeatPatternNumber() { assertFalse("not repeating number must return false", TextUtils.isRepeatPatternNumber("029209355")); assertTrue("repeat pattern number must return true", TextUtils.isRepeatPatternNumber("123123123")); assertTrue("repeat pattern number must return true", TextUtils.isRepeatPatternNumber("00010001")); assertTrue("repeating number must also return true", TextUtils.isRepeatPatternNumber("222222222")); }