### Question:
BooleanConverter implements BytesConverter<Boolean> { @Override public Boolean fromBytes(byte[] bytes) { if (bytes.length != 1) { throw new IllegalArgumentException("Unexpected number of bytes for boolean: " + bytes.length); } byte b = bytes[0]; if (b == 0) { return Boolean.FALSE; } else if (b == 1) { return Boolean.TRUE; } else { throw new IllegalArgumentException("Unexpected byte value for boolean: " + b); } }  @Override Boolean fromBytes(byte[] bytes); @Override byte[] toBytes(Boolean value); static final BytesConverter<Boolean> INSTANCE; }### Answer:
@Test public void testFromBytes() { assertEquals(true, BooleanConverter.INSTANCE.fromBytes(new byte[]{1})); assertEquals(false, BooleanConverter.INSTANCE.fromBytes(new byte[]{0})); }
@Test(expected = IllegalArgumentException.class) public void testFromBytes_InvalidArray() { BooleanConverter.INSTANCE.fromBytes(new byte[]{1, 0}); }