2 * Copyright (c) 2015 Cisco Systems, Inc. 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.stmt.test.yin;
10 import static org.hamcrest.CoreMatchers.anyOf;
11 import static org.hamcrest.core.Is.is;
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertNotNull;
14 import static org.junit.Assert.assertThat;
16 import java.net.URISyntaxException;
17 import java.util.Iterator;
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
22 import org.opendaylight.yangtools.yang.model.api.Module;
23 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
24 import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
26 public class YinFileFeatureStmtTest {
28 private Set<Module> modules;
31 public void init() throws URISyntaxException, ReactorException {
32 modules = TestUtils.loadYinModules(getClass().getResource
33 ("/semantic-statement-parser/yin/feature-test/").toURI());
34 assertEquals(1, modules.size());
38 public void testFeature() {
39 Module testModule = TestUtils.findModule(modules, "yang-with-features");
40 assertNotNull(testModule);
42 Set<FeatureDefinition> features = testModule.getFeatures();
43 assertEquals(2, features.size());
45 Iterator<FeatureDefinition> featuresIterator = features.iterator();
46 FeatureDefinition feature = featuresIterator.next();
48 assertThat(feature.getQName().getLocalName(), anyOf(is("arbitrary-names"), is("pre-provisioning")));
50 feature = featuresIterator.next();
52 assertThat(feature.getQName().getLocalName(), anyOf(is("arbitrary-names"), is("pre-provisioning")));