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.core.connection;
11 import org.junit.Test;
12 import org.junit.Assert;
13 import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;
20 public class RpcResponseKeyTest {
23 * Test equals (xid is not tested)
26 public void testEquals(){
30 String outputClazz1 = "Clazz01";
31 String outputClazz2 = "Clazz02";
32 RpcResponseKey key1 = new RpcResponseKey(xid1, null);
33 RpcResponseKey key2 = new RpcResponseKey(xid2, outputClazz2);
35 Assert.assertTrue("Wrong equal to same obejct.", key1.equals(key1));
36 Assert.assertFalse("Wrong equal to null.", key1.equals(null));
37 Assert.assertFalse("Wrong equal to different type.", key1.equals(new Object()));
38 Assert.assertFalse("Wrong equal by outputClazz.", key1.equals(key2));
40 key1 = new RpcResponseKey(xid1, outputClazz1);
41 Assert.assertFalse("Wrong equal by outputClazz.", key1.equals(key2));
42 key2 = new RpcResponseKey(xid2, outputClazz1);
43 Assert.assertFalse("Wrong equal.", key1.equals(key2));
44 key1 = new RpcResponseKey(xid2, outputClazz1);
45 Assert.assertTrue("Wrong equal.", key1.equals(key2));
52 public void testGetters(){
55 String outputClazz1 = "Clazz01";
56 RpcResponseKey key1 = new RpcResponseKey(xid1, outputClazz1);
58 Assert.assertTrue("Wrong getXid",key1.getXid() == xid1);
59 Assert.assertTrue("Wrong getOutputClazz",key1.getOutputClazz() == outputClazz1);