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 fornull
and 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 String
private final RelationshipTester.ItemReporter
private 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 void
assertRelated
(int groupNumber, int itemNumber, int relatedItemNumber) private void
assertUnrelated
(int groupNumber, int itemNumber, int unrelatedGroupNumber, int unrelatedItemNumber) private void
assertWithTemplate
(String template, RelationshipTester.Item<T> item, RelationshipTester.Item<T> other, boolean condition) private RelationshipTester.Item
<T> getItem
(int groupNumber, int itemNumber) void
test()
-
Field Details
-
equivalence
A word about usingEquivalence
, which automatically checks fornull
and 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:EqualsTester
testsnull
and 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
-