Skip to content

Update exception tests to JUnit Jupiter#368

Merged
asfgit merged 1 commit intoapache:masterfrom
mureinik:junit-jupiter-exception
Oct 7, 2018
Merged

Update exception tests to JUnit Jupiter#368
asfgit merged 1 commit intoapache:masterfrom
mureinik:junit-jupiter-exception

Conversation

@mureinik
Copy link
Copy Markdown
Contributor

@mureinik mureinik commented Oct 7, 2018

Upgrade the tests in the exception package to use JUnit Jupiter as part of the effort to remove the dependency on the Vintage Engine.

While most of these changes are drop-in replacements with no functional benefit, there are some non-obvious changes worth mentioning.

Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an expected argument. Instead, an explicit call to org.junit.jupiter.api.Assertions.assertThrows is used.

Another non-obvious change was performed in ContextedRuntimeExceptionTest. Unlike JUnit Vintage's @Before, JUnit Jupiter's @BeforeEach does not apply if a parent's method is annotated with it and the overriding method is not, so an explicit @BeforeEach annotation had to be added to ContexedTuntimeExceptionTest#setUp().

It's also worth noting this is a minimal patch for migrating the package's tests to Jupiter. There are several tests that can be made more elegant with Jupiter's new features, but that work is left for subsequent patches.

Upgrade the tests in the exception package to use JUnit Jupiter as
part of the effort to remove the dependency on the Vintage Engine.

While most of these changes are drop-in replacements with no functional
benefit, there are some non-obvious changes worth mentioning.

Unlike org.junit.Test, org.junit.jupiter.api.Test does not have an
"expected" argument. Instead, an explicit call to
org.junit.jupiter.api.Assertions.assertThrows is used.

Another non-obvious change was performed in
ContextedRuntimeExceptionTest. Unlike JUnit Vintages's @before, JUnit
Jupiter's @beforeeach does not apply if a parent's method is annotated
with it and the overriding method is not, so an explicit @beforeeach
annotation had to be added to ContexedTuntimeExceptionTest#setUp().

It's also worth noting this is a minimal patch for migrating the
package's tests to Jupiter. There are several tests that can be made
made more elegant with Jupiter's new features, but that work is left
for subsequent patches.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 95.253% when pulling 884d273 on mureinik:junit-jupiter-exception into 762641d on apache:master.

@PascalSchumacher
Copy link
Copy Markdown
Contributor

Thanks! 👍

@asfgit asfgit merged commit 884d273 into apache:master Oct 7, 2018
@mureinik mureinik deleted the junit-jupiter-exception branch October 7, 2018 18:00
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.

4 participants