1 package org.opendaylight.controller.config.api;
3 import junit.framework.Assert;
6 import static org.junit.Assert.assertEquals;
7 import static org.junit.Assert.assertFalse;
8 import static org.junit.Assert.assertNotEquals;
10 public class ModuleIdentifierTest {
11 String fact = new String("factory");
12 String inst = new String("instance");
14 @Test(expected = IllegalArgumentException.class)
15 public void testConstructor() throws Exception {
16 ModuleIdentifier m = new ModuleIdentifier(null, "instance");
19 @Test(expected = IllegalArgumentException.class)
20 public void testConstructor2() throws Exception {
21 ModuleIdentifier m = new ModuleIdentifier("name", null);
25 public void testEquals() throws Exception {
27 ModuleIdentifier m1 = new ModuleIdentifier(fact, inst);
28 assertEquals(m1, new ModuleIdentifier(fact, inst));
32 public void testEquals2() throws Exception {
33 assertNotEquals(new ModuleIdentifier(fact, inst), null);
37 public void testEquals3() throws Exception {
38 assertNotEquals(new ModuleIdentifier(fact, inst), new ModuleIdentifier(fact, "i"));
42 public void testEquals4() throws Exception {
43 assertNotEquals(new ModuleIdentifier(fact, inst), new ModuleIdentifier("f", inst));
47 public void testEquals5() throws Exception {
48 ModuleIdentifier m1 = new ModuleIdentifier(fact, inst);
53 public void testHashCode() throws Exception {
54 int hash = new ModuleIdentifier(fact, inst).hashCode();
55 assertEquals(hash, new ModuleIdentifier("factory", "instance").hashCode());
59 public void testToString() throws Exception {
60 assertEquals( new ModuleIdentifier("factory", "instance").toString(),
61 new ModuleIdentifier("factory", "instance").toString());