diff --git a/README.md b/README.md index bbf8b06..6ba5d2b 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Create calculator App * Substract: substract two numbers and return result * Multiply: multiply two numbers and return result * Divide: divide two numbers and return result + * divide by zero should return error message ## System requirements diff --git a/src/test/java/com/geekshubs/calculator/CalculatorTest.java b/src/test/java/com/geekshubs/calculator/CalculatorTest.java index 815f3a1..93e8871 100644 --- a/src/test/java/com/geekshubs/calculator/CalculatorTest.java +++ b/src/test/java/com/geekshubs/calculator/CalculatorTest.java @@ -2,9 +2,8 @@ import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; public class CalculatorTest { @@ -27,4 +26,9 @@ public void testMul() { public void testDiv() { assertEquals(1, new Calculator(12, 12, 12 / 12).getResult()); } + + @Test + public void testDivByZero() { + assertThrows(ArithmeticException.class, () -> new Calculator(12, 0, 12 / 0).getResult()); + } }