-
Notifications
You must be signed in to change notification settings - Fork 148
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
[pekko-testkit-typed] Support for JUnit5 in testkit #751
Conversation
...rc/test/java/jdocs/org/apache/pekko/actor/testkit/typed/javadsl/LogCapturingExampleTest.java
Outdated
Show resolved
Hide resolved
...tkit-typed/src/main/java/org/apache/pekko/actor/testkit/typed/annotations/JUnit5TestKit.java
Show resolved
Hide resolved
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.
While its true that we shouldn't rename the Junit4
class names, we should actually fix them and have the old class name as an alias that is deprecated (so we don't break binary compatibility).
There is no reason not to improve the current state of things and consistency with current incorrectly named code isn't a compelling argument if you can fix the original issue without breaking users so I would recommend the following
- Rename the classes back to
JUnit4
/JUnit5
so its actually consistent with howJUnit
is named. - Create deprecated
Junit4
/Junit5
classes that extendJUnit4
/JUnit5
so it doesn't break binary compatibility. These can then be dropped in Pekko 2.0.x
ok i changed all Junit5 names/labels to JUnit5. I suggest to rename the other Junit4 labels / class names in a different PR. |
@thmue There are some compile errors for Scala 3 |
...ped/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJUnit5Extension.scala
Outdated
Show resolved
Hide resolved
actor-typed/src/main/scala-jdk-9/org/apache/pekko/actor/typed/internal/jfr/Events.scala
Outdated
Show resolved
Hide resolved
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.
lgtm - @mdedetrich wdyt? - it may be worth merging as is and worrying about prospective changes to the junit4 existing code later
@mdedetrich is it possible to merge this? |
I would like to add the aliases as I mentioned before, if it's tok much work then I can do it in a follow up PR |
I think that would be better in a separate PR |
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.
lgtm, lets do alias changes in separate PR
I would like to write tests with Junit5 and it seems this PR was merged 8 months ago but this is still not available on any stable release. Are there any plans to make this available please? |
Good question! I agree we should be working towards an 1.1.0 release. I think the best way to help with that is to look at the issues and PRs linked to the 1.1.0-M2 milestone and see if there's anything in there that you'd feel comfortable picking up. |
If you don't want to use 1.1.0-M1 (and it is not a full release), you could copy the 4 small classes from this PR into your code base and use them Pekko 1.0.x. |
Due to some issues with the scala setup i created a new PR, which is based on the current main branch.
This PR replaces #445
The extension is activated through an annotation:
@ExtendWith(TestKitJUnit5Extension.class)
on the class level.
Additionally, a testKit with a @Junit5TestKit annotation needs to be created.
A builder pattern is used to construct the Testkit instance.
@JUnit5TestKit
public ActorTestKit testKit = new JUnit5TestKitBuilder().build();
The extension itself uses the JUnit5 AfterAllCallback to shutdown the testkit after all tests are executed.