|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+import java.util.List;
|
|
|
2
|
+import java.util.Arrays;
|
|
|
3
|
+
|
|
1
|
4
|
import org.junit.Test;
|
|
2
|
5
|
import org.junit.Ignore;
|
|
3
|
6
|
|
|
|
@@ -9,145 +12,171 @@ public class KindergartenGardenTest {
|
|
9
|
12
|
public void singleStudent() {
|
|
10
|
13
|
String student = "Alice";
|
|
11
|
14
|
String plants = "RC\nGG";
|
|
12
|
|
- Plant[] expected = {Plant.RADISHES, Plant.CLOVER, Plant.GRASS, Plant.GRASS};
|
|
|
15
|
+ List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.CLOVER, Plant.GRASS, Plant.GRASS);
|
|
13
|
16
|
|
|
14
|
|
- assertEquals(expected,
|
|
15
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
17
|
+ assertEquals(
|
|
|
18
|
+ expected,
|
|
|
19
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
20
|
+ );
|
|
16
|
21
|
}
|
|
17
|
22
|
|
|
18
|
|
- @Ignore("Remove to run test")
|
|
|
23
|
+ //@Ignore("Remove to run test")
|
|
19
|
24
|
@Test
|
|
20
|
25
|
public void singleStudent2() {
|
|
21
|
26
|
String student = "Alice";
|
|
22
|
27
|
String plants = "VC\nRC";
|
|
23
|
|
- Plant[] expected = {Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.CLOVER};
|
|
|
28
|
+ List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.CLOVER);
|
|
24
|
29
|
|
|
25
|
|
- assertEquals(expected,
|
|
26
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
30
|
+ assertEquals(
|
|
|
31
|
+ expected,
|
|
|
32
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
33
|
+ );
|
|
27
|
34
|
}
|
|
28
|
35
|
|
|
29
|
|
- @Ignore("Remove to run test")
|
|
|
36
|
+ //@Ignore("Remove to run test")
|
|
30
|
37
|
@Test
|
|
31
|
38
|
public void twoStudents() {
|
|
32
|
39
|
String student = "Bob";
|
|
33
|
40
|
String plants = "VVCG\nVVRC";
|
|
34
|
|
- Plant[] expected = {Plant.CLOVER, Plant.GRASS, Plant.RADISHES, Plant.CLOVER};
|
|
|
41
|
+ List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.GRASS, Plant.RADISHES, Plant.CLOVER);
|
|
35
|
42
|
|
|
36
|
|
- assertEquals(expected,
|
|
37
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
43
|
+ assertEquals(
|
|
|
44
|
+ expected,
|
|
|
45
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
46
|
+ );
|
|
38
|
47
|
}
|
|
39
|
48
|
|
|
40
|
|
- @Ignore("Remove to run test")
|
|
|
49
|
+ //@Ignore("Remove to run test")
|
|
41
|
50
|
@Test
|
|
42
|
51
|
public void oneGardenSecondStudent() {
|
|
43
|
52
|
String student = "Bob";
|
|
44
|
53
|
String plants = "VVCCGG\nVVCCGG";
|
|
45
|
|
- Plant[] expected = {Plant.CLOVER, Plant.CLOVER, Plant.CLOVER, Plant.CLOVER};
|
|
|
54
|
+ List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.CLOVER, Plant.CLOVER, Plant.CLOVER);
|
|
46
|
55
|
|
|
47
|
|
- assertEquals(expected,
|
|
48
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
56
|
+ assertEquals(
|
|
|
57
|
+ expected,
|
|
|
58
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
59
|
+ );
|
|
49
|
60
|
}
|
|
50
|
61
|
|
|
51
|
|
- @Ignore("Remove to run test")
|
|
|
62
|
+ //@Ignore("Remove to run test")
|
|
52
|
63
|
@Test
|
|
53
|
64
|
public void oneGardenThirdStudent() {
|
|
54
|
65
|
String student = "Charlie";
|
|
55
|
66
|
String plants = "VVCCGG\nVVCCGG";
|
|
56
|
|
- Plant[] expected = {Plant.GRASS, Plant.GRASS, Plant.GRASS, Plant.GRASS};
|
|
|
67
|
+ List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.GRASS, Plant.GRASS, Plant.GRASS);
|
|
57
|
68
|
|
|
58
|
|
- assertEquals(expected,
|
|
59
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
69
|
+ assertEquals(
|
|
|
70
|
+ expected,
|
|
|
71
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
72
|
+ );
|
|
60
|
73
|
}
|
|
61
|
74
|
|
|
62
|
|
- @Ignore("Remove to run test")
|
|
|
75
|
+ //@Ignore("Remove to run test")
|
|
63
|
76
|
@Test
|
|
64
|
77
|
public void fullGardenFirstStudent() {
|
|
65
|
78
|
String student = "Alice";
|
|
66
|
79
|
String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
|
|
67
|
|
- Plant[] expected = {Plant.VIOLETS, Plant.RADISHES, Plant.VIOLETS, Plant.RADISHES};
|
|
|
80
|
+ List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.RADISHES, Plant.VIOLETS, Plant.RADISHES);
|
|
68
|
81
|
|
|
69
|
|
- assertEquals(expected,
|
|
70
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
82
|
+ assertEquals(
|
|
|
83
|
+ expected,
|
|
|
84
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
85
|
+ );
|
|
71
|
86
|
}
|
|
72
|
87
|
|
|
73
|
|
- @Ignore("Remove to run test")
|
|
|
88
|
+ //@Ignore("Remove to run test")
|
|
74
|
89
|
@Test
|
|
75
|
90
|
public void fullGardenSecondStudent() {
|
|
76
|
91
|
String student = "Bob";
|
|
77
|
92
|
String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
|
|
78
|
|
- Plant[] expected = {Plant.CLOVER, Plant.GRASS, Plant.CLOVER, Plant.CLOVER};
|
|
|
93
|
+ List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.GRASS, Plant.CLOVER, Plant.CLOVER);
|
|
79
|
94
|
|
|
80
|
|
- assertEquals(expected,
|
|
81
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
95
|
+ assertEquals(
|
|
|
96
|
+ expected,
|
|
|
97
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
98
|
+ );
|
|
82
|
99
|
}
|
|
83
|
100
|
|
|
84
|
|
- @Ignore("Remove to run test")
|
|
|
101
|
+ //@Ignore("Remove to run test")
|
|
85
|
102
|
@Test
|
|
86
|
103
|
public void fullGardenSecondToLastStudent() {
|
|
87
|
104
|
String student = "Kincaid";
|
|
88
|
105
|
String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
|
|
89
|
|
- Plant[] expected = {Plant.GRASS, Plant.CLOVER, Plant.CLOVER, Plant.GRASS};
|
|
|
106
|
+ List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.CLOVER, Plant.CLOVER, Plant.GRASS);
|
|
90
|
107
|
|
|
91
|
|
- assertEquals(expected,
|
|
92
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
108
|
+ assertEquals(
|
|
|
109
|
+ expected,
|
|
|
110
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
111
|
+ );
|
|
93
|
112
|
}
|
|
94
|
113
|
|
|
95
|
|
- @Ignore("Remove to run test")
|
|
|
114
|
+ //@Ignore("Remove to run test")
|
|
96
|
115
|
@Test
|
|
97
|
116
|
public void fullGardenLastStudent() {
|
|
98
|
117
|
String student = "Larry";
|
|
99
|
118
|
String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
|
|
100
|
|
- Plant[] expected = {Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.VIOLETS};
|
|
|
119
|
+ List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.VIOLETS);
|
|
101
|
120
|
|
|
102
|
|
- assertEquals(expected,
|
|
103
|
|
- new KindergartenGarden(plants).getPlantsOfStudent(student));
|
|
|
121
|
+ assertEquals(
|
|
|
122
|
+ expected,
|
|
|
123
|
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
|
|
|
124
|
+ );
|
|
104
|
125
|
}
|
|
105
|
126
|
|
|
106
|
|
- @Ignore("Remove to run test")
|
|
|
127
|
+ //@Ignore("Remove to run test")
|
|
107
|
128
|
@Test
|
|
108
|
129
|
public void customStudentGardenFirstStudent() {
|
|
109
|
130
|
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
|
|
110
|
131
|
String student = "Patricia";
|
|
111
|
132
|
String plants = "VCRRGVRG\nRVGCCGCV";
|
|
112
|
|
- Plant[] expected = {Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.VIOLETS};
|
|
|
133
|
+ List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.VIOLETS);
|
|
113
|
134
|
|
|
114
|
|
- assertEquals(expected,
|
|
115
|
|
- new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student));
|
|
|
135
|
+ assertEquals(
|
|
|
136
|
+ expected,
|
|
|
137
|
+ new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
|
|
|
138
|
+ );
|
|
116
|
139
|
}
|
|
117
|
140
|
|
|
118
|
|
- @Ignore("Remove to run test")
|
|
|
141
|
+ //@Ignore("Remove to run test")
|
|
119
|
142
|
@Test
|
|
120
|
143
|
public void customStudentGardenSecondStudent() {
|
|
121
|
144
|
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
|
|
122
|
145
|
String student = "Roger";
|
|
123
|
146
|
String plants = "VCRRGVRG\nRVGCCGCV";
|
|
124
|
|
- Plant[] expected = {Plant.RADISHES, Plant.RADISHES, Plant.GRASS, Plant.CLOVER};
|
|
|
147
|
+ List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.RADISHES, Plant.GRASS, Plant.CLOVER);
|
|
125
|
148
|
|
|
126
|
|
- assertEquals(expected,
|
|
127
|
|
- new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student));
|
|
|
149
|
+ assertEquals(
|
|
|
150
|
+ expected,
|
|
|
151
|
+ new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
|
|
|
152
|
+ );
|
|
128
|
153
|
}
|
|
129
|
154
|
|
|
130
|
|
- @Ignore("Remove to run test")
|
|
|
155
|
+ //@Ignore("Remove to run test")
|
|
131
|
156
|
@Test
|
|
132
|
157
|
public void customStudentGardenThirdStudent() {
|
|
133
|
158
|
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
|
|
134
|
159
|
String student = "Samantha";
|
|
135
|
160
|
String plants = "VCRRGVRG\nRVGCCGCV";
|
|
136
|
|
- Plant[] expected = {Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.GRASS};
|
|
|
161
|
+ List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.GRASS);
|
|
137
|
162
|
|
|
138
|
|
- assertEquals(expected,
|
|
139
|
|
- new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student));
|
|
|
163
|
+ assertEquals(
|
|
|
164
|
+ expected,
|
|
|
165
|
+ new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
|
|
|
166
|
+ );
|
|
140
|
167
|
}
|
|
141
|
168
|
|
|
142
|
|
- @Ignore("Remove to run test")
|
|
|
169
|
+ //@Ignore("Remove to run test")
|
|
143
|
170
|
@Test
|
|
144
|
171
|
public void customStudentGardenFourthStudent() {
|
|
145
|
172
|
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
|
|
146
|
173
|
String student = "Xander";
|
|
147
|
174
|
String plants = "VCRRGVRG\nRVGCCGCV";
|
|
148
|
|
- Plant[] expected = {Plant.RADISHES, Plant.GRASS, Plant.CLOVER, Plant.VIOLETS};
|
|
|
175
|
+ List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.GRASS, Plant.CLOVER, Plant.VIOLETS);
|
|
149
|
176
|
|
|
150
|
|
- assertEquals(expected,
|
|
151
|
|
- new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student));
|
|
|
177
|
+ assertEquals(
|
|
|
178
|
+ expected,
|
|
|
179
|
+ new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
|
|
|
180
|
+ );
|
|
152
|
181
|
}
|
|
153
|
182
|
}
|