Merge "Fix modules Restconf call for mounted devices"
[controller.git] / opendaylight / md-sal / messagebus-impl / src / test / java / org / opendaylight / controller / messagebus / app / impl / TopicDOMNotificationTest.java
1 /*
2  * Copyright (c) 2015 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 package org.opendaylight.controller.messagebus.app.impl;
9
10 import org.junit.Before;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.TopicNotification;
14 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16
17 import static org.junit.Assert.assertEquals;
18 import static org.junit.Assert.assertNotNull;
19 import static org.mockito.Mockito.mock;
20
21 public class TopicDOMNotificationTest {
22
23     ContainerNode containerNodeBodyMock;
24     TopicDOMNotification topicDOMNotification;
25
26     @BeforeClass
27     public static void initTestClass() throws IllegalAccessException, InstantiationException {
28     }
29
30     @Before
31     public void setUp() throws Exception {
32         containerNodeBodyMock = mock(ContainerNode.class);
33         topicDOMNotification = new TopicDOMNotification(containerNodeBodyMock);
34     }
35
36     @Test
37     public void constructorTest() {
38         assertNotNull("Instance has not been created correctly.", topicDOMNotification);
39     }
40
41     @Test
42     public void getTypeTest() {
43         SchemaPath TOPIC_NOTIFICATION_ID = SchemaPath.create(true, TopicNotification.QNAME);
44         assertEquals("Type has not been created correctly.", TOPIC_NOTIFICATION_ID, topicDOMNotification.getType());
45     }
46
47     @Test
48     public void getBodyTest() {
49         assertEquals("String has not been created correctly.", containerNodeBodyMock, topicDOMNotification.getBody());
50     }
51
52     @Test
53     public void getToStringTest() {
54         String bodyString = "TopicDOMNotification [body=" + containerNodeBodyMock + "]";
55         assertEquals("String has not been created correctly.", bodyString, topicDOMNotification.toString());
56     }
57 }