IntegerToBoolean extends IntegerToInteger { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { return (int)super.to(bytes, offset, length, decimals, removePadding) != 0; }  @Override void validate(Class<?> type, int size, int decimals); @Override Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding); @Override byte[] from(Object value, int length, int decimals, boolean addPadding);  }
@Test public void testTo() throws Exception { assertEquals(false, typeConverter.to("0".getBytes(StandardCharsets.UTF_8), 0, 1, -1, true)); assertEquals(true, typeConverter.to("1".getBytes(StandardCharsets.UTF_8), 0, 1, -1, true)); }
@Test public void testToNullDefaultValue() throws Exception { config.setNullFillerChar((char)0); config.setDefaultValue("1"); typeConverter.initialize(config); assertEquals(true, typeConverter.to(new byte[4], 0, 2, 2, true)); }
@Test public void testToNullValue() throws Exception { expectedEx.expect(NumberFormatException.class); expectedEx.expectMessage("For input string"); config.setNullFillerChar((char)0); typeConverter.initialize(config); assertEquals(null, typeConverter.to(new byte[4], 0, 2, 2, true)); }