View Javadoc
1   /*
2    * Copyright (c) 2013, Dienst Landelijk Gebied - Ministerie van Economische Zaken
3    * 
4    * Gepubliceerd onder de BSD 2-clause licentie, zie https://github.com/MinELenI/CBSviewer/blob/master/LICENSE.md voor de volledige licentie.
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   * Testcases voor error.jsp, error404.jsp en andere fout pagina's.
18   * 
19   * @author mprins
20   */
21  public class ErrorJSPIntegrationTest extends JSPIntegrationTest {
22  
23  	/**
24  	 * testcase voor error.jsp.
25  	 * 
26  	 * @throws Exception
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  	 * testcase voor error404.jsp.
40  	 * 
41  	 * @throws Exception
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  }