@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 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 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)); }