@Test public void testRemoveObject1() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); map.put(literal(String.class, "key"), literal(String.class, "value")); assertThat(map.remove(literal(String.class, "string")), nullValue()); assertThat(map.remove(literal(String.class, "key")), equalTo(literal(String.class, "value"))); }
@Test public void testToString1() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); map.put(literal(String.class, "key"), literal(String.class, "value")); assertThat(map.toString(), equalTo("{key:value}")); }
@Test public void testContainsValue1() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); map.put(literal(String.class, "key"), literal(String.class, "value")); assertThat(map.containsValue(literal(String.class, "value")), is(true)); assertThat(map.containsValue(literal(String.class, "string")), is(false)); }
@Test public void testValues() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); map.put(literal(String.class, "key1"), literal(String.class, "value1")); map.put(literal(String.class, "key2"), literal(String.class, "value2")); assertThat( map.values(), containsInAnyOrder(literal(String.class, "value1"), literal(String.class, "value2"))); }
@Test public void testClear() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); map.put(literal(String.class, "key1"), literal(String.class, "value1")); map.put(literal(String.class, "key2"), literal(String.class, "value2")); map.clear(); assertThat(map.keySet(), empty()); }
@Test public void testPutAll() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); Map<SerializedValue, SerializedValue> value = new HashMap<>(); value.put(literal(String.class, "key1"), literal(String.class, "value1")); value.put(literal(String.class, "key2"), literal(String.class, "value2")); map.putAll(value); assertThat(map, hasEntry(literal(String.class, "key1"), literal(String.class, "value1"))); assertThat(map, hasEntry(literal(String.class, "key2"), literal(String.class, "value2"))); }
@Test public void testSize0() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); assertThat(map.size(), equalTo(0)); }
@Test public void testAccept() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); assertThat(map.accept(new TestValueVisitor()), equalTo("unknown")); assertThat(map.accept(new TestCollectionVisitor()), equalTo("map")); }
@Test public void testToString0() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); assertThat(map.toString(), equalTo("{}")); }
@Test public void testRemoveObject0() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); assertThat(map.remove(literal(String.class, "string")), nullValue()); }
@Test public void testIsEmpty1() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); map.put(literal(String.class, "key"), literal(String.class, "value")); assertThat(map.isEmpty(), is(false)); }
@Test public void testIsEmpty0() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); assertThat(map.isEmpty(), is(true)); }
@Test public void testSize1() throws Exception { SerializedMap map = new SerializedMap(Map.class, HashMap.class); map.put(literal(String.class, "key"), literal(String.class, "value")); assertThat(map.size(), equalTo(1)); }