@Test
public void shouldHandleDouble() {

  Codec<Double> doubleCodec = mapper.codecFor(primitive(DOUBLE));
  assertThat(doubleCodec).isSameAs(mapper.cdouble);
  encodeAndDecode(doubleCodec, 0.0, "0x0000000000000000");
  encodeAndDecode(doubleCodec, 86.765309, "0x4055b0fad2999568");
  encodeAndDecode(doubleCodec, Double.MIN_VALUE, "0x0000000000000001");
  encodeAndDecode(doubleCodec, Double.MAX_VALUE, "0x7fefffffffffffff");
  encodeAndDecode(doubleCodec, null, null, 0.0);
  encodeObjectAndDecode(doubleCodec, 86.765309, "0x4055b0fad2999568", 86.765309);
  // precision loss
  encodeObjectAndDecode(doubleCodec, 86.765309f, "0x4055b0fae0000000", 86.76531219482422);
  encodeObjectAndDecode(doubleCodec, "86.765309", "0x4055b0fad2999568", 86.765309);
  encodeObjectAndDecode(doubleCodec, null, null, 0.0);
  encodeObjectAndDecode(doubleCodec, Optional.of(12), null, 0.0);
  try {
    // not enough bytes.
    doubleCodec.decode(Bytes.fromHexString("0x00ffef"));
  } catch (InvalidTypeException e) {
    // expected
  }
}