Package com.google.common.truth
Class TruthJUnit
- java.lang.Object
-
- com.google.common.truth.TruthJUnit
-
@GwtIncompatible("JUnit4") public class TruthJUnit extends java.lang.ObjectTruth - a proposition framework for tests, supporting JUnit style assertion and assumption semantics in a fluent style. 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 theassume()method. eg:import com.google.common.truth.Truth.assert_; import com.google.common.truth.Truth.assume; public void @Test testFoosAgainstBars { assume().that(foo).isNotNull(); assume().that(bar).isNotNull(); assert_().that(foo.times(bar)).isEqualTo(blah); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classTruthJUnit.ThrowableAssumptionViolatedException
-
Field Summary
Fields Modifier and Type Field Description static TestVerbASSUMEstatic FailureStrategyTHROW_ASSUMPTION_ERROR
-
Constructor Summary
Constructors Modifier Constructor Description privateTruthJUnit()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TestVerbassume()
-
-
-
Field Detail
-
THROW_ASSUMPTION_ERROR
@GwtIncompatible("JUnit4") public static final FailureStrategy THROW_ASSUMPTION_ERROR
-
ASSUME
@GwtIncompatible("JUnit4") public static final TestVerb ASSUME
-
-
Method Detail
-
assume
@GwtIncompatible("JUnit4") public static final TestVerb assume()
-
-