@Test public void shouldValidateThrowExceptionWhenMaxInMemoryIsSmallerThanDesiredBatchSizeAndSchedulerIsEnabled() throws Exception { EmailSchedulerProperties emailSchedulerProperties = EmailSchedulerProperties.builder() .enabled(true) .priorityLevels(1) .persistence(EmailSchedulerProperties.Persistence.builder() .desiredBatchSize(100) .minKeptInMemory(1) .maxKeptInMemory(10) .build()) .build(); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("The application properties key 'spring.mail.scheduler.persistence.maxKeptInMemory' should not have a value smaller than the value in property 'spring.mail.scheduler.persistence.desiredBatchSize'."); emailSchedulerProperties.validate(); fail("IllegalStateException expected"); }
@PostConstruct protected boolean validate() { if (enabled) { checkIsValid(this); } else { setValuesToNull(); } return true; }
EmailSchedulerProperties { @PostConstruct protected boolean validate() { if (enabled) { checkIsValid(this); } else { setValuesToNull(); } return true; } }
EmailSchedulerProperties { @PostConstruct protected boolean validate() { if (enabled) { checkIsValid(this); } else { setValuesToNull(); } return true; }  }
EmailSchedulerProperties { @PostConstruct protected boolean validate() { if (enabled) { checkIsValid(this); } else { setValuesToNull(); } return true; }  static void checkIsValid(@NonNull final EmailSchedulerProperties emailSchedulerProperties); }
EmailSchedulerProperties { @PostConstruct protected boolean validate() { if (enabled) { checkIsValid(this); } else { setValuesToNull(); } return true; }  static void checkIsValid(@NonNull final EmailSchedulerProperties emailSchedulerProperties);  }