Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #34 from bmaxwell/JBMAR-171-master

[JBMAR-171] added test case to ensure object with writeObject does not t...
  • Loading branch information...
commit 2493854046028f8bbff25750fba1876922e0ad28 2 parents dc391ca + 9ae2c82
@dmlloyd dmlloyd authored
View
48 api/src/test/java/org/jboss/marshalling/cloner/SerializableWithWriteObject.java
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.marshalling.cloner;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * @author <a href="mailto:bmaxwell@redhat.com">Brad Maxwell</a>
+ */
+public class SerializableWithWriteObject implements Serializable {
+
+ private String[] data;
+
+ public String[] getData() {
+ return data;
+ }
+
+ private void writeObject(ObjectOutputStream objectoutputstream) throws IOException {
+ }
+
+ public boolean equals(Object other) {
+ return other instanceof SerializableWithWriteObject && equals((SerializableWithWriteObject)other);
+ }
+
+ public boolean equals(SerializableWithWriteObject other) {
+ return Arrays.equals(data, other.getData());
+ }
+}
+
View
7 api/src/test/java/org/jboss/marshalling/cloner/SerializingClonerTestCase.java
@@ -213,6 +213,13 @@ public void testRegulars() throws Throwable {
assertNotNull(objectCloner.clone(new ClonerTestException("blah")));
}
+ public void testWriteObject() throws Throwable {
+ final ObjectCloner objectCloner = ObjectCloners.getSerializingObjectClonerFactory().createCloner(new ClonerConfiguration());
+ Object orig = new SerializableWithWriteObject();
+ final Object clone = objectCloner.clone(orig);
+ assertEquals(clone, orig);
+ }
+
/**
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
*/
Please sign in to comment.
Something went wrong with that request. Please try again.