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 com.google.common.base.MoreObjects;
11 import com.google.common.testing.EqualsTester;
12 import java.util.Objects;
13 import org.junit.Test;
15 public class EvenMoreObjectsTest {
20 .addEqualityGroup(new Thing("hello", 123), new Thing("hello", 123))
21 .addEqualityGroup(new Thing("hoi", 123), new Thing("hoi", 123))
22 .addEqualityGroup(new Thing("hoi", null))
23 .addEqualityGroup(new Thing(null, null))
33 public boolean equals(Object obj) {
34 return EvenMoreObjects.equalsHelper(this, obj,
35 (one, another) -> Objects.equals(one.name, another.name) && Objects.equals(one.age, another.age));
39 public int hashCode() {
40 return Objects.hash(name, age);
44 public String toString() {
45 return MoreObjects.toStringHelper(this).add("name", name).add("age", age).toString();
48 Thing(String name, Integer age) {