Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

fmbenhassine
Copy link
Contributor

This PR 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.

@fmbenhassine fmbenhassine changed the title Add a new annotation @SpringBatchTest to simplify testing Add a new annotation @SpringBatchTest to simplify testing May 21, 2018
Copy link
Member

@mminella mminella left a 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);
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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
@mminella
Copy link
Member

Rebased and merged as 0dab67c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants