2 * Copyright (c) 2016 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
9 package org.opendaylight.yangtools.yang.stmt;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
14 import java.io.IOException;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18 import org.opendaylight.yangtools.yang.model.repo.api.YinTextSchemaSource;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
20 import org.xml.sax.SAXException;
22 public class Bug5693Test {
27 * Use input stream to load Yin module.
30 public void initTest() throws ReactorException, SAXException, IOException {
31 foo = TestUtils.loadYinModule(YinTextSchemaSource.forResource(getClass(), "/bugs/bug5693/foo.yin"));
35 * Test presence of testing feature (parsed in the last phase), if it is present then parsing was successful.
36 * Meaning that stream was not closed after the first parsing phase.
39 public void bug5693Test() {
40 assertNotNull(foo.getFeatures());
41 assertEquals("Module should has exactly one feature", 1, foo.getFeatures().size());
42 assertEquals("Present feature should has expected local name", "test-input-stream-not-closed",
43 foo.getFeatures().iterator().next().getQName().getLocalName());