@TestTargetNew(
      level = TestLevel.PARTIAL_COMPLETE,
      notes = "",
      method = "equals",
      args = {java.lang.Object.class})
  public void testEquals() {
    // equal to self
    assertTrue(buf.equals(buf));
    DoubleBuffer readonly = buf.asReadOnlyBuffer();
    assertTrue(buf.equals(readonly));
    DoubleBuffer duplicate = buf.duplicate();
    assertTrue(buf.equals(duplicate));

    // always false, if type mismatch
    assertFalse(buf.equals(Boolean.TRUE));

    assertTrue(buf.capacity() > 5);

    buf.limit(buf.capacity()).position(0);
    readonly.limit(readonly.capacity()).position(1);
    assertFalse(buf.equals(readonly));

    buf.limit(buf.capacity() - 1).position(0);
    duplicate.limit(duplicate.capacity()).position(0);
    assertFalse(buf.equals(duplicate));
  }
Ejemplo n.º 2
0
  public void testEquals() {
    // equal to self
    assertTrue(buf.equals(buf));
    DoubleBuffer readonly = buf.asReadOnlyBuffer();
    assertTrue(buf.equals(readonly));
    DoubleBuffer duplicate = buf.duplicate();
    assertTrue(buf.equals(duplicate));

    // always false, if type mismatch
    assertFalse(buf.equals(Boolean.TRUE));

    assertTrue(buf.capacity() > 5);

    buf.limit(buf.capacity()).position(0);
    readonly.limit(readonly.capacity()).position(1);
    assertFalse(buf.equals(readonly));

    buf.limit(buf.capacity() - 1).position(0);
    duplicate.limit(duplicate.capacity()).position(0);
    assertFalse(buf.equals(duplicate));
  }