-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add a new annotation @SpringBatchTest to simplify testing #605
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
Conversation
@SpringBatchTest
to simplify testingThere 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.
Two minor nit picks that I can fix on merge if you're ok with them.
@Override | ||
public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) { | ||
ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); | ||
Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory); |
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.
Need an error message here.
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.
Added an error message (and also added a test to cover the case).
* @author Mahmoud Ben Hassine | ||
* @since 4.1 | ||
* @see JobLauncherTestUtils | ||
* @see org.springframework.batch.test.JobRepositoryTestUtils |
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.
Why is this one fully qualified?
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.
No reason, I don't know why this went fully qualified while others are not. Fixed.
This commit adds a new annotation `@SpringBatchTest` that: * configures two beans `JobLauncherTestUtils` and `JobRepositoryTestUtils` in the test context. * imports the `StepScopeTestExecutionListener` and `JobScopeTestExecutionListener` as test execution listeners. Resolves BATCH-2718
Rebased and merged as 0dab67c. |
This PR adds a new annotation
@SpringBatchTest
that:configures two beans
JobLauncherTestUtils
andJobRepositoryTestUtils
in the test context.
imports the
StepScopeTestExecutionListener
andJobScopeTestExecutionListener
as test execution listeners.Resolves BATCH-2718.