@Test
public void testCorsHeaderAddedToAllWhenStar() throws IOException, ServletException {

    HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
    HttpServletResponse httpServletResponse = spy(new MockHttpServletResponse());
    FilterChain filterChain = mock(FilterChain.class);
    when(httpServletRequest.getHeader("origin")).thenReturn("http://www.geonetwork-opensource.org");
    buildFilter("*").doFilter(httpServletRequest, httpServletResponse, filterChain);
    assertEquals("*", httpServletResponse.getHeader("Access-Control-Allow-Origin"));
}