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)
This commit is contained in:
59
test/eva2/tools/StringToolsTest.java
Normal file
59
test/eva2/tools/StringToolsTest.java
Normal file
@@ -0,0 +1,59 @@
|
||||
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"));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user