@Test
 public void testParseHexPrefixEquals() throws Exception {
   long i = 123456;
   String s = Long.toHexString(i);
   String s1 = "0x" + s;
   String s2 = "0X" + s;
   //  Transitive property means we only have to test twice
   assertEquals(ParseLong.parseHex(s), ParseLong.parseHex(s1));
   assertEquals(ParseLong.parseHex(s1), ParseLong.parseHex(s2));
 }
 @Test
 public void testParseHexOrDefaultOk() throws Exception {
   long i = 0x12;
   String s = "0x" + Long.toHexString(i);
   int def = 14;
   assertEquals(i, ParseLong.parseHexOrDefault(s, def));
 }
 @Test
 public void testParseDecOrDefaultOk() throws Exception {
   long i = 12;
   String s = Long.toString(i);
   int def = 14;
   assertEquals(i, ParseLong.parseDecOrDefault(s, def));
 }
 @Test
 public void testParseHexOptionalOk() throws Exception {
   long i = 0x14;
   String s = Long.toHexString(i);
   OptionalLong ret = ParseLong.parseHexOptional(s);
   assertTrue(ret.isPresent());
   assertEquals(i, ret.getAsLong());
 }
 @Test
 public void testParseHexOrDefaultNull() throws Exception {
   int def = 14;
   assertEquals(def, ParseLong.parseHexOrDefault(null, def));
 }
 @Test
 public void testParseHexOrDefaultFail() throws Exception {
   String s = "aq12.g";
   int def = 14;
   assertEquals(def, ParseLong.parseHexOrDefault(s, def));
 }
 //  Test dec/hex picking
 @Test
 public void testParse_Hex() throws Exception {
   long i = 0x123ABC;
   String s = "0x" + Long.toHexString(i);
   assertEquals(i, ParseLong.parse(s));
 }
 //  For values lower than the signed min, the method shouldn't thrown an exception but it will
 // return a
 //  garbage result
 @Test
 public void testParseDec_MinSignedUnderflow() throws Exception {
   String s = "-9223372036854775809";
   ParseLong.parseDec(s);
 }
 //  Test empty
 @Test(expected = NumberFormatException.class)
 public void testParseDec_Empty() throws Exception {
   ParseLong.parseDec("");
 }
 //  Test negative sign inside
 @Test(expected = NumberFormatException.class)
 public void testParseDec_NegativeBad() throws Exception {
   ParseLong.parseDec("-12-34");
 }
 //  Test negative sign prefix
 @Test
 public void testParseDec_Negative() throws Exception {
   long i = -123456;
   String s = Long.toString(i);
   assertEquals(i, ParseLong.parseDec(s));
 }
 @Test
 public void testParseHexOptionalFail() throws Exception {
   String s = "astg2148465klkast12hkls";
   OptionalLong ret = ParseLong.parseHexOptional(s);
   assertFalse(ret.isPresent());
 }
 @Test
 public void testParseHexOptionalNull() throws Exception {
   OptionalLong ret = ParseLong.parseHexOptional(null);
   assertFalse(ret.isPresent());
 }
 //  Test negative sign prefix reject (after prefix)
 @Test(expected = NumberFormatException.class)
 public void testParseHex_Negative2() throws Exception {
   String s = "0x-12AC";
   ParseLong.parseHex(s);
 }
 //  Test bad
 @Test(expected = NumberFormatException.class)
 public void testParseHex_Bad() throws Exception {
   ParseLong.parseHex("12AB-**&1'");
 }
 //  Technically this is the same as MaxUnsigned
 @Test
 public void testParseHexMinSigned() throws Exception {
   long i = Long.MIN_VALUE;
   String s = "0x" + Long.toHexString(i);
   assertEquals(i, ParseLong.parseHex(s));
 }
 //  For values larger than the unsigned max, the method shouldn't thrown an exception but it will
 // return a
 //  garbage result
 @Test
 public void testParseHexMaxUnsignedOverflow() throws Exception {
   String s = "0x10000000000000000";
   ParseLong.parseHex(s);
 }
 @Test
 public void testParseHexMaxUnsigned() throws Exception {
   long i = 0xFFFFFFFFFFFFFFFFL;
   String s = "0xFFFFFFFFFFFFFFFF";
   assertEquals(i, ParseLong.parseHex(s));
 }
 @Test
 public void testParseOptionalHexFail() throws Exception {
   String s = "0x12akjhsdr?";
   OptionalLong ret = ParseLong.parseOptional(s);
   assertFalse(ret.isPresent());
 }
 //  Test null reject
 @Test(expected = NumberFormatException.class)
 public void testParse_Null() throws Exception {
   ParseLong.parse(null);
 }
 //  Test positive sign prefix reject (no prefix)
 @Test(expected = NumberFormatException.class)
 public void testParseHex_Positive3() throws Exception {
   String s = "+12AB";
   ParseLong.parseHex(s);
 }
 //  Test positive sign inside
 @Test(expected = NumberFormatException.class)
 public void testParseDec_PositiveBad() throws Exception {
   ParseLong.parseDec("+12+34");
 }
 //  Test dec/hex dec trimming
 @Test
 public void testParse_DecTrim() throws Exception {
   long i = 123456;
   String s = WHITESPACE + Long.toString(i) + WHITESPACE;
   assertEquals(i, ParseLong.parse(s));
 }
 //  Test dec/hex picking
 @Test
 public void testParse_Dec() throws Exception {
   long i = 123456;
   String s = Long.toString(i);
   assertEquals(i, ParseLong.parse(s));
 }
 //  Test dec/hex hex trimming
 @Test
 public void testParse_HexTrim() throws Exception {
   long i = 0x123ABC;
   String s = WHITESPACE + "0x" + Long.toHexString(i) + WHITESPACE;
   assertEquals(i, ParseLong.parse(s));
 }
 //  Test prefix with no value reject
 @Test(expected = NumberFormatException.class)
 public void testParseHex_PrefixNoValue() throws Exception {
   String s = "0x";
   ParseLong.parseHex(s);
 }
 //  Test missing hex digits reject
 @Test(expected = NumberFormatException.class)
 public void testParse_EmptyHex() throws Exception {
   String s = "0x";
   ParseLong.parse(s);
 }
 @Test
 public void testParseOrDefaultDecDefault() throws Exception {
   String s = "abcd";
   int def = 14;
   assertEquals(def, ParseLong.parseOrDefault(s, def));
 }
 @Test
 public void testParseDec_MaxSigned() throws Exception {
   long i = Long.MAX_VALUE;
   String s = Long.toString(i);
   assertEquals(i, ParseLong.parseDec(s));
 }
 //  For values larger than the unsigned max, the method shouldn't thrown an exception but it will
 // return a
 //  garbage result
 @Test
 public void testParseDec_UnsignedOverflow() throws Exception {
   String s = "18446744073709551616";
   ParseLong.parseDec(s);
 }