@Test
public void shouldHandleTinyint() throws Exception {

  Codec<Byte> tinyintCodec = mapper.codecFor(primitive(TINYINT));
  assertThat(tinyintCodec).isSameAs(mapper.tinyint);
  encodeAndDecode(tinyintCodec, (byte) 0, "0x00");
  encodeAndDecode(tinyintCodec, Byte.MAX_VALUE, "0x7f");
  encodeAndDecode(tinyintCodec, Byte.MIN_VALUE, "0x80");
  encodeAndDecode(tinyintCodec, null, null, (byte) 0);
  encodeObjectAndDecode(tinyintCodec, (byte) 1, "0x01", (byte) 1);
  encodeObjectAndDecode(tinyintCodec, 1.0, "0x01", (byte) 1);
  encodeObjectAndDecode(tinyintCodec, "1", "0x01", (byte) 1);
  encodeObjectAndDecode(tinyintCodec, null, null, (byte) 0);
  encodeObjectAndDecode(tinyintCodec, Optional.of(12), null, (byte) 0);
  try {
    // too many bytes
    tinyintCodec.decode(Bytes.fromHexString("0x0404"));
  } catch (InvalidTypeException e) {
    // expected
  }
}