@Test(expected = IllegalArgumentException.class) public void testFromBytes_InvalidArray() { BooleanConverter.INSTANCE.fromBytes(new byte[]{1, 0}); }
@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); } }
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); } } }
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); } }  }
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); }
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; }