InRange implements Validation { @Override public String getErrorMessage(final Context context) { return context.getString(R.string.formvalidations_not_in_range, mMin, mMax); } private  InRange(final int min, final int max); static Validation build(final int min, final int max); @Override String getErrorMessage(final Context context); @Override boolean isValid(final String text);  }
@Test public void testGetErrorMessage() throws Exception { final Validation validation = InRange.build(2, 4); final String errorMessage = validation.getErrorMessage(mActivity); assertNotNull(errorMessage); assertTrue(errorMessage.contains(Integer.toString(2))); assertTrue(errorMessage.contains(Integer.toString(4))); }