@Test public void shouldValidateThrowExceptionWhenNumberOfPriorityLevelsIsNegativeAndSchedulerIsEnabled() throws Exception { EmailSchedulerProperties emailSchedulerProperties = EmailSchedulerProperties.builder() .enabled(true) .priorityLevels(-1) .build(); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Expected at least one priority level. Review property 'spring.mail.scheduler.priorityLevels'."); 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);  }