@@ -0,0 +1,2380 @@
+package com.monkeyapp.blog;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.junit.MockitoJUnitRunner;%0A%0Aimport javax.servlet.FilterChain;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.io.IOException;%0A%0Aimport static org.mockito.Mockito.*;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class ResponseFilterTest %7B%0A    @Mock%0A    private HttpServletRequest httpServletRequest;%0A%0A    @Mock%0A    private HttpServletResponse httpServletResponse;%0A%0A    @Mock%0A    private FilterChain filterChain;%0A%0A    @Test%0A    public void testAddSecuirtyHeaders() throws IOException, ServletException%7B%0A        doReturn(%22%22).when(httpServletRequest).getServletPath();%0A%0A        new ResponseFilter().doFilter(httpServletRequest, httpServletResponse, filterChain);%0A%0A        verify(httpServletResponse, times(1)).addHeader(eq(%22Content-Security-Policy%22), anyString());%0A        verify(httpServletResponse, times(1)).addHeader(eq(%22Strict-Transport-Security%22), anyString());%0A        verify(httpServletResponse, times(1)).addHeader(eq(%22X-Content-Type-Options%22), anyString());%0A        verify(httpServletResponse, times(1)).addHeader(eq(%22X-Frame-Options%22), anyString());%0A        verify(httpServletResponse, times(1)).addHeader(eq(%22X-XSS-Protection%22), anyString());%0A        verify(filterChain, times(1)).doFilter(eq(httpServletRequest), eq(httpServletResponse));%0A    %7D%0A%0A    @Test%0A    public void testNotAddSecuirtyHeadersForJsFiles() throws IOException, ServletException%7B%0A        doReturn(%22x.js%22).when(httpServletRequest).getServletPath();%0A%0A        new ResponseFilter().doFilter(httpServletRequest, httpServletResponse, filterChain);%0A%0A        verify(httpServletResponse, never()).addHeader(anyString(), anyString());%0A        verify(filterChain, times(1)).doFilter(eq(httpServletRequest), eq(httpServletResponse));%0A    %7D%0A%0A    @Test%0A    public void testNotAddSecuirtyHeadersForCssFiles() throws IOException, ServletException%7B%0A        doReturn(%22x.css%22).when(httpServletRequest).getServletPath();%0A%0A        new ResponseFilter().doFilter(httpServletRequest, httpServletResponse, filterChain);%0A%0A        verify(httpServletResponse, never()).addHeader(anyString(), anyString());%0A        verify(filterChain, times(1)).doFilter(eq(httpServletRequest), eq(httpServletResponse));%0A    %7D%0A%7D%0A

add ResponseFilter unit test