### Question:
EtagMessageDigestServletFilter implements Filter { static boolean isUnmodified(Enumeration<String> ifNoneMatchETags, String responseETag) { if (ifNoneMatchETags == null) { log.debug("Can not access request headers or no NoneMatchETags header given!"); return false; } while (ifNoneMatchETags.hasMoreElements()) { String ifNoneMatchETag = ifNoneMatchETags.nextElement(); if (ifNoneMatchETag.equals("*")) { return true; } if (ifNoneMatchETag.startsWith(WEAK_TAG_PREFIX)) { ifNoneMatchETag = ifNoneMatchETag.substring(WEAK_TAG_PREFIX.length()); } if (!ifNoneMatchETag.startsWith("\"") || !ifNoneMatchETag.endsWith("\"")) { log.debug("Ignoring invalid ETag not starting and ending with quotes: {}", ifNoneMatchETag); continue; } ifNoneMatchETag = ifNoneMatchETag.substring(1, ifNoneMatchETag.length() - 1); if (ifNoneMatchETag.equals(responseETag)) { return true; } } return false; }  @Activate void activate(Config configuration); @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void destroy();  }### Answer:
@Test public void testIsUnmodified() { Vector<String> ifNoneMatchETags = new Vector<>(); ifNoneMatchETags.add("W/\"ab\""); ifNoneMatchETags.add("\"cd\""); Assert.assertTrue(EtagMessageDigestServletFilter.isUnmodified(ifNoneMatchETags.elements(), "cd")); ifNoneMatchETags = new Vector<>(); ifNoneMatchETags.add("W/\"ab\""); ifNoneMatchETags.add("W/\"cd\""); Assert.assertTrue(EtagMessageDigestServletFilter.isUnmodified(ifNoneMatchETags.elements(), "cd")); ifNoneMatchETags = new Vector<>(); ifNoneMatchETags.add("W/\"ab\""); ifNoneMatchETags.add("cd"); Assert.assertFalse(EtagMessageDigestServletFilter.isUnmodified(ifNoneMatchETags.elements(), "cd")); ifNoneMatchETags = new Vector<>(); ifNoneMatchETags.add("W/\"ab\""); ifNoneMatchETags.add("W/\"cd\""); Assert.assertFalse(EtagMessageDigestServletFilter.isUnmodified(ifNoneMatchETags.elements(), "de")); ifNoneMatchETags = new Vector<>(); ifNoneMatchETags.add("*"); Assert.assertTrue(EtagMessageDigestServletFilter.isUnmodified(ifNoneMatchETags.elements(), "sometag")); ifNoneMatchETags = new Vector<>(); ifNoneMatchETags.add("\"ab"); Assert.assertFalse(EtagMessageDigestServletFilter.isUnmodified(ifNoneMatchETags.elements(), "ab")); }
@Test public void testIsUnmodifiedWithNullParameter() { Assert.assertFalse(EtagMessageDigestServletFilter.isUnmodified(null, "ab")); }