dimanche 28 février 2016

How to test a controller method that uses a custom parser in play 2.5?

My controller method:

def postCategory = Action(parse.tolerantText) { request =>
    Ok("")
  }

and this is my test:

val result = categoryController.postCategory.apply(FakeRequest())
      status(result) mustEqual OK //error this line

I have this error:

Error:(63, 14) type mismatch; found : play.api.libs.streams.Accumulator[akka.util.ByteString,play.api.mvc.Result] required: scala.concurrent.Future[play.api.mvc.Result] status(result) mustEqual OK ^

It seem that using a custom parser parse.* makes it returns Accumulator rather than Future[Result]

I'm using play 2.5-RC2

Aucun commentaire:

Enregistrer un commentaire