Leon Hunter 5 년 전
부모
커밋
ee506d95d5

+ 2
- 2
src/test/java/rocks/zipcode/quiz3a/fundamentals/stringutils/LowerCaseMiddleCharacterTest.java 파일 보기

@@ -12,7 +12,7 @@ public class LowerCaseMiddleCharacterTest {
12 12
         String expected = "o";
13 13
 
14 14
         // when
15
-        String actual = StringUtils.capitalizeMiddleCharacter(input);
15
+        String actual = StringUtils.lowerCaseMiddleCharacter(input);
16 16
 
17 17
         // then
18 18
         Assert.assertEquals(expected, actual);
@@ -25,7 +25,7 @@ public class LowerCaseMiddleCharacterTest {
25 25
         String expected = "OoO";
26 26
 
27 27
         // when
28
-        String actual = StringUtils.capitalizeMiddleCharacter(input);
28
+        String actual = StringUtils.lowerCaseMiddleCharacter(input);
29 29
 
30 30
         // then
31 31
         Assert.assertEquals(expected, actual);

+ 36
- 3
src/test/java/rocks/zipcode/quiz3a/objectorientation/food/GetSpiceCountTest.java 파일 보기

@@ -3,20 +3,53 @@ package rocks.zipcode.quiz3a.objectorientation.food;
3 3
 import org.junit.Assert;
4 4
 import org.junit.Test;
5 5
 import rocks.zipcode.quiz3a.collections.Food;
6
+import rocks.zipcode.quiz3a.objectorientation.Curry;
7
+import rocks.zipcode.quiz3a.objectorientation.Ginger;
6 8
 import rocks.zipcode.quiz3a.objectorientation.Pepper;
7 9
 import rocks.zipcode.quiz3a.objectorientation.Spice;
8 10
 
9 11
 import java.util.Map;
12
+import java.util.function.Supplier;
10 13
 
11 14
 public class GetSpiceCountTest {
12 15
     @Test
13 16
     public void test1() {
17
+        test(5, Pepper::new);
18
+    }
19
+
20
+    @Test
21
+    public void test2() {
22
+        test(10, Pepper::new);
23
+    }
24
+
25
+    @Test
26
+    public void test3() {
27
+        test(3, Curry::new);
28
+    }
29
+
30
+
31
+    @Test
32
+    public void test4() {
33
+        test(6, Curry::new);
34
+    }
35
+
36
+    @Test
37
+    public void test5() {
38
+        test(2, Ginger::new);
39
+    }
40
+
41
+    @Test
42
+    public void test6() {
43
+        test(4, Ginger::new);
44
+    }
45
+
46
+    public void test(Integer amountOfIngredients, Supplier<?> ingredientConstructor) {
14 47
         // given
48
+        Integer expected = amountOfIngredients;
15 49
         Food food = new Food();
16
-        Integer expected = 5;
17 50
         Spice pepper = null;
18
-        for (int i = 0; i < expected; i++) {
19
-            pepper = (Spice)new Pepper();
51
+        for (int i = 0; i < amountOfIngredients; i++) {
52
+            pepper = (Spice) ingredientConstructor.get();
20 53
             food.applySpice(pepper);
21 54
         }
22 55