View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.mina.example.haiku;
20  
21  import org.junit.Before;
22  import org.junit.Test;
23  
24  
25  /**
26   * @author <a href="http://mina.apache.org">Apache MINA Project</a>
27   */
28  public class HaikuValidatorTest {
29      // from http://allrileyedup.blogspot.com/2006/10/dont-hassle-haiku.html -- good friend of proyal@apache.org
30      private static final String[] HAIKUS = {
31              "This class is boring.\n" + "Will David ever shut up?\n"
32                      + "What is Steph wearing?",
33  
34              "Oh, I drank too much.\n" + "Why, oh why did I sign up\n"
35                      + "For an eight thirty?",
36  
37              "Which one should I do?\n" + "Wax my chest or perm my hair?\n"
38                      + "Can’t wait to decide.",
39  
40              "Watch my video.\n" + "I can't stop this fee-ee-ling!\n"
41                      + "What is wrong with me?",
42  
43              "The car chases me.\n" + "I must get away from it.\n"
44                      + "Turbo Boost! Oh, yeah.",
45  
46              "My new slogan is\n" + "Don't hassle me... I'm oiling.\n"
47                      + "You know it’s so true.",
48  
49              "Michael, I love you.\n" + "I long for you to tell me\n"
50                      + "\"KITT, need you buddy.\"",
51  
52              "In Knight Rider, I’m\n" + "A Man Who Does Not Exist.\n"
53                      + "(Except in your dreams).",
54  
55              "Yes, I’m Michael Knight\n" + "Check out my unbuttoned shirt.\n"
56                      + "And sexy tight pants.",
57  
58              "My bitch ex-wife sucks.\n" + "And so do all the airlines.\n"
59                      + "I miss Knight Rider.",
60  
61              "I am Michael Knight.\n" + "I am David Hasselhoff.\n"
62                      + "I’m not Rick James, bitch." };
63  
64      private HaikuValidator validator;
65  
66      @Before
67      public void setUp() throws Exception {
68          validator = new HaikuValidator();
69      }
70  
71      @Test
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  }