Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-api / src / test / java / org / opendaylight / openflowjava / protocol / api / keys / experimenter / ExperimenterInstructionSerializerKeyTest.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.util.EncodeConstants;
14
15 /**
16  * @author michal.polkorab
17  *
18  */
19 public class ExperimenterInstructionSerializerKeyTest {
20
21     /**
22      * Test ExperimenterInstructionSerializerKey equals and hashCode
23      */
24     @Test
25     public void test() {
26         ExperimenterInstructionSerializerKey key1 =
27                 new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
28         ExperimenterInstructionSerializerKey key2 =
29                 new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 42L);
30         Assert.assertTrue("Wrong equals", key1.equals(key2));
31         Assert.assertTrue("Wrong hashcode", key1.hashCode() == key2.hashCode());
32         key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF13_VERSION_ID, 42L);
33         Assert.assertFalse("Wrong equals", key1.equals(key2));
34         Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
35         key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, null);
36         Assert.assertFalse("Wrong equals", key1.equals(key2));
37         Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
38         key2 = new ExperimenterInstructionSerializerKey(EncodeConstants.OF10_VERSION_ID, 55L);
39         Assert.assertFalse("Wrong equals", key1.equals(key2));
40         Assert.assertFalse("Wrong hashcode", key1.hashCode() == key2.hashCode());
41
42     }
43 }