Bug 5947: Increasing code coverage - yang util
[mdsal.git] / binding / yang-binding / src / test / java / org / opendaylight / yangtools / yang / binding / util / QNameRpcServiceInvokerTest.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.yangtools.yang.binding.util;
9
10 import static org.junit.Assert.assertNotNull;
11 import static org.junit.Assert.fail;
12 import static org.mockito.Mockito.mock;
13
14 import com.google.common.collect.ImmutableMap;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.binding.RpcService;
17 import org.opendaylight.yangtools.yang.common.QName;
18
19 public class QNameRpcServiceInvokerTest {
20
21     @Test
22     public void instanceForTest() throws Exception {
23         assertNotNull(QNameRpcServiceInvoker.instanceFor(ImmutableMap.of()));
24     }
25
26     @Test(expected = IllegalArgumentException.class)
27     public void qnameToKeyTest() throws Exception {
28         final RpcService rpcService = mock(RpcService.class);
29         QNameRpcServiceInvoker.instanceFor(ImmutableMap.of()).invokeRpc(rpcService, QName.create("test"), null);
30         fail("Expected exception: constructed with empty map");
31     }
32 }