Fix checkstyle issues to enforce it
[controller.git] / opendaylight / config / config-api / src / test / java / org / opendaylight / controller / config / api / JmxAttributeTest.java
1 /*
2  * Copyright (c) 2014, 2017 Cisco Systems, Inc. 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.controller.config.api;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotEquals;
13 import static org.junit.Assert.assertNotNull;
14
15 import org.junit.Test;
16
17 public class JmxAttributeTest {
18
19     @Test
20     public void testJmxAttribute() throws Exception {
21         JmxAttribute attr = new JmxAttribute("test");
22         assertEquals("test", attr.getAttributeName());
23     }
24
25     @Test
26     public void testToString() throws Exception {
27         JmxAttribute attr = new JmxAttribute("test");
28         assertEquals(attr.toString(), new JmxAttribute("test").toString());
29     }
30
31     @Test(expected = NullPointerException.class)
32     public void testJmxAttributeInvalid() throws Exception {
33         JmxAttribute attr = new JmxAttribute(null);
34     }
35
36     @Test
37     public void testJmxAttributeEqual() throws Exception {
38         JmxAttribute a1 = new JmxAttribute("test_string");
39         JmxAttribute a2 = new JmxAttribute("test_string");
40         assertEquals(a1, a2);
41     }
42
43     @Test
44     public void testJmxAttributeNotEqual() throws Exception {
45         JmxAttribute a1 = new JmxAttribute("test_string");
46         JmxAttribute a2 = new JmxAttribute("different");
47         assertNotEquals(a1, a2);
48     }
49
50     @Test
51     public void testJmxAttributeEqual2() throws Exception {
52         JmxAttribute a1 = new JmxAttribute("test_string");
53         assertNotNull(a1);
54     }
55
56     @Test
57     public void testJmxAttributeHashCode() throws Exception {
58         JmxAttribute a1 = new JmxAttribute("test_string");
59         assertEquals(a1.hashCode(), new String("test_string").hashCode());
60     }
61 }