@Test public void testToNullDefaultValue() throws Exception { config.setNullFillerChar((char) 0); config.setDefaultValue("42"); typeConverter.initialize(config); assertEquals(42, (long) 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)); }
@Before public void runBeforeEveryTest() { this.config = new TypeConverterConfig(); this.config.setCharset(StandardCharsets.UTF_8); this.config.setPaddingChar('0'); typeConverter = new IntegerToLong(); typeConverter.initialize(config); }