### Question:
XSDPrimitiveTypeParser { public static long parseLong(final Reader reader) throws IOException { boolean isNegative = false; long result = 0; int c = reader.read(); if (isSign(c)) { isNegative = (c == '-') ? true : false; c = reader.read(); } while (c != -1) { result = accumulateLongDecimal(c, result); c = reader.read(); } if ((result == Long.MIN_VALUE) && !isNegative) { throw new NumberFormatException("Long overflow"); } return isNegative ? result : -result; }  static short parseShort(final Reader reader); static int parseInt(final Reader reader); static long parseLong(final Reader reader); static float parseFloat(final Reader reader); static double parseDouble(final Reader reader);  }### Answer:
@Test public void testGoodLong() throws IOException { for (final String s : goodIntStrings) { try { checkLong(s, XSDPrimitiveTypeParser.parseLong(new StringReader(s))); } catch (final NumberFormatException e) { throw new RuntimeException("parseLong failed. " + "String:" + s + ". " + e.getMessage()); } } checkLong("9223372036854775807", XSDPrimitiveTypeParser.parseLong(new StringReader("9223372036854775807"))); checkLong("-9223372036854775808", XSDPrimitiveTypeParser.parseLong(new StringReader("-9223372036854775808"))); }
@Test(expected=NumberFormatException.class) public void testOverflowMaxLong() throws IOException { XSDPrimitiveTypeParser.parseLong(new StringReader("9223372036854775808")); }
@Test(expected=NumberFormatException.class) public void testOverflowMinLong() throws IOException { XSDPrimitiveTypeParser.parseLong(new StringReader("-9223372036854775809")); }
@Test(expected=NumberFormatException.class) public void testInvalidLong() throws IOException { XSDPrimitiveTypeParser.parseLong(new StringReader("fdaslk")); }