Merge "Add Unit Test (only) for ActionDrop equals"
authorMichael Vorburger <vorburger@redhat.com>
Thu, 1 Jun 2017 05:18:52 +0000 (05:18 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 1 Jun 2017 05:18:52 +0000 (05:18 +0000)
mdsalutil/mdsalutil-api/src/test/java/org/opendaylight/genius/mdsalutil/actions/ActionDropTest.java [new file with mode: 0644]

diff --git a/mdsalutil/mdsalutil-api/src/test/java/org/opendaylight/genius/mdsalutil/actions/ActionDropTest.java b/mdsalutil/mdsalutil-api/src/test/java/org/opendaylight/genius/mdsalutil/actions/ActionDropTest.java
new file mode 100644 (file)
index 0000000..3c596a3
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.genius.mdsalutil.actions;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.google.common.testing.EqualsTester;
+import org.junit.Test;
+
+/**
+ * Unit test for {@link ActionDrop}.
+ *
+ * @author Michael Vorburger.ch
+ */
+public class ActionDropTest {
+
+    /**
+     * ActionDrop's equals works, even though it's not overriden (because
+     * ActionInfo's equals() has a getClass() != other.getClass()).
+     */
+    @Test
+    public void testEqualsToAnotherClass() {
+        assertThat(new ActionDrop()).isNotEqualTo(new ActionMoveShaToTha());
+        assertThat(new ActionMoveShaToTha()).isNotEqualTo(new ActionDrop());
+    }
+
+    @Test
+    public void testEqualsAndHashCode() {
+        new EqualsTester()
+            .addEqualityGroup(new ActionDrop(), new ActionDrop())
+            .addEqualityGroup(new ActionDrop(123), new ActionDrop(123))
+            .addEqualityGroup(new ActionMoveShaToTha(), new ActionMoveShaToTha())
+            .testEquals();
+    }
+
+}