Merge "BUG-2953: do not use a complete InMemoryDataStore"
[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 static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.mockito.Mockito.doReturn;
13 import static org.mockito.Mockito.mock;
14
15 import org.junit.Before;
16 import org.junit.BeforeClass;
17 import org.junit.Test;
18 import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.TopicNotification;
19 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
20 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
21
22 public class TopicDOMNotificationTest {
23
24     private static final String containerNodeBodyMockToString = "containerNodeBodyMock";
25     ContainerNode containerNodeBodyMock;
26     TopicDOMNotification topicDOMNotification;
27
28     @BeforeClass
29     public static void initTestClass() throws IllegalAccessException, InstantiationException {
30     }
31
32     @Before
33     public void setUp() throws Exception {
34         containerNodeBodyMock = mock(ContainerNode.class);
35         doReturn(containerNodeBodyMockToString).when(containerNodeBodyMock).toString();
36         topicDOMNotification = new TopicDOMNotification(containerNodeBodyMock);
37     }
38
39     @Test
40     public void constructorTest() {
41         assertNotNull("Instance has not been created correctly.", topicDOMNotification);
42     }
43
44     @Test
45     public void getTypeTest() {
46         SchemaPath TOPIC_NOTIFICATION_ID = SchemaPath.create(true, TopicNotification.QNAME);
47         assertEquals("Type has not been created correctly.", TOPIC_NOTIFICATION_ID, topicDOMNotification.getType());
48     }
49
50     @Test
51     public void getBodyTest() {
52         assertEquals("String has not been created correctly.", containerNodeBodyMock, topicDOMNotification.getBody());
53     }
54
55     @Test
56     public void getToStringTest() {
57         String bodyString = "TopicDOMNotification [body=" + containerNodeBodyMockToString + "]";
58         assertEquals("String has not been created correctly.", bodyString, topicDOMNotification.toString());
59     }
60 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.