blob: c29b12672a8e1ba57f5099bc0cfa21944459d3a7 [file] [log] [blame]
Vidyashree Rama210c01d2016-05-20 16:29:25 +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.parseutils;
18
19import java.io.IOException;
20import org.junit.Rule;
21import org.junit.Test;
22import org.junit.rules.ExpectedException;
23import org.onosproject.yangutils.parser.exceptions.ParserException;
24import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
25
26/**
27 * Test case for testing listener util.
28 */
29public class ListenerUtilTest {
30
31 @Rule
32 public ExpectedException thrown = ExpectedException.none();
33
34 private final YangUtilsParserManager manager = new YangUtilsParserManager();
35
36 /**
37 * Checks whether exception is thrown when identifier starts with xml.
38 */
39 @Test
40 public void validateIdentifierStartsWithXml() throws IOException {
41 thrown.expect(ParserException.class);
42 thrown.expectMessage("YANG file error : module identifier xMlTest must not start" +
43 " with (('X'|'x') ('M'|'m') ('L'|'l'))");
44 manager.getDataModel("src/test/resources/InValidIdentifierXML.yang");
45 }
46}