HasTransitionsValidator implements ConstraintValidator<HasTransitions, SetPagesTransitionParameters> { @Override public boolean isValid(SetPagesTransitionParameters value, ConstraintValidatorContext context) { if (value != null) { return value.getDefaultTransition() != null || !value.getTransitions().isEmpty(); } return true; }  @Override void initialize(HasTransitions constraintAnnotation); @Override boolean isValid(SetPagesTransitionParameters value, ConstraintValidatorContext context);  }
@Test public void testNull() { assertTrue(victim.isValid(null, null)); }
@Test public void testHasDefault() { when(params.getDefaultTransition()).thenReturn(mockTransition); assertTrue(victim.isValid(params, null)); }
@Test public void testHasTransitions() { when(params.getDefaultTransition()).thenReturn(null); when(params.getTransitions()).thenReturn(Collections.singletonMap(Integer.MAX_VALUE, mockTransition)); assertTrue(victim.isValid(params, null)); }
@Test public void testHasBoth() { when(params.getDefaultTransition()).thenReturn(mockTransition); when(params.getTransitions()).thenReturn(Collections.singletonMap(Integer.MAX_VALUE, mockTransition)); assertTrue(victim.isValid(params, null)); }
@Test public void testHasNone() { when(params.getDefaultTransition()).thenReturn(null); Map<Integer, PdfPageTransition> empty = Collections.emptyMap(); when(params.getTransitions()).thenReturn(empty); assertFalse(victim.isValid(params, null)); }