Migrate callers of Truth's Subject.failWithRawMessage to Subject.failWithoutActual

See []

Requires the use of Guava 25.1 for Strings.lenientFormat and Truth 0.41 for Subject.failWithoutActual

RELNOTES: Migrated from Subject.failWithRawMessage to Subject.failWithoutActual
BEGIN_PUBLIC
Migrated from Subject.failWithRawMessage to Subject.failWithoutActual
END_PUBLIC

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

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205709366
This commit is contained in:
jianglai 2018-07-23 12:57:49 -07:00
parent 03a00782d6
commit 0cdbf71daf

View file

@ -15,6 +15,8 @@
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;
@ -136,15 +138,19 @@ abstract class AbstractEppResourceSubject
public And<S> hasStatusValue(StatusValue statusValue) {
if (!actual().getStatusValues().contains(statusValue)) {
failWithRawMessage("%s should have had status value %s", actualAsString(), statusValue);
failWithoutActual(
simpleFact(
lenientFormat("%s should have had status value %s", actualAsString(), statusValue)));
}
return andChainer();
}
public And<S> doesNotHaveStatusValue(StatusValue statusValue) {
if (actual().getStatusValues().contains(statusValue)) {
failWithRawMessage(
"%s should not have had status value %s", actualAsString(), statusValue);
failWithoutActual(
simpleFact(
lenientFormat(
"%s should not have had status value %s", actualAsString(), statusValue)));
}
return andChainer();
}