@Test public void shouldValidateThrowExceptionWhenDesiredBatchSizeIsZeroAndSchedulerIsEnabled() throws Exception { EmailSchedulerProperties emailSchedulerProperties = EmailSchedulerProperties.builder() .enabled(true) .priorityLevels(1) .persistence(EmailSchedulerProperties.Persistence.builder() .desiredBatchSize(0) .minKeptInMemory(100) .maxKeptInMemory(10) .build()) .build(); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Expected at least a batch of size one, otherwise the persistence layer will not work. Review 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);  }