Package com.google.common.testing
Class RelationshipTester<T>
java.lang.Object
com.google.common.testing.RelationshipTester<T>
Implementation helper for
EqualsTester and EquivalenceTester that tests for
equivalence classes.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Equivalence<? super T>A word about usingEquivalence, which automatically checks fornulland identical inputs: This sounds like it ought to be a problem here, since the goals of this class include testing thatequals()is reflexive and is tolerant ofnull.private final List<ImmutableList<T>>private final Stringprivate final RelationshipTester.ItemReporterprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionRelationshipTester(Equivalence<? super T> equivalence, String relationshipName, String hashName, RelationshipTester.ItemReporter itemReporter) -
Method Summary
Modifier and TypeMethodDescriptionaddRelatedGroup(Iterable<? extends T> group) private voidassertRelated(int groupNumber, int itemNumber, int relatedItemNumber) private voidassertUnrelated(int groupNumber, int itemNumber, int unrelatedGroupNumber, int unrelatedItemNumber) private voidassertWithTemplate(String template, RelationshipTester.Item<T> item, RelationshipTester.Item<T> other, boolean condition) private RelationshipTester.Item<T>getItem(int groupNumber, int itemNumber) voidtest()
-
Field Details
-
equivalence
A word about usingEquivalence, which automatically checks fornulland identical inputs: This sounds like it ought to be a problem here, since the goals of this class include testing thatequals()is reflexive and is tolerant ofnull. However, there's no problem. The reason:EqualsTestertestsnulland identical inputs directly againstequals()rather than through theEquivalence. -
relationshipName
-
hashName
-
itemReporter
-
groups
-
-
Constructor Details
-
RelationshipTester
RelationshipTester(Equivalence<? super T> equivalence, String relationshipName, String hashName, RelationshipTester.ItemReporter itemReporter)
-
-
Method Details
-
addRelatedGroup
-
test
public void test() -
assertRelated
private void assertRelated(int groupNumber, int itemNumber, int relatedItemNumber) -
assertWithTemplate
private void assertWithTemplate(String template, RelationshipTester.Item<T> item, RelationshipTester.Item<T> other, boolean condition) -
getItem
-