public final class Fact extends Object implements Serializable
Most Truth users will never interact with this type. It appears in the Truth API only as a
parameter to methods like
Subject.failWithActual(Fact, Fact...), which are used only by
If you are writing a custom
Subject, see our tips on writing failure messages.
|Modifier and Type||Method and Description|
Creates a fact with the given key and value, which will be printed in a format like "key: value." The value is converted to a string by calling
Creates a fact with no value, which will be printed in the format "key" (with no colon or value).
Returns a simple string representation for the fact.
In most cases, prefer key-value facts, which give Truth more flexibility
in how to format the fact for display.
simpleFact is useful primarily for:
isNotEmpty()would generate the fact "expected not to be empty"
contains()sometimes displays facts like "expected to contain: ..." "but did not" "though it did contain: ..."
Copyright © 2019. All rights reserved.