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.junit.Assert.assertThrows;
12 import static org.mockito.Mockito.mock;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
18 public class QNameToStatementDefinitionMapTest {
19 private static final QName QNAME = QName.create("", "a");
21 private final QNameToStatementDefinitionMap map = new QNameToStatementDefinitionMap();
22 private final StatementSupport<?, ?, ?> support = mock(StatementSupport.class);
25 public void testPutNullNull() {
26 assertThrows(NullPointerException.class, () -> map.put(null, null));
30 public void testPutNullSome() {
31 assertThrows(NullPointerException.class, () -> map.put(null, mock(StatementSupport.class)));
35 public void testPutSomeNull() {
36 assertThrows(NullPointerException.class, () -> map.put(QName.create("", "a"), null));
40 public void testPut() {
41 map.put(QNAME, support);
42 assertSame(support, map.get(QNAME));