|
|
@@ -0,0 +1,57 @@
|
|
|
+/*
|
|
|
+ * @author Ranides Atterwim <ranides@gmail.com>
|
|
|
+ * @copyright Ranides Atterwim
|
|
|
+ * @license WTFPL
|
|
|
+ * @url http://ranides.net/projects/assira
|
|
|
+ */
|
|
|
+package net.ranides.assira.collection.map;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.Collection;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import net.ranides.assira.generic.Serializer;
|
|
|
+import org.junit.After;
|
|
|
+import org.junit.AfterClass;
|
|
|
+import org.junit.Before;
|
|
|
+import org.junit.BeforeClass;
|
|
|
+import org.junit.Test;
|
|
|
+import static org.junit.Assert.*;
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author msieron
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+public class MultiHashMapTest {
|
|
|
+
|
|
|
+ public MultiHashMapTest() {
|
|
|
+ }
|
|
|
+
|
|
|
+ private MultiHashMap<Integer, Integer> make() {
|
|
|
+ MultiHashMap<Integer, Integer> imap = new MultiHashMap<>();
|
|
|
+ imap.putItem(1, 1000);
|
|
|
+ imap.putItem(2, 2000);
|
|
|
+ imap.putItem(3, 3000);
|
|
|
+ imap.putItem(1, 4000);
|
|
|
+ return imap;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSerialization() throws IOException {
|
|
|
+ MultiHashMap<Integer, Integer> imap = make();
|
|
|
+ MultiHashMap<Integer, Integer> omap = Serializer.copy(imap);
|
|
|
+
|
|
|
+ assertNotSame(imap, omap);
|
|
|
+ assertEquals(imap, omap);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testConstruct() {
|
|
|
+ MultiHashMap<Integer, Integer> imap = make();
|
|
|
+ MultiHashMap<Integer,Integer> mmap = new MultiHashMap<Integer,Integer>(imap);
|
|
|
+
|
|
|
+ assertEquals(imap, mmap);
|
|
|
+ }
|
|
|
+}
|