Reduce use of getChildByName()
[yangtools.git] / yang / yang-data-impl / src / test / java / org / opendaylight / yangtools / yang / data / impl / codecs / StringPatternCheckingCodecTest.java
index e053e30c1c150bd08e4b72592d661d6dfb91f413..5922e6bf1d881b1f92ca447daa6efcbaab5946f0 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.assertEquals;
@@ -39,13 +38,11 @@ public class StringPatternCheckingCodecTest {
         final QNameModule testModuleQName = QNameModule.create(URI.create("string-pattern-checking-codec-test"));
 
         final Module testModule = schemaContext.findModules("string-pattern-checking-codec-test").iterator().next();
-        final ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.getDataChildByName(
-                QName.create(testModuleQName, "test-container"));
-        assertNotNull(testContainer);
+        final ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.findDataChildByName(
+                QName.create(testModuleQName, "test-container")).get();
 
-        final LeafSchemaNode testLeaf = (LeafSchemaNode) testContainer.getDataChildByName(
-                QName.create(testModuleQName, "string-leaf-with-valid-pattern"));
-        assertNotNull(testLeaf);
+        final LeafSchemaNode testLeaf = (LeafSchemaNode) testContainer.findDataChildByName(
+                QName.create(testModuleQName, "string-leaf-with-valid-pattern")).get();
 
         final StringCodec<String> codec = getCodec(testLeaf.getType(), StringCodec.class);
         assertNotNull(codec);