X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-rfc7950%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fstmt%2FBug5396Test.java;fp=yang%2Fyang-parser-rfc7950%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fstmt%2FBug5396Test.java;h=87597f9c59d0529ff52897c77f0fef416d3f886f;hb=5ec96dec358f8adf58e8169b367193d67fbc7f3c;hp=caa5a82eb580cc5bbd6c03be4c3e9d16e7b162e2;hpb=3a4bc1e4e2b7d01682834ba8dc802fac8378cdb9;p=yangtools.git diff --git a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5396Test.java b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5396Test.java index caa5a82eb5..87597f9c59 100644 --- a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5396Test.java +++ b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5396Test.java @@ -8,10 +8,11 @@ package org.opendaylight.yangtools.yang.stmt; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.util.List; import org.junit.Test; @@ -19,12 +20,10 @@ import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.SchemaNode; -import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint; import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition; -import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil; public class Bug5396Test { @Test @@ -35,13 +34,12 @@ public class Bug5396Test { QName root = QName.create("foo", "root"); QName myLeaf2 = QName.create("foo", "my-leaf2"); - SchemaPath schemaPath = SchemaPath.create(true, root, myLeaf2); - SchemaNode findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context, schemaPath); - assertTrue(findDataSchemaNode instanceof LeafSchemaNode); + SchemaNode findDataSchemaNode = context.findDataTreeChild(root, myLeaf2).get(); + assertThat(findDataSchemaNode, instanceOf(LeafSchemaNode.class)); LeafSchemaNode leaf2 = (LeafSchemaNode) findDataSchemaNode; TypeDefinition type = leaf2.getType(); - assertTrue(type instanceof UnionTypeDefinition); + assertThat(type, instanceOf(UnionTypeDefinition.class)); UnionTypeDefinition union = (UnionTypeDefinition) type; List> types = union.getTypes(); @@ -53,14 +51,14 @@ public class Bug5396Test { TypeDefinition type2 = types.get(2); TypeDefinition type3 = types.get(3); - assertFalse(type0.equals(type1)); - assertFalse(type0.equals(type2)); - assertFalse(type0.equals(type3)); + assertNotEquals(type0, type1); + assertNotEquals(type0, type2); + assertNotEquals(type0, type3); - assertTrue(type0 instanceof StringTypeDefinition); - assertTrue(type1 instanceof StringTypeDefinition); - assertTrue(type2 instanceof StringTypeDefinition); - assertTrue(type3 instanceof StringTypeDefinition); + assertThat(type0, instanceOf(StringTypeDefinition.class)); + assertThat(type1, instanceOf(StringTypeDefinition.class)); + assertThat(type2, instanceOf(StringTypeDefinition.class)); + assertThat(type3, instanceOf(StringTypeDefinition.class)); StringTypeDefinition stringType0 = (StringTypeDefinition) type0; StringTypeDefinition stringType1 = (StringTypeDefinition) type1;