Search in sources :

Example 1 with SerialJavaObject

use of javax.sql.rowset.serial.SerialJavaObject in project jdk8u_jdk by JetBrains.

the class SerialJavaObjectTests method test04.

/**
     * Validate that a SerialJavaObject that is serialized & deserialized is
     * equal to itself
     */
@Test
public void test04() throws Exception {
    SerialJavaObject sjo = new SerialJavaObject("Hello");
    SerialJavaObject sjo2 = serializeDeserializeObject(sjo);
    assertTrue(sjo.equals(sjo2));
}
Also used : SerialJavaObject(javax.sql.rowset.serial.SerialJavaObject) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 2 with SerialJavaObject

use of javax.sql.rowset.serial.SerialJavaObject in project jdk8u_jdk by JetBrains.

the class SerialJavaObjectTests method test02.

/*
     * Validate that an getFields()s returns the same Field[] for the object
     * used to create the SerialJavaObject
     */
@Test
public void test02() throws Exception {
    SerialException e = new SerialException();
    SerialJavaObject sjo = new SerialJavaObject(e);
    Field[] f = e.getClass().getFields();
    assertTrue(Arrays.equals(f, sjo.getFields()));
    assertFalse(Arrays.equals("hello".getClass().getFields(), sjo.getFields()));
}
Also used : Field(java.lang.reflect.Field) SerialException(javax.sql.rowset.serial.SerialException) SerialJavaObject(javax.sql.rowset.serial.SerialJavaObject) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 3 with SerialJavaObject

use of javax.sql.rowset.serial.SerialJavaObject in project jdk8u_jdk by JetBrains.

the class SerialJavaObjectTests method test05.

/*
     * Validate that a getObject() returns an object used to create the
     * SerialJavaObject
     */
@Test
public void test05() throws Exception {
    String s = "Hello world";
    SerialJavaObject sjo = new SerialJavaObject(s);
    assertTrue(s.equals(sjo.getObject()));
}
Also used : SerialJavaObject(javax.sql.rowset.serial.SerialJavaObject) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Example 4 with SerialJavaObject

use of javax.sql.rowset.serial.SerialJavaObject in project jdk8u_jdk by JetBrains.

the class SerialJavaObjectTests method test03.

/*
     * clone() a SerialJavaObject and check that it is equal to the
     * object it was cloned from
     */
@Test
public void test03() throws Exception {
    SerialJavaObject sjo = new SerialJavaObject("Hello");
    SerialJavaObject sjo2 = (SerialJavaObject) sjo.clone();
    assertTrue(sjo.equals(sjo2));
}
Also used : SerialJavaObject(javax.sql.rowset.serial.SerialJavaObject) Test(org.testng.annotations.Test) BaseTest(util.BaseTest)

Aggregations

SerialJavaObject (javax.sql.rowset.serial.SerialJavaObject)4 Test (org.testng.annotations.Test)4 BaseTest (util.BaseTest)4 Field (java.lang.reflect.Field)1 SerialException (javax.sql.rowset.serial.SerialException)1