@Test public void testParseOptionalHexOk() throws Exception { long i = 0x14; String s = "0x" + Long.toHexString(i); OptionalLong ret = ParseLong.parseOptional(s); assertTrue(ret.isPresent()); assertEquals(i, ret.getAsLong()); }
@Test public void testParseOptionalNullFail() throws Exception { OptionalLong ret = ParseLong.parseOptional(null); assertFalse(ret.isPresent()); }
@Test public void testParseOptionalHexFail() throws Exception { String s = "0x12akjhsdr?"; OptionalLong ret = ParseLong.parseOptional(s); assertFalse(ret.isPresent()); }