Title: [2293] branches/v-1.4.x: Merge test changes from HEAD.
Revision
2293
Author
joehni
Date
2014-07-03 13:01:52 -0500 (Thu, 03 Jul 2014)

Log Message

Merge test changes from HEAD.

Modified Paths


Property Changed

Diff

Property changes: branches/v-1.4.x


Modified: svn:mergeinfo

+ /trunk:2151-2152,2154-2156,2158-2163,2165,2172,2175,2177,2188-2189,2197,2199-2201,2204,2206,2210,2212,2214-2217,2226,2229,2231,2233-2234,2236-2238,2247-2249,2279-2280,2285,2291-2292

Modified: branches/v-1.4.x/xstream/src/test/com/thoughtworks/acceptance/SerializationNestedWriteObjectsTest.java (2292 => 2293)


--- branches/v-1.4.x/xstream/src/test/com/thoughtworks/acceptance/SerializationNestedWriteObjectsTest.java	2014-07-02 12:01:16 UTC (rev 2292)
+++ branches/v-1.4.x/xstream/src/test/com/thoughtworks/acceptance/SerializationNestedWriteObjectsTest.java	2014-07-03 18:01:52 UTC (rev 2293)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2010, 2012 XStream Committers.
+ * Copyright (C) 2006, 2007, 2010, 2012, 2014 XStream Committers.
  * All rights reserved.
  *
  * The software in this package is published under the terms of the BSD
@@ -207,17 +207,17 @@
         xstream.alias("raw", RawString.class);
 
         String expectedXml = ""
-            + "<object-stream>\n"
+            + "<root>\n"
             + "  <raw serialization=\"custom\">\n"
             + "    <raw>\n"
             + "      <byte>7</byte>\n"
             + "      <byte-array>WFN0cmVhbQ==</byte-array>\n"
             + "    </raw>\n"
             + "  </raw>\n"
-            + "</object-stream>";
+            + "</root>";
 
         StringWriter stringWriter = new StringWriter();
-        ObjectOutputStream os = xstream.createObjectOutputStream(stringWriter);
+        ObjectOutputStream os = xstream.createObjectOutputStream(stringWriter, "root");
         os.writeObject(new RawString("XStream"));
         os.close();
         String actualXml = stringWriter.getBuffer().toString();

Modified: branches/v-1.4.x/xstream/src/test/com/thoughtworks/acceptance/annotations/AnnotationsTest.java (2292 => 2293)


--- branches/v-1.4.x/xstream/src/test/com/thoughtworks/acceptance/annotations/AnnotationsTest.java	2014-07-02 12:01:16 UTC (rev 2292)
+++ branches/v-1.4.x/xstream/src/test/com/thoughtworks/acceptance/annotations/AnnotationsTest.java	2014-07-03 18:01:52 UTC (rev 2293)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2005, 2006 Joe Walnes.
- * Copyright (C) 2006, 2007, 2008 XStream Committers.
+ * Copyright (C) 2006, 2007, 2008, 2014 XStream Committers.
  * All rights reserved.
  *
  * The software in this package is published under the terms of the BSD
@@ -16,6 +16,9 @@
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 import com.thoughtworks.xstream.annotations.XStreamInclude;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -170,6 +173,23 @@
         assertEquals(internalType, xstream.fromXML(xml));
     }
 
+    public void testForClassInObjectStreamIsDetectedAtDeserialization() throws IOException, ClassNotFoundException {
+        // must preprocess annotations here
+        xstream.processAnnotations(InternalType.class);
+        xstream.ignoreUnknownElements();
+        InternalType internalType = new InternalType();
+        String xml = ""
+            + "<root>\n"
+            + "  <second>\n"
+            + "    <aliased>value</aliased>\n"
+            + "    <none>1</none>\n"
+            + "  </second>\n"
+            + "</root>";
+        ObjectInputStream in = xstream.createObjectInputStream(new StringReader(xml));
+        assertEquals(internalType, in.readObject());
+        in.close();
+    }
+
     @XStreamInclude({InternalType.class})
     interface Include {
     }

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to