Giter VIP home page Giter VIP logo

Comments (10)

wsargent avatar wsargent commented on May 28, 2024 6

Can you test out the milestone build:

https://groups.google.com/d/msg/play-framework/KLpcJGzqbbI/k9DENVgDBAAJ

"org.scalatestplus.play" %% "scalatestplus-play" % "2.0.0-M1" % Test

from scalatestplus-play.

wsargent avatar wsargent commented on May 28, 2024 1

Scalatest 3.0.0 is not compatible with Scalatestplus-play 1.5.x. The version that it's built against is "org.scalatest" %% "scalatest" % "2.2.6". The master snapshot "3.0.0-SNAPSHOT" is built against scalatest 3.0.0.

from scalatestplus-play.

gavares avatar gavares commented on May 28, 2024

Using scalatest version 3.0.0-M-15 seems to be the cause of the probem. Once I reverted to 2.2.6, the issue was resolved.

from scalatestplus-play.

njouanin avatar njouanin commented on May 28, 2024

Hi, is there a fix or workaround currently available for this issue ?

from scalatestplus-play.

marcospereira avatar marcospereira commented on May 28, 2024

Hey @gavares and @njouanin,

Could you please submit a reproducible scenario here?

from scalatestplus-play.

njouanin avatar njouanin commented on May 28, 2024

I'm using scalatestplus-play 1.5.1 with play 2.5.x and scalatest/scalactic 3.0.0
I'm running the documentation example:

class SampleSpec extends PlaySpec with OneAppPerSuite {

  // Override app if you need a Application with other than
  // default parameters.
  implicit override lazy val app = new GuiceApplicationBuilder().configure(Map("ehcacheplugin" -> "disabled")).build()

  "The OneAppPerSuite trait" must {
    "provide an Application" in {
      app.configuration.getString("ehcacheplugin") mustBe Some("disabled")
    }
    "start the Application" in {
      Play.maybeApplication mustBe Some(app)
    }
  }
}

For me, the ClassCastException is raised in a test class which uses should matchers ("something" should {...) instead of must. When using must the following exception is thrown :

[info] models.dao.SampleSpec *** ABORTED ***
[info]   java.lang.AbstractMethodError: models.dao.SampleSpec.convertToStringMustWrapper(Ljava/lang/String;Lorg/scalactic/source/Position;Lorg/scalactic/Prettifier;)Lorg/scalatest/MustMatchers$StringMustWrapper;
[info]   at models.dao.SampleSpec.<init>(SampleSpec.scala:29)
[info]   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[info]   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[info]   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[info]   at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
[info]   at java.lang.Class.newInstance(Class.java:442)
[info]   at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:435)
[info]   at sbt.ForkMain$Run$2.call(ForkMain.java:296)
[info]   at sbt.ForkMain$Run$2.call(ForkMain.java:286)
[info]   at java.util.concurrent.FutureTask.run(FutureTask.java:266)

I guess scalatestplus-play 1.5.x doesn't support scalatest/scalactic 3.0.0. When switching to scalatest/scalactic 2.2.6 the test runs fine. So I don't know if there's an issue here. Just waiting for a scalatestplus-play version compatible with scalatest 3.0.0

from scalatestplus-play.

mach-kernel avatar mach-kernel commented on May 28, 2024

I have the same issue. I wanted to use ScalaTest 3.0.0 because of its async spec classes that would make a lot of my tests more idiomatic.

Class
class QuerySpec extends WordSpec with OneServerPerSuite with MustMatchers
Relevant SBT
libraryDependencies ++= Seq(
  "org.scalatest" % "scalatest_2.11" % "3.0.0" % Test,
  "org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test
)
Console Output
[info] org.pack.age.test.database.QuerySpec *** ABORTED ***
[info]   java.lang.ClassCastException: scala.util.Success cannot be cast to java.lang.Boolean
[info]   at scala.runtime.BoxesRunTime.unboxToBoolean(BoxesRunTime.java:85)
[info]   at org.scalatestplus.play.OneServerPerSuite$$anonfun$run$1.apply(OneServerPerSuite.scala:182)
[info]   at org.scalatest.CompositeStatus.whenCompleted(Status.scala:886)
[info]   at org.scalatestplus.play.OneServerPerSuite$class.run(OneServerPerSuite.scala:182)
[info]   at org.birdfeed.chirp.test.database.QuerySpec.run(QuerySpec.scala:14)
[info]   at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:314)
[info]   at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:472)
[info]   at sbt.ForkMain$Run$2.call(ForkMain.java:296)
[info]   at sbt.ForkMain$Run$2.call(ForkMain.java:286)
[info]   at java.util.concurrent.FutureTask.run(FutureTask.java:266)

from scalatestplus-play.

mach-kernel avatar mach-kernel commented on May 28, 2024

@wsargent Thanks for the prompt reply! I'm going to give this a shot and report back after I've ported over a few tests with some feedback.

from scalatestplus-play.

mach-kernel avatar mach-kernel commented on May 28, 2024

@wsargent it works perfectly and I have not to the best of my ability been able to break it (yet). I will try though. 🎉

Thank you!

from scalatestplus-play.

marcospereira avatar marcospereira commented on May 28, 2024

Closing since now we have a version compatible with Scalatest 3.0.x.

from scalatestplus-play.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.