Add method to register listener for unknown msg
[openflowjava.git] / openflow-protocol-api / src / test / java / org / opendaylight / openflowjava / protocol / api / keys / experimenter / ExperimenterActionDeserializerKeyTest.java
1 /*
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowjava.protocol.api.keys.experimenter;
10
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionDeserializerKey;
14 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
15
16 /**
17  * @author michal.polkorab
18  *
19  */
20 public class ExperimenterActionDeserializerKeyTest {
21
22     /**
23      * Test ExperimenterActionDeserializerKey equals and hashCode
24      */
25     @Test
26     public void test() {
27         ExperimenterActionDeserializerKey key1 =
28                 new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
29         ExperimenterActionDeserializerKey key2 =
30                 new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
31         Assert.assertTrue("Wrong equals", key1.equals(key2));
32         Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
33         key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF13_VERSION_ID, 42L);
34         Assert.assertFalse("Wrong equals", key1.equals(key2));
35         Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
36         key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, null);
37         Assert.assertFalse("Wrong equals", key1.equals(key2));
38         Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
39         key2 = new ExperimenterActionDeserializerKey(EncodeConstants.OF10_VERSION_ID, 55L);
40         Assert.assertFalse("Wrong equals", key1.equals(key2));
41         Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
42     }
43 }