eva2/test/eva2/tools/StringToolsTest.java
Fabian Becker af82e0e5a2 Started to add unit tests.
Refactored IntegerArrayList, which is now not needed anymore (who implemented this in the first place?)
Auto-Formatted DPointSetMultiIcon -> it was just so badly formatted I had to do auto formatting to make it readable.

Added test for eva2.tools.StringTools (partly at least)
2012-04-20 09:13:21 +00:00

60 lines
1.3 KiB
Java

package eva2.tools;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.junit.After;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
/**
*
* @author becker
*/
public class StringToolsTest {
public StringToolsTest() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of humaniseCamelCase method, of class StringTools.
*/
@Test
public void testHumaniseCamelCase() {
HashMap<String, String> map = new HashMap<String, String>();
map.put("camelCase", "Camel Case");
map.put("Camel Case", "Camel Case");
map.put("thisIsAwesome", "This Is Awesome");
map.put("THQIsNice", "THQ Is Nice");
map.put("iLikeABC", "I Like ABC");
String key, value;
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry pairs = (Map.Entry) iter.next();
key = (String) pairs.getKey();
value = (String) pairs.getValue();
String result = StringTools.humaniseCamelCase(key);
assertEquals(value, result);
}
}
/**
* Test of upcaseFirst method, of class StringTools.
*/
@Test
public void testUpcaseFirst() {
assertEquals("Camel", StringTools.upcaseFirst("camel"));
assertEquals("UpWeGo", StringTools.upcaseFirst("upWeGo"));
}
}