Kaynağa Gözat

updated tests

Leon 6 yıl önce
ebeveyn
işleme
40b69246d0

+ 2
- 2
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestMathUtilities.java Dosyayı Görüntüle

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

+ 13
- 12
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestPredicateUtilities.java Dosyayı Görüntüle

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

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