Leon vor 6 Jahren
Ursprung
Commit
40b69246d0

+ 2
- 2
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestMathUtilities.java Datei anzeigen

36
         // : Given
36
         // : Given
37
         short baseValue = 16384;
37
         short baseValue = 16384;
38
         short addedValue = 7;
38
         short addedValue = 7;
39
-        short expected = 32767;
39
+        short expected = 16391;
40
         // : When
40
         // : When
41
         short actual = primativeTypes.add(baseValue, addedValue);
41
         short actual = primativeTypes.add(baseValue, addedValue);
42
         // : Then
42
         // : Then
146
         // : When
146
         // : When
147
         float actualFloat = primativeTypes.subtract(baseValue,difference);
147
         float actualFloat = primativeTypes.subtract(baseValue,difference);
148
         // : Then
148
         // : Then
149
-        assertEquals(expectedFloat,actualFloat, 0);
149
+        assertEquals(expectedFloat,actualFloat, 0.005);
150
     }
150
     }
151
     @Test
151
     @Test
152
     public void testSubtractions5() {
152
     public void testSubtractions5() {

+ 13
- 12
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestPredicateUtilities.java Datei anzeigen

1
 package com.zipcodewilmington.danny_do_better_exercises;
1
 package com.zipcodewilmington.danny_do_better_exercises;
2
 
2
 
3
 import org.junit.Test;
3
 import org.junit.Test;
4
+
4
 import static org.junit.Assert.*;
5
 import static org.junit.Assert.*;
6
+
5
 /**
7
 /**
6
  * Created by dan on 6/14/17.
8
  * Created by dan on 6/14/17.
7
  */
9
  */
9
     private static volatile PredicateUtilities math = new PredicateUtilities();
11
     private static volatile PredicateUtilities math = new PredicateUtilities();
10
 
12
 
11
     @Test
13
     @Test
12
-    public void testGreaterThanTrue(){
14
+    public void testGreaterThanTrue() {
13
         // : Given
15
         // : Given
14
         int greaterValue = 450;
16
         int greaterValue = 450;
15
         int lesserValue = 350;
17
         int lesserValue = 350;
24
 
26
 
25
 
27
 
26
     @Test
28
     @Test
27
-    public void testGreaterThanFalse(){
29
+    public void testGreaterThanFalse() {
28
         // : Given
30
         // : Given
29
         int greaterValue = 350;
31
         int greaterValue = 350;
30
         int lesserValue = 350;
32
         int lesserValue = 350;
33
         boolean outcome = math.isGreaterThan(greaterValue, lesserValue);
35
         boolean outcome = math.isGreaterThan(greaterValue, lesserValue);
34
 
36
 
35
         // : Then
37
         // : Then
36
-        assertTrue(outcome);
38
+        assertFalse(outcome);
37
     }
39
     }
38
 
40
 
39
 
41
 
40
     @Test
42
     @Test
41
-    public void testLessThanTrue(){
43
+    public void testLessThanTrue() {
42
         // : Given
44
         // : Given
43
         int greaterValue = 450;
45
         int greaterValue = 450;
44
         int lesserValue = 350;
46
         int lesserValue = 350;
51
     }
53
     }
52
 
54
 
53
 
55
 
54
-
55
     @Test
56
     @Test
56
-    public void testLessThan1(){
57
+    public void testLessThan1() {
57
         // : Given
58
         // : Given
58
         int greaterValue = 450;
59
         int greaterValue = 450;
59
         int lesserValue = 350;
60
         int lesserValue = 350;
62
         boolean outcome = math.isLessThan(greaterValue, lesserValue);
63
         boolean outcome = math.isLessThan(greaterValue, lesserValue);
63
 
64
 
64
         // : Then
65
         // : Then
65
-        assertTrue(outcome);
66
+        assertFalse(outcome);
66
     }
67
     }
67
 
68
 
68
 
69
 
69
     @Test
70
     @Test
70
-    public void testLessOrEqual1(){
71
+    public void testLessOrEqual1() {
71
         // : Given
72
         // : Given
72
         int greaterValue = 3;
73
         int greaterValue = 3;
73
         int lesserValue = 3;
74
         int lesserValue = 3;
80
     }
81
     }
81
 
82
 
82
     @Test
83
     @Test
83
-    public void testLessOrEqual2(){
84
+    public void testLessOrEqual2() {
84
         // : Given
85
         // : Given
85
         int greaterValue = 3;
86
         int greaterValue = 3;
86
         int lesserValue = 6;
87
         int lesserValue = 6;
93
     }
94
     }
94
 
95
 
95
     @Test
96
     @Test
96
-    public void testGreaterOrEqual1(){
97
+    public void testGreaterOrEqual1() {
97
         // : Given
98
         // : Given
98
         int greaterValue = 4;
99
         int greaterValue = 4;
99
         int lesserValue = 4;
100
         int lesserValue = 4;
107
 
108
 
108
 
109
 
109
     @Test
110
     @Test
110
-    public void testGreaterOrEqual2(){
111
+    public void testGreaterOrEqual2() {
111
         // : Given
112
         // : Given
112
         int greaterValue = 8;
113
         int greaterValue = 8;
113
         int lesserValue = 15;
114
         int lesserValue = 15;
116
         boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
117
         boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
117
 
118
 
118
         // : Then
119
         // : Then
119
-        assertTrue(outcome);
120
+        assertFalse(outcome);
120
     }
121
     }
121
 }
122
 }

+ 2
- 2
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestStringUtilities.java Datei anzeigen

56
     public void substringBeginTest(){
56
     public void substringBeginTest(){
57
         // : Given
57
         // : Given
58
         String input = "Hello";
58
         String input = "Hello";
59
-        String expected = "olleH";
59
+        String expected = "Hel";
60
 
60
 
61
         // : When
61
         // : When
62
         String actual = StringUtilities.getPrefix(input);
62
         String actual = StringUtilities.getPrefix(input);
154
         String expected = "Wilmington";
154
         String expected = "Wilmington";
155
 
155
 
156
         // : When
156
         // : When
157
-        String actual = StringUtilities.getFirstWord(input);
157
+        String actual = StringUtilities.getSecondWord(input);
158
 
158
 
159
         // : Then
159
         // : Then
160
         assertEquals(expected, actual);
160
         assertEquals(expected, actual);