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