@Test
public void shouldHandleInt() throws Exception {

  Codec<Integer> intCodec = mapper.codecFor(primitive(INT));
  assertThat(intCodec).isSameAs(mapper.cint);
  encodeAndDecode(intCodec, 0, "0x00000000");
  encodeAndDecode(intCodec, Integer.MAX_VALUE, "0x7fffffff");
  encodeAndDecode(intCodec, Integer.MIN_VALUE, "0x80000000");
  encodeAndDecode(intCodec, null, null, 0);
  encodeObjectAndDecode(intCodec, 1, "0x00000001", 1);
  encodeObjectAndDecode(intCodec, 1.0, "0x00000001", 1);
  encodeObjectAndDecode(intCodec, "1", "0x00000001", 1);
  encodeObjectAndDecode(intCodec, null, null, 0);
  encodeObjectAndDecode(intCodec, Optional.of(12), null, 0);
  try {
    // not enough bytes.
    intCodec.decode(Bytes.fromHexString("0x00ff"));
  } catch (InvalidTypeException e) {
    // expected
  }
}