Example usage for org.jfree.data DefaultKeyedValues getClass

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

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

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

/**
 * Some checks for the clone() method./*ww w .j ava  2 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  ww w .  ja  v a 2  s.  com*/
 */
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./*ww w .java 2  s  .co 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));
}