Use new Truth failWithActual() method

Migrate Truth subjects from the old fail(String, Object) to the new failWithActual(String, Object), tweaking verbs for the new grammar.

Before:
  fail("has foo", expected);

After:
  failWithActual("expected to have foo", expected);

Open-source note: The fail*() methods used by this CL were added in Truth 0.41.

More information:
  []
Tested:
    TAP --sample for global presubmit queue
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=244418884
This commit is contained in:
cpovirk 2019-04-19 14:05:12 -07:00 committed by jianglai
parent 24bb78bd16
commit a46227b201
5 changed files with 25 additions and 20 deletions

View file

@ -15,6 +15,7 @@
package google.registry.testing;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.truth.Fact.simpleFact;
import static com.google.common.truth.Truth.assertAbout;
import com.google.common.truth.FailureMetadata;
@ -54,14 +55,14 @@ public final class DomainBaseSubject
public And<DomainBaseSubject> hasDeletePollMessage() {
if (actual().getDeletePollMessage() == null) {
fail("has a delete poll message");
failWithActual(simpleFact("expected to have a delete poll message"));
}
return andChainer();
}
public And<DomainBaseSubject> hasNoDeletePollMessage() {
if (actual().getDeletePollMessage() != null) {
fail("has no delete poll message");
failWithActual(simpleFact("expected to have no delete poll message"));
}
return andChainer();
}