test[protocol]: test

This commit is contained in:
godotg
2024-07-02 18:57:23 +08:00
parent a3220afd68
commit 382d4b423d
5 changed files with 10 additions and 17 deletions
@@ -46,7 +46,6 @@ public class ConcurrentHashMapTest {
@Test
public void primitiveMapTest() {
var map = new LongObjectHashMap<Integer>();
var startTime = System.currentTimeMillis();
var num = 10;
@@ -67,7 +66,7 @@ public class ConcurrentHashMapTest {
}
}
System.out.println(System.currentTimeMillis() - startTime);
Assert.assertTrue(map.isEmpty());
}
}
@@ -13,6 +13,7 @@
package com.zfoo.protocol.collection;
import com.zfoo.protocol.collection.tree.GeneralTree;
import org.junit.Assert;
import org.junit.Test;
/**
@@ -30,8 +31,8 @@ public class GeneralTreeTest {
generalTree.addNode("a.b.d", "world2");
generalTree.addNode("a.b.e", "world3");
System.out.println(generalTree.getNodeByPath("a.b").getData());
System.out.println(generalTree.getNodeByPath("a.b").getChildren());
Assert.assertEquals("hello", generalTree.getNodeByPath("a.b").getData());
Assert.assertEquals("[[a.b.c]:[world1], [a.b.d]:[world2], [a.b.e]:[world3]]", generalTree.getNodeByPath("a.b").getChildren().toString());
}
}
@@ -37,8 +37,7 @@ public class HashMapTest {
map.put(1, 1);
map.put(2, 2);
map.put(3, 3);
System.out.println(map.size());
System.out.println(map);
Assert.assertEquals(map.size(), 4);
}
private void assertKey(HashMapIntInt primitiveMap, HashMap<Integer, Integer> javaMap, int key) {
@@ -46,17 +46,16 @@ public class DomUtilsTest {
@Test
public void testXmlWithHead() {
var protos = DomUtils.string2Object(XML_WITH_HEAD, XmlProtocols.class);
for (var module : protos.getModules()) {
System.out.println(module.getId());
}
Assert.assertEquals(protos.getModules().get(0).getId(), 1);
Assert.assertEquals(protos.getModules().get(1).getId(), 2);
Assert.assertEquals(protos.getModules().get(0).getProtocols().get(0).getId(), 1000);
}
@Test
public void testXmlOfStandardText() {
var protos = DomUtils.string2Object(XML_OF_STANDARD_TEXT, XmlProtocols.class);
for (var module : protos.getModules()) {
System.out.println(module.getId());
}
Assert.assertEquals(protos.getModules().get(0).getId(), 1);
Assert.assertEquals(protos.getModules().get(1).getId(), 2);
}
}
@@ -111,10 +111,5 @@ public class JsonUtilTest {
var temp = JsonUtils.string2Object(tripleStr, Triple.class);
}
@Test
public void prettyPrinterTest() {
var user = JsonUtils.string2Object(userJson, User.class);
System.out.println(JsonUtils.object2StringPrettyPrinter(user));
}
}