NotNegativeCoordinatesValidator implements ConstraintValidator<NotNegativeCoordinates, RectangularBox> { @Override public boolean isValid(RectangularBox value, ConstraintValidatorContext context) { if (value != null) { return value.getBottom() >= 0 && value.getTop() >= 0 && value.getLeft() >= 0 && value.getRight() >= 0; } return true; }  @Override void initialize(NotNegativeCoordinates constraintAnnotation); @Override boolean isValid(RectangularBox value, ConstraintValidatorContext context);  }
@Test public void testNull() { assertTrue(victim.isValid(null, null)); }
@Test public void testTopNegative() { TestUtils.setProperty(box, "top", -1); assertFalse(victim.isValid(box, null)); }
@Test public void testBottomNegative() { TestUtils.setProperty(box, "bottom", -1); assertFalse(victim.isValid(box, null)); }
@Test public void testLeftNegative() { TestUtils.setProperty(box, "left", -1); assertFalse(victim.isValid(box, null)); }
@Test public void testRightNegative() { TestUtils.setProperty(box, "right", -1); assertFalse(victim.isValid(box, null)); }
@Test public void testValid() { assertTrue(victim.isValid(box, null)); }