0

I am using play application and for testing I am using Rest assured here is my code

describe("signup processing")
  {
    it("user singed up")
    {
      val json: JsValue = JsObject(Seq(
       "firstName" -> JsString("alice"),
       "lastName" -> JsString("bob"),
       "email" -> JsString("example@gmail.com"),
       "secondryEmail" -> JsString("example1@gmail.com"),
       "password" -> JsString("a@s**dasda_sds5")
    ))

      given()
      .port(9000)
      .contentType("application/json") 
      .body(json)
     .when()
      .post("/direct-user/signup-processing")
     .Then()
       .statusCode(200)
    }
  }

when I run the tests I am getting the following exception

Exception encountered when attempting to run a suite with class name: endtoendtesting.directusertests.DirectUserSignUpTest *** ABORTED ***

    [info]   java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
    [info]   at io.restassured.internal.util.MatcherErrorMessageBuilder.buildError(MatcherErrorMessageBuilder.java:19)
    [info]   at io.restassured.internal.util.MatcherErrorMessageBuilder$buildError.call(Unknown Source)
    [info]   at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    [info]   at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    [info]   at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
    [info]   at io.restassured.internal.ResponseSpecificationImpl$HamcrestAssertionClosure.validateStatusCodeAndStatusLine(ResponseSpecificationImpl.groovy:536)
    [info]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [info]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    [info]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [info]   at java.lang.reflect.Method.invoke(Method.java:498)

here is build.sbt file

libraryDependencies ++= Seq(filters, 
                "org.scalatest" %% "scalatest" % "2.2.6" % "test"withSources() withJavadoc(),
                "org.scalatestplus" %% "play" % "1.4.0-M3" % "test",
                "org.slf4j" % "slf4j-api" % "1.6.4",
                    "com.typesafe.akka" %% "akka-actor" % "2.3.6",
            "com.typesafe.akka" % "akka-testkit_2.11" % "2.3.6",
            "ch.qos.logback" % "logback-core" % "1.0.9",
            "io.rest-assured" % "scala-support" % "3.0.6")

is there any jar missing? which is cauing this exception

Zoey Hewll
  • 4,788
  • 2
  • 20
  • 33
swaheed
  • 3,671
  • 10
  • 42
  • 103
  • if there was a jar missing, it would say it couldn't find a certain class, now it's actually a method that can't be found. Maybe you've passed wrong parameters. – Stultuske Jan 11 '18 at 11:14
  • 3
    Looks like a version conflict. Some of your dependencies is pulling hamcrest of a different version then what rest-assured wants – Dima Jan 11 '18 at 11:37
  • Check Related questions: https://stackoverflow.com/questions/25964522/how-to-resolve-version-conflicts-in-intellij-sbt-included-libraries, https://stackoverflow.com/questions/36305311/how-to-resolve-dependecny-conflict-of-an-sbt-dependecy, https://stackoverflow.com/questions/15833015/nosuchmethoderror-with-hamcrest-1-3-junit-4-11?noredirect=1&lq=1 – tkruse Jan 12 '18 at 01:22
  • Possible duplicate of [Getting "NoSuchMethodError: org.hamcrest.Matcher.describeMismatch" when running test in IntelliJ 10.5](https://stackoverflow.com/questions/7869711/getting-nosuchmethoderror-org-hamcrest-matcher-describemismatch-when-running) – tkruse Jan 12 '18 at 01:22

0 Answers0