### Question:
HttpCacheEntry implements MessageHeaders, Serializable { @Override public Header[] getHeaders() { final HeaderGroup filteredHeaders = new HeaderGroup(); for (final Iterator<Header> iterator = responseHeaders.headerIterator(); iterator.hasNext();) { final Header header = iterator.next(); if (!REQUEST_METHOD_HEADER_NAME.equals(header.getName())) { filteredHeaders.addHeader(header); } } return filteredHeaders.getHeaders(); } HttpCacheEntry(
            final Date requestDate,
            final Date responseDate,
            final int status,
            final Header[] responseHeaders,
            final Resource resource,
            final Map<String, String> variantMap);  HttpCacheEntry(final Date requestDate, final Date responseDate, final int status,
            final Header[] responseHeaders, final Resource resource); int getStatus(); Date getRequestDate(); Date getResponseDate(); @Override Header[] getHeaders(); @Override Header getFirstHeader(final String name); @Override Header getLastHeader(final String name); @Override Header[] getHeaders(final String name); @Override boolean containsHeader(final String name); @Override int countHeaders(final String name); @Override Header getHeader(final String name); @Override Iterator<Header> headerIterator(); @Override Iterator<Header> headerIterator(final String name); Date getDate(); Resource getResource(); boolean hasVariants(); Map<String, String> getVariantMap(); String getRequestMethod(); @Override String toString();  }### Answer:
@Test public void testGetHeadersReturnsCorrectHeaders() { final Header[] headers = { new BasicHeader("foo", "fooValue"), new BasicHeader("bar", "barValue1"), new BasicHeader("bar", "barValue2") }; entry = makeEntry(headers); assertEquals(2, entry.getHeaders("bar").length); }
@Test public void testGetHeadersReturnsEmptyArrayIfNoneMatch() { final Header[] headers = { new BasicHeader("foo", "fooValue"), new BasicHeader("bar", "barValue1"), new BasicHeader("bar", "barValue2") }; entry = makeEntry(headers); assertEquals(0, entry.getHeaders("baz").length); }
@Test public void canGetOriginalHeaders() { final Header[] headers = { new BasicHeader("Server", "MockServer/1.0"), new BasicHeader("Date", DateUtils.formatDate(now)) }; entry = new HttpCacheEntry(new Date(), new Date(), HttpStatus.SC_OK, headers, mockResource); final Header[] result = entry.getHeaders(); assertEquals(headers.length, result.length); for(int i=0; i<headers.length; i++) { assertEquals(headers[i], result[i]); } }