*/
package org.opendaylight.yangtools.yang.stmt;
+import static org.hamcrest.Matchers.isA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
fail("ReactorException should be thrown.");
} catch (ReactorException e) {
final Throwable cause = e.getCause();
- assertTrue(cause instanceof SourceException);
+ assertThat(cause, isA(SourceException.class));
assertTrue(cause.getMessage().startsWith("String 'not_supported' is not valid deviate argument"));
}
}
*/
package org.opendaylight.yangtools.yang.stmt;
+import static org.hamcrest.Matchers.isA;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
SchemaPath leafRef2Path = SchemaPath.create(true, root, leafRef2);
SchemaNode findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context, leafRefPath);
SchemaNode findDataSchemaNode2 = SchemaContextUtil.findDataSchemaNode(context, leafRef2Path);
- assertTrue(findDataSchemaNode instanceof LeafSchemaNode);
- assertTrue(findDataSchemaNode2 instanceof LeafSchemaNode);
+ assertThat(findDataSchemaNode, isA(LeafSchemaNode.class));
+ assertThat(findDataSchemaNode2, isA(LeafSchemaNode.class));
+
LeafSchemaNode leafRefNode = (LeafSchemaNode) findDataSchemaNode;
LeafSchemaNode leafRefNode2 = (LeafSchemaNode) findDataSchemaNode2;
- assertTrue(leafRefNode.getType() instanceof LeafrefTypeDefinition);
- assertTrue(leafRefNode2.getType() instanceof LeafrefTypeDefinition);
+ assertThat(leafRefNode.getType(), isA(LeafrefTypeDefinition.class));
+ assertThat(leafRefNode2.getType(), isA(LeafrefTypeDefinition.class));
TypeDefinition<?> baseTypeForLeafRef = SchemaContextUtil.getBaseTypeForLeafRef(
(LeafrefTypeDefinition) leafRefNode.getType(), context, leafRefNode);
TypeDefinition<?> baseTypeForLeafRef2 = SchemaContextUtil.getBaseTypeForLeafRef(
(LeafrefTypeDefinition) leafRefNode2.getType(), context, leafRefNode2);
- assertTrue(baseTypeForLeafRef instanceof BinaryTypeDefinition);
- assertTrue(baseTypeForLeafRef2 instanceof Int16TypeDefinition);
+ assertThat(baseTypeForLeafRef, isA(BinaryTypeDefinition.class));
+ assertThat(baseTypeForLeafRef2, isA(Int16TypeDefinition.class));
}
}
*/
package org.opendaylight.yangtools.yang.stmt;
+import static org.hamcrest.Matchers.isA;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertThat;
import java.util.Iterator;
import java.util.Set;
while (iterator.hasNext()) {
AugmentationSchemaNode allAugments = iterator.next();
final DataSchemaNode currentChoice = allAugments.getChildNodes().iterator().next();
- assertTrue(currentChoice instanceof CaseSchemaNode);
+ assertThat(currentChoice, isA(CaseSchemaNode.class));
}
}
}
\ No newline at end of file
*/
package org.opendaylight.yangtools.yang.stmt.yin;
+import static org.hamcrest.Matchers.isA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.Iterator;
assertEquals(1, augment.getChildNodes().size());
final DataSchemaNode caseNode = augment.findDataChildByName(
QName.create(testModule.getQNameModule(), "main-impl")).get();
- assertTrue(caseNode instanceof CaseSchemaNode);
+ assertThat(caseNode, isA(CaseSchemaNode.class));
}
}
*/
package org.opendaylight.yangtools.yang.stmt.yin;
+import static org.hamcrest.Matchers.isA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.Collection;
import org.opendaylight.yangtools.yang.stmt.TestUtils;
public class YinFileListStmtTest extends AbstractYinModulesTest {
-
@Test
public void testListAndLeaves() {
final Module testModule = TestUtils.findModule(context, "config").get();
assertEquals("type", leaf.getQName().getLocalName());
final TypeDefinition<?> leafType = leaf.getType();
- assertTrue(leafType instanceof IdentityrefTypeDefinition);
+ assertThat(leafType, isA(IdentityrefTypeDefinition.class));
assertEquals("module-type", ((IdentityrefTypeDefinition)leafType).getIdentities().iterator().next().getQName()
.getLocalName());
assertTrue(leaf.isMandatory());
}
-
}
*/
package org.opendaylight.yangtools.yang.stmt.yin;
+import static org.hamcrest.Matchers.isA;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
fail("Reactor exception should have been thrown");
} catch (ReactorException e) {
final Throwable cause = e.getCause();
- assertTrue(cause instanceof SourceException);
+ assertThat(cause, isA(SourceException.class));
assertTrue(cause.getMessage().startsWith(
"Key argument 'testing-string testing-string' contains duplicates"));
}
*/
package org.opendaylight.yangtools.yang.thirdparty.plugin;
+import static org.hamcrest.Matchers.isA;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertThat;
import java.io.IOException;
import java.net.URISyntaxException;
final SchemaContext schema = reactor.buildEffective();
final DataSchemaNode dataChildByName = schema.getDataChildByName(QName.create(NS, REV, "root"));
- assertTrue(dataChildByName instanceof ContainerSchemaNode);
+ assertThat(dataChildByName, isA(ContainerSchemaNode.class));
+
final ContainerSchemaNode root = (ContainerSchemaNode) dataChildByName;
final List<UnknownSchemaNode> unknownSchemaNodes = root.getUnknownSchemaNodes();
assertEquals(1, unknownSchemaNodes.size());
final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.get(0);
- assertTrue(unknownSchemaNode instanceof ThirdPartyExtensionEffectiveStatement);
+ assertThat(unknownSchemaNode, isA(ThirdPartyExtensionEffectiveStatement.class));
final ThirdPartyExtensionEffectiveStatement thirdPartyExtensionStmt =
(ThirdPartyExtensionEffectiveStatement) unknownSchemaNode;
assertEquals("Third-party namespace test.", thirdPartyExtensionStmt.getValueFromNamespace());