2 * Copyright (c) 2015 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
8 package org.opendaylight.controller.messagebus.app.util;
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;
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.stmt.SchemaNodeIdentifier.Absolute;
22 public class TopicDOMNotificationTest {
24 private static final String CONTAINER_NODE_BODY_MOCK_TO_STRING = "containerNodeBodyMock";
25 ContainerNode containerNodeBodyMock;
26 TopicDOMNotification topicDOMNotification;
29 public static void initTestClass() {
34 containerNodeBodyMock = mock(ContainerNode.class);
35 doReturn(CONTAINER_NODE_BODY_MOCK_TO_STRING).when(containerNodeBodyMock).toString();
36 topicDOMNotification = new TopicDOMNotification(containerNodeBodyMock);
40 public void constructorTest() {
41 assertNotNull("Instance has not been created correctly.", topicDOMNotification);
45 public void getTypeTest() {
46 assertEquals("Type has not been created correctly.", Absolute.of(TopicNotification.QNAME),
47 topicDOMNotification.getType());
51 public void getBodyTest() {
52 assertEquals("String has not been created correctly.", containerNodeBodyMock, topicDOMNotification.getBody());
56 public void getToStringTest() {
57 String bodyString = "TopicDOMNotification [body=" + CONTAINER_NODE_BODY_MOCK_TO_STRING + "]";
58 assertEquals("String has not been created correctly.", bodyString, topicDOMNotification.toString());