Example usage for org.jfree.data DefaultKeyedValues equals

List of usage examples for org.jfree.data DefaultKeyedValues equals

Introduction

In this page you can find the example usage for org.jfree.data DefaultKeyedValues equals.

Prototype

@Override
public boolean equals(Object obj) 

Source Link

Document

Tests if this object is equal to another.

Usage

From source file:org.jfree.data.DefaultKeyedValuesTest.java

/**
 * Some checks for the clone() method./*from w  ww  . j  av a2  s  .co m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    DefaultKeyedValues v1 = new DefaultKeyedValues();
    v1.addValue("V1", new Integer(1));
    v1.addValue("V2", null);
    v1.addValue("V3", new Integer(3));
    DefaultKeyedValues v2 = (DefaultKeyedValues) v1.clone();
    assertTrue(v1 != v2);
    assertTrue(v1.getClass() == v2.getClass());
    assertTrue(v1.equals(v2));

    // confirm that the clone is independent of the original
    v2.setValue("V1", new Integer(44));
    assertFalse(v1.equals(v2));
}

From source file:org.jfree.data.junit.DefaultKeyedValuesTests.java

/**
 * Some checks for the clone() method.//from  w w  w .ja va 2  s  .c  o m
 */
public void testCloning() {
    DefaultKeyedValues v1 = new DefaultKeyedValues();
    v1.addValue("V1", new Integer(1));
    v1.addValue("V2", null);
    v1.addValue("V3", new Integer(3));
    DefaultKeyedValues v2 = null;
    try {
        v2 = (DefaultKeyedValues) v1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(v1 != v2);
    assertTrue(v1.getClass() == v2.getClass());
    assertTrue(v1.equals(v2));

    // confirm that the clone is independent of the original
    v2.setValue("V1", new Integer(44));
    assertFalse(v1.equals(v2));
}

From source file:org.jfree.data.junit.DefaultKeyedValuesTest.java

/**
 * Some checks for the clone() method./*from   w w  w  .  j av a2 s .c o  m*/
 */
public void testCloning() {
    DefaultKeyedValues v1 = new DefaultKeyedValues();
    v1.addValue("V1", new Integer(1));
    v1.addValue("V2", null);
    v1.addValue("V3", new Integer(3));
    DefaultKeyedValues v2 = null;
    try {
        v2 = (DefaultKeyedValues) v1.clone();
    } catch (CloneNotSupportedException e) {
        System.err.println("Failed to clone.");
    }
    assertTrue(v1 != v2);
    assertTrue(v1.getClass() == v2.getClass());
    assertTrue(v1.equals(v2));

    // confirm that the clone is independent of the original
    v2.setValue("V1", new Integer(44));
    assertFalse(v1.equals(v2));
}