-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JobLauncherApplicationRunner returns a success exit code even when no jobs have been run #36060
JobLauncherApplicationRunner returns a success exit code even when no jobs have been run #36060
Conversation
.withPropertyValues("spring.batch.job.names:discreteLocalJob,nonConfiguredJob") | ||
.run((context) -> { | ||
assertThat(context).hasSingleBean(JobLauncher.class); | ||
assertThrows(NoSuchJobException.class,()->{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Spring Boot style rules don't allow JUnit assertThrows()
. Please use the AssertJ assertThatIllegalArgumentException()
or assertThatExceptionOfType()
instead.
@itsAkshayDubey Thanks for the PR. As also suggested in the issue comments, it would be better to fail early if any job names are unknown instead of potentially processing some jobs and then failing. Starting in Spring Boot 3.0, some validation is done in a |
Hi @scottfrederick , Added suggested changes, kindly have a look. Thanks, |
@itsAkshayDubey thank you for making your first contribution to Spring Boot. |
JobLauncherApplicationRunner returns a success exit code even when no jobs have been run.
fix: Rethrowing exception when NoSuchJobException is caught for non configured jobs.
Closes: #35940