### Question:
HttpCacheEntry implements MessageHeaders, Serializable { public Date getDate() { return date; } 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 testMissingDateHeaderIsIgnored() { final Header[] headers = new Header[] {}; entry = new HttpCacheEntry(new Date(), new Date(), HttpStatus.SC_OK, headers, mockResource); assertNull(entry.getDate()); }
@Test public void testMalformedDateHeaderIsIgnored() { final Header[] headers = new Header[] { new BasicHeader("Date", "asdf") }; entry = new HttpCacheEntry(new Date(), new Date(), HttpStatus.SC_OK, headers, mockResource); assertNull(entry.getDate()); }
@Test public void testValidDateHeaderIsParsed() { final long nowMs = System.currentTimeMillis(); final Date date = new Date(nowMs - (nowMs % 1000L)); final Header[] headers = new Header[] { new BasicHeader("Date", DateUtils.formatDate(date)) }; entry = new HttpCacheEntry(new Date(), new Date(), HttpStatus.SC_OK, headers, mockResource); final Date dateHeaderValue = entry.getDate(); assertNotNull(dateHeaderValue); assertEquals(date.getTime(), dateHeaderValue.getTime()); }