aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/junit/internal/AssumptionViolatedException.java
diff options
context:
space:
mode:
authorDavid Srbecky <dsrbecky@google.com>2021-02-24 21:20:54 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-02-24 21:20:54 +0000
commit138b64feb682b90292d36002f3aff9869d6a9e4b (patch)
treefb060599e56a1ce3ccfa4cacd193406f14ba84db /src/main/java/org/junit/internal/AssumptionViolatedException.java
parent99022df227f5503b68838d97e0a6b3fa5f558f1b (diff)
parent91c5e5ff9d71ebc00818b310c09b175016c36dc2 (diff)
downloadjunit-138b64feb682b90292d36002f3aff9869d6a9e4b.tar.gz
Merge changes from topic "revert-1601635-AIQYZOHWTP" am: 565f36d281 am: 23e304a839 am: 91c5e5ff9d
Original change: https://android-review.googlesource.com/c/platform/external/junit/+/1605377 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Iaa51f5a85f96ec87a01eff9bc98e2274fc5a97dd
Diffstat (limited to 'src/main/java/org/junit/internal/AssumptionViolatedException.java')
-rw-r--r--src/main/java/org/junit/internal/AssumptionViolatedException.java30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/main/java/org/junit/internal/AssumptionViolatedException.java b/src/main/java/org/junit/internal/AssumptionViolatedException.java
index 0e79b56..880d73f 100644
--- a/src/main/java/org/junit/internal/AssumptionViolatedException.java
+++ b/src/main/java/org/junit/internal/AssumptionViolatedException.java
@@ -1,8 +1,5 @@
package org.junit.internal;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.SelfDescribing;
@@ -21,7 +18,7 @@ public class AssumptionViolatedException extends RuntimeException implements Sel
/*
* We have to use the f prefix until the next major release to ensure
* serialization compatibility.
- * See https://github.com/junit-team/junit4/issues/976
+ * See https://github.com/junit-team/junit/issues/976
*/
private final String fAssumption;
private final boolean fValueMatcher;
@@ -111,29 +108,4 @@ public class AssumptionViolatedException extends RuntimeException implements Sel
}
}
}
-
- /**
- * Override default Java object serialization to correctly deal with potentially unserializable matchers or values.
- * By not implementing readObject, we assure ourselves of backwards compatibility and compatibility with the
- * standard way of Java serialization.
- *
- * @param objectOutputStream The outputStream to write our representation to
- * @throws IOException When serialization fails
- */
- private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
- ObjectOutputStream.PutField putField = objectOutputStream.putFields();
- putField.put("fAssumption", fAssumption);
- putField.put("fValueMatcher", fValueMatcher);
-
- // We have to wrap the matcher into a serializable form.
- putField.put("fMatcher", SerializableMatcherDescription.asSerializableMatcher(fMatcher));
-
- // We have to wrap the value inside a non-String class (instead of serializing the String value directly) as
- // A Description will handle a String and non-String object differently (1st is surrounded by '"' while the
- // latter will be surrounded by '<' '>'. Wrapping it makes sure that the description of a serialized and
- // non-serialized instance produce the exact same description
- putField.put("fValue", SerializableValueDescription.asSerializableValue(fValue));
-
- objectOutputStream.writeFields();
- }
}