Update the source code to add validation
This commit is contained in:
parent
0259b13754
commit
7b4d2e6871
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CheckStyle-IDEA" serialisationVersion="2">
|
||||||
|
<checkstyleVersion>10.12.5</checkstyleVersion>
|
||||||
|
<scanScope>JavaOnly</scanScope>
|
||||||
|
<copyLibs>true</copyLibs>
|
||||||
|
<option name="thirdPartyClasspath" />
|
||||||
|
<option name="activeLocationIds" />
|
||||||
|
<option name="locations">
|
||||||
|
<list>
|
||||||
|
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
|
||||||
|
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -8,6 +8,7 @@
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
<module name="rets-io-client (1)" />
|
<module name="rets-io-client (1)" />
|
||||||
<module name="rets-io-common" />
|
<module name="rets-io-common" />
|
||||||
|
<module name="rets-io-validation" />
|
||||||
<module name="rets-io-client" />
|
<module name="rets-io-client" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
|
|
|
@ -7,5 +7,7 @@
|
||||||
<file url="file://$PROJECT_DIR$/common/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/common/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/validation/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/validation/src/main/resources" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -2,5 +2,6 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="Git" />
|
<mapping directory="" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/validation" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -1,54 +1,64 @@
|
||||||
package com.ossez.usreio.tests.common.util;
|
package com.ossez.usreio.tests.common.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ossez.usreio.common.util.CaseInsensitiveTreeMap;
|
import com.ossez.usreio.common.util.CaseInsensitiveTreeMap;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
public class CaseInsensitiveTreeMapTest extends TestCase {
|
public class CaseInsensitiveTreeMapTest extends TestCase {
|
||||||
|
|
||||||
private CaseInsensitiveTreeMap map;
|
private CaseInsensitiveTreeMap map;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
this.map = new CaseInsensitiveTreeMap();
|
this.map = new CaseInsensitiveTreeMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
this.map = null;
|
this.map = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetPut() throws Exception {
|
public void testGetPut() throws Exception {
|
||||||
this.map.put("A", "X");
|
|
||||||
assertEquals("X", this.map.get("A"));
|
|
||||||
assertEquals("X", this.map.get("a"));
|
|
||||||
|
|
||||||
this.map.put("a", "Y");
|
List<Integer> numbers = List.of(1, 2, 3, 4, 5, 6, 7);
|
||||||
assertEquals("Y", this.map.get("a"));
|
List<Integer> result = new ArrayList<Integer>();
|
||||||
assertEquals("Y", this.map.get("A"));
|
for (int i = numbers.size() - 1; i >= 0; i--) {
|
||||||
|
result.add(numbers.get(i));
|
||||||
|
|
||||||
assertEquals(1, this.map.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testContainsKey() throws Exception {
|
}
|
||||||
this.map.put("A", "X");
|
System.out.println(result);
|
||||||
assertTrue(this.map.containsKey("A"));
|
}
|
||||||
assertTrue(this.map.containsKey("a"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testClone() throws Exception {
|
private String alertText(String inputText) {
|
||||||
Map otherMap = new HashMap();
|
if (StringUtils.isBlank(inputText))
|
||||||
otherMap.put("A", "X");
|
return inputText;
|
||||||
otherMap.put("a", "Y");
|
|
||||||
assertEquals(2, otherMap.size());
|
|
||||||
|
|
||||||
CaseInsensitiveTreeMap newCitm = new CaseInsensitiveTreeMap(otherMap);
|
return inputText.charAt(inputText.length() - 1) + alertText(inputText.substring(0, inputText.length() - 1));
|
||||||
assertEquals(1, newCitm.size());
|
}
|
||||||
// no guarantee of *which* value we'll get, just that they'll be equal
|
|
||||||
assertEquals(this.map.get("a"), this.map.get("A"));
|
public void testContainsKey() throws Exception {
|
||||||
}
|
this.map.put("A", "X");
|
||||||
|
assertTrue(this.map.containsKey("A"));
|
||||||
|
assertTrue(this.map.containsKey("a"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testClone() throws Exception {
|
||||||
|
Map otherMap = new HashMap();
|
||||||
|
otherMap.put("A", "X");
|
||||||
|
otherMap.put("a", "Y");
|
||||||
|
assertEquals(2, otherMap.size());
|
||||||
|
|
||||||
|
CaseInsensitiveTreeMap newCitm = new CaseInsensitiveTreeMap(otherMap);
|
||||||
|
assertEquals(1, newCitm.size());
|
||||||
|
// no guarantee of *which* value we'll get, just that they'll be equal
|
||||||
|
assertEquals(this.map.get("a"), this.map.get("A"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
1
pom.xml
1
pom.xml
|
@ -49,6 +49,7 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>common</module>
|
<module>common</module>
|
||||||
<module>client</module>
|
<module>client</module>
|
||||||
|
<module>validation</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -13,6 +13,7 @@ public class AllTests {
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite suite;
|
TestSuite suite;
|
||||||
|
|
||||||
|
|
||||||
suite = new TestSuite();
|
suite = new TestSuite();
|
||||||
/*suite.addTestSuite(GetMetadataRequestTest.class);
|
/*suite.addTestSuite(GetMetadataRequestTest.class);
|
||||||
suite.addTestSuite(GetMetadataResponseTest.class);
|
suite.addTestSuite(GetMetadataResponseTest.class);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit bb415ec2142a5f08c14b499e03092b96ad3d38c6
|
Loading…
Reference in New Issue