Vidyashree Rama | 210c01d | 2016-05-20 16:29:25 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onosproject.yangutils.parser.impl.parseutils; |
| 18 | |
| 19 | import java.io.IOException; |
| 20 | import org.junit.Rule; |
| 21 | import org.junit.Test; |
| 22 | import org.junit.rules.ExpectedException; |
| 23 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
| 24 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
| 25 | |
| 26 | /** |
| 27 | * Test case for testing listener util. |
| 28 | */ |
| 29 | public 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 | } |