0
votes

It seems sbt is ignoring my Java test in my Akka application, probably for a good reason I wouldn't know of, as I am not well versed in Junit, which Akka Testkit relies on. Is my code missing some necessary ceremony?

import akka.testkit.javadsl.TestKit;
import org.scalatest.junit.*;
import VowpalWrapper.Actors.*;
import VowpalWrapper.DecisionPoint.*;
import java.util.*;

public class JavaInitializationTest extends JUnitSuite {
   public void test() {
     List<String> actions = Arrays.asList("action A", "action B", "action C");
     DecisionPointDef dp = new DecisionPointDef("some-decision-point", "0.0", actions);
   }
}

Initially, I am writing these tests just to validate my Java API for actor classes written (and tested elsewhere) in Scala.

My build.sbt is very straightforward, but I'll include it just in case:

scalaVersion := "2.12.4"
libraryDependencies ++= Seq(
  "org.scalactic" %% "scalactic" % "3.0.5",
  "org.scalatest" %% "scalatest" % "3.0.5" % "test",
  "org.apache.commons" % "commons-math3" % "3.6.1",
  "com.typesafe.akka" %% "akka-actor" % "2.5.1",
  "com.typesafe.akka" %% "akka-testkit" % "2.5.1" % Test
)

Trying to add import org.junit.Test for the @Test annotation, I am not sure which version of junit to include to match the Akka Testkit stack, or whether that's a really good idea.

Many thanks in advance!!

1

1 Answers

0
votes

Adding junit to build.sbt solves it. For my case:

"junit" % "junit" % "4.12" % Test

which hopefully corresponds the the version of junit that the Akka TestKit version in my build.sbt corresponds to. Someone should really update https://doc.akka.io/docs/akka/2.5/testing.html I guess.