-
Notifications
You must be signed in to change notification settings - Fork 351
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
Add initial implementation of JUnit Jupiter Extension (#3662) #4351
Conversation
Signed-off-by: Sascha Volkenandt <sascha@akv-soft.de>
Is there any progress with this PR? |
I created another PR. I was not aware of this. Here is my PR: I found the only issue is that there are 2 methods annotated with @after and @before in JerseyTest. Those methods are not invoked in JUnit5 because it has other annotations for this (@AfterEach and @beforeeach) In my opinion we only need to add those new annotations together with the Junit4 ones. This does not throw runtime errors when JUnit5 is not in the classpath. |
@jbescos I think the two PRs are mostly unrelated. Enabling JerseyTest to work with JUnit 5 does not provide a JUnit-Extension, which is IMO preferable to having a test class extend JerseyTest. But the extension only provides an additional (more JUnit-y) approach to launching the Jersey Testframework. |
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 logic looks good to me.
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>5.5.2</version> |
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.
We can use here: ${junit5.version}
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<version>3.14.0</version> |
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.
It is preferable to create a property in pom.xml and reference that property here with ${assert.version}
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
|
||
Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. |
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.
Date needs to be the date of this was added in a commit. It should look like '2019, 2021'
There is a plugin that will fail in case it is not set correctly.
@@ -0,0 +1,145 @@ | |||
/* | |||
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. |
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.
2019, 2021
@@ -0,0 +1,30 @@ | |||
/* | |||
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. |
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.
2019, 2021
@@ -0,0 +1,171 @@ | |||
/* | |||
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. |
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.
2019, 2021
@@ -0,0 +1,31 @@ | |||
/* | |||
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. |
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.
2019, 2021
@@ -38,6 +38,7 @@ | |||
<module>util</module> | |||
<module>maven</module> | |||
<module>memleak-test-common</module> | |||
<module>jupiter-extension</module> |
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.
You have to update the copyright date. This time it has to be: 2010, 2021
Fix #3662
We are using this initial implementation in our internal projects successfully with JUnit Jupiter 5.2+. It provides a JUnit Jupiter Extension (and annotation) that sets up and configures the Jersey Test Framework and is able to inject Client, WebTarget and URI instances into fields and/or test method parameters.
ECA is signed.
Signed-off-by: Sascha Volkenandt sascha@akv-soft.de