Exemplo n.º 1
0
 @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")));
 }
Exemplo n.º 2
0
  @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}"));
  }
Exemplo n.º 3
0
 @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));
 }
Exemplo n.º 4
0
  @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")));
  }
Exemplo n.º 5
0
  @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());
  }
Exemplo n.º 6
0
 @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));
 }
Exemplo n.º 7
0
 @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));
 }