1 16 17 package org.apache.commons.betwixt.strategy; 18 19 import junit.framework.Test; 20 import junit.framework.TestCase; 21 import junit.framework.TestSuite; 22 23 29 public class TestDefaultNameMapper extends TestCase 30 { 31 32 public static Test suite() { 33 return new TestSuite(TestDefaultNameMapper.class); 34 } 35 36 public TestDefaultNameMapper(String testName) 37 { 38 super(testName); 39 } 40 45 public void testDefault() { 46 String [] values = { "foo", "Foo", "FooBar", "fooBar", 47 "FOOBAR", "FOOBar", "FoOBaR"}; 48 DefaultNameMapper mapper = new DefaultNameMapper(); 49 for (int i=0; i < values.length; i++) { 50 String result = mapper.mapTypeToElementName(values[i]); 51 assertEquals(values[i], result); 52 } 53 } 54 55 public void testBadCharBadFirstOne() { 56 String name="$LoadsOfMoney"; 57 DefaultNameMapper mapper = new DefaultNameMapper(); 58 String out = mapper.mapTypeToElementName(name); 59 assertEquals("Expected", "LoadsOfMoney", out); 60 } 61 62 public void testBadCharBadFirstTwo() { 63 String name="$LOADSŁOF$MONEY"; 64 DefaultNameMapper mapper = new DefaultNameMapper(); 65 String out = mapper.mapTypeToElementName(name); 66 assertEquals("Expected", "LOADSOFMONEY", out); 67 } 68 69 public void testBadCharGoodFirstOne() { 70 String name="L$oads%OfMone$y$"; 71 DefaultNameMapper mapper = new DefaultNameMapper(); 72 String out = mapper.mapTypeToElementName(name); 73 assertEquals("Expected", "LoadsOfMoney", out); 74 } 75 76 public void testBadCharGoodFirstTwo() { 77 String name="LOADSOFMONE$$Y"; 78 DefaultNameMapper mapper = new DefaultNameMapper(); 79 String out = mapper.mapTypeToElementName(name); 80 assertEquals("Expected", "LOADSOFMONEY", out); 81 } 82 } 83 84 | Popular Tags |