org.junit.contrib.truth
Class Truth
java.lang.Object
org.junit.contrib.truth.Truth
@GwtCompatible(emulated=true)
public class Truth
- extends Object
Truth - a proposition framework for tests, supporting JUnit style
assertion and assumption semantics in a fluent style.
Truth is the simplest entry point class. A developer can statically
import the ASSERT and ASSUME constants to get easy access to the
library's capabilities. Then, instead of writing:
Assert.assertEquals(a,b);
Assert.assertTrue(c);
Assert.assertTrue(d.contains(a) && d.contains(e));
Assert.assertTrue(d.contains(a) || d.contains(q) || d.contains(z));
one would write:
ASSERT.that(a).equals(b);
ASSERT.that(c).isTrue();
ASSERT.that(d).contains(a).and().contains(b);
// or
ASSERT.that(d).containsAllOf(a, b);
ASSERT.that(d).containsAnyOf(a, q, z);
Tests should be easier to read, and flow more clearly.
- Author:
- David Saff, Christian Gruber (cgruber@israfil.net)
Constructor Summary |
Truth()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
THROW_ASSERTION_ERROR
public static final FailureStrategy THROW_ASSERTION_ERROR
THROW_ASSUMPTION_ERROR
@GwtIncompatible(value="JUnit4")
public static final FailureStrategy THROW_ASSUMPTION_ERROR
ASSERT
public static final TestVerb ASSERT
ASSUME
@GwtIncompatible(value="JUnit4")
public static final TestVerb ASSUME
Truth
public Truth()
Copyright © 2014. All Rights Reserved.