コード例 #1
0
 /*
  * 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()));
 }
コード例 #2
0
 /*
  * 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()));
 }
コード例 #3
0
 /** 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));
 }
コード例 #4
0
 /*
  * 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));
 }