StringPattern { public int digits() { return digits; } private  StringPattern(int pattern, int digits); boolean isAllLetter(); boolean isInitialCapitalLetter(); boolean isAllCapitalLetter(); boolean isAllLowerCaseLetter(); boolean isAllDigit(); int digits(); boolean containsPeriod(); boolean containsComma(); boolean containsSlash(); boolean containsDigit(); boolean containsHyphen(); boolean containsLetters(); static StringPattern recognize(String token);  }
@Test public void testDigits() { assertEquals(6, StringPattern.recognize("123456").digits()); assertEquals(3, StringPattern.recognize("123fff").digits()); assertEquals(0, StringPattern.recognize("test").digits()); }