1 package org.opendaylight.controller.config.api;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotEquals;
8 public class ModuleIdentifierTest {
9 String fact = new String("factory");
10 String inst = new String("instance");
12 @Test(expected = IllegalArgumentException.class)
13 public void testConstructor() throws Exception {
14 ModuleIdentifier m = new ModuleIdentifier(null, "instance");
17 @Test(expected = IllegalArgumentException.class)
18 public void testConstructor2() throws Exception {
19 ModuleIdentifier m = new ModuleIdentifier("name", null);
23 public void testEquals() throws Exception {
25 ModuleIdentifier m1 = new ModuleIdentifier(fact, inst);
26 assertEquals(m1, new ModuleIdentifier(fact, inst));
30 public void testEquals2() throws Exception {
31 assertNotEquals(new ModuleIdentifier(fact, inst), null);
35 public void testEquals3() throws Exception {
36 assertNotEquals(new ModuleIdentifier(fact, inst), new ModuleIdentifier(fact, "i"));
40 public void testEquals4() throws Exception {
41 assertNotEquals(new ModuleIdentifier(fact, inst), new ModuleIdentifier("f", inst));
45 public void testEquals5() throws Exception {
46 ModuleIdentifier m1 = new ModuleIdentifier(fact, inst);
51 public void testHashCode() throws Exception {
52 int hash = new ModuleIdentifier(fact, inst).hashCode();
53 assertEquals(hash, new ModuleIdentifier("factory", "instance").hashCode());
57 public void testToString() throws Exception {
58 assertEquals( new ModuleIdentifier("factory", "instance").toString(),
59 new ModuleIdentifier("factory", "instance").toString());