1 19 package org.apache.mina.example.haiku; 20 21 import junit.framework.TestCase; 22 23 27 public class PhraseUtilitiesTest extends TestCase { 28 public void testCountSyllablesInWord() throws Exception { 29 assertSyllableCount(1, "one"); 30 assertSyllableCount(1, "I"); 31 assertSyllableCount(1, "too"); 32 assertSyllableCount(1, "why"); 33 assertSyllableCount(1, "oh"); 34 assertSyllableCount(1, "did"); 35 assertSyllableCount(1, "sign"); 36 assertSyllableCount(1, "up"); 37 assertSyllableCount(1, "watch"); 38 assertSyllableCount(1, "my"); 39 assertSyllableCount(1, "what"); 40 assertSyllableCount(1, "is"); 41 assertSyllableCount(1, "wrong"); 42 assertSyllableCount(1, "with"); 43 assertSyllableCount(1, "me"); 44 assertSyllableCount(1, "don't"); 45 assertSyllableCount(1, "you"); 46 assertSyllableCount(1, "love"); 47 assertSyllableCount(2, "hassle"); 48 assertSyllableCount(2, "oiling"); 49 assertSyllableCount(2, "decide"); 50 assertSyllableCount(2, "Michael"); 51 assertSyllableCount(1, "I'm"); 52 assertSyllableCount(1, "check"); 53 assertSyllableCount(1, "out"); 54 assertSyllableCount(1, "shirt"); 55 assertSyllableCount(1, "bitch"); 56 assertSyllableCount(1, "sucks"); 57 assertSyllableCount(1, "James"); 58 assertSyllableCount(2, "ex-wife"); 59 assertSyllableCount(2, "airlines"); 60 assertSyllableCount(3, "video"); 61 assertSyllableCount(3, "fee-ee-ling"); 62 assertSyllableCount(3, "unbuttoned"); 63 } 64 65 private static void assertSyllableCount(int count, String word) { 66 assertEquals("syllables in " + word, count, PhraseUtilities 67 .countSyllablesInWord(word.toLowerCase())); 68 } 69 } 70 | Popular Tags |