@Test(expected = IllegalArgumentException.class) public void testNegativeMaxValueRangeIsNotPossible() throws Exception { Length.range(1, -1); }
public static Validation range(final int minLength, final int maxLength) { if (minLength <= 0) { throw new IllegalArgumentException("minLength must be positive"); } if (maxLength <= 0) { throw new IllegalArgumentException("maxLength must be positive"); } return new Length(minLength, maxLength); }
Length implements Validation { public static Validation range(final int minLength, final int maxLength) { if (minLength <= 0) { throw new IllegalArgumentException("minLength must be positive"); } if (maxLength <= 0) { throw new IllegalArgumentException("maxLength must be positive"); } return new Length(minLength, maxLength); } }
Length implements Validation { public static Validation range(final int minLength, final int maxLength) { if (minLength <= 0) { throw new IllegalArgumentException("minLength must be positive"); } if (maxLength <= 0) { throw new IllegalArgumentException("maxLength must be positive"); } return new Length(minLength, maxLength); } private  Length(final int minLength, final int maxLength); }
Length implements Validation { public static Validation range(final int minLength, final int maxLength) { if (minLength <= 0) { throw new IllegalArgumentException("minLength must be positive"); } if (maxLength <= 0) { throw new IllegalArgumentException("maxLength must be positive"); } return new Length(minLength, maxLength); } private  Length(final int minLength, final int maxLength); static Validation min(final int minLength); static Validation max(final int maxLength); static Validation range(final int minLength, final int maxLength); @Override String getErrorMessage(final Context context); @Override boolean isValid(final String text); }
Length implements Validation { public static Validation range(final int minLength, final int maxLength) { if (minLength <= 0) { throw new IllegalArgumentException("minLength must be positive"); } if (maxLength <= 0) { throw new IllegalArgumentException("maxLength must be positive"); } return new Length(minLength, maxLength); } private  Length(final int minLength, final int maxLength); static Validation min(final int minLength); static Validation max(final int maxLength); static Validation range(final int minLength, final int maxLength); @Override String getErrorMessage(final Context context); @Override boolean isValid(final String text);  }