Skip to content

Commit

Permalink
Rename fields of internal AssumptionViolatedException so we don't bre…
Browse files Browse the repository at this point in the history
…ak serialization with JUnit 4.11
  • Loading branch information
kcooney committed Sep 21, 2014
1 parent a18c000 commit 30efd9a
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/main/java/org/junit/internal/AssumptionViolatedException.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
public class AssumptionViolatedException extends RuntimeException implements SelfDescribing {
private static final long serialVersionUID = 2L;

private final String assumption;
private final boolean hasValue;
private final Object value;
private final String fAssumption;
private final boolean fValueMatcher;
private final Object fValue;

private final Matcher<?> matcher;
private final Matcher<?> fMatcher;

/**
* @deprecated Please use {@link org.junit.AssumptionViolatedException} instead.
*/
@Deprecated
public AssumptionViolatedException(String assumption, boolean hasValue, Object value, Matcher<?> matcher) {
this.assumption = assumption;
this.value = value;
this.matcher = matcher;
this.hasValue = hasValue;
this.fAssumption = assumption;
this.fValue = value;
this.fMatcher = matcher;
this.fValueMatcher = hasValue;

if (value instanceof Throwable) {
initCause((Throwable) value);
Expand Down Expand Up @@ -85,21 +85,22 @@ public String getMessage() {
}

public void describeTo(Description description) {
if (assumption != null) {
description.appendText(assumption);
if (fAssumption != null) {
description.appendText(fAssumption);
}

if (hasValue) {
if (assumption != null) {
if (fValueMatcher) {
// a value was passed in when this instance was constructed; print it
if (fAssumption != null) {
description.appendText(": ");
}

description.appendText("got: ");
description.appendValue(value);
description.appendValue(fValue);

if (matcher != null) {
if (fMatcher != null) {
description.appendText(", expected: ");
description.appendDescriptionOf(matcher);
description.appendDescriptionOf(fMatcher);
}
}
}
Expand Down

0 comments on commit 30efd9a

Please sign in to comment.