Browse Source

Test: Test assert true for prime numbers

remotes/origin/test/client/add-test-cases
Alena Bandarovich 11 months ago
parent
commit
340116f306
  1. 9
      src/test/java/CalculationsTest.java

9
src/test/java/CalculationsTest.java

@ -1,5 +1,7 @@
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class CalculationsTest { public class CalculationsTest {
@ -41,5 +43,12 @@ public class CalculationsTest {
Calculations fact = new Calculations(); Calculations fact = new Calculations();
fact.calculateFactorial(-5); // Should throw IllegalArgumentException fact.calculateFactorial(-5); // Should throw IllegalArgumentException
} }
@Test
public void testIsPrime() {
assertTrue(Calculations.isPrime(2)); // Prime number
assertTrue(Calculations.isPrime(3)); // Prime number
assertTrue(Calculations.isPrime(5)); // Prime number
}
} }
Loading…
Cancel
Save