ETagFilter implements ContainerResponseFilter { String removeLeadingAndTrailingQuotes(String value) { if (value.startsWith("\"")) { value = value.substring(1, value.length()); } if (value.endsWith("\"")) { value = value.substring(0, value.length() - 1); } return value; }  @Override void filter(ContainerRequestContext request, ContainerResponseContext response);  }
@Test public void testRemoveLeadingAndTrailingQuotes() { ETagFilter eTagFilter = new ETagFilter(); assertEquals(eTagFilter.removeLeadingAndTrailingQuotes("abc"), "abc"); assertEquals(eTagFilter.removeLeadingAndTrailingQuotes("\"abc"), "abc"); assertEquals(eTagFilter.removeLeadingAndTrailingQuotes("abc\""), "abc"); assertEquals(eTagFilter.removeLeadingAndTrailingQuotes("\"abc\""), "abc"); assertEquals(eTagFilter.removeLeadingAndTrailingQuotes("\"a\"bc\""), "a\"bc"); }