use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestSynchronousErrors method testWebappThrowsNotFound.
@Test
public void testWebappThrowsNotFound() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/throwNotFound");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
response.assertContains("Your page was not found");
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestBeansAndSplit method create.
private ResponseWrapper create() {
List<HttpPayload> payloads = parser.parse(dataReceived);
HttpResponse response = (HttpResponse) payloads.get(0);
DataWrapper all = dataGen.emptyWrapper();
for (int i = 1; i < payloads.size(); i++) {
HttpData d = (HttpData) payloads.get(i);
all = dataGen.chainDataWrappers(all, d.getBodyNonNull());
}
HttpFullResponse fResponse = new HttpFullResponse(response, all);
return new ResponseWrapper(fResponse);
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestBeans method testBeanMissingForGetSoNotFoundResults.
@Test
public void testBeanMissingForGetSoNotFoundResults() {
HttpFullRequest req = Requests.createRequest(KnownHttpMethod.GET, "/getuser?user.firstName=jeff&password=as");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestBeans method testArraySaved.
@Test
public void testArraySaved() {
HttpFullRequest req = Requests.createPostRequest("/postArray2", "user.accounts[1].name", "Account2Name", "user.accounts[1].color", "green", "user.accounts[2].addresses[0].number", "56", "user.firstName", "D&D", "user.lastName", "Hiller", "user.fullName", "Dean Hiller");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
UserDto user = mockSomeLib.getUser();
Assert.assertEquals("D&D", user.getFirstName());
Assert.assertEquals(3, user.getAccounts().size());
Assert.assertEquals("Account2Name", user.getAccounts().get(1).getName());
Assert.assertEquals(56, user.getAccounts().get(2).getAddresses().get(0).getNumber());
}
use of org.webpieces.webserver.test.ResponseWrapper in project webpieces by deanhiller.
the class TestBeans method testComplexBeanSaved.
@Test
public void testComplexBeanSaved() {
HttpFullRequest req = Requests.createPostRequest("/postuser2", "user.firstName", "D&D", "user.lastName", "Hiller", "user.fullName", "Dean Hiller", "user.address.zipCode", "555", "user.address.street", "Coolness Dr.");
XFuture<HttpFullResponse> respFuture = http11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
UserDto user = mockSomeOtherLib.getUser();
Assert.assertEquals(555, user.getAddress().getZipCode());
Assert.assertEquals("D&D", user.getFirstName());
Assert.assertEquals("Coolness Dr.", user.getAddress().getStreet());
}
Aggregations