/*
* Enhydra Java Application Server Project
*
* The contents of this file are subject to the Enhydra Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License on
* the Enhydra web site ( http://www.enhydra.org/ ).
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific terms governing rights and limitations
* under the License.
*
* The Initial Developer of the Enhydra Application Server is Lutris
* Technologies, Inc. The Enhydra Application Server and portions created
* by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
* All Rights Reserved.
*/
package org.enhydra.zeus.util;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* <p>
* This is a test case for the <code>{@link CapitalizationUtils}</code> class.
* </p>
*
* @author Farhat Kaleem
* @author Brett McLaughlin
*/
public class CapitalizationUtilsTest extends TestCase {
/**
* <p>
* This constructs a new <code>CapitalizationUtilsTest</code>.
* </p>
*
* @param name the name of the test case.
*/
public CapitalizationUtilsTest(String name) {
super(name);
}
/**
* <p>
* This method maeks it easier to call these
* tests dynamically.
* </p>
*
* @return <code>TestSuite</code> - corresponds to this
* <code>TestCase</code>.
*/
public static Test suite(){
return new TestSuite(CapitalizationUtilsTest.class);
}
/**
* <p>
* This tests the <code>{@link CapitalizationUtils#allLower}</code> method.
* </p>
*/
public void testAllLower() {
String [] someStrings = {"CanYouReadThisNow", "CANYOUREADTHISNOW"};
String expected = "canyoureadthisnow";
for (int i=0; i<someStrings.length; i++) {
assertEquals(expected,
CapitalizationUtils.allLower(someStrings[i]));
}
}
/**
* <p>
* This tests the <code>{@link CapitalizationUtils#allUpper}</code> method.
* </p>
*/
public void testAllUpper() {
String [] someStrings = {"CanYouReadThisNow", "canyoureadthisnow"};
String expected = "CANYOUREADTHISNOW";
for (int i=0; i<someStrings.length; i++) {
assertEquals(expected,
CapitalizationUtils.allUpper(someStrings[i]));
}
}
/**
* <p>
* This tests the <code>{@link CapitalizationUtils#initialLower}</code>
* method.
* </p>
*/
public void testInitialLower() {
String [] someStrings = {"CanYouReadThisNow", "CANYOUREADTHISNOW"};
String [] expectedStrings = {"canYouReadThisNow", "cANYOUREADTHISNOW"};
for (int i=0; i<someStrings.length; i++) {
assertEquals(expectedStrings[i],
CapitalizationUtils.initialLower(someStrings[i]));
}
}
/**
* <p>
* This tests the <code>{@link CapitalizationUtils#initialUpper}</code>
* method.
* </p>
*/
public void testInitialUpper() {
String [] someStrings = {"canYouReadThisNow", "canyoureadthisnow"};
String [] expectedStrings = {"CanYouReadThisNow", "Canyoureadthisnow"};
for (int i=0; i<someStrings.length; i++) {
assertEquals(expectedStrings[i],
CapitalizationUtils.initialUpper(someStrings[i]));
}
}
/**
* <p>
* This tests the <code>{@link CapitalizationUtils#justInitialUpper}</code>
* method.
* </p>
*/
public void testJustInitialUpper() {
String [] someStrings = {"canYouReadThisNow", "canyoureadTHISnow"};
String [] expectedStrings = {"Canyoureadthisnow", "Canyoureadthisnow"};
for (int i=0; i<someStrings.length; i++) {
assertEquals(expectedStrings[i],
CapitalizationUtils.justInitialUpper(someStrings[i]));
}
}
}
|