Add AbstractYangTest
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / parser / stmt / rfc7950 / Bug6867BasicTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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
9 package org.opendaylight.yangtools.yang.parser.stmt.rfc7950;
10
11 import static org.hamcrest.CoreMatchers.startsWith;
12 import static org.junit.Assert.assertNotNull;
13
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.InvalidSubstatementException;
16 import org.opendaylight.yangtools.yang.stmt.AbstractYangTest;
17 import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
18
19 public class Bug6867BasicTest extends AbstractYangTest {
20
21     @Test
22     public void valid10Test() throws Exception {
23         assertEffectiveModel("/rfc7950/basic-test/valid-10.yang");
24     }
25
26     @Test
27     public void valid11Test() throws Exception {
28         assertEffectiveModel("/rfc7950/basic-test/valid-11.yang");
29     }
30
31     @Test
32     public void invalid10Test() {
33         assertException(InvalidSubstatementException.class, startsWith("NOTIFICATION is not valid for CONTAINER"),
34             "/rfc7950/basic-test/invalid-10.yang");
35     }
36
37     @Test
38     public void invalid11Test() {
39         assertException(InvalidSubstatementException.class, startsWith("RPC is not valid for CONTAINER"),
40             "/rfc7950/basic-test/invalid-11.yang");
41     }
42
43     @Test
44     public void anyData11Test() throws Exception {
45         assertEffectiveModel("/rfc7950/basic-test/anydata-11.yang");
46     }
47
48     @Test
49     public void anyData10Test() {
50         assertSourceException(startsWith("anydata is not a YANG statement or use of extension"),
51             "/rfc7950/basic-test/anydata-10.yang");
52     }
53
54     @Test
55     public void yangModelTest() throws Exception {
56         assertNotNull(StmtTestUtils.parseYangSources("/rfc7950/model"));
57     }
58
59     @Test
60     public void unsupportedVersionTest() {
61         assertSourceException(startsWith("Unsupported YANG version 2.3"),
62             "/rfc7950/basic-test/unsupported-version.yang");
63     }
64 }