mirror of
https://github.com/google/nomulus
synced 2026-08-19 13:46:13 +00:00
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:
@@ -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;
|
||||
@@ -39,14 +40,14 @@ public final class ContactResourceSubject
|
||||
|
||||
public And<ContactResourceSubject> hasNullLocalizedPostalInfo() {
|
||||
if (actual().getLocalizedPostalInfo() != null) {
|
||||
fail("has null localized postal info");
|
||||
failWithActual(simpleFact("expected to have null localized postal info"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasNonNullLocalizedPostalInfo() {
|
||||
if (actual().getLocalizedPostalInfo() == null) {
|
||||
fail("has non-null localized postal info");
|
||||
failWithActual(simpleFact("expected to have non-null localized postal info"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
@@ -61,7 +62,7 @@ public final class ContactResourceSubject
|
||||
|
||||
public And<ContactResourceSubject> hasNullInternationalizedPostalInfo() {
|
||||
if (actual().getInternationalizedPostalInfo() != null) {
|
||||
fail("has null internationalized postal info");
|
||||
failWithActual(simpleFact("expected to have null internationalized postal info"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
@@ -69,49 +70,49 @@ public final class ContactResourceSubject
|
||||
|
||||
public And<ContactResourceSubject> hasNonNullInternationalizedPostalInfo() {
|
||||
if (actual().getInternationalizedPostalInfo() == null) {
|
||||
fail("has non-null internationalized postal info");
|
||||
failWithActual(simpleFact("expected to have non-null internationalized postal info"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasNullEmailAddress() {
|
||||
if (actual().getEmailAddress() != null) {
|
||||
fail("has null email address");
|
||||
failWithActual(simpleFact("expected to have null email address"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasNonNullEmailAddress() {
|
||||
if (actual().getEmailAddress() == null) {
|
||||
fail("has non-null email address");
|
||||
failWithActual(simpleFact("expected to have non-null email address"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasNullVoiceNumber() {
|
||||
if (actual().getVoiceNumber() != null) {
|
||||
fail("has null voice number");
|
||||
failWithActual(simpleFact("expected to have null voice number"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasNonNullVoiceNumber() {
|
||||
if (actual().getVoiceNumber() == null) {
|
||||
fail("has non-null voice number");
|
||||
failWithActual(simpleFact("expected to have non-null voice number"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasNullFaxNumber() {
|
||||
if (actual().getFaxNumber() != null) {
|
||||
fail("has null fax number");
|
||||
failWithActual(simpleFact("expected to have null fax number"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
public And<ContactResourceSubject> hasNonNullFaxNumber() {
|
||||
if (actual().getFaxNumber() == null) {
|
||||
fail("has non-null fax number");
|
||||
failWithActual(simpleFact("expected to have non-null fax number"));
|
||||
}
|
||||
return andChainer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user