|
|
@ -40,6 +40,10 @@ import static org.junit.Assert.assertFalse;
|
|
|
|
import static org.junit.Assert.assertNotNull;
|
|
|
|
import static org.junit.Assert.assertNotNull;
|
|
|
|
import static org.junit.Assert.assertThat;
|
|
|
|
import static org.junit.Assert.assertThat;
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
|
|
|
import static org.mockito.BDDMockito.given;
|
|
|
|
|
|
|
|
import static org.mockito.Mockito.mock;
|
|
|
|
|
|
|
|
import static org.mockito.Mockito.times;
|
|
|
|
|
|
|
|
import static org.mockito.Mockito.verify;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Tests for {@link ErrorPageFilter}.
|
|
|
|
* Tests for {@link ErrorPageFilter}.
|
|
|
@ -343,4 +347,16 @@ public class ErrorPageFilterTests {
|
|
|
|
assertTrue(this.response.isCommitted());
|
|
|
|
assertTrue(this.response.isCommitted());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void responseIsNotFlushedIfStatusIsLessThan400AndItHasAlreadyBeenCommitted()
|
|
|
|
|
|
|
|
throws Exception {
|
|
|
|
|
|
|
|
HttpServletResponse committedResponse = mock(HttpServletResponse.class);
|
|
|
|
|
|
|
|
given(committedResponse.isCommitted()).willReturn(true);
|
|
|
|
|
|
|
|
given(committedResponse.getStatus()).willReturn(200);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.filter.doFilter(this.request, committedResponse, this.chain);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
verify(committedResponse, times(0)).flushBuffer();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|