Skip to content
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

Closed
wants to merge 72 commits into from

Conversation

thmue
Copy link
Contributor

@thmue thmue commented Jun 21, 2023

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.

@pjfanning
Copy link
Contributor

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.

Copy link
Contributor

@pjfanning pjfanning left a 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.

@thmue
Copy link
Contributor Author

thmue commented Jun 21, 2023

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.
However, i don't see any test framework support in the subproject [pekko-testkit].

@pjfanning
Copy link
Contributor

The CI build is strict about unused imports.

[06-22 09:13:36.548] [error] /home/runner/work/incubator-pekko/incubator-pekko/actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/TestKitJunit5Extension.scala:12:19: Unused import
[06-22 09:13:36.549] [error] import org.apache.pekko

@pjfanning
Copy link
Contributor

pjfanning commented Jun 26, 2023

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

This file is part of the Apache Pekko project, derived from Akka.

Needs to be replaced by

This file is part of the Apache Pekko project, which was derived from Akka.

@thmue
Copy link
Contributor Author

thmue commented Jun 26, 2023

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?

@pjfanning
Copy link
Contributor

also Scala 3 compile issue -> https://github.com/apache/incubator-pekko/actions/runs/5379239855/jobs/9760373110?pr=445

needs to be (instance: T) => -- you'll need to replace the T with the correct type.

Don't use https://github.com/scala/scala-collection-compat. Try this

import org.apache.pekko
import pekko.util.ccompat._

ccompat is short for collection-compat.

@thmue
Copy link
Contributor Author

thmue commented Oct 16, 2023

i rebased it, unfortunately i had a lot of build problems. However these could be due to some local setup problems (intellij / scala etc....)

@thmue thmue marked this pull request as draft October 19, 2023 14:06
@thmue thmue closed this Oct 19, 2023
@thmue thmue deleted the junit5-extension branch November 24, 2023 21:26
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.

5 participants