* Copyright (C) 2011 The Guava Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
import static com.google.common.base.Preconditions.checkNotNull;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
relationships between groups of objects.
To use, create a new
and add equivalence groups
where each group contains objects that are supposed to be equal to each
other. Objects of different groups are expected to be unequal. For example:
EquivalenceTester.of(someStringEquivalence) .addEquivalenceGroup("hello", "h" + "ello") .addEquivalenceGroup("world", "wor" + "ld") .test();
Note that testing
is more simply done using
. It includes an extra test against an instance of an
arbitrary class without having to explicitly add another equivalence group.
* TODO(cpovirk): consider no longer running these equivalent() tests on every Equivalence,
* since the Equivalence base type now implements this logic itself