use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method testRollback.
@Test
public void testRollback() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/fail");
mock.addException(() -> {
throw new RuntimeException("for test");
});
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR);
Assert.assertEquals(2, TransactionFilter.getState());
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestSyncHibernate method saveBean.
private String saveBean(String path) {
HttpRequest req = Requests.createRequest(KnownHttpMethod.POST, path);
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
return response.getRedirectUrl();
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestDevSynchronousErrors method testWebAppHasBugAndRender500HasBug.
@Test
public void testWebAppHasBugAndRender500HasBug() {
mockNotFoundLib.throwRuntime();
mockInternalSvrErrorLib.throwRuntime();
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_500_INTERNAL_SVR_ERROR);
response.assertContains("The webpieces platform saved them");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestDevSynchronousErrors method testNotFoundFromMismatchArgType.
@Test
public void testNotFoundFromMismatchArgType() {
//because 'notAnInt' is not convertable to integer, this result in NotFound rather than 500 as truly a route with
//no int doesn't really exist so it's a NotFound
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/redirectint/notAnInt");
http11Socket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(http11Socket);
response.assertStatusCode(KnownStatusCode.HTTP_404_NOTFOUND);
response.assertContains("Your app's webpage was not found");
}
use of org.webpieces.webserver.test.FullResponse in project webpieces by deanhiller.
the class TestHttps method testReverseUrlLookupOnHttpPageForHttpsUrl.
@Test
public void testReverseUrlLookupOnHttpPageForHttpsUrl() {
HttpRequest req = Requests.createRequest(KnownHttpMethod.GET, "/same");
httpSocket.send(req);
FullResponse response = ResponseExtract.assertSingleResponse(httpSocket);
response.assertStatusCode(KnownStatusCode.HTTP_200_OK);
//notice the Https Route page is not shown
response.assertContains("https://myhost.com:8443");
}
Aggregations