checkStyleViolationSeverity=error implemented for mdsal-dom-broker
[mdsal.git] / dom / mdsal-dom-broker / src / test / java / org / opendaylight / mdsal / dom / broker / RoutedDOMRpcRoutingTableEntryTest.java
1 /*
2  * Copyright (c) 2016 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.mdsal.dom.broker;
9
10 import static org.junit.Assert.assertNotNull;
11 import static org.junit.Assert.assertTrue;
12 import static org.junit.Assert.fail;
13 import static org.mockito.Mockito.doReturn;
14 import static org.mockito.Mockito.mock;
15
16 import java.util.HashMap;
17 import org.junit.Test;
18 import org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException;
19 import org.opendaylight.mdsal.dom.broker.util.TestModel;
20 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
21 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
22
23 public class RoutedDOMRpcRoutingTableEntryTest extends TestUtils {
24
25     @SuppressWarnings("checkstyle:IllegalCatch")
26     @Test
27     public void basicTest() throws Exception {
28         final RpcDefinition rpcDefinition = mock(RpcDefinition.class);
29         doReturn(SchemaPath.ROOT).when(rpcDefinition).getPath();
30
31         final RoutedDOMRpcRoutingTableEntry routedDOMRpcRoutingTableEntry =
32                 new RoutedDOMRpcRoutingTableEntry(rpcDefinition, TestModel.TEST_PATH, new HashMap<>());
33         assertNotNull(routedDOMRpcRoutingTableEntry.newInstance(new HashMap<>()));
34
35         try {
36             routedDOMRpcRoutingTableEntry.invokeRpc(TEST_CHILD).checkedGet();
37             fail("Expected DOMRpcImplementationNotAvailableException");
38         } catch (final Exception e) {
39             assertTrue(e instanceof DOMRpcImplementationNotAvailableException);
40         }
41     }
42 }