2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.parser.impl;
11 import java.io.IOException;
12 import java.net.URISyntaxException;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
16 import org.opendaylight.yangtools.yang.parser.util.YangParseException;
18 public class ListKeysTest {
21 public void correctListKeysTest() throws IOException, YangSyntaxErrorException, URISyntaxException {
22 File yangFile = new File(getClass().getResource("/list-keys-test/correct-list-keys-test.yang").toURI());
24 YangParserImpl parser = YangParserImpl.getInstance();
25 parser.parseFile(yangFile, yangFile.getParentFile());
28 @Test(expected = YangParseException.class)
29 public void incorrectListKeysTest1() throws IOException, YangSyntaxErrorException, URISyntaxException {
30 File yangFile = new File(getClass().getResource("/list-keys-test/incorrect-list-keys-test.yang").toURI());
32 YangParserImpl parser = YangParserImpl.getInstance();
33 parser.parseFile(yangFile, yangFile.getParentFile());
36 @Test(expected = YangParseException.class)
37 public void incorrectListKeysTest2() throws IOException, YangSyntaxErrorException, URISyntaxException {
38 File yangFile = new File(getClass().getResource("/list-keys-test/incorrect-list-keys-test2.yang").toURI());
40 YangParserImpl parser = YangParserImpl.getInstance();
41 parser.parseFile(yangFile, yangFile.getParentFile());
44 @Test(expected = YangParseException.class)
45 public void incorrectListKeysTest3() throws IOException, YangSyntaxErrorException, URISyntaxException {
46 File yangFile = new File(getClass().getResource("/list-keys-test/incorrect-list-keys-test3.yang").toURI());
48 YangParserImpl parser = YangParserImpl.getInstance();
49 parser.parseFile(yangFile, yangFile.getParentFile());
52 @Test(expected = YangParseException.class)
53 public void incorrectListKeysTest4() throws IOException, YangSyntaxErrorException, URISyntaxException {
54 File yangFile = new File(getClass().getResource("/list-keys-test/incorrect-list-keys-test4.yang").toURI());
56 YangParserImpl parser = YangParserImpl.getInstance();
57 parser.parseFile(yangFile, yangFile.getParentFile());