Ad
  • Custom User Avatar

    I changed the tests a bit in an attempt to make the failure messages clearer. They look better now, but I wonder if clear enough.

  • Custom User Avatar

    It is unfortunately JUnit giving not very clear feedback in some situations, but the root cause of the error is in your code. Look at the stack trace:

    java.lang.NumberFormatException: For input string: "813611416183156161"
    	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    	at java.base/java.lang.Integer.parseInt(Integer.java:652)
    	at java.base/java.lang.Integer.parseInt(Integer.java:770)
    	at SquareDigit.squareDigits(SquareDigit.java:29)
    	at SquareDigitTest.test(SquareDigitTest.java:7)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [... snip ...]
    

    in the line 4th from the bottom you can see that the error comes from the Imteger.parseInt, which is un turn called from SquareDigit.squareDigits, i.e. your solution. You have a bug in your code, which paired up with the poor test feedback.