Clean up TreeNode API
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / ListKeysTest.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 package org.opendaylight.yangtools.yang.stmt;
9
10 import static org.hamcrest.CoreMatchers.startsWith;
11
12 import org.junit.jupiter.api.Test;
13
14 class ListKeysTest extends AbstractYangTest {
15     @Test
16     void correctListKeysTest() {
17         assertEffectiveModel("/list-keys-test/correct-list-keys-test.yang");
18     }
19
20     @Test
21     void incorrectListKeysTest1() {
22         assertInferenceException(startsWith("Key 'test1_key1 test1_key2' misses node 'test1_key2'"),
23             "/list-keys-test/incorrect-list-keys-test.yang");
24     }
25
26     @Test
27     void incorrectListKeysTest2() {
28         assertInferenceException(startsWith("Key 'test1_key1 test1_key2' misses node 'test1_key2'"),
29             "/list-keys-test/incorrect-list-keys-test2.yang");
30     }
31
32     @Test
33     void incorrectListKeysTest3() {
34         assertInferenceException(startsWith("Key 'grp_list' misses node 'grp_list'"),
35             "/list-keys-test/incorrect-list-keys-test3.yang");
36     }
37
38     @Test
39     void incorrectListKeysTest4()  {
40         assertInferenceException(startsWith("Key 'grp_leaf' misses node 'grp_leaf'"),
41             "/list-keys-test/incorrect-list-keys-test4.yang");
42     }
43 }