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
Remove the JUnit dependency in AssertFile #4112
Conversation
@@ -34,7 +35,7 @@ | |||
* queue for inspection.</p> | |||
*/ | |||
|
|||
@RunWith(SpringJUnit4ClassRunner.class) | |||
@ExtendWith(SpringExtension.class) | |||
@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/amqp-example-job.xml", "/job-runner-context.xml" }) |
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.
Not really important, but if @ContextConfiguration
is replaced with @SpringJUnitConfig
, the @ExtendWith(SpringExtension.class)
can be omitted, which makes the code a bit leaner.
@SpringJUnitConfig
is basically @ContextConfiguration
but meta-annotated with @ExtendWith(SpringExtension.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.
+1 to using @SpringJUnitConfig
here and in every test class changed in this PR. Another PR could be opened to update all tests cases to use this annotation where appropriate.
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 tests have been migrated to JUnit 5 and @SpringJUnitConfig
in #4173. When the PR is rebased, the tests in the sample module shouldn't require much change.
I like how we removed the dependency to any testing library in e90330b! 👍 I'm not sure what would be the best exception to throw when the file comparison fails, but if you think In hindsight, everything in that |
Since I had to add the dependency to the tests to have them pass because of the change made in the previous commit, I decided to migrate all tests to JUnit 5. 2 things to note: * I used Spring's AssertionErrors on some AssertTrue or AssertFalse methods so that we could maintain the message. * In a couple of cases the use of assertNotSame that was used had a message, but is no longer supported, so I removed those messages.
The side effect is a breaking change in that it will now throw IllegalStateException instead of the Compare and AssertExceptions provided by JUnit.
9dda1cb
to
ccdfba6
Compare
Revert the removal of `@SpringJUnitConfig` usage in the test suite of samples. Related to #4111
resolves #4111