|
|
@@ -0,0 +1,79 @@
|
|
|
+/*
|
|
|
+ * @author Ranides Atterwim <ranides@gmail.com>
|
|
|
+ * @copyright Ranides Atterwim
|
|
|
+ * @license WTFPL
|
|
|
+ * @url http://ranides.net/projects/assira
|
|
|
+ */
|
|
|
+package net.ranides.assira.collection.maps;
|
|
|
+
|
|
|
+import java.util.Collection;
|
|
|
+import java.util.Set;
|
|
|
+import net.ranides.assira.ContractTesters;
|
|
|
+import net.ranides.assira.collection.mockup.TMaps;
|
|
|
+import net.ranides.assira.collection.mockup.TPoint;
|
|
|
+import net.ranides.assira.test.TMap;
|
|
|
+import org.junit.Test;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author Ranides Atterwim <ranides@gmail.com>
|
|
|
+ */
|
|
|
+public class MultiMapTest {
|
|
|
+
|
|
|
+ private final TMap<TPoint, Integer> $map = TMaps.MAP_PI;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testSuite() {
|
|
|
+ ContractTesters.runner()
|
|
|
+ .param("map!", $map)
|
|
|
+ .ignore("MapTester.basicEquals_HC")
|
|
|
+ .function(new int[0], array -> $map.list(array).into(new MTMap()))
|
|
|
+ .run();
|
|
|
+ }
|
|
|
+
|
|
|
+ private static final class MTMap extends AMap<TPoint, Integer> implements MultiMap<TPoint, Integer> {
|
|
|
+
|
|
|
+ private final HashMultiMap<TPoint, Integer> data = new HashMultiMap<>();
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Set<Entry<TPoint, Integer>> entrySet() {
|
|
|
+ return data.entrySet();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int size() {
|
|
|
+ return data.size();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean containsKey(Object key) {
|
|
|
+ return data.containsKey(key);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean containsValue(Object value) {
|
|
|
+ return data.containsValue(value);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer get(Object key) {
|
|
|
+ return data.get(key);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Collection<Integer> getAll(Object key) {
|
|
|
+ return data.getAll(key);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer put(TPoint key, Integer value) {
|
|
|
+ return data.put(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer remove(Object key) {
|
|
|
+ return data.remove(key);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|