You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "mdedetrich (via GitHub)" <gi...@apache.org> on 2023/04/12 13:04:15 UTC

[GitHub] [incubator-pekko] mdedetrich commented on a diff in pull request #283: Add ScalaTestWithActorTestKitBase trait to handle multiple extends

mdedetrich commented on code in PR #283:
URL: https://github.com/apache/incubator-pekko/pull/283#discussion_r1164106793


##########
actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/scaladsl/ScalaTestWithActorTestKit.scala:
##########
@@ -74,6 +70,21 @@ abstract class ScalaTestWithActorTestKit(testKit: ActorTestKit)
    */
   def this(config: Config, settings: TestKitSettings) =
     this(ActorTestKit(ActorTestKitBase.testNameFromCallStack(), config, settings))
+}
+
+/**
+ * A ScalaTest base trait for the [[ActorTestKit]] which [[ScalaTestWithActorTestKit]] extends. If you find yourself in
+ * the situation where you need to extend the same test suite in different ways then you can implement your tests within
+ * a trait that extends [[ScalaTestWithActorTestKitBase]].
+ */
+trait ScalaTestWithActorTestKitBase
+    extends TestSuite
+    with Matchers
+    with BeforeAndAfterAll
+    with ScalaFutures
+    with Eventually {
+
+  def testKit: ActorTestKit

Review Comment:
   This is a deliberately a `def` since its the lowest common denominator, i.e. when extending `ScalaTestWithActorTestKitBase` you can specify the `testKit` field to be either a `val`/`lazy val` or `def` (in most cases I would expect it to be a `val`)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org