1
2
3
4
5
6 package nl.mineleni.cbsviewer.jsp;
7
8 import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
9 import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
10 import static org.hamcrest.Matchers.equalTo;
11 import static org.junit.Assert.assertThat;
12
13 import org.apache.http.client.methods.HttpGet;
14 import org.junit.Test;
15
16
17
18
19
20
21 public class ErrorJSPIntegrationTest extends JSPIntegrationTest {
22
23
24
25
26
27
28 @Test
29 @Override
30 public void testIfValidResponse() throws Exception {
31 response = client.execute(new HttpGet(BASE_TEST_URL + "error.jsp"));
32 assertThat("Response status is SC_INTERNAL_SERVER_ERROR.", response
33 .getStatusLine().getStatusCode(),
34 equalTo(SC_INTERNAL_SERVER_ERROR));
35 boilerplateValidationTests(response);
36 }
37
38
39
40
41
42
43 @Test
44 public void testIfValidResponse404() throws Exception {
45 response = client.execute(new HttpGet(BASE_TEST_URL
46 + "non-existant.jsp"));
47 assertThat("Response status is SC_NOT_FOUND.", response.getStatusLine()
48 .getStatusCode(), equalTo(SC_NOT_FOUND));
49 boilerplateValidationTests(response);
50 }
51
52 }