2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
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
9 package org.opendaylight.openflowjava.protocol.impl.deserialization;
11 import org.junit.Test;
13 import junit.framework.Assert;
20 public class MessageTypeCodeKeyTest {
23 public void testEquals(){
25 short msgVersion1 = 34;
27 short msgVersion2 = 43;
29 MessageTypeCodeKey key1 = new MessageTypeCodeKey(msgVersion1, msgType1);
31 Assert.assertTrue("Wrong - equals to same obejct",key1.equals(key1));
32 Assert.assertFalse("Wrong - equals to null",key1.equals(null));
33 Assert.assertFalse("Wrong - equals to different class",key1.equals(new Object()));
35 MessageTypeCodeKey key2 = new MessageTypeCodeKey(msgVersion2, msgType2);
36 Assert.assertFalse("Wrong - equals by msgType",key1.equals(key2));
38 key2 = new MessageTypeCodeKey(msgVersion2, msgType1);
39 Assert.assertFalse("Wrong - equals by msgVersion",key1.equals(key2));
43 public void testGetter(){
46 short msgVersion = 34;
48 MessageTypeCodeKey key1 = new MessageTypeCodeKey(msgVersion, msgType);
50 Assert.assertEquals(msgType, key1.getMsgType());
51 Assert.assertEquals(msgVersion, key1.getMsgVersion());