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