java - FakeRequest Result of type Promise -


i need test api written in java play framework v2.1.1 considering test below, passes (isnotnull) cannot check if correct result (i.e. status code, json array in response, ...). works call, if route doesn't exist. logger logs following: asyncresult(scala.concurrent.impl.promise$defaultpromise@3c7feca8 mean result still come, if yes: how it?

@test public void testroute() {     result result = routeandcall(fakerequest(get, "/api/call"));     assertthat(result).isnotnull();     logger.info(result.tostring()); } 

grateful reply! :)

you can use helpers class:

import static play.test.helpers.*; //important import  @test public void testroute() {     result result = routeandcall(fakerequest(get, "/api/call"));     assertthat(result).isnotnull();     assertthat(status(result)).isequalto(200);     assertthat(getcontentasstring(result)).isequalto("{\"a\": [1,2,3,4,5]}"); } 

Comments