08cd1a4f5c04e1eeca3ba41c812a008d93f2f8f9
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / TypeToClassKeyTest.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.impl.deserialization;
10
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
14 import org.opendaylight.openflowjava.protocol.impl.util.TypeToClassKey;
15 /**
16  * 
17  * @author madamjak
18  *
19  */
20 public class TypeToClassKeyTest {
21
22     /**
23      * Test equals
24      */
25     @Test
26     public void test(){
27         final short ver10 = EncodeConstants.OF10_VERSION_ID;
28         final short ver13 = EncodeConstants.OF13_VERSION_ID;
29         final int type1 = 1;
30         final int type2 = 2;
31         TypeToClassKey typeToClsKey10 = new TypeToClassKey(ver10,type1);
32         Assert.assertTrue("Wrong - equals to same object", typeToClsKey10.equals(typeToClsKey10));
33         Assert.assertFalse("Wrong - equals to null", typeToClsKey10.equals(null));
34         Assert.assertFalse("Wrong - equals to different class", typeToClsKey10.equals(new Object()));
35         TypeToClassKey typeToClsKey13 = new TypeToClassKey(ver13,type2);
36         Assert.assertFalse("Wrong - equals by different version", typeToClsKey13.equals(new Object()));
37         Assert.assertFalse("Wrong - equals by different type", typeToClsKey13.equals(typeToClsKey10));
38     }
39 }