use of java.io.ObjectStreamClass in project j2objc by google.
the class SerializationTest method testArraySerialVersionUIDs.
// Verify that the serialVersionUID values for arrays are the same as the JVM returns.
public void testArraySerialVersionUIDs() throws Exception {
ObjectStreamClass osc = ObjectStreamClass.lookupAny(new int[0].getClass());
assertEquals(5600894804908749477L, osc.getSerialVersionUID());
osc = ObjectStreamClass.lookupAny(new int[0][0].getClass());
assertEquals(1727100010502261052L, osc.getSerialVersionUID());
osc = ObjectStreamClass.lookupAny(new double[0].getClass());
assertEquals(4514449696888150558L, osc.getSerialVersionUID());
osc = ObjectStreamClass.lookupAny(new String[0].getClass());
assertEquals(-5921575005990323385L, osc.getSerialVersionUID());
osc = ObjectStreamClass.lookupAny(new Thread[0].getClass());
assertEquals(-6192713741133905679L, osc.getSerialVersionUID());
}
use of java.io.ObjectStreamClass in project j2objc by google.
the class PatternSyntaxExceptionTest method test_objectStreamField.
// Regression test for HARMONY-3787
public void test_objectStreamField() {
ObjectStreamClass objectStreamClass = ObjectStreamClass.lookup(PatternSyntaxException.class);
assertNotNull(objectStreamClass.getField("desc"));
}
use of java.io.ObjectStreamClass in project j2objc by google.
the class MyObjectInputStream method test_getType_Deserialized.
/**
* java.io.ObjectStreamField#getType()
*/
public void test_getType_Deserialized() throws IOException, ClassNotFoundException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(new SerializableObject());
oos.close();
baos.close();
byte[] bytes = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais);
SerializableObject obj = (SerializableObject) ois.readObject();
ObjectStreamClass oc = obj.getObjectStreamClass();
ObjectStreamField field = oc.getField("i");
assertEquals(Object.class, field.getType());
}
use of java.io.ObjectStreamClass in project j2objc by google.
the class ObjectStreamClassTest method test_getSerialVersionUID.
/**
* java.io.ObjectStreamClass#getSerialVersionUID()
*/
public void test_getSerialVersionUID() {
ObjectStreamClass osc = ObjectStreamClass.lookup(DummyClass.class);
assertTrue("getSerialversionUID returned incorrect uid: " + osc.getSerialVersionUID() + " instead of " + DummyClass.getUID(), osc.getSerialVersionUID() == DummyClass.getUID());
}
use of java.io.ObjectStreamClass in project j2objc by google.
the class ObjectStreamClassTest method test_lookupLjava_lang_Class.
/**
* java.io.ObjectStreamClass#lookup(java.lang.Class)
*/
public void test_lookupLjava_lang_Class() {
ObjectStreamClass osc = ObjectStreamClass.lookup(DummyClass.class);
assertEquals("lookup returned wrong class: " + osc.getName(), "org.apache.harmony.tests.java.io.ObjectStreamClassTest$DummyClass", osc.getName());
}
Aggregations