playframework 2.2 - Play Framework 2.2 - functional test fails with type mismatch -


i've upgraded play 2.2, , since helpers have changed, test isn't compiling anymore.

import org.specs2.mutable.specification  import play.api.test._ import play.api.test.helpers._  import play.api.libs.ws._ import play.api.mvc.results._  class applicationspec extends specification {   import controllers._    "application" should {      "test ws logic" in new withserver {       await(ws.url("http://localhost:3333").get()).status must equalto(ok)     }    } } 

gives following compile error

type mismatch; [error]  found   : scala.concurrent.future[play.api.libs.ws.response] [error]  required: org.specs2.matcher.matcher[?] 

it's name clash between play.api.test.helpers.await , org.specs2.matcher.futurematchers.await.

you refer play helper more explicitly (or rename import):

helpers.await(ws.url("http://localhost:3333").get()).status must equalto(ok) 

the following better, however, hasn't made documentation yet:

https://github.com/playframework/playframework/blob/master/framework/src/play-test/src/main/scala/play/api/test/playspecification.scala

so extend playspecification instead of specification in test:

import org.specs2.mutable.specification  import play.api.test._ import play.api.test.helpers._  import play.api.libs.ws._ import play.api.mvc.results._  class applicationspec extends playspecification {   import controllers._    "application" should {      "test ws logic" in new withserver {       await(ws.url("http://localhost:3333").get()).status must equalto(ok)     }    } } 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -