瀏覽代碼

first commit

Leon 6 年之前
父節點
當前提交
9aeab377a6
共有 23 個文件被更改,包括 269 次插入229 次删除
  1. 0
    11
      src/main/java/com/zipcodewilmington/danny_do_better/HelloWorld.java
  2. 0
    41
      src/main/java/com/zipcodewilmington/danny_do_better/MathUtilities.java
  3. 0
    55
      src/main/java/com/zipcodewilmington/danny_do_better/StringUtilities.java
  4. 13
    0
      src/main/java/com/zipcodewilmington/danny_do_better_exercises/HelloWorld.java
  5. 42
    0
      src/main/java/com/zipcodewilmington/danny_do_better_exercises/PredicateUtilities.java
  6. 54
    54
      src/main/java/com/zipcodewilmington/danny_do_better_exercises/PrimitiveTypes.java
  7. 82
    0
      src/main/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.java
  8. 1
    1
      src/test/java/com/zipcodewilmington/danny_do_better_exercises/HelloWorldTest.java
  9. 43
    49
      src/test/java/com/zipcodewilmington/danny_do_better_exercises/PredicateUtilitiesTest.java
  10. 2
    2
      src/test/java/com/zipcodewilmington/danny_do_better_exercises/PrimativeTypesTest.java
  11. 14
    16
      src/test/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilitiesTest.java
  12. 18
    0
      src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestSuite.java
  13. 二進制
      target/classes/com/zipcodewilmington/danny_do_better/MathUtilities.class
  14. 二進制
      target/classes/com/zipcodewilmington/danny_do_better/PredicateUtilities.class
  15. 二進制
      target/classes/com/zipcodewilmington/danny_do_better/PrimativeTypes.class
  16. 二進制
      target/classes/com/zipcodewilmington/danny_do_better/PrimitiveTypes.class
  17. 二進制
      target/classes/com/zipcodewilmington/danny_do_better/StringUtilities.class
  18. 二進制
      target/test-classes/com/zipcodewilmington/danny_do_better/HelloWorldTest.class
  19. 二進制
      target/test-classes/com/zipcodewilmington/danny_do_better/MathUtilitiesTest.class
  20. 二進制
      target/test-classes/com/zipcodewilmington/danny_do_better/PredicateUtilitiesTest.class
  21. 二進制
      target/test-classes/com/zipcodewilmington/danny_do_better/PrimativeTypesTest.class
  22. 二進制
      target/test-classes/com/zipcodewilmington/danny_do_better/StringUtilitiesTest.class
  23. 二進制
      target/test-classes/com/zipcodewilmington/danny_do_better/TestSuite.class

+ 0
- 11
src/main/java/com/zipcodewilmington/danny_do_better/HelloWorld.java 查看文件

1
-package com.zipcodewilmington.danny_do_better;
2
-
3
-/**
4
- * Created by leon on 2/1/18.
5
- */
6
-public class HelloWorld {
7
-    //Should return `Hello World` as a string
8
-    public String helloWorld(){
9
-        return null;
10
-    }
11
-}

+ 0
- 41
src/main/java/com/zipcodewilmington/danny_do_better/MathUtilities.java 查看文件

1
-package com.zipcodewilmington.danny_do_better;
2
-
3
-/**
4
- * Created by dan on 6/14/17.
5
- */
6
-public class MathUtilities {
7
-    //Get the remainder from division
8
-    public int remainder(int dividend, int divisor){
9
-        return 0;
10
-    }
11
-
12
-    //Evaluate the equality of `greaterValue` and `lesserValue` using greater than operation.
13
-    public boolean isGreaterThan(int greaterValue, int lesserValue){
14
-        return greaterValue > lesserValue;
15
-    }
16
-
17
-    //Return true using less than symbol
18
-    public boolean isLessThan(int greaterValue, int lesserValue){
19
-        return false;
20
-    }
21
-
22
-    //Return true using greater or equal symbol
23
-    public boolean isGreaterThanOrEqualTo(int greaterValue, int lesserValue){
24
-        return false;
25
-    }
26
-
27
-    //Return true using less than or equal symbol
28
-    public boolean isLessThanOrEqualTo(int greaterValue, int lesserValue){
29
-        return false;
30
-    }
31
-
32
-    //Return true if the number in parameter is equal to 3 and less than 90
33
-    public boolean isBoth(Integer number){
34
-        return false;
35
-    }
36
-
37
-    //Return true if the number passed in is equal to 4 or greater than 100
38
-    public boolean logicalOr(Integer number){
39
-        return false;
40
-    }
41
-}

+ 0
- 55
src/main/java/com/zipcodewilmington/danny_do_better/StringUtilities.java 查看文件

1
-package com.zipcodewilmington.danny_do_better;
2
-
3
-/**
4
- * Created by dan on 6/14/17.
5
- */
6
-public class StringUtilities {
7
-
8
-    // Return the concatenation of two strings, `firstSegment`, and `secondSegment`
9
-    public String concatenation(String firstSegment, String secondSegment){
10
-        return null;
11
-    }
12
-
13
-    // Return the concatenation of an integer and a string, `firstSegment`, and `secondSegment`
14
-    public String concatenation(int firstSegment, String secondSegment){
15
-        return null;
16
-    }
17
-
18
-    // Return a substring of the first three characters of a string
19
-    public String getPrefix(String input){
20
-        return null;
21
-    }
22
-
23
-    // Return a substring of the last three characters of a string
24
-    public String getSuffix(String input){
25
-        return null;
26
-    }
27
-
28
-    // Return the equivalence of two strings as a boolean
29
-    public boolean compareTwoStrings(String inputValue, String comparableValue){
30
-        return false;
31
-    }
32
-
33
-    // Return the center character of a provided string
34
-    public Character getMiddleCharacter(String input){
35
-        int length = input.length();
36
-        int centerIndex = length /2;
37
-        char centerCharacter = input.charAt(centerIndex);
38
-        return centerCharacter;
39
-    }
40
-
41
-    // Return the first word of a string delimited by spaces.
42
-    public String getFirstWord(String spaceDelimitedString){
43
-        return null;
44
-    }
45
-
46
-    // Return the second word of a string delimited by spaces.
47
-    public String getTheSecondWord(String spaceDelimitedString){
48
-        return null;
49
-    }
50
-
51
-    // Return an identical string with characters in reverse order.
52
-    public String reverseTheTwo(String stringToReverse){
53
-        return null;
54
-    }
55
-}

+ 13
- 0
src/main/java/com/zipcodewilmington/danny_do_better_exercises/HelloWorld.java 查看文件

1
+package com.zipcodewilmington.danny_do_better_exercises;
2
+
3
+/**
4
+ * Created by leon on 2/1/18.
5
+ */
6
+public class HelloWorld {
7
+    /**
8
+     * @return 'Hello World' as a string
9
+     */
10
+    public String toString(){
11
+        return null;
12
+    }
13
+}

+ 42
- 0
src/main/java/com/zipcodewilmington/danny_do_better_exercises/PredicateUtilities.java 查看文件

1
+package com.zipcodewilmington.danny_do_better_exercises;
2
+
3
+/**
4
+ * Created by dan on 6/14/17.
5
+ */
6
+public class PredicateUtilities {
7
+    /**
8
+     * @param x
9
+     * @param y
10
+     * @return true if `x` is greater than `y`
11
+     */
12
+    public Boolean isGreaterThan(int x, int y) {
13
+        return null;
14
+    }
15
+
16
+    /**
17
+     * @param x
18
+     * @param y
19
+     * @return true if `x` is less than `y`
20
+     */
21
+    public Boolean isLessThan(int x, int y) {
22
+        return null;
23
+    }
24
+
25
+    /**
26
+     * @param x
27
+     * @param y
28
+     * @return true if `x` is greater than or equal to `y`
29
+     */
30
+    public Boolean isGreaterThanOrEqualTo(int x, int y) {
31
+        return null;
32
+    }
33
+
34
+    /**
35
+     * @param x
36
+     * @param y
37
+     * @return true if `x` is less than or equal to `y`
38
+     */
39
+    public Boolean isLessThanOrEqualTo(int x, int y) {
40
+        return null;
41
+    }
42
+}

src/main/java/com/zipcodewilmington/danny_do_better/PrimativeTypes.java → src/main/java/com/zipcodewilmington/danny_do_better_exercises/PrimitiveTypes.java 查看文件

1
-package com.zipcodewilmington.danny_do_better;
1
+package com.zipcodewilmington.danny_do_better_exercises;
2
 
2
 
3
 /**
3
 /**
4
  * Created by dan on 6/14/17.
4
  * Created by dan on 6/14/17.
5
  */
5
  */
6
-public class PrimativeTypes {
6
+public class PrimitiveTypes {
7
 
7
 
8
     /**
8
     /**
9
      * @param baseValue  starting value
9
      * @param baseValue  starting value
10
      * @param difference value to add to starting value
10
      * @param difference value to add to starting value
11
      * @return sum of `baseValue` and `difference`
11
      * @return sum of `baseValue` and `difference`
12
      */
12
      */
13
-    public int add(int baseValue, int difference) {
14
-        return 0;
13
+    public Integer add(int baseValue, int difference) {
14
+        return null;
15
     }
15
     }
16
 
16
 
17
     /**
17
     /**
19
      * @param difference value to add to starting value
19
      * @param difference value to add to starting value
20
      * @return sum of `baseValue` and `difference`
20
      * @return sum of `baseValue` and `difference`
21
      */
21
      */
22
-    public long add(long baseValue, long difference) {
23
-        return 0;
22
+    public Long add(long baseValue, long difference) {
23
+        return null;
24
     }
24
     }
25
 
25
 
26
     /**
26
     /**
28
      * @param difference value to add to starting value
28
      * @param difference value to add to starting value
29
      * @return sum of `baseValue` and `difference`
29
      * @return sum of `baseValue` and `difference`
30
      */
30
      */
31
-    public short add(short baseValue, short difference) {
32
-        return 0;
31
+    public Short add(short baseValue, short difference) {
32
+        return null;
33
     }
33
     }
34
 
34
 
35
     /**
35
     /**
37
      * @param difference value to add to starting value
37
      * @param difference value to add to starting value
38
      * @return sum of `baseValue` and `difference`
38
      * @return sum of `baseValue` and `difference`
39
      */
39
      */
40
-    public byte add(byte baseValue, byte difference) {
41
-        return 0;
40
+    public Byte add(byte baseValue, byte difference) {
41
+        return null;
42
     }
42
     }
43
 
43
 
44
     /**
44
     /**
46
      * @param difference value to add to starting value
46
      * @param difference value to add to starting value
47
      * @return sum of `baseValue` and `difference`
47
      * @return sum of `baseValue` and `difference`
48
      */
48
      */
49
-    public float add(float baseValue, float difference) {
50
-        return 0;
49
+    public Float add(float baseValue, float difference) {
50
+        return null;
51
     }
51
     }
52
 
52
 
53
     /**
53
     /**
55
      * @param difference value to add to starting value
55
      * @param difference value to add to starting value
56
      * @return sum of `baseValue` and `difference`
56
      * @return sum of `baseValue` and `difference`
57
      */
57
      */
58
-    public double add(double baseValue, double difference) {
59
-        return 0;
58
+    public Double add(double baseValue, double difference) {
59
+        return null;
60
     }
60
     }
61
 
61
 
62
     /**
62
     /**
64
      * @param difference value to subtract from starting value
64
      * @param difference value to subtract from starting value
65
      * @return difference between `baseValue` and `difference`
65
      * @return difference between `baseValue` and `difference`
66
      */
66
      */
67
-    public int subtract(int baseValue, int difference) {
68
-        return 0;
67
+    public Integer subtract(int baseValue, int difference) {
68
+        return null;
69
     }
69
     }
70
 
70
 
71
     /**
71
     /**
73
      * @param difference value to subtract from starting value
73
      * @param difference value to subtract from starting value
74
      * @return difference between `baseValue` and `difference`
74
      * @return difference between `baseValue` and `difference`
75
      */
75
      */
76
-    public long subtract(long baseValue, long difference) {
77
-        return 0;
76
+    public Long subtract(long baseValue, long difference) {
77
+        return null;
78
     }
78
     }
79
 
79
 
80
     /**
80
     /**
82
      * @param difference value to subtract from starting value
82
      * @param difference value to subtract from starting value
83
      * @return difference between `baseValue` and `difference`
83
      * @return difference between `baseValue` and `difference`
84
      */
84
      */
85
-    public short subtract(short baseValue, short difference) {
86
-        return 0;
85
+    public Short subtract(short baseValue, short difference) {
86
+        return null;
87
     }
87
     }
88
 
88
 
89
     /**
89
     /**
91
      * @param difference value to subtract from starting value
91
      * @param difference value to subtract from starting value
92
      * @return difference between `baseValue` and `difference`
92
      * @return difference between `baseValue` and `difference`
93
      */
93
      */
94
-    public byte subtract(byte baseValue, byte difference) {
95
-        return 0;
94
+    public Byte subtract(byte baseValue, byte difference) {
95
+        return null;
96
     }
96
     }
97
 
97
 
98
     /**
98
     /**
100
      * @param difference value to subtract from starting value
100
      * @param difference value to subtract from starting value
101
      * @return difference between `baseValue` and `difference`
101
      * @return difference between `baseValue` and `difference`
102
      */
102
      */
103
-    public float subtract(float baseValue, float difference) {
104
-        return 0;
103
+    public Float subtract(float baseValue, float difference) {
104
+        return null;
105
     }
105
     }
106
 
106
 
107
     /**
107
     /**
109
      * @param difference value to subtract from starting value
109
      * @param difference value to subtract from starting value
110
      * @return difference between `baseValue` and `difference`
110
      * @return difference between `baseValue` and `difference`
111
      */
111
      */
112
-    public double subtract(double baseValue, double difference) {
113
-        return 0;
112
+    public Double subtract(double baseValue, double difference) {
113
+        return null;
114
     }
114
     }
115
 
115
 
116
 
116
 
119
      * @param divisor value to divide by
119
      * @param divisor value to divide by
120
      * @return division of `dividend` by `divisor
120
      * @return division of `dividend` by `divisor
121
      */
121
      */
122
-    public int divide(int dividend, int divisor) {
123
-        return 0;
122
+    public Integer divide(int dividend, int divisor) {
123
+        return null;
124
     }
124
     }
125
 
125
 
126
     /**
126
     /**
128
      * @param divisor value to divide by
128
      * @param divisor value to divide by
129
      * @return division of `dividend` by `divisor
129
      * @return division of `dividend` by `divisor
130
      */
130
      */
131
-    public long divide(long dividend, long divisor) {
132
-        return 0;
131
+    public Long divide(long dividend, long divisor) {
132
+        return null;
133
     }
133
     }
134
 
134
 
135
     /**
135
     /**
137
      * @param divisor value to divide by
137
      * @param divisor value to divide by
138
      * @return division of `dividend` by `divisor
138
      * @return division of `dividend` by `divisor
139
      */
139
      */
140
-    public short divide(short dividend, short divisor) {
141
-        return 0;
140
+    public Short divide(short dividend, short divisor) {
141
+        return null;
142
     }
142
     }
143
 
143
 
144
     /**
144
     /**
146
      * @param divisor value to divide by
146
      * @param divisor value to divide by
147
      * @return division of `dividend` by `divisor
147
      * @return division of `dividend` by `divisor
148
      */
148
      */
149
-    public byte divide(byte dividend, byte divisor) {
150
-        return 0;
149
+    public Byte divide(byte dividend, byte divisor) {
150
+        return null;
151
     }
151
     }
152
 
152
 
153
     /**
153
     /**
155
      * @param divisor value to divide by
155
      * @param divisor value to divide by
156
      * @return division of `dividend` by `divisor
156
      * @return division of `dividend` by `divisor
157
      */
157
      */
158
-    public float divide(float dividend, float divisor) {
159
-        return 0;
158
+    public Float divide(float dividend, float divisor) {
159
+        return null;
160
     }
160
     }
161
 
161
 
162
     /**
162
     /**
164
      * @param divisor value to divide by
164
      * @param divisor value to divide by
165
      * @return division of `dividend` by `divisor
165
      * @return division of `dividend` by `divisor
166
      */
166
      */
167
-    public double divide(double dividend, double divisor) {
168
-        return 0;
167
+    public Double divide(double dividend, double divisor) {
168
+        return null;
169
     }
169
     }
170
 
170
 
171
 
171
 
174
      * @param multiplier value to multiply by
174
      * @param multiplier value to multiply by
175
      * @return product of `multiplicand` by `multiplier`
175
      * @return product of `multiplicand` by `multiplier`
176
      */
176
      */
177
-    public int multiply(int multiplicand, int multiplier) {
178
-        return 0;
177
+    public Integer multiply(int multiplicand, int multiplier) {
178
+        return null;
179
     }
179
     }
180
 
180
 
181
     /**
181
     /**
183
      * @param multiplier value to multiply by
183
      * @param multiplier value to multiply by
184
      * @return product of `multiplicand` by `multiplier`
184
      * @return product of `multiplicand` by `multiplier`
185
      */
185
      */
186
-    public long multiply(long multiplicand, long multiplier) {
187
-        return 0;
186
+    public Long multiply(long multiplicand, long multiplier) {
187
+        return null;
188
     }
188
     }
189
 
189
 
190
     /**
190
     /**
192
      * @param multiplier value to multiply by
192
      * @param multiplier value to multiply by
193
      * @return product of `multiplicand` by `multiplier`
193
      * @return product of `multiplicand` by `multiplier`
194
      */
194
      */
195
-    public short multiply(short multiplicand, short multiplier) {
196
-        return 0;
195
+    public Short multiply(short multiplicand, short multiplier) {
196
+        return null;
197
     }
197
     }
198
     /**
198
     /**
199
      * @param multiplicand value to be multiplied
199
      * @param multiplicand value to be multiplied
200
      * @param multiplier value to multiply by
200
      * @param multiplier value to multiply by
201
      * @return product of `multiplicand` by `multiplier`
201
      * @return product of `multiplicand` by `multiplier`
202
      */
202
      */
203
-    public byte multiply(byte multiplicand, byte multiplier) {
204
-        return 0;
203
+    public Byte multiply(byte multiplicand, byte multiplier) {
204
+        return null;
205
     }
205
     }
206
 
206
 
207
     /**
207
     /**
209
      * @param multiplier value to multiply by
209
      * @param multiplier value to multiply by
210
      * @return product of `multiplicand` by `multiplier`
210
      * @return product of `multiplicand` by `multiplier`
211
      */
211
      */
212
-    public float multiply(float multiplicand, float multiplier) {
213
-        return 0;
212
+    public Float multiply(float multiplicand, float multiplier) {
213
+        return null;
214
     }
214
     }
215
 
215
 
216
     /**
216
     /**
218
      * @param multiplier value to multiply by
218
      * @param multiplier value to multiply by
219
      * @return product of `multiplicand` by `multiplier`
219
      * @return product of `multiplicand` by `multiplier`
220
      */
220
      */
221
-    public double multiply(double multiplicand, double multiplier) {
222
-        return 0;
221
+    public Double multiply(double multiplicand, double multiplier) {
222
+        return null;
223
     }
223
     }
224
 
224
 
225
 
225
 
226
     /**
226
     /**
227
       * @return true
227
       * @return true
228
      */
228
      */
229
-    public boolean returnTrue() {
230
-        return false;
229
+    public Boolean returnTrue() {
230
+        return null;
231
     }
231
     }
232
 
232
 
233
     /**
233
     /**
234
      * @return false
234
      * @return false
235
      */
235
      */
236
-    public boolean returnFalse() {
237
-        return true;
236
+    public Boolean returnFalse() {
237
+        return null;
238
     }
238
     }
239
 
239
 
240
 }
240
 }

+ 82
- 0
src/main/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilities.java 查看文件

1
+package com.zipcodewilmington.danny_do_better_exercises;
2
+
3
+/**
4
+ * Created by dan on 6/14/17.
5
+ */
6
+public class StringUtilities {
7
+
8
+    /**
9
+     * @param firstSegment a string to be added to
10
+     * @param secondSegment a string to add
11
+     * @return the concatenation of two strings, `firstSegment`, and `secondSegment`
12
+     */
13
+    public static String concatenation(String firstSegment, String secondSegment){
14
+        return null;
15
+    }
16
+
17
+    /**
18
+     * @param firstSegment a string to be added to
19
+     * @param secondSegment a string to add
20
+     * @return the concatenation of an integer, `firstSegment`, and a String, `secondSegment`
21
+     */
22
+    public static String concatenation(int firstSegment, String secondSegment){
23
+        return null;
24
+    }
25
+
26
+    /**
27
+     * @param input a string to be manipulated
28
+     * @return the first 3 characters of `input`
29
+     */
30
+    public static String getPrefix(String input){
31
+        return null;
32
+    }
33
+
34
+    /**
35
+     * @param input a string to be manipulated
36
+     * @return the last 3 characters of `input`
37
+     */
38
+    public static String getSuffix(String input){
39
+        return null;
40
+    }
41
+
42
+    /**
43
+     * @param inputValue the value to be compared
44
+     * @param comparableValue the value to be compared against
45
+     * @return the equivalence of two strings, `inputValue` and `comparableValue`
46
+     */
47
+    public static Boolean compareTwoStrings(String inputValue, String comparableValue){
48
+        return null;
49
+    }
50
+
51
+    /**
52
+     * @param inputValue the value input from user
53
+     * @return the middle character of `inputValue`
54
+     */
55
+    public static Character getMiddleCharacter(String inputValue){
56
+        return null;
57
+    }
58
+
59
+    /**
60
+     * @param spaceDelimitedString a string, representative of a sentence, containing spaces
61
+     * @return the first sequence of characters
62
+     */
63
+    public static String getFirstWord(String spaceDelimitedString){
64
+        return null;
65
+    }
66
+
67
+    /**
68
+     * @param spaceDelimitedString a string delimited by spaces
69
+     * @return the second word of a string delimited by spaces.
70
+     */
71
+    public static String getSecondWord(String spaceDelimitedString){
72
+        return null;
73
+    }
74
+
75
+    /**
76
+     * @param stringToReverse
77
+     * @return an identical string with characters in reverse order.
78
+     */
79
+    public static String reverseTheTwo(String stringToReverse){
80
+        return null;
81
+    }
82
+}

