Browse Source

Test: Check method for wrong and negative entries

remotes/origin/test/client/add-test-cases
Alena Bandarovich 11 months ago
parent
commit
7b9dc7ea40
  1. 6
      src/test/java/CalculationsTest.java

6
src/test/java/CalculationsTest.java

@ -35,5 +35,11 @@ public class CalculationsTest {
// Test with large number // Test with large number
assertEquals(3628800, fact.calculateFactorial(10)); assertEquals(3628800, fact.calculateFactorial(10));
} }
@Test(expected = IllegalArgumentException.class)
public void testNegativeNumber() {
Calculations fact = new Calculations();
fact.calculateFactorial(-5); // Should throw IllegalArgumentException
}
} }
Loading…
Cancel
Save