org.junit.internal.AssumptionViolatedException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of junit-dep Show documentation
Show all versions of junit-dep Show documentation
JUnit is a regression testing framework written by Erich Gamma and Kent Beck.
It is used by the developer who implements unit tests in Java.
package org.junit.internal;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.SelfDescribing;
import org.hamcrest.StringDescription;
public class AssumptionViolatedException extends RuntimeException implements SelfDescribing {
private static final long serialVersionUID= 1L;
private final Object fValue;
private final Matcher> fMatcher;
public AssumptionViolatedException(Object value, Matcher> matcher) {
super(value instanceof Throwable ? (Throwable) value : null);
fValue= value;
fMatcher= matcher;
}
public AssumptionViolatedException(String assumption) {
this(assumption, null);
}
@Override
public String getMessage() {
return StringDescription.asString(this);
}
public void describeTo(Description description) {
if (fMatcher != null) {
description.appendText("got: ");
description.appendValue(fValue);
description.appendText(", expected: ");
description.appendDescriptionOf(fMatcher);
} else {
description.appendText("failed assumption: " + fValue);
}
}
}