src/test/java/com/zipcodewilmington/danny_do_better/HelloWorldTest.java → src/test/java/com/zipcodewilmington/danny_do_better_exercises/HelloWorldTest.java 查看文件

1
-package com.zipcodewilmington.danny_do_better;
1
+package com.zipcodewilmington.danny_do_better_exercises;
2
 
2
 
3
 import org.junit.Test;
3
 import org.junit.Test;
4
 
4
 

src/test/java/com/zipcodewilmington/danny_do_better/MathUtilitiesTest.java → src/test/java/com/zipcodewilmington/danny_do_better_exercises/PredicateUtilitiesTest.java 查看文件

1
-package com.zipcodewilmington.danny_do_better;
1
+package com.zipcodewilmington.danny_do_better_exercises;
2
 
2
 
3
-import org.junit.Before;
4
 import org.junit.Test;
3
 import org.junit.Test;
5
 import static org.junit.Assert.*;
4
 import static org.junit.Assert.*;
6
 /**
5
 /**
7
  * Created by dan on 6/14/17.
6
  * Created by dan on 6/14/17.
8
  */
7
  */
9
-public class MathUtilitiesTest {
10
-    private static volatile MathUtilities math = new MathUtilities();
11
-
12
-    @Test
13
-    public void testRemainder1(){
14
-        // : Given
15
-        Integer dividend = 7;
16
-        Integer divisor = 3;
17
-        Integer expected = 1;
18
-
19
-        // : When
20
-        Integer actual = math.remainder(dividend, divisor);
21
-
22
-        // : Then
23
-        assertEquals(expected, actual);
24
-    }
25
-
26
-
27
-    @Test
28
-    public void testRemainder2(){
29
-        // : Given
30
-        Integer dividend = 8;
31
-        Integer divisor = 3;
32
-        Integer expected = 2;
33
-
34
-        // : When
35
-        Integer actual = math.remainder(dividend, divisor);
36
-
37
-        // : Then
38
-        assertEquals(expected, actual);
39
-    }
8
+public class PredicateUtilitiesTest {
9
+    private static volatile PredicateUtilities math = new PredicateUtilities();
40
 
10
 
41
     @Test
11
     @Test
42
     public void testGreaterThanTrue(){
12
     public void testGreaterThanTrue(){
73
         int greaterValue = 450;
43
         int greaterValue = 450;
74
         int lesserValue = 350;
44
         int lesserValue = 350;
75
 
45
 
76
-
77
         // : When
46
         // : When
78
         boolean outcome = math.isLessThan(greaterValue, lesserValue);
47
         boolean outcome = math.isLessThan(greaterValue, lesserValue);
79
 
48
 
89
         int greaterValue = 450;
58
         int greaterValue = 450;
90
         int lesserValue = 350;
59
         int lesserValue = 350;
91
 
60
 
92
-
93
         // : When
61
         // : When
94
         boolean outcome = math.isLessThan(greaterValue, lesserValue);
62
         boolean outcome = math.isLessThan(greaterValue, lesserValue);
95
 
63
 
99
 
67
 
100
 
68
 
101
     @Test
69
     @Test
102
-    public void testLessOrEqual(){
103
-        assertTrue(math.isLessThanOrEqualTo(3 , 3));
104
-        assertTrue(math.isLessThanOrEqualTo(3, 6));
70
+    public void testLessOrEqual1(){
71
+        // : Given
72
+        int greaterValue = 3;
73
+        int lesserValue = 3;
74
+
75
+        // : When
76
+        boolean outcome = math.isLessThanOrEqualTo(greaterValue, lesserValue);
77
+
78
+        // : Then
79
+        assertTrue(outcome);
105
     }
80
     }
106
 
81
 
107
     @Test
82
     @Test
108
-    public void testGreaterOrEqual(){
109
-        assertTrue(math.isGreaterThanOrEqualTo(4, 4));
110
-        assertTrue(math.isGreaterThanOrEqualTo(78, 5));
83
+    public void testLessOrEqual2(){
84
+        // : Given
85
+        int greaterValue = 3;
86
+        int lesserValue = 6;
87
+
88
+        // : When
89
+        boolean outcome = math.isLessThanOrEqualTo(greaterValue, lesserValue);
90
+
91
+        // : Then
92
+        assertTrue(outcome);
111
     }
93
     }
112
 
94
 
113
     @Test
95
     @Test
114
-    public void testLogicalAnd(){
115
-        assertTrue(math.isBoth(3));
116
-        assertFalse(math.isBoth(4));
96
+    public void testGreaterOrEqual1(){
97
+        // : Given
98
+        int greaterValue = 4;
99
+        int lesserValue = 4;
100
+
101
+        // : When
102
+        boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
103
+
104
+        // : ThenP
105
+        assertTrue(outcome);
117
     }
106
     }
118
 
107
 
108
+
119
     @Test
109
     @Test
120
-    public void testLogicalOr(){
121
-        assertTrue(math.logicalOr(4));
122
-        assertTrue(math.logicalOr(14564));
123
-        assertFalse(math.logicalOr(54));
124
-    }
110
+    public void testGreaterOrEqual2(){
111
+        // : Given
112
+        int greaterValue = 8;
113
+        int lesserValue = 15;
125
 
114
 
115
+        // : When
116
+        boolean outcome = math.isGreaterThanOrEqualTo(greaterValue, lesserValue);
126
 
117
 
118
+        // : Then
119
+        assertTrue(outcome);
120
+    }
127
 }
121
 }

src/test/java/com/zipcodewilmington/danny_do_better/PrimativeTypesTest.java → src/test/java/com/zipcodewilmington/danny_do_better_exercises/PrimativeTypesTest.java 查看文件

1
-package com.zipcodewilmington.danny_do_better;
1
+package com.zipcodewilmington.danny_do_better_exercises;
2
 
2
 
3
 import org.junit.Test;
3
 import org.junit.Test;
4
 
4
 
7
  * Created by dan on 6/14/17.
7
  * Created by dan on 6/14/17.
8
  */
8
  */
9
 public class PrimativeTypesTest {
9
 public class PrimativeTypesTest {
10
-    private PrimativeTypes primativeTypes = new PrimativeTypes();
10
+    private static volatile PrimitiveTypes primativeTypes = new PrimitiveTypes();
11
 
11
 
12
     @Test
12
     @Test
13
     public void testAdditions() {
13
     public void testAdditions() {

src/test/java/com/zipcodewilmington/danny_do_better/StringUtilitiesTest.java → src/test/java/com/zipcodewilmington/danny_do_better_exercises/StringUtilitiesTest.java 查看文件

1
-package com.zipcodewilmington.danny_do_better;
1
+package com.zipcodewilmington.danny_do_better_exercises;
2
 
2
 
3
 import org.junit.Assert;
3
 import org.junit.Assert;
4
-import org.junit.Before;
5
 import org.junit.Test;
4
 import org.junit.Test;
6
 import static org.junit.Assert.*;
5
 import static org.junit.Assert.*;
7
 
6
 
9
  * Created by dan on 6/14/17.
8
  * Created by dan on 6/14/17.
10
  */
9
  */
11
 public class StringUtilitiesTest {
10
 public class StringUtilitiesTest {
12
-    private static StringUtilities stringUtilities = new StringUtilities();
13
 
11
 
14
     @Test
12
     @Test
15
     public void concatenationStringTest(){
13
     public void concatenationStringTest(){
19
         String expected = "Hello Java";
17
         String expected = "Hello Java";
20
 
18
 
21
         // : When
19
         // : When
22
-        String actual = stringUtilities.concatenation(one,two);
20
+        String actual = StringUtilities.concatenation(one,two);
23
 
21
 
24
 
22
 
25
         // : Then
23
         // : Then
35
         String expected = "1 Java";
33
         String expected = "1 Java";
36
 
34
 
37
         // : When
35
         // : When
38
-        String actual = stringUtilities.concatenation(one,two);
36
+        String actual = StringUtilities.concatenation(one,two);
39
 
37
 
40
 
38
 
41
         // : Then
39
         // : Then
49
         String expected = "olleH";
47
         String expected = "olleH";
50
 
48
 
51
         // : When
49
         // : When
52
-        String actual = stringUtilities.getPrefix(input);
50
+        String actual = StringUtilities.getPrefix(input);
53
 
51
 
54
         // : Then
52
         // : Then
55
         assertEquals(expected, actual);
53
         assertEquals(expected, actual);
62
         String expected = "llo";
60
         String expected = "llo";
63
 
61
 
64
         // : When
62
         // : When
65
-        String actual = stringUtilities.getSuffix("Hello");
63
+        String actual = StringUtilities.getSuffix("Hello");
66
 
64
 
67
         // : Then
65
         // : Then
68
         assertEquals(expected, actual);
66
         assertEquals(expected, actual);
75
         String comparableValue = "Zipcode";
73
         String comparableValue = "Zipcode";
76
 
74
 
77
         // : When
75
         // : When
78
-        boolean actual = stringUtilities.compareTwoStrings(inputValue, comparableValue);
76
+        boolean actual = StringUtilities.compareTwoStrings(inputValue, comparableValue);
79
 
77
 
80
         // : Then
78
         // : Then
81
         assertTrue(actual);
79
         assertTrue(actual);
89
         String comparableValue = "Zipcodee";
87
         String comparableValue = "Zipcodee";
90
 
88
 
91
         // : When
89
         // : When
92
-        boolean actual = stringUtilities.compareTwoStrings(inputValue, comparableValue);
90
+        boolean actual = StringUtilities.compareTwoStrings(inputValue, comparableValue);
93
 
91
 
94
         // : Then
92
         // : Then
95
         assertFalse(actual);
93
         assertFalse(actual);
96
     }
94
     }
97
 
95
 
98
     @Test
96
     @Test
99
-    public void getTheMiddleChar(){
97
+    public void getTheMiddleChar1(){
100
         // : Given
98
         // : Given
101
         String input = "Zipcode";
99
         String input = "Zipcode";
102
         char expected = 'c';
100
         char expected = 'c';
103
 
101
 
104
         // : When
102
         // : When
105
-        char actual = stringUtilities.getMiddleCharacter(input);
103
+        char actual = StringUtilities.getMiddleCharacter(input);
106
 
104
 
107
         // : Then
105
         // : Then
108
         Assert.assertEquals(expected, actual);
106
         Assert.assertEquals(expected, actual);
110
 
108
 
111
 
109
 
112
     @Test
110
     @Test
113
-    public void getTheMiddleCharr(){
111
+    public void getTheMiddleChar2(){
114
         // : Given
112
         // : Given
115
         String input = "Zipcoder";
113
         String input = "Zipcoder";
116
         Character expected = 'c';
114
         Character expected = 'c';
117
 
115
 
118
         // : When
116
         // : When
119
-        Character actual = stringUtilities.getMiddleCharacter(input);
117
+        Character actual = StringUtilities.getMiddleCharacter(input);
120
 
118
 
121
         // : Then
119
         // : Then
122
         Assert.assertEquals(expected.toString(), actual.toString());
120
         Assert.assertEquals(expected.toString(), actual.toString());
130
         String expected = "Zipcode";
128
         String expected = "Zipcode";
131
 
129
 
132
         // : When
130
         // : When
133
-        String actual = stringUtilities.getFirstWord(input);
131
+        String actual = StringUtilities.getFirstWord(input);
134
 
132
 
135
         // : Then
133
         // : Then
136
         assertEquals(expected, actual);
134
         assertEquals(expected, actual);
144
         String expected = "Wilmington";
142
         String expected = "Wilmington";
145
 
143
 
146
         // : When
144
         // : When
147
-        String actual = stringUtilities.getFirstWord(input);
145
+        String actual = StringUtilities.getFirstWord(input);
148
 
146
 
149
         // : Then
147
         // : Then
150
         assertEquals(expected, actual);
148
         assertEquals(expected, actual);
158
 
156
 
159
 
157
 
160
         // : When
158
         // : When
161
-        String actual = stringUtilities.reverseTheTwo(input);
159
+        String actual = StringUtilities.reverseTheTwo(input);
162
 
160
 
163
         // : Then
161
         // : Then
164
         assertEquals(expected, actual);
162
         assertEquals(expected, actual);

+ 18
- 0
src/test/java/com/zipcodewilmington/danny_do_better_exercises/TestSuite.java 查看文件

1
+package com.zipcodewilmington.danny_do_better_exercises;
2
+
3
+import org.junit.runner.RunWith;
4
+import org.junit.runners.Suite;
5
+
6
+/**
7
+ * Created by leon on 2/5/18.
8
+ */
9
+@RunWith(Suite.class)
10
+
11
+@Suite.SuiteClasses({
12
+        HelloWorldTest.class,
13
+        PredicateUtilitiesTest.class,
14
+        PrimativeTypesTest.class,
15
+        StringUtilitiesTest.class,
16
+})
17
+public class TestSuite {
18
+}

二進制
target/classes/com/zipcodewilmington/danny_do_better/MathUtilities.class 查看文件


二進制
target/classes/com/zipcodewilmington/danny_do_better/PredicateUtilities.class 查看文件


二進制
target/classes/com/zipcodewilmington/danny_do_better/PrimativeTypes.class 查看文件


二進制
target/classes/com/zipcodewilmington/danny_do_better/PrimitiveTypes.class 查看文件


二進制
target/classes/com/zipcodewilmington/danny_do_better/StringUtilities.class 查看文件


二進制
target/test-classes/com/zipcodewilmington/danny_do_better/HelloWorldTest.class 查看文件


二進制
target/test-classes/com/zipcodewilmington/danny_do_better/MathUtilitiesTest.class 查看文件


二進制
target/test-classes/com/zipcodewilmington/danny_do_better/PredicateUtilitiesTest.class 查看文件


二進制
target/test-classes/com/zipcodewilmington/danny_do_better/PrimativeTypesTest.class 查看文件


二進制
target/test-classes/com/zipcodewilmington/danny_do_better/StringUtilitiesTest.class 查看文件


二進制
target/test-classes/com/zipcodewilmington/danny_do_better/TestSuite.class 查看文件