|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+import org.junit.Test;
|
|
|
2
|
+import org.junit.Ignore;
|
|
|
3
|
+import org.junit.Before;
|
|
|
4
|
+
|
|
|
5
|
+import static org.junit.Assert.assertEquals;
|
|
|
6
|
+
|
|
|
7
|
+public class HouseTest {
|
|
|
8
|
+
|
|
|
9
|
+ private House house;
|
|
|
10
|
+
|
|
|
11
|
+ @Before
|
|
|
12
|
+ public void setup() {
|
|
|
13
|
+ house = new House();
|
|
|
14
|
+ }
|
|
|
15
|
+
|
|
|
16
|
+ @Test
|
|
|
17
|
+ public void verseOne() {
|
|
|
18
|
+ String expected = "This is the house that Jack built.";
|
|
|
19
|
+ int verse = 1;
|
|
|
20
|
+
|
|
|
21
|
+ assertEquals(expected, house.verse(verse));
|
|
|
22
|
+ }
|
|
|
23
|
+
|
|
|
24
|
+ @Ignore("Remove to run test")
|
|
|
25
|
+ @Test
|
|
|
26
|
+ public void verseTwo() {
|
|
|
27
|
+ String expected =
|
|
|
28
|
+ "This is the malt\n" +
|
|
|
29
|
+ "that lay in the house that Jack built.";
|
|
|
30
|
+ int verse = 2;
|
|
|
31
|
+
|
|
|
32
|
+ assertEquals(expected, house.verse(verse));
|
|
|
33
|
+ }
|
|
|
34
|
+
|
|
|
35
|
+ @Ignore("Remove to run test")
|
|
|
36
|
+ @Test
|
|
|
37
|
+ public void verseThree() {
|
|
|
38
|
+ String expected =
|
|
|
39
|
+ "This is the rat\n" +
|
|
|
40
|
+ "that ate the malt\n" +
|
|
|
41
|
+ "that lay in the house that Jack built.";
|
|
|
42
|
+ int verse = 3;
|
|
|
43
|
+
|
|
|
44
|
+ assertEquals(expected, house.verse(verse));
|
|
|
45
|
+ }
|
|
|
46
|
+
|
|
|
47
|
+ @Ignore("Remove to run test")
|
|
|
48
|
+ @Test
|
|
|
49
|
+ public void verseFour() {
|
|
|
50
|
+ String expected =
|
|
|
51
|
+ "This is the cat\n" +
|
|
|
52
|
+ "that killed the rat\n" +
|
|
|
53
|
+ "that ate the malt\n" +
|
|
|
54
|
+ "that lay in the house that Jack built.";
|
|
|
55
|
+ int verse = 4;
|
|
|
56
|
+
|
|
|
57
|
+ assertEquals(expected, house.verse(verse));
|
|
|
58
|
+ }
|
|
|
59
|
+
|
|
|
60
|
+ @Ignore("Remove to run test")
|
|
|
61
|
+ @Test
|
|
|
62
|
+ public void verseFive() {
|
|
|
63
|
+ String expected =
|
|
|
64
|
+ "This is the dog\n" +
|
|
|
65
|
+ "that worried the cat\n" +
|
|
|
66
|
+ "that killed the rat\n" +
|
|
|
67
|
+ "that ate the malt\n" +
|
|
|
68
|
+ "that lay in the house that Jack built.";
|
|
|
69
|
+ int verse = 5;
|
|
|
70
|
+
|
|
|
71
|
+ assertEquals(expected, house.verse(verse));
|
|
|
72
|
+ }
|
|
|
73
|
+
|
|
|
74
|
+ @Ignore("Remove to run test")
|
|
|
75
|
+ @Test
|
|
|
76
|
+ public void verseSix() {
|
|
|
77
|
+ String expected =
|
|
|
78
|
+ "This is the cow with the crumpled horn\n" +
|
|
|
79
|
+ "that tossed the dog\n" +
|
|
|
80
|
+ "that worried the cat\n" +
|
|
|
81
|
+ "that killed the rat\n" +
|
|
|
82
|
+ "that ate the malt\n" +
|
|
|
83
|
+ "that lay in the house that Jack built.";
|
|
|
84
|
+ int verse = 6;
|
|
|
85
|
+
|
|
|
86
|
+ assertEquals(expected, house.verse(verse));
|
|
|
87
|
+ }
|
|
|
88
|
+
|
|
|
89
|
+ @Ignore("Remove to run test")
|
|
|
90
|
+ @Test
|
|
|
91
|
+ public void verseSeven() {
|
|
|
92
|
+ String expected =
|
|
|
93
|
+ "This is the maiden all forlorn\n" +
|
|
|
94
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
95
|
+ "that tossed the dog\n" +
|
|
|
96
|
+ "that worried the cat\n" +
|
|
|
97
|
+ "that killed the rat\n" +
|
|
|
98
|
+ "that ate the malt\n" +
|
|
|
99
|
+ "that lay in the house that Jack built.";
|
|
|
100
|
+ int verse = 7;
|
|
|
101
|
+
|
|
|
102
|
+ assertEquals(expected, house.verse(verse));
|
|
|
103
|
+ }
|
|
|
104
|
+
|
|
|
105
|
+ @Ignore("Remove to run test")
|
|
|
106
|
+ @Test
|
|
|
107
|
+ public void verseEight() {
|
|
|
108
|
+ String expected =
|
|
|
109
|
+ "This is the man all tattered and torn\n" +
|
|
|
110
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
111
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
112
|
+ "that tossed the dog\n" +
|
|
|
113
|
+ "that worried the cat\n" +
|
|
|
114
|
+ "that killed the rat\n" +
|
|
|
115
|
+ "that ate the malt\n" +
|
|
|
116
|
+ "that lay in the house that Jack built.";
|
|
|
117
|
+ int verse = 8;
|
|
|
118
|
+
|
|
|
119
|
+ assertEquals(expected, house.verse(verse));
|
|
|
120
|
+ }
|
|
|
121
|
+
|
|
|
122
|
+ @Ignore("Remove to run test")
|
|
|
123
|
+ @Test
|
|
|
124
|
+ public void verseNine() {
|
|
|
125
|
+ String expected =
|
|
|
126
|
+ "This is the priest all shaven and shorn\n" +
|
|
|
127
|
+ "that married the man all tattered and torn\n" +
|
|
|
128
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
129
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
130
|
+ "that tossed the dog\n" +
|
|
|
131
|
+ "that worried the cat\n" +
|
|
|
132
|
+ "that killed the rat\n" +
|
|
|
133
|
+ "that ate the malt\n" +
|
|
|
134
|
+ "that lay in the house that Jack built.";
|
|
|
135
|
+ int verse = 9;
|
|
|
136
|
+
|
|
|
137
|
+ assertEquals(expected, house.verse(verse));
|
|
|
138
|
+ }
|
|
|
139
|
+
|
|
|
140
|
+ @Ignore("Remove to run test")
|
|
|
141
|
+ @Test
|
|
|
142
|
+ public void verse10() {
|
|
|
143
|
+ String expected =
|
|
|
144
|
+ "This is the rooster that crowed in the morn\n" +
|
|
|
145
|
+ "that woke the priest all shaven and shorn\n" +
|
|
|
146
|
+ "that married the man all tattered and torn\n" +
|
|
|
147
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
148
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
149
|
+ "that tossed the dog\n" +
|
|
|
150
|
+ "that worried the cat\n" +
|
|
|
151
|
+ "that killed the rat\n" +
|
|
|
152
|
+ "that ate the malt\n" +
|
|
|
153
|
+ "that lay in the house that Jack built.";
|
|
|
154
|
+ int verse = 10;
|
|
|
155
|
+
|
|
|
156
|
+ assertEquals(expected, house.verse(verse));
|
|
|
157
|
+ }
|
|
|
158
|
+
|
|
|
159
|
+ @Ignore("Remove to run test")
|
|
|
160
|
+ @Test
|
|
|
161
|
+ public void verse11() {
|
|
|
162
|
+ String expected =
|
|
|
163
|
+ "This is the farmer sowing his corn\n" +
|
|
|
164
|
+ "that kept the rooster that crowed in the morn\n" +
|
|
|
165
|
+ "that woke the priest all shaven and shorn\n" +
|
|
|
166
|
+ "that married the man all tattered and torn\n" +
|
|
|
167
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
168
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
169
|
+ "that tossed the dog\n" +
|
|
|
170
|
+ "that worried the cat\n" +
|
|
|
171
|
+ "that killed the rat\n" +
|
|
|
172
|
+ "that ate the malt\n" +
|
|
|
173
|
+ "that lay in the house that Jack built.";
|
|
|
174
|
+ int verse = 11;
|
|
|
175
|
+
|
|
|
176
|
+ assertEquals(expected, house.verse(verse));
|
|
|
177
|
+ }
|
|
|
178
|
+
|
|
|
179
|
+ @Ignore("Remove to run test")
|
|
|
180
|
+ @Test
|
|
|
181
|
+ public void verse12() {
|
|
|
182
|
+ String expected =
|
|
|
183
|
+ "This is the horse and the hound and the horn\n" +
|
|
|
184
|
+ "that belonged to the farmer sowing his corn\n" +
|
|
|
185
|
+ "that kept the rooster that crowed in the morn\n" +
|
|
|
186
|
+ "that woke the priest all shaven and shorn\n" +
|
|
|
187
|
+ "that married the man all tattered and torn\n" +
|
|
|
188
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
189
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
190
|
+ "that tossed the dog\n" +
|
|
|
191
|
+ "that worried the cat\n" +
|
|
|
192
|
+ "that killed the rat\n" +
|
|
|
193
|
+ "that ate the malt\n" +
|
|
|
194
|
+ "that lay in the house that Jack built.";
|
|
|
195
|
+ int verse = 12;
|
|
|
196
|
+
|
|
|
197
|
+ assertEquals(expected, house.verse(verse));
|
|
|
198
|
+ }
|
|
|
199
|
+
|
|
|
200
|
+ @Ignore("Remove to run test")
|
|
|
201
|
+ @Test
|
|
|
202
|
+ public void multipleVerses() {
|
|
|
203
|
+ String expected =
|
|
|
204
|
+ "This is the cat\n" +
|
|
|
205
|
+ "that killed the rat\n" +
|
|
|
206
|
+ "that ate the malt\n" +
|
|
|
207
|
+ "that lay in the house that Jack built.\n" +
|
|
|
208
|
+ "\n" +
|
|
|
209
|
+ "This is the dog\n" +
|
|
|
210
|
+ "that worried the cat\n" +
|
|
|
211
|
+ "that killed the rat\n" +
|
|
|
212
|
+ "that ate the malt\n" +
|
|
|
213
|
+ "that lay in the house that Jack built.\n" +
|
|
|
214
|
+ "\n" +
|
|
|
215
|
+ "This is the cow with the crumpled horn\n" +
|
|
|
216
|
+ "that tossed the dog\n" +
|
|
|
217
|
+ "that worried the cat\n" +
|
|
|
218
|
+ "that killed the rat\n" +
|
|
|
219
|
+ "that ate the malt\n" +
|
|
|
220
|
+ "that lay in the house that Jack built.\n" +
|
|
|
221
|
+ "\n" +
|
|
|
222
|
+ "This is the maiden all forlorn\n" +
|
|
|
223
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
224
|
+ "that tossed the dog\n" +
|
|
|
225
|
+ "that worried the cat\n" +
|
|
|
226
|
+ "that killed the rat\n" +
|
|
|
227
|
+ "that ate the malt\n" +
|
|
|
228
|
+ "that lay in the house that Jack built.\n" +
|
|
|
229
|
+ "\n" +
|
|
|
230
|
+ "This is the man all tattered and torn\n" +
|
|
|
231
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
232
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
233
|
+ "that tossed the dog\n" +
|
|
|
234
|
+ "that worried the cat\n" +
|
|
|
235
|
+ "that killed the rat\n" +
|
|
|
236
|
+ "that ate the malt\n" +
|
|
|
237
|
+ "that lay in the house that Jack built.";
|
|
|
238
|
+
|
|
|
239
|
+ int startVerse = 4;
|
|
|
240
|
+ int endVerse = 8;
|
|
|
241
|
+
|
|
|
242
|
+ assertEquals(expected, house.verses(startVerse, endVerse));
|
|
|
243
|
+ }
|
|
|
244
|
+
|
|
|
245
|
+ @Ignore("Remove to run test")
|
|
|
246
|
+ @Test
|
|
|
247
|
+ public void wholeRhyme() {
|
|
|
248
|
+ String expected =
|
|
|
249
|
+ "This is the house that Jack built.\n" +
|
|
|
250
|
+ "\n" +
|
|
|
251
|
+ "This is the malt\n" +
|
|
|
252
|
+ "that lay in the house that Jack built.\n" +
|
|
|
253
|
+ "\n" +
|
|
|
254
|
+ "This is the rat\n" +
|
|
|
255
|
+ "that ate the malt\n" +
|
|
|
256
|
+ "that lay in the house that Jack built.\n" +
|
|
|
257
|
+ "\n" +
|
|
|
258
|
+ "This is the cat\n" +
|
|
|
259
|
+ "that killed the rat\n" +
|
|
|
260
|
+ "that ate the malt\n" +
|
|
|
261
|
+ "that lay in the house that Jack built.\n" +
|
|
|
262
|
+ "\n" +
|
|
|
263
|
+ "This is the dog\n" +
|
|
|
264
|
+ "that worried the cat\n" +
|
|
|
265
|
+ "that killed the rat\n" +
|
|
|
266
|
+ "that ate the malt\n" +
|
|
|
267
|
+ "that lay in the house that Jack built.\n" +
|
|
|
268
|
+ "\n" +
|
|
|
269
|
+ "This is the cow with the crumpled horn\n" +
|
|
|
270
|
+ "that tossed the dog\n" +
|
|
|
271
|
+ "that worried the cat\n" +
|
|
|
272
|
+ "that killed the rat\n" +
|
|
|
273
|
+ "that ate the malt\n" +
|
|
|
274
|
+ "that lay in the house that Jack built.\n" +
|
|
|
275
|
+ "\n" +
|
|
|
276
|
+ "This is the maiden all forlorn\n" +
|
|
|
277
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
278
|
+ "that tossed the dog\n" +
|
|
|
279
|
+ "that worried the cat\n" +
|
|
|
280
|
+ "that killed the rat\n" +
|
|
|
281
|
+ "that ate the malt\n" +
|
|
|
282
|
+ "that lay in the house that Jack built.\n" +
|
|
|
283
|
+ "\n" +
|
|
|
284
|
+ "This is the man all tattered and torn\n" +
|
|
|
285
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
286
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
287
|
+ "that tossed the dog\n" +
|
|
|
288
|
+ "that worried the cat\n" +
|
|
|
289
|
+ "that killed the rat\n" +
|
|
|
290
|
+ "that ate the malt\n" +
|
|
|
291
|
+ "that lay in the house that Jack built.\n" +
|
|
|
292
|
+ "\n" +
|
|
|
293
|
+ "This is the priest all shaven and shorn\n" +
|
|
|
294
|
+ "that married the man all tattered and torn\n" +
|
|
|
295
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
296
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
297
|
+ "that tossed the dog\n" +
|
|
|
298
|
+ "that worried the cat\n" +
|
|
|
299
|
+ "that killed the rat\n" +
|
|
|
300
|
+ "that ate the malt\n" +
|
|
|
301
|
+ "that lay in the house that Jack built.\n" +
|
|
|
302
|
+ "\n" +
|
|
|
303
|
+ "This is the rooster that crowed in the morn\n" +
|
|
|
304
|
+ "that woke the priest all shaven and shorn\n" +
|
|
|
305
|
+ "that married the man all tattered and torn\n" +
|
|
|
306
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
307
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
308
|
+ "that tossed the dog\n" +
|
|
|
309
|
+ "that worried the cat\n" +
|
|
|
310
|
+ "that killed the rat\n" +
|
|
|
311
|
+ "that ate the malt\n" +
|
|
|
312
|
+ "that lay in the house that Jack built.\n" +
|
|
|
313
|
+ "\n" +
|
|
|
314
|
+ "This is the farmer sowing his corn\n" +
|
|
|
315
|
+ "that kept the rooster that crowed in the morn\n" +
|
|
|
316
|
+ "that woke the priest all shaven and shorn\n" +
|
|
|
317
|
+ "that married the man all tattered and torn\n" +
|
|
|
318
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
319
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
320
|
+ "that tossed the dog\n" +
|
|
|
321
|
+ "that worried the cat\n" +
|
|
|
322
|
+ "that killed the rat\n" +
|
|
|
323
|
+ "that ate the malt\n" +
|
|
|
324
|
+ "that lay in the house that Jack built.\n" +
|
|
|
325
|
+ "\n" +
|
|
|
326
|
+ "This is the horse and the hound and the horn\n" +
|
|
|
327
|
+ "that belonged to the farmer sowing his corn\n" +
|
|
|
328
|
+ "that kept the rooster that crowed in the morn\n" +
|
|
|
329
|
+ "that woke the priest all shaven and shorn\n" +
|
|
|
330
|
+ "that married the man all tattered and torn\n" +
|
|
|
331
|
+ "that kissed the maiden all forlorn\n" +
|
|
|
332
|
+ "that milked the cow with the crumpled horn\n" +
|
|
|
333
|
+ "that tossed the dog\n" +
|
|
|
334
|
+ "that worried the cat\n" +
|
|
|
335
|
+ "that killed the rat\n" +
|
|
|
336
|
+ "that ate the malt\n" +
|
|
|
337
|
+ "that lay in the house that Jack built.";
|
|
|
338
|
+
|
|
|
339
|
+ assertEquals(expected, house.sing());
|
|
|
340
|
+ }
|
|
|
341
|
+}
|