@Test
  public void set_secured_headers() throws ServletException, IOException {
    underTest.init(mock(FilterConfig.class));
    HttpServletRequest request = newRequest("GET");

    underTest.doFilter(request, response, chain);

    verify(response, times(3)).addHeader(startsWith("X-"), anyString());

    underTest.destroy();
  }
 private void assertThatMethodIsDenied(String httpMethod) throws IOException, ServletException {
   underTest.doFilter(newRequest(httpMethod), response, chain);
   verify(response).setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
 }
 private void assertThatMethodIsAllowed(String httpMethod) throws IOException, ServletException {
   HttpServletRequest request = newRequest(httpMethod);
   underTest.doFilter(request, response, chain);
   verify(response, never()).setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
   verify(chain).doFilter(request, response);
 }