@Test
public void shouldHandleDate() {

  Codec<LocalDate> dateCodec = mapper.codecFor(primitive(DATE));
  assertThat(dateCodec).isSameAs(mapper.date);
  encodeAndDecode(dateCodec, LocalDate.of(2017, 7, 4), "0x800043c7");
  encodeAndDecode(dateCodec, LocalDate.of(1970, 1, 1), "0x80000000");
  encodeAndDecode(dateCodec, LocalDate.of(1969, 12, 31), "0x7fffffff");
  encodeAndDecode(dateCodec, null, null);
  encodeObjectAndDecode(
      dateCodec, LocalDate.of(2017, 7, 4), "0x800043c7", LocalDate.of(2017, 7, 4));
  encodeObjectAndDecode(dateCodec, 0, "0x80000000", LocalDate.of(1970, 1, 1));
  encodeObjectAndDecode(dateCodec, null, null, null);
  encodeObjectAndDecode(dateCodec, "2018-05-03", "0x800044f6", LocalDate.parse("2018-05-03"));
  encodeObjectAndDecode(dateCodec, Optional.of(12), null, null);
}