Ejemplo n.º 1
0
  @Test
  public void handleRequest_nullChain() throws Exception {
    compressionHandler.setFilterChain(null);

    FilterDirector director = compressionHandler.handleRequest(request, response);

    assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.intValue(), director.getResponseStatusCode());
    assertThat(director.getFilterAction(), equalTo(FilterAction.RETURN));
  }
Ejemplo n.º 2
0
  @Test
  public void handleRequest_handleGenericIOError() throws Exception {
    compressionHandler.setFilterChain(filterChain);
    doThrow(new IOException())
        .when(compressingFilter)
        .doFilter(any(ServletRequest.class), any(ServletResponse.class), any(FilterChain.class));

    FilterDirector director = compressionHandler.handleRequest(request, response);

    assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.intValue(), director.getResponseStatusCode());
    assertThat(director.getFilterAction(), equalTo(FilterAction.RETURN));
  }