For assertions made _inside the implementation of another assertion_, migrate from assertThat to check.

For example:
  assertThat(actual().foo()).isEqualTo(expected);
becomes:
  check("foo()").that(actual().foo()).isEqualTo(expected);

More information:
  []

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

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=245750144
This commit is contained in:
cpovirk 2019-04-29 08:26:29 -07:00 committed by jianglai
parent 8daca56024
commit de5f3e6177

View file

@ -17,7 +17,6 @@ package google.registry.testing;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.lenientFormat;
import static com.google.common.truth.Fact.simpleFact;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.EppResourceUtils.isActive;
import static google.registry.testing.DatastoreHelper.getHistoryEntriesOfType;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
@ -158,7 +157,9 @@ abstract class AbstractEppResourceSubject
public And<S> hasExactlyStatusValues(StatusValue... statusValues) {
if (!ImmutableSet.copyOf(actual().getStatusValues())
.equals(ImmutableSet.copyOf(statusValues))) {
assertThat(actual().getStatusValues()).named("status values for " + actualAsString())
check("getStatusValues()")
.that(actual().getStatusValues())
.named("status values for " + actualAsString())
.containsExactly((Object[]) statusValues);
}
return andChainer();