@Test
  public void blocksDisallowedMethod() throws Exception {
    when(request.getMethod()).thenReturn("TRACE");
    filter.doFilter(request, response, chain);

    verify(chain, never()).doFilter(request, response);
  }
 @Test
 public void disallowedMethodCausesMethodNotAllowedResponse()
     throws IOException, ServletException {
   when(request.getMethod()).thenReturn("TRACE");
   filter.doFilter(request, response, chain);
   verify(response).sendError(eq(DISALLOWED_STATUS_CODE));
 }
  @Test
  public void allowsAllowedMethod() throws Exception {
    when(request.getMethod()).thenReturn("GET");
    filter.doFilter(request, response, chain);

    verify(chain).doFilter(request, response);
  }