Question

Today I wanted to write some tests that use ImpermamentDatabase, on Neo4j page: http://docs.neo4j.org/chunked/stable/tutorials-java-unit-testing.html it says that neo4j-kernel jar must be added with <type>test-jar</type> for it to containt test classes.

Now, here is my build.sbt:

name := """scheduling-backend"""

version := "1.0"

scalaVersion := "2.10.2"

resolvers += "spray repo" at "http://repo.spray.io"

resolvers += "spray nightlies" at "http://nightlies.spray.io"

resolvers += "SpringSource Milestone Repository" at "http://repo.springsource.org/milestone"

resolvers += "Neo4j Cypher DSL Repository" at "http://m2.neo4j.org/content/repositories/releases"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % "2.2.0",
  "com.typesafe.akka" %% "akka-slf4j" % "2.2.0",
  "ch.qos.logback" % "logback-classic" % "1.0.13",
  "io.spray" % "spray-can" % "1.2-20130712",
  "io.spray" % "spray-routing" % "1.2-20130712",
  "io.spray" %% "spray-json" % "1.2.3",
  "org.specs2" %% "specs2" % "1.14" % "test",
  "io.spray" % "spray-testkit" % "1.2-20130712" % "test",
  "com.typesafe.akka" %% "akka-testkit" % "2.2.0" % "test",
  "com.novocode" % "junit-interface" % "0.7" % "test->default",
  "org.springframework.scala" % "spring-scala" % "1.0.0.M2",
  "org.springframework.data" % "spring-data-neo4j" % "2.3.4.RELEASE",
  "org.springframework.data" % "spring-data-neo4j-rest" % "2.3.4.RELEASE",
  "javax.validation" % "validation-api" % "1.1.0.Final",
  "com.github.nscala-time" %% "nscala-time" % "0.8.0"
)

scalacOptions ++= Seq(
  "-unchecked",
  "-deprecation",
  "-Xlint",
  "-Ywarn-dead-code",
  "-language:_",
  "-target:jvm-1.7",
  "-encoding", "UTF-8"
)

testOptions += Tests.Argument(TestFrameworks.JUnit, "-v")

when looking in Intellij I can see that I have for example neo4j-kernel dependency in version 1.9.3, shouldn't it include jars in 2.X version?

Another question, is it safe for me to just add neo4j-kernel with type test-jar in newest version or should I add it in the 1.9.3 version (like the existing jar)

Was it helpful?

Solution

You have this dependency org.springframework.data:spring-data-neo4j:2.3.4.RELEASE which means it will use Neo4j 1.9.3 (including testing).

If you want the latest Neo4j release (2.0 / 2.0.1) then use org.springframework.data:spring-data-neo4j:3.0.0.RELEASE.

You must use the same testing version as the normal version. Otherwise you might get tricked into thinking that some things work on the test version (and since it's newer some bugs might be fixed), but in the normal version it will fail.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top