Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-parser-spi / src / test / java / org / opendaylight / yangtools / yang / parser / spi / validation / ValidationBundlesNamespaceTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.parser.spi.validation;
9
10 import static org.junit.Assert.assertSame;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
13 import static org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace.BEHAVIOUR;
14 import static org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace.ValidationBundleType.SUPPORTED_DATA_NODES;
15
16 import java.util.Collection;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
20
21 public class ValidationBundlesNamespaceTest {
22     @Test
23     public void testBehaviour() {
24         final NamespaceStorageNode node = mock(NamespaceStorageNode.class);
25         doReturn(StorageNodeType.GLOBAL).when(node).getStorageNodeType();
26
27         final Collection<?> result = mock(Collection.class);
28         doReturn(result).when(node).getFromLocalStorage(ValidationBundlesNamespace.class, SUPPORTED_DATA_NODES);
29         assertSame(result, BEHAVIOUR.getFrom(node, SUPPORTED_DATA_NODES));
30     }
31 }