2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.yangtools.yang.parser.spi.source;
10 import static org.junit.Assert.assertSame;
11 import static org.mockito.Mockito.mock;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
17 public class QNameToStatementDefinitionMapTest {
18 private static final QName QNAME = QName.create("", "a");
20 private final QNameToStatementDefinitionMap map = new QNameToStatementDefinitionMap();
21 private final StatementSupport<?, ?, ?> support = mock(StatementSupport.class);
23 @Test(expected = NullPointerException.class)
24 public void testPutNullNull() {
28 @Test(expected = NullPointerException.class)
29 public void testPutNullSome() {
30 map.put(null, mock(StatementSupport.class));
33 @Test(expected = NullPointerException.class)
34 public void testPutSomeNull() {
35 map.put(QName.create("", "a"), null);
39 public void testPut() {
40 map.put(QNAME, support);
41 assertSame(support, map.get(QNAME));