@Test void testValidateNotNullConstraintCompound() { Attribute attribute = when(mock(Attribute.class).getDataType()).thenReturn(COMPOUND).getMock(); EntityType entityType = when(mock(EntityType.class).getAtomicAttributes()) .thenReturn(singletonList(attribute)) .getMock(); Entity entity = when(mock(Entity.class).getEntityType()).thenReturn(entityType).getMock(); Errors errors = mock(Errors.class); assertThrows(UnexpectedEnumException.class, () -> entityValidator.validate(entity, errors)); }
@Override public void validate(@Nonnull Object target, @Nonnull Errors errors) { Entity entity = (Entity) target; entity .getEntityType() .getAtomicAttributes() .forEach(attribute -> validate(entity, attribute, errors)); }
EntityValidator implements Validator { @Override public void validate(@Nonnull Object target, @Nonnull Errors errors) { Entity entity = (Entity) target; entity .getEntityType() .getAtomicAttributes() .forEach(attribute -> validate(entity, attribute, errors)); } }
EntityValidator implements Validator { @Override public void validate(@Nonnull Object target, @Nonnull Errors errors) { Entity entity = (Entity) target; entity .getEntityType() .getAtomicAttributes() .forEach(attribute -> validate(entity, attribute, errors)); } EntityValidator(ExpressionValidator expressionValidator); }
EntityValidator implements Validator { @Override public void validate(@Nonnull Object target, @Nonnull Errors errors) { Entity entity = (Entity) target; entity .getEntityType() .getAtomicAttributes() .forEach(attribute -> validate(entity, attribute, errors)); } EntityValidator(ExpressionValidator expressionValidator); @Override boolean supports(@Nonnull Class<?> clazz); @Override void validate(@Nonnull Object target, @Nonnull Errors errors); }
EntityValidator implements Validator { @Override public void validate(@Nonnull Object target, @Nonnull Errors errors) { Entity entity = (Entity) target; entity .getEntityType() .getAtomicAttributes() .forEach(attribute -> validate(entity, attribute, errors)); } EntityValidator(ExpressionValidator expressionValidator); @Override boolean supports(@Nonnull Class<?> clazz); @Override void validate(@Nonnull Object target, @Nonnull Errors errors);  }