You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We added the following test (in MathematicsTests) which checks that the method Multiplication.multiplyUsingLoopWithStringInput works correctly when multiplying with zero. It fails with the error below
Test: @test
public void testMultiplyUsingLoopsWithStringInputZero(){
long result = Integer.parseInt(Multiplication.multiplyUsingLoopWithStringInput("0", "0"));
long expected = 0;
//Requirement:
//When multiplying two values where one or both is zero the result should be zero
assertTrue(result ==expected);
}
Error:
Testcase: testMultiplyUsingLoopsWithStringInputZero(com.jwetherell.algorithms.mathematics.test.MathematicsTest): Caused an ERROR
[junit] For input string: ""
[junit] java.lang.NumberFormatException: For input string: ""
[junit] at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
[junit] at java.base/java.lang.Integer.parseInt(Integer.java:678)
[junit] at java.base/java.lang.Integer.parseInt(Integer.java:786)
[junit] at com.jwetherell.algorithms.mathematics.test.MathematicsTest.testMultiplyUsingLoopsWithStringInputZero(Unknown Source)
The text was updated successfully, but these errors were encountered:
We added the following test (in MathematicsTests) which checks that the method Multiplication.multiplyUsingLoopWithStringInput works correctly when multiplying with zero. It fails with the error below
Test:
@test
public void testMultiplyUsingLoopsWithStringInputZero(){
long result = Integer.parseInt(Multiplication.multiplyUsingLoopWithStringInput("0", "0"));
long expected = 0;
//Requirement:
//When multiplying two values where one or both is zero the result should be zero
assertTrue(result ==expected);
}
Error:
Testcase: testMultiplyUsingLoopsWithStringInputZero(com.jwetherell.algorithms.mathematics.test.MathematicsTest): Caused an ERROR
[junit] For input string: ""
[junit] java.lang.NumberFormatException: For input string: ""
[junit] at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
[junit] at java.base/java.lang.Integer.parseInt(Integer.java:678)
[junit] at java.base/java.lang.Integer.parseInt(Integer.java:786)
[junit] at com.jwetherell.algorithms.mathematics.test.MathematicsTest.testMultiplyUsingLoopsWithStringInputZero(Unknown Source)
The text was updated successfully, but these errors were encountered: