diff options
author | cpovirk <cpovirk@google.com> | 2019-04-19 13:02:42 -0700 |
---|---|---|
committer | Ron Shapiro <shapiro.rd@gmail.com> | 2019-04-29 11:35:05 -0400 |
commit | 41588ef3405dce426e1e51a238de8d42fc29b34d (patch) | |
tree | f775ba3cce6a85af0cb1df072d2648f78a67627d | |
parent | 64b0b187221a529be531271d9e27627ad1954572 (diff) | |
download | jimfs-41588ef3405dce426e1e51a238de8d42fc29b34d.tar.gz |
Migrate Truth subjects from a manual "test and fail" approach to one using Subject.check(...).
Before:
if (actual().foo() != expected) {
fail("has foo", expected);
}
After:
check("foo()").that(actual().foo()).isEqualTo(expected);
This CL changes the format of the failure message. The new message will typically contain the same information as the old, but if some is missing, let us know, and consider adding a test.
The overload of check(...) used by this CL was added in Truth 0.40.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=244408001
-rw-r--r-- | jimfs/src/test/java/com/google/common/jimfs/PathSubject.java | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java b/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java index 819272d..f0a63fb 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java +++ b/jimfs/src/test/java/com/google/common/jimfs/PathSubject.java @@ -123,9 +123,7 @@ public final class PathSubject extends Subject<PathSubject, Path> { /** Asserts that the path has no name components. */ public PathSubject hasNoNameComponents() { - if (actual().getNameCount() != 0) { - fail("has no name components"); - } + check("getNameCount()").that(actual().getNameCount()).isEqualTo(0); return this; } |