### Question:
HttpUtil { public static void setCORSheader(HttpServletResponse resp, Collection<String> validOrigins) { if (validOrigins == null) { return; } for (String origin : validOrigins) { resp.addHeader(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, origin); } } private  HttpUtil(); static void setTimeSource(TimeSource timeSource); static TimeSource getTimeSource(); static void setCachingHeaders(HttpServletResponse response); static void setCachingHeaders(HttpServletResponse response, boolean noProxy); static void setCachingHeaders(HttpServletResponse response, int ttl); static void setNoCache(HttpServletResponse response); static void setCachingHeaders(HttpServletResponse response, int ttl, boolean noProxy); static List<Pair<String, String>> getCachingHeadersToSet(int ttl, boolean noProxy); static int getDefaultTtl(); static void setDefaultTtl(int defaultTtl); static boolean isJSONP(HttpServletRequest request); static void setCORSheader(HttpServletResponse resp, Collection<String> validOrigins); static final String ACCESS_CONTROL_ALLOW_ORIGIN_HEADER; }### Answer:
@Test public void testCORSstar() { HttpUtil.setCORSheader(recorder, Collections.singleton("*")); assertEquals(recorder.getHeader(HttpUtil.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER), "*"); }
@Test public void testCORSnull() { HttpUtil.setCORSheader(recorder, null); assertEquals(recorder.getHeader(HttpUtil.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER), null); }
@Test @Ignore("HttpServletResponseRecorder doesn't support multiple headers") public void testCORSmultiple() { HttpUtil.setCORSheader(recorder, Arrays.asList("http: }