Leon 5 years ago
parent
commit
d05ffe0367

+ 6
- 9
src/test/java/rocks/zipcode/quiz3a/fundamentals/calculator/SubtractTest.java View File

11
     @Test
11
     @Test
12
     public void test1() {
12
     public void test1() {
13
         // given
13
         // given
14
-        test(32.70, 49.04);
14
+        test(5.0, 10.0, 5.0);
15
     }
15
     }
16
 
16
 
17
     @Test
17
     @Test
18
     public void test2() {
18
     public void test2() {
19
         // given
19
         // given
20
-        test(689.93, 746.00);
20
+        test(150.0, 250.0, 100.0);
21
     }
21
     }
22
 
22
 
23
     @Test
23
     @Test
24
     public void test3() {
24
     public void test3() {
25
         // given
25
         // given
26
-        test(35354.0, 74542.0);
26
+        test(762.0, 862.0, 100.0);
27
     }
27
     }
28
 
28
 
29
     @Test
29
     @Test
30
     public void test4() {
30
     public void test4() {
31
         // given
31
         // given
32
-        test(746.93774653, 889409027.3737773635554244);
32
+        test(-899.999, -999.999, -100.0);
33
     }
33
     }
34
 
34
 
35
     @Test
35
     @Test
36
     public void test5() {
36
     public void test5() {
37
         // given
37
         // given
38
-        test(99873636.94874, 839.03);
38
+        test(-10.0, -5.0, 5.0);
39
     }
39
     }
40
 
40
 
41
-    private void test(Double input1, Double input2) {
42
-        // given
43
-        Double expected = input1 - input2;
44
-
41
+    private void test(Double expected, Double input1, Double input2) {
45
         // when
42
         // when
46
         Calculator calculator = new Calculator();
43
         Calculator calculator = new Calculator();
47
         Double actual = calculator.subtract(input1, input2);
44
         Double actual = calculator.subtract(input1, input2);