2 * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.config.api;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotEquals;
13 import static org.junit.Assert.assertNotNull;
15 import org.junit.Test;
17 public class JmxAttributeTest {
20 public void testJmxAttribute() throws Exception {
21 JmxAttribute attr = new JmxAttribute("test");
22 assertEquals("test", attr.getAttributeName());
26 public void testToString() throws Exception {
27 JmxAttribute attr = new JmxAttribute("test");
28 assertEquals(attr.toString(), new JmxAttribute("test").toString());
31 @Test(expected = NullPointerException.class)
32 public void testJmxAttributeInvalid() throws Exception {
33 JmxAttribute attr = new JmxAttribute(null);
37 public void testJmxAttributeEqual() throws Exception {
38 JmxAttribute a1 = new JmxAttribute("test_string");
39 JmxAttribute a2 = new JmxAttribute("test_string");
44 public void testJmxAttributeNotEqual() throws Exception {
45 JmxAttribute a1 = new JmxAttribute("test_string");
46 JmxAttribute a2 = new JmxAttribute("different");
47 assertNotEquals(a1, a2);
51 public void testJmxAttributeEqual2() throws Exception {
52 JmxAttribute a1 = new JmxAttribute("test_string");
57 public void testJmxAttributeHashCode() throws Exception {
58 JmxAttribute a1 = new JmxAttribute("test_string");
59 assertEquals(a1.hashCode(), new String("test_string").hashCode());