AlphaNumeric implements Validation { @Override public boolean isValid(final String text) { return text.matches("[0-9a-zA-Z]*"); } private  AlphaNumeric(); static AlphaNumeric build(); @Override String getErrorMessage(final Context context); @Override boolean isValid(final String text);  }
@Test public void testNumbersAreValid() throws Exception { assertTrue(mAlphaNumeric.isValid("123")); }
@Test public void testAsciiTextIsValid() throws Exception { assertTrue(mAlphaNumeric.isValid("test")); }
@Test public void testNumbersAndAsciiTextAreValid() throws Exception { assertTrue(mAlphaNumeric.isValid("test123")); }
@Test public void testSpecialCharsAreNotValid() throws Exception { assertFalse(mAlphaNumeric.isValid("ä")); assertFalse(mAlphaNumeric.isValid("ö")); assertFalse(mAlphaNumeric.isValid("ü")); assertFalse(mAlphaNumeric.isValid("ß")); }