use of org.webpieces.webserver.json.app.SearchRequest in project webpieces by deanhiller.
the class TestJsonCustomFilter method testNoAttributeValueInJsonGoesToEmptyString.
@Test
public void testNoAttributeValueInJsonGoesToEmptyString() {
// test out "something":null converts to "" in java....
String json = "{ `meta`: { `numResults`: 4 }, `testValidation`:`notBlank` }".replace("`", "\"");
HttpFullRequest req = Requests.createJsonRequest(KnownHttpMethod.POST, "/json/simple", json);
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContentType("application/json");
SearchRequest request = mockSvc.getCachedRequest();
Assert.assertEquals("", request.getQuery());
Assert.assertEquals("", request.getMeta().getExtraField());
}
use of org.webpieces.webserver.json.app.SearchRequest in project webpieces by deanhiller.
the class TestJsonCustomFilter method testNullValueInJsonGoesToEmptyString.
@Test
public void testNullValueInJsonGoesToEmptyString() {
// test out "something":null converts to "" in java....
String json = "{ `query`: null, `meta`: { `numResults`: 4 }, `testValidation`:`notBlank` }".replace("`", "\"");
HttpFullRequest req = Requests.createJsonRequest(KnownHttpMethod.POST, "/json/simple", json);
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
response.assertContentType("application/json");
SearchRequest request = mockSvc.getCachedRequest();
Assert.assertEquals("", request.getQuery());
Assert.assertEquals("", request.getMeta().getExtraField());
}
Aggregations