2 * Copyright (c) 2017 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;
10 import static org.junit.Assert.assertNotNull;
11 import static org.junit.Assert.assertTrue;
12 import static org.junit.Assert.fail;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
18 public class Bug8831Test {
20 public void test() throws Exception {
21 final SchemaContext context = TestUtils.parseYangSources("/bugs/bug8831/valid");
22 assertNotNull(context);
26 public void invalidModelsTest() throws Exception {
28 TestUtils.parseYangSource("/bugs/bug8831/invalid/inv-model.yang");
29 fail("Test should fails due to invalid yang 1.1 model");
30 } catch (final SomeModifiersUnresolvedException e) {
32 e.getCause().getMessage().contains("has default value 'any' marked with an if-feature statement"));
37 public void invalidModelsTest2() throws Exception {
39 TestUtils.parseYangSource("/bugs/bug8831/invalid/inv-model2.yang");
40 fail("Test should fails due to invalid yang 1.1 model");
41 } catch (final SomeModifiersUnresolvedException e) {
43 e.getCause().getMessage().contains("has default value 'any' marked with an if-feature statement"));