Home | History | Annotate | Download | only in io
      1 package tests.api.java.io;
      2 
      3 import java.io.ObjectInputStream;
      4 
      5 public class ComputeSerialVersionUIDTest extends junit.framework.TestCase {
      6 
      7 
      8     private String path = "/serialization/tests/api/java/io/";
      9 
     10     public void testComputeSUIDClass() throws Exception {
     11         ObjectInputStream ois = new ObjectInputStream(getClass()
     12                 .getResourceAsStream(path + "testComputeSUIDClass.ser"));
     13         SerializationTestClass.TestClassName1 o1 = (SerializationTestClass.TestClassName1) ois
     14                 .readObject();
     15         SerializationTestClass.TestClassName2T_T$T o2 = (SerializationTestClass.TestClassName2T_T$T) ois
     16                 .readObject();
     17         SerializationTestClass.TestClassModifierPublic o6 = (SerializationTestClass.TestClassModifierPublic) ois
     18                 .readObject();
     19         SerializationTestClass.TestClassModifierAbstract o3 = (SerializationTestClass.TestClassModifierAbstract) ois
     20                 .readObject();
     21         SerializationTestClass.TestClassModifierFinal o4 = (SerializationTestClass.TestClassModifierFinal) ois
     22                 .readObject();
     23         SerializationTestClass.TestClassModifierInterface o5 = (SerializationTestClass.TestClassModifierInterface) ois
     24                 .readObject();
     25         ois.close();
     26     }
     27 
     28     public void testComputeSUIDInterfaces() throws Exception {
     29         ObjectInputStream ois = new ObjectInputStream(getClass()
     30                 .getResourceAsStream(path + "testComputeSUIDInterfaces.ser"));
     31         SerializationTestClass.TestIntefaces o1 = (SerializationTestClass.TestIntefaces) ois
     32                 .readObject();
     33         SerializationTestClass.TestIntefacesA o2 = (SerializationTestClass.TestIntefacesA) ois
     34                 .readObject();
     35         SerializationTestClass.TestIntefacesAB o3 = (SerializationTestClass.TestIntefacesAB) ois
     36                 .readObject();
     37         SerializationTestClass.TestIntefacesBA o4 = (SerializationTestClass.TestIntefacesBA) ois
     38                 .readObject();
     39         SerializationTestClass.TestIntefacesC o5 = (SerializationTestClass.TestIntefacesC) ois
     40                 .readObject();
     41         SerializationTestClass.TestIntefacesAC o6 = (SerializationTestClass.TestIntefacesAC) ois
     42                 .readObject();
     43         SerializationTestClass.TestIntefacesCA o7 = (SerializationTestClass.TestIntefacesCA) ois
     44                 .readObject();
     45         SerializationTestClass.TestIntefacesABC o8 = (SerializationTestClass.TestIntefacesABC) ois
     46                 .readObject();
     47         SerializationTestClass.TestIntefacesACB o9 = (SerializationTestClass.TestIntefacesACB) ois
     48                 .readObject();
     49         SerializationTestClass.TestIntefacesBAC o10 = (SerializationTestClass.TestIntefacesBAC) ois
     50                 .readObject();
     51         SerializationTestClass.TestIntefacesBCA o11 = (SerializationTestClass.TestIntefacesBCA) ois
     52                 .readObject();
     53         SerializationTestClass.TestIntefacesCAB o12 = (SerializationTestClass.TestIntefacesCAB) ois
     54                 .readObject();
     55         SerializationTestClass.TestIntefacesCBA o13 = (SerializationTestClass.TestIntefacesCBA) ois
     56                 .readObject();
     57         ois.close();
     58     }
     59 
     60     public void testComputeSUIDFields() throws Exception {
     61         ObjectInputStream ois = new ObjectInputStream(getClass()
     62                 .getResourceAsStream(path + "testComputeSUIDFields.ser"));
     63         SerializationTestClass.TestFieldsNone o1 = (SerializationTestClass.TestFieldsNone) ois
     64                 .readObject();
     65         SerializationTestClass.TestFieldsOneFinal o2 = (SerializationTestClass.TestFieldsOneFinal) ois
     66                 .readObject();
     67         SerializationTestClass.TestFieldsTwoFinal o3 = (SerializationTestClass.TestFieldsTwoFinal) ois
     68                 .readObject();
     69         SerializationTestClass.TestFieldsOnePrivate o4 = (SerializationTestClass.TestFieldsOnePrivate) ois
     70                 .readObject();
     71         SerializationTestClass.TestFieldsTwoPrivate o5 = (SerializationTestClass.TestFieldsTwoPrivate) ois
     72                 .readObject();
     73         SerializationTestClass.TestFieldsOneProtected o6 = (SerializationTestClass.TestFieldsOneProtected) ois
     74                 .readObject();
     75         SerializationTestClass.TestFieldsTwoProtected o7 = (SerializationTestClass.TestFieldsTwoProtected) ois
     76                 .readObject();
     77         SerializationTestClass.TestFieldsOnePublic o8 = (SerializationTestClass.TestFieldsOnePublic) ois
     78                 .readObject();
     79         SerializationTestClass.TestFieldsTwoPublic o9 = (SerializationTestClass.TestFieldsTwoPublic) ois
     80                 .readObject();
     81         SerializationTestClass.TestFieldsOneStatic o10 = (SerializationTestClass.TestFieldsOneStatic) ois
     82                 .readObject();
     83         SerializationTestClass.TestFieldsTwoStatic o11 = (SerializationTestClass.TestFieldsTwoStatic) ois
     84                 .readObject();
     85         SerializationTestClass.TestFieldsOneTransient o12 = (SerializationTestClass.TestFieldsOneTransient) ois
     86                 .readObject();
     87         SerializationTestClass.TestFieldsTwoTransient o13 = (SerializationTestClass.TestFieldsTwoTransient) ois
     88                 .readObject();
     89         SerializationTestClass.TestFieldsOneVolatile o14 = (SerializationTestClass.TestFieldsOneVolatile) ois
     90                 .readObject();
     91         SerializationTestClass.TestFieldsTwoVolatile o15 = (SerializationTestClass.TestFieldsTwoVolatile) ois
     92                 .readObject();
     93         SerializationTestClass.TestFieldSignatures o16 = (SerializationTestClass.TestFieldSignatures) ois
     94                 .readObject();
     95         ois.close();
     96     }
     97 
     98     public void testComputeSUIDConstructors() throws Exception {
     99         ObjectInputStream ois = new ObjectInputStream(getClass()
    100                 .getResourceAsStream(path + "testComputeSUIDConstructors.ser"));
    101         SerializationTestClass.TestConstructorNone o1 = (SerializationTestClass.TestConstructorNone) ois
    102                 .readObject();
    103         SerializationTestClass.TestConstructorOne o2 = (SerializationTestClass.TestConstructorOne) ois
    104                 .readObject();
    105         SerializationTestClass.TestConstructorPrivate o3 = (SerializationTestClass.TestConstructorPrivate) ois
    106                 .readObject();
    107         SerializationTestClass.TestConstructorProtected o4 = (SerializationTestClass.TestConstructorProtected) ois
    108                 .readObject();
    109         SerializationTestClass.TestConstructorPublic o5 = (SerializationTestClass.TestConstructorPublic) ois
    110                 .readObject();
    111         SerializationTestClass.TestConstructorSignature o6 = (SerializationTestClass.TestConstructorSignature) ois
    112                 .readObject();
    113         SerializationTestClass.TestConstructorTwo o7 = (SerializationTestClass.TestConstructorTwo) ois
    114                 .readObject();
    115         SerializationTestClass.TestConstructorTwoReverse o8 = (SerializationTestClass.TestConstructorTwoReverse) ois
    116                 .readObject();
    117         ois.close();
    118     }
    119 
    120     public void testComputeSUIDMethods() throws Exception {
    121         ObjectInputStream ois = new ObjectInputStream(getClass()
    122                 .getResourceAsStream(path + "testComputeSUIDMethods.ser"));
    123         SerializationTestClass.TestMehodPrivate o1 = (SerializationTestClass.TestMehodPrivate) ois
    124                 .readObject();
    125         SerializationTestClass.TestMethodAbstract o2 = (SerializationTestClass.TestMethodAbstract) ois
    126                 .readObject();
    127         SerializationTestClass.TestMethodFinal o3 = (SerializationTestClass.TestMethodFinal) ois
    128                 .readObject();
    129         SerializationTestClass.TestMethodNative o4 = (SerializationTestClass.TestMethodNative) ois
    130                 .readObject();
    131         SerializationTestClass.TestMethodProtected o5 = (SerializationTestClass.TestMethodProtected) ois
    132                 .readObject();
    133         SerializationTestClass.TestMethodPublic o6 = (SerializationTestClass.TestMethodPublic) ois
    134                 .readObject();
    135         SerializationTestClass.TestMethodStatic o7 = (SerializationTestClass.TestMethodStatic) ois
    136                 .readObject();
    137         SerializationTestClass.TestMethodSignature o9 = (SerializationTestClass.TestMethodSignature) ois
    138                 .readObject();
    139         SerializationTestClass.TestMethodReturnSignature o10 = (SerializationTestClass.TestMethodReturnSignature) ois
    140                 .readObject();
    141         SerializationTestClass.TestMethodSynchronized o8 = (SerializationTestClass.TestMethodSynchronized) ois
    142                 .readObject();
    143         ois.close();
    144     }
    145 }
    146