Update yang-parser-api
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / YT971Test.java
index d103d07fe98f7ab56eefdf48a9304b146f3370f1..3644bd3daaab9cb7cd1f3afc5f4066c4be59f996 100644 (file)
@@ -12,8 +12,6 @@ import static org.hamcrest.core.IsInstanceOf.instanceOf;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import java.io.IOException;
-import java.net.URISyntaxException;
 import java.util.Optional;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -26,32 +24,29 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.type.Int16TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.Int32TypeDefinition;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class YT971Test {
     private static final QNameModule NAMESPACE = QNameModule.create(XMLNamespace.of("test"), Revision.of("2019-03-25"));
 
     @Test
-    public void testEscapeLexer() throws URISyntaxException, IOException, YangSyntaxErrorException, ReactorException {
+    public void testEscapeLexer() throws Exception {
         final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/bugs/YT971/test.yang");
         assertNotNull(schemaContext);
 
-        final DataSchemaNode someContainer = schemaContext.findDataChildByName(
-            QName.create(NAMESPACE, "some-container")).get();
+        final DataSchemaNode someContainer = schemaContext.getDataChildByName(
+            QName.create(NAMESPACE, "some-container"));
         assertThat(someContainer, instanceOf(ContainerSchemaNode.class));
         final ContainerSchemaNode containerSchemaNode = (ContainerSchemaNode) someContainer;
 
-        final DataSchemaNode someLeaf = containerSchemaNode.findDataChildByName(QName.create(NAMESPACE, "some-leaf"))
-                .get();
+        final DataSchemaNode someLeaf = containerSchemaNode.getDataChildByName(QName.create(NAMESPACE, "some-leaf"));
         assertThat(someLeaf, instanceOf(LeafSchemaNode.class));
         final LeafSchemaNode leafSchemaNode = (LeafSchemaNode) someLeaf;
         assertEquals(Optional.of("Some string that ends with a backslash (with escape backslash too) \\"),
                      leafSchemaNode.getDescription());
         assertThat(leafSchemaNode.getType(), instanceOf(Int16TypeDefinition.class));
 
-        final DataSchemaNode someOtherLeaf = containerSchemaNode.findDataChildByName(
-                QName.create(NAMESPACE, "some-other-leaf")).get();
+        final DataSchemaNode someOtherLeaf = containerSchemaNode.getDataChildByName(
+            QName.create(NAMESPACE, "some-other-leaf"));
         assertThat(someOtherLeaf, instanceOf(LeafSchemaNode.class));
 
         final LeafSchemaNode otherLeafSchemaNode = (LeafSchemaNode) someOtherLeaf;