Ejemplo n.º 1
0
  @Test
  public void ensureAlreadyCommitedResponsesSafelyExit() throws Exception {
    doReturn(true).when(response).isCommitted();

    filter.doFilter(request, response, chain);
    verify(scope, VerificationModeFactory.noMoreInteractions()).enter();
  }
Ejemplo n.º 2
0
 @Test
 public void ensureFilterExitsScopeOnError() throws Exception {
   doThrow(new ServletException()).when(chain).doFilter(request, response);
   try {
     filter.doFilter(request, response, chain);
     fail("Expected an exception to be thrown.");
   } catch (ServletException e) {
     // Expected. We want to make sure that our scope is properly
     // exited.
   }
   verify(scope).enter();
   verify(scope).exit();
 }
Ejemplo n.º 3
0
 @Test
 public void ensureFilterEntersAndExitsScope() throws Exception {
   filter.doFilter(request, response, chain);
   verify(scope).enter();
   verify(scope).exit();
 }