Merge "Remove raw references to Map in XSQL"
[controller.git] / opendaylight / config / config-api / src / test / java / org / opendaylight / controller / config / api / JmxAttributeTest.java
1 package org.opendaylight.controller.config.api;
2
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotEquals;
5 import static org.junit.Assert.assertNotNull;
6
7 import org.junit.Test;
8
9 public class JmxAttributeTest {
10
11     @Test
12     public void testJmxAttribute() throws Exception {
13         JmxAttribute attr = new JmxAttribute("test");
14         assertEquals("test", attr.getAttributeName());
15     }
16
17     @Test
18     public void testToString() throws Exception {
19         JmxAttribute attr = new JmxAttribute("test");
20         assertEquals(attr.toString(), new JmxAttribute("test").toString());
21     }
22
23     @Test(expected = NullPointerException.class)
24     public void testJmxAttributeInvalid() throws Exception {
25         JmxAttribute attr = new JmxAttribute(null);
26     }
27
28     @Test
29     public void testJmxAttributeEqual() throws Exception {
30         JmxAttribute a1 = new JmxAttribute("test_string");
31         JmxAttribute a2 = new JmxAttribute("test_string");
32         assertEquals(a1, a2);
33     }
34
35     @Test
36     public void testJmxAttributeNotEqual() throws Exception {
37         JmxAttribute a1 = new JmxAttribute("test_string");
38         JmxAttribute a2 = new JmxAttribute("different");
39         assertNotEquals(a1, a2);
40     }
41
42     @Test
43     public void testJmxAttributeEqual2() throws Exception {
44         JmxAttribute a1 = new JmxAttribute("test_string");
45         assertNotNull(a1);
46     }
47
48     @Test
49     public void testJmxAttributeHashCode() throws Exception {
50         JmxAttribute a1 = new JmxAttribute("test_string");
51         assertEquals(a1.hashCode(), new String("test_string").hashCode());
52     }
53 }