@Test public void testParseDec_MaxSigned() throws Exception { long i = Long.MAX_VALUE; String s = Long.toString(i); assertEquals(i, ParseLong.parseDec(s)); }
// Test positive sign inside @Test(expected = NumberFormatException.class) public void testParseDec_PositiveBad() 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 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 null @Test(expected = NumberFormatException.class) public void testParseDec_Null() throws Exception { ParseLong.parseDec(null); }
// Test bad @Test(expected = NumberFormatException.class) public void testParseDec_Bad() throws Exception { ParseLong.parseDec("12AB-**&1'"); }
// 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); }
// 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); }
@Test public void testParseDec_MaxUnsigned() throws Exception { long i = 0xFFFFFFFF; String s = "18446744073709551615"; assertEquals(i, ParseLong.parseDec(s)); }