Files
java-tutorials/play-framework/student-api/app/utils/Util.java
T
Yavuz Tas e28fd3e7c9 Update javaxval/src/test/java/org/baeldung/javaxval/messageinterpolator/ParameterMessageInterpolaterIntegrationTest.java
update to use the givenX_whenY_thenZ naming convention for tests

Co-Authored-By: KevinGilmore <kpg102@gmail.com>
2019-10-29 10:02:27 +01:00

18 lines
473 B
Java

package utils;
import com.fasterxml.jackson.databind.node.ObjectNode;
import play.libs.Json;
public class Util {
public static ObjectNode createResponse(Object response, boolean ok) {
ObjectNode result = Json.newObject();
result.put("isSuccessful", ok);
if (response instanceof String) {
result.put("body", (String) response);
} else {
result.putPOJO("body", response);
}
return result;
}
}