Remove unneeded throws
[yangtools.git] / parser / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / AbstractModelTest.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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.junit.Assert.assertEquals;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.junit.BeforeClass;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.common.QNameModule;
16 import org.opendaylight.yangtools.yang.common.Revision;
17 import org.opendaylight.yangtools.yang.common.XMLNamespace;
18 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
19 import org.opendaylight.yangtools.yang.model.api.Module;
20
21 /**
22  * Abstract base class for tests of the model context available in {@code src/test/resources/model}.
23  */
24 public abstract class AbstractModelTest extends AbstractYangTest {
25     private static final QNameModule FOO_NS =
26         QNameModule.create(XMLNamespace.of("urn:opendaylight.foo"), Revision.of("2013-02-27"));
27     private static final QNameModule BAR_NS =
28         QNameModule.create(XMLNamespace.of("urn:opendaylight.bar"), Revision.of("2013-07-03"));
29     private static final QNameModule BAZ_NS =
30         QNameModule.create(XMLNamespace.of("urn:opendaylight.baz"), Revision.of("2013-02-27"));
31
32     static EffectiveModelContext CTX;
33     static Module FOO;
34     static Module BAR;
35     static Module BAZ;
36
37     @BeforeClass
38     public static void beforeClass() throws Exception {
39         CTX = assertEffectiveModelDir("/model");
40         assertEquals(3, CTX.getModules().size());
41
42         FOO = CTX.findModules("foo").iterator().next();
43         BAR = CTX.findModules("bar").iterator().next();
44         BAZ = CTX.findModules("baz").iterator().next();
45     }
46
47     static final @NonNull QName fooQName(final String localName) {
48         return QName.create(FOO_NS, localName);
49     }
50
51     static final @NonNull QName barQName(final String localName) {
52         return QName.create(BAR_NS, localName);
53     }
54
55     static final @NonNull QName bazQName(final String localName) {
56         return QName.create(BAZ_NS, localName);
57     }
58 }