Esempio n. 1
0
 @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));
 }
Esempio n. 2
0
 @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));
 }
Esempio n. 3
0
 @Test
 public void testToZeroValue() throws Exception {
   assertEquals(
       0, (long) typeConverter.to("0000000000".getBytes(StandardCharsets.UTF_8), 0, 10, -1, true));
 }
Esempio n. 4
0
 @Test
 public void testTo() throws Exception {
   long result =
       (long) typeConverter.to("12147483648".getBytes(StandardCharsets.UTF_8), 0, 11, -1, true);
   assertEquals(12147483648L, result);
 }