TextUtils { public static boolean isDigitOnly(String text) { return text.matches("\\d+"); } 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 isDigitOnly() { assertTrue("input only digit should return true", TextUtils.isDigitOnly("12346")); assertTrue("input only digit should return true", TextUtils.isDigitOnly("222222222")); assertFalse("input not only digit should return false", TextUtils.isDigitOnly("123adc")); assertFalse("empty should return false", TextUtils.isDigitOnly("")); }