    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 junit.framework.TestCase;
    22
    23  /**
    24   * @author Apache Mina Project (dev@mina.apache.org)
    25   * @version $Rev: $, $Date:  $
    26   */
    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  }