From 8a83ce2aa0f56cb34aa6e5ea8b15535d3f8140a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Gracia?= Date: Tue, 17 Apr 2018 10:44:05 +0200 Subject: [PATCH] Added fix to test issue --- src/main/java/MyCalculator.java | 15 ++++++++++++++- src/test/java/MyCalculatorTest.java | 26 +++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/main/java/MyCalculator.java b/src/main/java/MyCalculator.java index cdea4b3..3b8455d 100644 --- a/src/main/java/MyCalculator.java +++ b/src/main/java/MyCalculator.java @@ -15,9 +15,22 @@ public double divide (int a, int b) { return ((double)a)/b; } - public int multilply (int a, int b) { + public int multiply(int a, int b) { return a*b; } + public double sum (double a, double b) { + return a+b; + } + + public double subtract (double a, double b) { + return a-b; + } + + public double divide (double a, double b) { return a/b;} + + public double multiply(double a, double b) { + return a*b; + } } diff --git a/src/test/java/MyCalculatorTest.java b/src/test/java/MyCalculatorTest.java index 6c76f67..333781e 100644 --- a/src/test/java/MyCalculatorTest.java +++ b/src/test/java/MyCalculatorTest.java @@ -34,7 +34,31 @@ public void divideTest() { @Test public void multiplyTest() { int a = 2, b = 2; - assert calculator.multilply(a, b)==(a*b); + assert calculator.multiply(a, b)==(a*b); + } + + @Test + public void sumTestDouble() { + double a = 2, b = 2; + assert calculator.sum(a, b)==(a+b); + } + + @Test + public void subtractTestDouble() { + double a = 2, b = 2; + assert calculator.subtract(a, b)==(a-b); + } + + @Test + public void divideTestDouble() { + double a = 2, b = 3; + assert calculator.divide(a, b)==(((double)a)/b); + } + + @Test + public void multiplyTestDouble() { + double a = 2, b = 2; + assert calculator.multiply(a, b)==(a*b); } }