@GwtIncompatible(value="JUnit4") public class TruthJUnit extends Object
TruthJUnit contains a junit-specific "failure strategy" known as an assumption. An assumption is a proposition that, if the proposition is false, aborts (skips) the test. This is especially useful in JUnit theories or parameterized tests, or other combinatorial tests where some subset of the combinations are simply not applicable for testing.
TruthJUnit is the entry point for assumptions, via the assume()
method.
eg:
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.TruthJUnit.assume;
public void @Test testFoosAgainstBars {
assume().that(foo).isNotNull();
assume().that(bar).isNotNull();
assertThat(foo.times(bar)).isEqualTo(blah);
}
Modifier and Type | Method and Description |
---|---|
static TestVerb |
assume() |
static FailureStrategy |
throwAssumptionError() |
@GwtIncompatible(value="JUnit4") public static final FailureStrategy throwAssumptionError()
@GwtIncompatible(value="JUnit4") public static final TestVerb assume()
Copyright © 2017. All rights reserved.