diff --git a/app/src/test/java/com/coderabbit/app/calculator/CalculatorTest.kt b/app/src/test/java/com/coderabbit/app/calculator/CalculatorTest.kt index 871dadf..0ef6ff3 100644 --- a/app/src/test/java/com/coderabbit/app/calculator/CalculatorTest.kt +++ b/app/src/test/java/com/coderabbit/app/calculator/CalculatorTest.kt @@ -1,6 +1,7 @@ package com.coderabbit.app.calculator import org.junit.Assert.assertEquals +import org.junit.Assert.assertThrows import org.junit.Assert.assertTrue import org.junit.Test @@ -23,4 +24,28 @@ class CalculatorTest { val calculator = Calculator() assertEquals(calculator.divide(4,2) ,2) } + + @Test + fun `test divide function che divide`() { + val calculator = Calculator() + assertThrows(ArithmeticException::class.java){ + calculator.divide(4,0) + } + } + + @Test + fun `test divide function che divide zero`() { + val calculator = Calculator() + assertThrows(ArithmeticException::class.java){ + calculator.divide(10,0) + } + } + + @Test + fun `test divide function che divide zero by 17`() { + val calculator = Calculator() + assertThrows(ArithmeticException::class.java){ + calculator.divide(17,0) + } + } } \ No newline at end of file