1 19 package org.enhydra.zeus.util; 20 21 import junit.framework.Test; 22 import junit.framework.TestCase; 23 import junit.framework.TestSuite; 24 25 33 public class CapitalizationUtilsTest extends TestCase { 34 35 42 public CapitalizationUtilsTest(String name) { 43 super(name); 44 } 45 46 55 public static Test suite(){ 56 return new TestSuite(CapitalizationUtilsTest.class); 57 } 58 59 64 public void testAllLower() { 65 String [] someStrings = {"CanYouReadThisNow", "CANYOUREADTHISNOW"}; 66 String expected = "canyoureadthisnow"; 67 68 for (int i=0; i<someStrings.length; i++) { 69 assertEquals(expected, 70 CapitalizationUtils.allLower(someStrings[i])); 71 } 72 } 73 74 79 public void testAllUpper() { 80 String [] someStrings = {"CanYouReadThisNow", "canyoureadthisnow"}; 81 String expected = "CANYOUREADTHISNOW"; 82 83 for (int i=0; i<someStrings.length; i++) { 84 assertEquals(expected, 85 CapitalizationUtils.allUpper(someStrings[i])); 86 } 87 } 88 89 95 public void testInitialLower() { 96 String [] someStrings = {"CanYouReadThisNow", "CANYOUREADTHISNOW"}; 97 String [] expectedStrings = {"canYouReadThisNow", "cANYOUREADTHISNOW"}; 98 99 for (int i=0; i<someStrings.length; i++) { 100 assertEquals(expectedStrings[i], 101 CapitalizationUtils.initialLower(someStrings[i])); 102 } 103 } 104 105 111 public void testInitialUpper() { 112 String [] someStrings = {"canYouReadThisNow", "canyoureadthisnow"}; 113 String [] expectedStrings = {"CanYouReadThisNow", "Canyoureadthisnow"}; 114 115 for (int i=0; i<someStrings.length; i++) { 116 assertEquals(expectedStrings[i], 117 CapitalizationUtils.initialUpper(someStrings[i])); 118 } 119 } 120 121 127 public void testJustInitialUpper() { 128 String [] someStrings = {"canYouReadThisNow", "canyoureadTHISnow"}; 129 String [] expectedStrings = {"Canyoureadthisnow", "Canyoureadthisnow"}; 130 131 for (int i=0; i<someStrings.length; i++) { 132 assertEquals(expectedStrings[i], 133 CapitalizationUtils.justInitialUpper(someStrings[i])); 134 } 135 } 136 } 137 138 | Popular Tags |