IsNumber implements Validation { @Override public boolean isValid(final String value) { return value.matches("[0-9]*"); } private  IsNumber(); static IsNumber build(); @Override String getErrorMessage(final Context context); @Override boolean isValid(final String value);  }
@Test public void testNumbersAreValid() throws Exception { assertTrue(mIsNumber.isValid("1")); assertTrue(mIsNumber.isValid("12")); assertTrue(mIsNumber.isValid("123")); }
@Test public void testTextIsNotValid() throws Exception { assertFalse(mIsNumber.isValid("text")); }