001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.mina.example.haiku; 020 021import org.junit.Before; 022import org.junit.Test; 023 024 025/** 026 * @author <a href="http://mina.apache.org">Apache MINA Project</a> 027 */ 028public class HaikuValidatorTest { 029 // from http://allrileyedup.blogspot.com/2006/10/dont-hassle-haiku.html -- good friend of proyal@apache.org 030 private static final String[] HAIKUS = { 031 "This class is boring.\n" + "Will David ever shut up?\n" 032 + "What is Steph wearing?", 033 034 "Oh, I drank too much.\n" + "Why, oh why did I sign up\n" 035 + "For an eight thirty?", 036 037 "Which one should I do?\n" + "Wax my chest or perm my hair?\n" 038 + "Can’t wait to decide.", 039 040 "Watch my video.\n" + "I can't stop this fee-ee-ling!\n" 041 + "What is wrong with me?", 042 043 "The car chases me.\n" + "I must get away from it.\n" 044 + "Turbo Boost! Oh, yeah.", 045 046 "My new slogan is\n" + "Don't hassle me... I'm oiling.\n" 047 + "You know it’s so true.", 048 049 "Michael, I love you.\n" + "I long for you to tell me\n" 050 + "\"KITT, need you buddy.\"", 051 052 "In Knight Rider, I’m\n" + "A Man Who Does Not Exist.\n" 053 + "(Except in your dreams).", 054 055 "Yes, I’m Michael Knight\n" + "Check out my unbuttoned shirt.\n" 056 + "And sexy tight pants.", 057 058 "My bitch ex-wife sucks.\n" + "And so do all the airlines.\n" 059 + "I miss Knight Rider.", 060 061 "I am Michael Knight.\n" + "I am David Hasselhoff.\n" 062 + "I’m not Rick James, bitch." }; 063 064 private HaikuValidator validator; 065 066 @Before 067 public void setUp() throws Exception { 068 validator = new HaikuValidator(); 069 } 070 071 @Test 072 public void testValidateHaikus() throws Exception { 073 for (String s : HAIKUS) { 074 String[] lines = s.split("\n"); 075 076 Haiku haiku = new Haiku(lines); 077 078 validator.validate(haiku); 079 } 080 } 081}