2 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.util;
10 import static org.junit.Assert.assertTrue;
12 import com.google.common.base.MoreObjects;
13 import com.google.common.testing.EqualsTester;
14 import java.util.Objects;
15 import org.junit.Test;
17 @Deprecated(since = "11.0.0", forRemoval = true)
18 public class EvenMoreObjectsTest {
21 public void thingPassesEqualsTester() {
23 .addEqualityGroup(new Thing("hello", 123), new Thing("hello", 123))
24 .addEqualityGroup(new Thing("hoi", 123), new Thing("hoi", 123))
25 .addEqualityGroup(new Thing("hoi", null))
26 .addEqualityGroup(new Thing(null, null))
31 public void nullEqualsNull() {
32 assertTrue(EvenMoreObjects.equalsHelper(null, null, (one, another) -> Boolean.TRUE));
35 private static class Thing {
40 public boolean equals(final Object obj) {
41 return EvenMoreObjects.equalsHelper(this, obj,
42 (one, another) -> Objects.equals(one.name, another.name) && Objects.equals(one.age, another.age));
46 public int hashCode() {
47 return Objects.hash(name, age);
51 public String toString() {
52 return MoreObjects.toStringHelper(this).add("name", name).add("age", age).toString();
55 Thing(final String name, final Integer age) {