Ejemplo n.º 1
0
  @Test
  public void entry_hashCodeForNullKeyAndValue() {
    MutableMap<Integer, String> map = this.newMapWithKeyValue(null, null);
    Map.Entry<Integer, String> entry = Iterate.getFirst(map.entrySet());

    Assert.assertEquals(0, entry.hashCode());
  }
Ejemplo n.º 2
0
  @Test
  public void entry_equalsWithNonEntry() {
    MutableMap<Integer, String> map = this.newMapWithKeyValue(null, null);
    Map.Entry<Integer, String> entry = Iterate.getFirst(map.entrySet());

    Verify.assertNotEquals(entry, new Object());
  }
Ejemplo n.º 3
0
  @Test
  public void entry_setValue() {
    MutableMap<Integer, String> map = this.newMapWithKeyValue(1, "One");
    Map.Entry<Integer, String> entry = Iterate.getFirst(map.entrySet());
    String value = "Ninety-Nine";
    Assert.assertEquals("One", entry.setValue(value));
    Assert.assertEquals(value, entry.getValue());
    Verify.assertContainsKeyValue(1, value, map);

    map.remove(1);
    Verify.assertEmpty(map);
    Assert.assertNull(entry.setValue("Ignored"));
  }