Update the source code to add validation

This commit is contained in:
YuCheng Hu 2024-02-02 16:33:46 -05:00 committed by honeymoose
parent 0259b13754
commit 7b4d2e6871
8 changed files with 68 additions and 35 deletions

16
.idea/checkstyle-idea.xml Normal file
View File

@ -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>

View File

@ -8,6 +8,7 @@
<outputRelativeToContentRoot value="true" />
<module name="rets-io-client (1)" />
<module name="rets-io-common" />
<module name="rets-io-validation" />
<module name="rets-io-client" />
</profile>
</annotationProcessing>

View File

@ -7,5 +7,7 @@
<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/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>
</project>

View File

@ -2,5 +2,6 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/validation" vcs="Git" />
</component>
</project>

View File

@ -1,54 +1,64 @@
package com.ossez.usreio.tests.common.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ossez.usreio.common.util.CaseInsensitiveTreeMap;
import junit.framework.TestCase;
import org.apache.commons.lang3.StringUtils;
public class CaseInsensitiveTreeMapTest extends TestCase {
private CaseInsensitiveTreeMap map;
private CaseInsensitiveTreeMap map;
@Override
protected void setUp() throws Exception {
super.setUp();
this.map = new CaseInsensitiveTreeMap();
}
@Override
protected void setUp() throws Exception {
super.setUp();
this.map = new CaseInsensitiveTreeMap();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
this.map = null;
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
this.map = null;
}
public void testGetPut() throws Exception {
this.map.put("A", "X");
assertEquals("X", this.map.get("A"));
assertEquals("X", this.map.get("a"));
public void testGetPut() throws Exception {
this.map.put("a", "Y");
assertEquals("Y", this.map.get("a"));
assertEquals("Y", this.map.get("A"));
List<Integer> numbers = List.of(1, 2, 3, 4, 5, 6, 7);
List<Integer> result = new ArrayList<Integer>();
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");
assertTrue(this.map.containsKey("A"));
assertTrue(this.map.containsKey("a"));
}
}
System.out.println(result);
}
public void testClone() throws Exception {
Map otherMap = new HashMap();
otherMap.put("A", "X");
otherMap.put("a", "Y");
assertEquals(2, otherMap.size());
private String alertText(String inputText) {
if (StringUtils.isBlank(inputText))
return inputText;
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"));
}
return inputText.charAt(inputText.length() - 1) + alertText(inputText.substring(0, inputText.length() - 1));
}
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"));
}
}

View File

@ -49,6 +49,7 @@
<modules>
<module>common</module>
<module>client</module>
<module>validation</module>
</modules>
<dependencies>

View File

@ -13,6 +13,7 @@ public class AllTests {
public static Test suite() {
TestSuite suite;
suite = new TestSuite();
/*suite.addTestSuite(GetMetadataRequestTest.class);
suite.addTestSuite(GetMetadataResponseTest.class);

1
validation Submodule

@ -0,0 +1 @@
Subproject commit bb415ec2142a5f08c14b499e03092b96ad3d38c6