@Test public void testNumericIntervalConstraintDescription() { Constraint.Description description = minInMaxEx.getDescription(); assertEquals("NumericIntervalConstraint", description.getName()); Map<String, Serializable> params = description.getParameters(); assertEquals(4, params.size()); assertTrue(params.containsKey("Minimum")); assertTrue(params.containsKey("MinimumInclusive")); assertTrue(params.containsKey("Maximum")); assertTrue(params.containsKey("MaximumInclusive")); assertEquals(new BigDecimal(VAL2), params.get("Minimum")); assertTrue((Boolean) params.get("MinimumInclusive")); assertEquals(new BigDecimal(VAL4), params.get("Maximum")); assertFalse((Boolean) params.get("MaximumInclusive")); }
@Override public Description getDescription() { Map<String, Serializable> params = new HashMap<>(); if (min != null) { params.put(PNAME_MINIMUM, min); params.put(PNAME_MIN_INC, includingMin); } if (max != null) { params.put(PNAME_MAXIMUM, max); params.put(PNAME_MAX_INC, includingMax); } return new Description(NumericIntervalConstraint.NAME, params); }
NumericIntervalConstraint extends AbstractConstraint { @Override public Description getDescription() { Map<String, Serializable> params = new HashMap<>(); if (min != null) { params.put(PNAME_MINIMUM, min); params.put(PNAME_MIN_INC, includingMin); } if (max != null) { params.put(PNAME_MAXIMUM, max); params.put(PNAME_MAX_INC, includingMax); } return new Description(NumericIntervalConstraint.NAME, params); } }
NumericIntervalConstraint extends AbstractConstraint { @Override public Description getDescription() { Map<String, Serializable> params = new HashMap<>(); if (min != null) { params.put(PNAME_MINIMUM, min); params.put(PNAME_MIN_INC, includingMin); } if (max != null) { params.put(PNAME_MAXIMUM, max); params.put(PNAME_MAX_INC, includingMax); } return new Description(NumericIntervalConstraint.NAME, params); } NumericIntervalConstraint(Object min, boolean includingMin, Object max, boolean includingMax); }
NumericIntervalConstraint extends AbstractConstraint { @Override public Description getDescription() { Map<String, Serializable> params = new HashMap<>(); if (min != null) { params.put(PNAME_MINIMUM, min); params.put(PNAME_MIN_INC, includingMin); } if (max != null) { params.put(PNAME_MAXIMUM, max); params.put(PNAME_MAX_INC, includingMax); } return new Description(NumericIntervalConstraint.NAME, params); } NumericIntervalConstraint(Object min, boolean includingMin, Object max, boolean includingMax); @Override boolean validate(Object object); @Override Description getDescription(); BigDecimal getMin(); BigDecimal getMax(); boolean isIncludingMin(); boolean isIncludingMax(); @Override String getErrorMessage(Object invalidValue, Locale locale); @Override int hashCode(); @Override boolean equals(Object obj); }
NumericIntervalConstraint extends AbstractConstraint { @Override public Description getDescription() { Map<String, Serializable> params = new HashMap<>(); if (min != null) { params.put(PNAME_MINIMUM, min); params.put(PNAME_MIN_INC, includingMin); } if (max != null) { params.put(PNAME_MAXIMUM, max); params.put(PNAME_MAX_INC, includingMax); } return new Description(NumericIntervalConstraint.NAME, params); } NumericIntervalConstraint(Object min, boolean includingMin, Object max, boolean includingMax); @Override boolean validate(Object object); @Override Description getDescription(); BigDecimal getMin(); BigDecimal getMax(); boolean isIncludingMin(); boolean isIncludingMax(); @Override String getErrorMessage(Object invalidValue, Locale locale); @Override int hashCode(); @Override boolean equals(Object obj);  }