play.test.Helpers.contentAsString()

Here are the examples of the java api play.test.Helpers.contentAsString() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : UserTypeControllerTest.java
with MIT License
from project-sunbird

public String getResponseCode(Result result) {
    String responseStr = Helpers.contentreplacedtring(result);
    ObjectMapper mapper = new ObjectMapper();
    try {
        Response response = mapper.readValue(responseStr, Response.clreplaced);
        ResponseParams params = response.getParams();
        if (result.status() != 200) {
            return params.getErr();
        } else {
            return params.getStatus();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}

19 Source : TestUtil.java
with MIT License
from project-sunbird

public static String getResponseCode(Result result) {
    String responseStr = Helpers.contentreplacedtring(result);
    ObjectMapper mapper = new ObjectMapper();
    try {
        Response response = mapper.readValue(responseStr, Response.clreplaced);
        if (response != null) {
            ResponseParams params = response.getParams();
            if (result.status() != 200) {
                return params.getErr();
            } else {
                return params.getStatus();
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}