1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.mina.example.haiku;
20
21 import junit.framework.TestCase;
22
23
24
25
26
27 public class HaikuValidatorTest extends TestCase {
28
29 private static final String[] HAIKUS = {
30 "This class is boring.\n" + "Will David ever shut up?\n"
31 + "What is Steph wearing?",
32
33 "Oh, I drank too much.\n" + "Why, oh why did I sign up\n"
34 + "For an eight thirty?",
35
36 "Which one should I do?\n" + "Wax my chest or perm my hair?\n"
37 + "Can’t wait to decide.",
38
39 "Watch my video.\n" + "I can't stop this fee-ee-ling!\n"
40 + "What is wrong with me?",
41
42 "The car chases me.\n" + "I must get away from it.\n"
43 + "Turbo Boost! Oh, yeah.",
44
45 "My new slogan is\n" + "Don't hassle me... I'm oiling.\n"
46 + "You know it’s so true.",
47
48 "Michael, I love you.\n" + "I long for you to tell me\n"
49 + "\"KITT, need you buddy.\"",
50
51 "In Knight Rider, I’m\n" + "A Man Who Does Not Exist.\n"
52 + "(Except in your dreams).",
53
54 "Yes, I’m Michael Knight\n" + "Check out my unbuttoned shirt.\n"
55 + "And sexy tight pants.",
56
57 "My bitch ex-wife sucks.\n" + "And so do all the airlines.\n"
58 + "I miss Knight Rider.",
59
60 "I am Michael Knight.\n" + "I am David Hasselhoff.\n"
61 + "I’m not Rick James, bitch." };
62
63 private HaikuValidator validator;
64
65 @Override
66 protected void setUp() throws Exception {
67 super.setUp();
68
69 validator = new HaikuValidator();
70 }
71
72 public void testValidateHaikus() throws Exception {
73 for (String s : HAIKUS) {
74 String[] lines = s.split("\n");
75
76 Haiku haiku = new Haiku(lines);
77
78 validator.validate(haiku);
79 }
80 }
81 }