-
Notifications
You must be signed in to change notification settings - Fork 154
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 #445
Conversation
thanks @thmue - this looks useful. It does seem a little strange to not support junit5 in the legacy testkit and only in the typed testkit. |
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.
would it be possible to run scalafmt on the code? We require all PRs to be formatted correctly. The CI build will probably fail.
thank you for your review, i updated the commit after running scalafmt. Unfortunately i was not aware of the legacy testkit. In case this is not (that much) deprecated/legacy and if you find it useful to support it, i am happy to try to add support to it. |
...ava/jdocs/org/apache/pekko/actor/testkit/typed/javadsl/LogCapturingExtensionExampleTest.java
Outdated
Show resolved
Hide resolved
The CI build is strict about unused imports.
|
...ped/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunit5Extension.scala
Outdated
Show resolved
Hide resolved
...testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/Junit5TestKit.java
Outdated
Show resolved
Hide resolved
the build is still failing because of wrong apache headers in new source files - https://github.com/apache/incubator-pekko/actions/runs/5365713746/jobs/9754413547 This text is now wrong
Needs to be replaced by
|
it seems that the compatibility check for 2.12 is failing due to the usage of import scala.jdk.CollectionConverters.CollectionHasAsScala should https://github.com/scala/scala-collection-compat be used or is there another recommended way to convert a list for 2.12 and 2.13? |
also Scala 3 compile issue -> https://github.com/apache/incubator-pekko/actions/runs/5379239855/jobs/9760373110?pr=445 needs to be Don't use https://github.com/scala/scala-collection-compat. Try this
ccompat is short for collection-compat. |
...ped/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunit5Extension.scala
Outdated
Show resolved
Hide resolved
...testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/Junit5TestKit.java
Outdated
Show resolved
Hide resolved
…tension # Conflicts: # project/Dependencies.scala
i rebased it, unfortunately i had a lot of build problems. However these could be due to some local setup problems (intellij / scala etc....) |
I added a Junit5 Extension to support Junit5 framework integration.
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.
I closed the the last PR due to some rebase issues, this PR is directly based on main. Additionally, i discarded the changes in the docs. Sorry for the inconvenience.