Remove trailing whitespace
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / core / connection / RpcResponseKeyTest.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.core.connection;
10
11 import org.junit.Test;
12 import org.junit.Assert;
13 import org.opendaylight.openflowjava.protocol.impl.core.connection.RpcResponseKey;
14
15 /**
16  *
17  * @author madamjak
18  *
19  */
20 public class RpcResponseKeyTest {
21
22     /**
23      * Test equals (xid is not tested)
24      */
25     @Test
26     public void testEquals(){
27
28         long xid1 = 12L;
29         long xid2 = 66L;
30         String outputClazz1 = "Clazz01";
31         String outputClazz2 = "Clazz02";
32         RpcResponseKey key1 = new RpcResponseKey(xid1, null);
33         RpcResponseKey key2 = new RpcResponseKey(xid2, outputClazz2);
34
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));
39
40         key1 = new RpcResponseKey(xid1, outputClazz1);
41         Assert.assertFalse("Wrong equal by outputClazz.", key1.equals(key2));
42         key2 = new RpcResponseKey(xid2, outputClazz1);
43         Assert.assertTrue("Wrong equal.", key1.equals(key2));
44     }
45
46     /**
47      * Test getters
48      */
49     @Test
50     public void testGetters(){
51
52         long xid1 = 12L;
53         String outputClazz1 = "Clazz01";
54         RpcResponseKey key1 = new RpcResponseKey(xid1, outputClazz1);
55
56         Assert.assertTrue("Wrong getXid",key1.getXid() == xid1);
57         Assert.assertTrue("Wrong getOutputClazz",key1.getOutputClazz() == outputClazz1);
58     }
59 }