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.Assert;
12 import org.junit.Test;
15 * Unit tests for RpcResponseKey.
19 public class RpcResponseKeyTest {
22 * Test equals (xid is not tested).
25 public void testEquals() {
29 final String outputClazz1 = "Clazz01";
30 String outputClazz2 = "Clazz02";
31 RpcResponseKey key1 = new RpcResponseKey(xid1, null);
32 RpcResponseKey key2 = new RpcResponseKey(xid2, outputClazz2);
34 Assert.assertTrue("Wrong equal to same obejct.", key1.equals(key1));
35 Assert.assertFalse("Wrong equal to null.", key1.equals(null));
36 Assert.assertFalse("Wrong equal to different type.", key1.equals(new Object()));
37 Assert.assertFalse("Wrong equal by outputClazz.", key1.equals(key2));
39 key1 = new RpcResponseKey(xid1, outputClazz1);
40 Assert.assertFalse("Wrong equal by outputClazz.", key1.equals(key2));
41 key2 = new RpcResponseKey(xid2, outputClazz1);
42 Assert.assertFalse("Wrong equal.", key1.equals(key2));
43 key1 = new RpcResponseKey(xid2, outputClazz1);
44 Assert.assertTrue("Wrong equal.", key1.equals(key2));
51 public void testGetters() {
54 String outputClazz1 = "Clazz01";
55 RpcResponseKey key1 = new RpcResponseKey(xid1, outputClazz1);
57 Assert.assertTrue("Wrong getXid",key1.getXid() == xid1);
58 Assert.assertTrue("Wrong getOutputClazz",key1.getOutputClazz() == outputClazz1);