blob: cebd6807793882f2f465775bd90be97a2acb8a69 [file] [log] [blame]
Vidyashree Rama1db15562016-05-17 16:16:15 +05301/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.yangutils.parser.impl;
18
19import java.io.IOException;
20
21import org.junit.Rule;
22import org.junit.Test;
23import org.junit.rules.ExpectedException;
24import org.onosproject.yangutils.parser.exceptions.ParserException;
25
26/**
27 * Test cases for testing tree walk listener functionality.
28 */
29public class TreeWalkListenerTest {
30
31 private final YangUtilsParserManager manager = new YangUtilsParserManager();
32
33 @Rule
34 public ExpectedException thrown = ExpectedException.none();
35 /**
36 * Checks whether exception is thrown for ordered statement.
37 */
38 @Test
39 public void processOrderedByStatement() throws IOException, ParserException {
40 thrown.expect(ParserException.class);
41 thrown.expectMessage("YANG file error : \"ordered-by\" is not supported in current version, please check wiki" +
42 " for YANG utils road map.");
43 manager.getDataModel("src/test/resources/OrderedByStatement.yang");
44 }
45
46 /**
47 * Checks whether exception is thrown for anyxml statement.
48 */
49 @Test
50 public void processAnyXmlStatement() throws IOException, ParserException {
51 thrown.expect(ParserException.class);
52 thrown.expectMessage("YANG file error : \"anyxml\" is not supported.");
53 manager.getDataModel("src/test/resources/AnyxmlStatement.yang");
54 }
55}