Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unit test #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/com/codingblackfemales/Calculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static Integer multiply(final int firstInput, final int secondInput) {
return firstInput * secondInput;
}

public static Integer divide(final int firstInput, final int secondInput) {
return firstInput / secondInput;
public static Double divide(final double d, final double e) {
return d / e;
}
}
29 changes: 29 additions & 0 deletions src/test/java/com/codingblackfemales/CalculatorTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,33 @@ public void testSubtraction() {

assertEquals(-2, difference);
}
@Test
@DisplayName("Multiply two positive numbers")
public void testMultiplyTwoPositiveNumbers() {
final Integer product = Calculator.multiply(3, 4);
assertEquals(12, product);
}

@Test
@DisplayName("Multiply a positive number and a negative number")
public void testMultiplyPositiveAndNegativeNumbers() {
final Integer product = Calculator.multiply(3, -4);
assertEquals(-12, product);
}


@Test
@DisplayName ("Divide two positive numbers")
public void testDivideTwoPositiveNumbers() {
final Double result = Calculator.divide(6.0, 3.0);
assertEquals(2.0, result);

}

@Test
@DisplayName("Divide a number by itself")
public void testDivideByItself() {
final Double result = Calculator.divide(6.0, 6.0);
assertEquals(1.0, result);
}
}