Skip to content
Snippets Groups Projects
Commit a63d693f authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

Added integer version of multiplyByTen

parent 1544b464
Branches main
No related tags found
No related merge requests found
...@@ -23,6 +23,15 @@ public class TestDemoTarget { ...@@ -23,6 +23,15 @@ public class TestDemoTarget {
return returnValue; return returnValue;
} }
public static int multiplyByTen(int multiplicand) {
double multiplier = 0.0;
for (int i = 0; i < 100; i++) {
multiplier += 0.1;
}
double product = multiplicand * multiplier;
return (int)product;
}
public static double multiplyByTen(double multiplicand) { public static double multiplyByTen(double multiplicand) {
double multiplier = 0.0; double multiplier = 0.0;
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
......
...@@ -4,6 +4,17 @@ import org.junit.Test; ...@@ -4,6 +4,17 @@ import org.junit.Test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class TestDemoTests { public class TestDemoTests {
@Test
public void testMultiplyZero() {
// arrange
int value = 0;
int expectedResult = 0;
// act
int actualResult = TestDemoTarget.multiplyByTen(value);
// assert
assertEquals(expectedResult, actualResult);
}
@Test @Test
public void testIntegerFirstValueIsGreater() { public void testIntegerFirstValueIsGreater() {
// arrange // arrange
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment