1 package org.opendaylight.controller.config.api;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotEquals;
7 public class ModuleIdentifierTest {
8 String fact = new String("factory");
9 String inst = new String("instance");
11 @Test(expected = IllegalArgumentException.class)
12 public void testConstructor() throws Exception {
13 ModuleIdentifier m = new ModuleIdentifier(null, "instance");
16 @Test(expected = IllegalArgumentException.class)
17 public void testConstructor2() throws Exception {
18 ModuleIdentifier m = new ModuleIdentifier("name", null);
22 public void testEquals() throws Exception {
24 ModuleIdentifier m1 = new ModuleIdentifier(fact, inst);
25 assertEquals(m1, new ModuleIdentifier(fact, inst));
29 public void testEquals2() throws Exception {
30 assertNotEquals(new ModuleIdentifier(fact, inst), null);
34 public void testEquals3() throws Exception {
35 assertNotEquals(new ModuleIdentifier(fact, inst), new ModuleIdentifier(fact, "i"));
39 public void testEquals4() throws Exception {
40 assertNotEquals(new ModuleIdentifier(fact, inst), new ModuleIdentifier("f", inst));
44 public void testEquals5() throws Exception {
45 ModuleIdentifier m1 = new ModuleIdentifier(fact, inst);
50 public void testHashCode() throws Exception {
51 int hash = new ModuleIdentifier(fact, inst).hashCode();
52 assertEquals(hash, new ModuleIdentifier("factory", "instance").hashCode());
56 public void testToString() throws Exception {
57 assertEquals( new ModuleIdentifier("factory", "instance").toString(),
58 new ModuleIdentifier("factory", "instance").toString());