Skip to content

Commit

Permalink
feat: update calculator requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogarfe committed Jun 21, 2024
1 parent 16a9629 commit b15b399
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 6 additions & 2 deletions src/test/java/com/geekshubs/calculator/CalculatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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());
}
}

0 comments on commit b15b399

Please sign in to comment.