Replace FailureStrategy with FailureMetadata in gtld's Subjects

Also changed truth.SubjectFactory to truth.Subject.Factory (plain renaming) and use method reference instead of anonymous class to create the factory when applicable.

FailureMetadata, an opaque object to its users, is introduced to replace FailureStrategy in in custom Subject in order to resolve some existing flaws of FailureStrategy as well as enable new features to be added to Truth.

New API is available in Truth-0.36, if there is a build/pom.xml, it's also updated to use this version.

More information: See []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176110788
This commit is contained in:
jianglai 2017-11-17 08:18:43 -08:00
parent 6083ef9ba0
commit 9ab68613a0
12 changed files with 44 additions and 127 deletions

View file

@ -15,7 +15,7 @@
package google.registry.testing;
import com.google.common.collect.ImmutableSet;
import com.google.common.truth.FailureStrategy;
import com.google.common.truth.FailureMetadata;
import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.launch.LaunchNotice;
@ -29,8 +29,8 @@ public abstract class AbstractDomainBaseSubject
<T extends DomainBase, S extends AbstractDomainBaseSubject<T, S>>
extends AbstractEppResourceSubject<T, S> {
public AbstractDomainBaseSubject(FailureStrategy strategy, T subject) {
super(strategy, subject);
public AbstractDomainBaseSubject(FailureMetadata failureMetadata, T subject) {
super(failureMetadata, subject);
}
public And<S> hasFullyQualifiedDomainName(String fullyQualifiedDomainName) {