Buggy code:
public class WicketFilterTest extends TestCase { private static WebApplication application ; private final DateFormat headerDateFormat = new SimpleDateFormat ( "EEE,<seq2seq4repair_space>d<seq2seq4repair_space>MMM<seq2seq4repair_space>yyyy<seq2seq4repair_space>HH:mm:ss<seq2seq4repair_space>z" , Locale . UK ) ; @ Override protected void tearDown ( ) throws Exception { } public void testFilterPath1 ( ) { } public void testFilterPath2 ( ) { } public void testNotModifiedResponseIncludesExpiresHeader ( ) throws IOException , ParseException , ServletException { try { WicketFilterTest . application = new MockApplication ( ) ; WicketFilter filter = new WicketFilter ( ) ; filter . init ( new WicketFilterTest . FilterTestingConfig ( ) ) ; ThreadContext . setApplication ( WicketFilterTest . application ) ; DynamicImageResource resource = new DynamicImageResource ( ) { private static final long serialVersionUID = 1L ; @ Override protected byte [ ] getImageData ( Attributes attributes ) { throw new UnsupportedOperationException ( "Not<seq2seq4repair_space>implemented" ) ; } @ Override protected ResourceResponse newResourceResponse ( Attributes attributes ) { ResourceResponse response = super . newResourceResponse ( attributes ) ; response . setCacheDurationToMaximum ( ) ; return response ; } } ; WicketFilterTest . application . getSharedResources ( ) . add ( "foo.gif" , resource ) ; MockHttpServletRequest request = new MockHttpServletRequest ( WicketFilterTest . application , null , null ) ; request . setURL ( ( ( ( ( ( request . getContextPath ( ) ) + ( request . getServletPath ( ) ) ) + "//wicket//resource//" ) + ( Application . class . getName ( ) ) ) + "//foo.gif" ) ) ; setIfModifiedSinceToNextWeek ( request ) ; MockHttpServletResponse response = new MockHttpServletResponse ( request ) ; filter . doFilter ( request , response , new FilterChain ( ) { public void doFilter ( ServletRequest servletRequest , ServletResponse servletResponse ) throws IOException , ServletException { } } ) ; <START_BUG> assertEquals ( ( ( Integer ) ( SC_NOT_MODIFIED ) ) , response . getStatus ( ) ) ; <END_BUG> String responseExpiresHeader = response . getHeader ( "Expires" ) ; assertNotNull ( "Expires<seq2seq4repair_space>header<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>set<seq2seq4repair_space>on<seq2seq4repair_space>not<seq2seq4repair_space>modified<seq2seq4repair_space>response" , responseExpiresHeader ) ; Date responseExpires = headerDateFormat . parse ( responseExpiresHeader ) ; assertTrue ( ( "Expected<seq2seq4repair_space>later<seq2seq4repair_space>than<seq2seq4repair_space>current<seq2seq4repair_space>date<seq2seq4repair_space>but<seq2seq4repair_space>was<seq2seq4repair_space>" + responseExpires ) , responseExpires . after ( new Date ( ) ) ) ; } finally { ThreadContext . detach ( ) ; } } private void setIfModifiedSinceToNextWeek ( MockHttpServletRequest request ) { } private String getFilterPath ( String string , InputStream in ) { } private static class FilterTestingConfig implements FilterConfig { private final Map < String , String > initParameters = new HashMap < String , String > ( ) ; public FilterTestingConfig ( ) { } public String getFilterName ( ) { } public ServletContext getServletContext ( ) { } public String getInitParameter ( String s ) { } public Enumeration < String > getInitParameterNames ( ) { } } public static class FilterTestingApplicationFactory implements IWebApplicationFactory { public WebApplication createApplication ( WicketFilter filter ) { } public void destroy ( ) { } } public void testCheckRedirect_1 ( ) { } }

Fix:
assertEquals ( SC_NOT_MODIFIED , response . getStatus ( ) ) ;