Bug 2245 Fixed Avoid cycle between java packages
[openflowjava.git] / openflow-protocol-api / src / test / java / org / opendaylight / openflowjava / protocol / api / keys / experimenter / ExperimenterActionSerializerKeyTest.java
index 59141fc4051ccf9f06ce1c723c8f31218e7a816a..6c469573fe311738796596706b376c35e3545311 100644 (file)
@@ -1,57 +1,74 @@
-/*\r
- * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.openflowjava.protocol.api.keys.experimenter;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;\r
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class ExperimenterActionSerializerKeyTest {\r
-\r
-    /**\r
-     * Test ExperimenterActionSerializerKey equals and hashCode\r
-     */\r
-    @Test\r
-    public void test() {\r
-        ExperimenterActionSerializerKey key1 =\r
-                new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
-        ExperimenterActionSerializerKey key2 =\r
-                new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);\r
-        Assert.assertTrue("Wrong equals", key1.equals(key2));\r
-        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, null, TestSubType.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);\r
-        Assert.assertFalse("Wrong equals", key1.equals(key2));\r
-        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());\r
-    }\r
-\r
-    private static class TestSubType extends ExperimenterActionSubType {\r
-        // empty class - only used in test for comparation\r
-    }\r
-\r
-    private static class TestSubType2 extends ExperimenterActionSubType {\r
-        // empty class - only used in test for comparation\r
-    }\r
+/*
+ * Copyright (c) 2014 Pantheon Technologies s.r.o. 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.openflowjava.protocol.api.keys.experimenter;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.ExperimenterActionSubType;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class ExperimenterActionSerializerKeyTest {
+
+
+    /**
+     * Test ExperimenterActionSerializerKey equals and hashCode
+     */
+    @Test
+    public void test() {
+        ExperimenterActionSerializerKey key1 =
+                new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+        ExperimenterActionSerializerKey key2 =
+                new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+        Assert.assertTrue("Wrong equals", key1.equals(key2));
+        Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L, TestSubType.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, null, TestSubType.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, null);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L, TestSubType2.class);
+        Assert.assertFalse("Wrong equals", key1.equals(key2));
+        Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
+    }
+
+    @Test
+    public void testEquals() {
+        ExperimenterActionSerializerKey key1;
+        ExperimenterActionSerializerKey key2;
+        key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, null);
+        Assert.assertTrue("Wrong equal to identical object.", key1.equals(key1));
+        key2 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType2.class);
+        Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
+        key1 = new ExperimenterActionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L, TestSubType.class);
+        Assert.assertFalse("Wrong equal by actionSubType.", key1.equals(key2));
+    }
+
+
+    private static class TestSubType extends ExperimenterActionSubType {
+        // empty class - only used in test for comparation
+    }
+
+    private static class TestSubType2 extends ExperimenterActionSubType {
+        // empty class - only used in test for comparation
+    }
+
+
 }
\ No newline at end of file