From d642131102960f51575cfa76b5d219dae52cce08 Mon Sep 17 00:00:00 2001 From: Alena Bandarovich Date: Fri, 9 Feb 2024 23:16:48 +0100 Subject: [PATCH] Test: check prime for non-prime numbers --- src/test/java/CalculationsTest.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/test/java/CalculationsTest.java b/src/test/java/CalculationsTest.java index 3aec84b..f5b91aa 100644 --- a/src/test/java/CalculationsTest.java +++ b/src/test/java/CalculationsTest.java @@ -1,7 +1,7 @@ import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; public class CalculationsTest { @@ -46,9 +46,16 @@ public class CalculationsTest { @Test public void testIsPrime() { - assertTrue(Calculations.isPrime(2)); // Prime number - assertTrue(Calculations.isPrime(3)); // Prime number - assertTrue(Calculations.isPrime(5)); // Prime number + // Prime + assertTrue(Calculations.isPrime(2)); + assertTrue(Calculations.isPrime(3)); + assertTrue(Calculations.isPrime(5)); + + // Non-Prime + assertFalse(Calculations.isPrime(22)); + assertFalse(Calculations.isPrime(25)); + assertFalse(Calculations.isPrime(27)); + assertFalse(Calculations.isPrime(30)); } }