final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"),Revision.of("2014-10-07")).get();
+ final Module myModule = context.findModule(URI.create("uri:my-module"), Revision.of("2014-10-07")).get();
SchemaNode testNode = ((ContainerSchemaNode) myModule.getDataChildByName(QName.create(
myModule.getQNameModule(), "my-container"))).getDataChildByName(QName.create(myModule.getQNameModule(),
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), Revision.of("2014-10-07")).get();
+ final Module myModule = context.findModule(URI.create("uri:my-module"), Revision.of("2014-10-07")).get();
SchemaNode testNode = ((ContainerSchemaNode) myModule.getDataChildByName(QName.create(
myModule.getQNameModule(), "my-container"))).getDataChildByName(QName.create(myModule.getQNameModule(),
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), Revision.of("2014-10-07")).get();
+ final Module myModule = context.findModule(URI.create("uri:my-module"), Revision.of("2014-10-07")).get();
SchemaNode testNode = myModule.getDataChildByName(QName.create(myModule.getQNameModule(), "my-container"));
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), Revision.of("2014-10-07")).get();
+ final Module myModule = context.findModule(URI.create("uri:my-module"), Revision.of("2014-10-07")).get();
final DataSchemaNode node = myModule.getDataChildByName(QName.create(myModule.getQNameModule(),
"my-container"));
assertEquals(myModule, foundModule);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = NullPointerException.class)
public void findParentModuleIllegalArgumentTest() {
-
- final SchemaContext mockContext = mock(SchemaContext.class);
- SchemaContextUtil.findParentModule(mockContext, null);
-
+ SchemaContextUtil.findParentModule(mock(SchemaContext.class), null);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = NullPointerException.class)
public void findParentModuleIllegalArgumentTest2() {
-
- final SchemaNode mockSchemaNode = mock(SchemaNode.class);
- SchemaContextUtil.findParentModule(null, mockSchemaNode);
-
+ SchemaContextUtil.findParentModule(null, mock(SchemaNode.class));
}
- @Test(expected = IllegalStateException.class)
- public void findParentModuleIllegalStateTest() {
- final SchemaContext mockContext = mock(SchemaContext.class);
- final SchemaNode mockSchemaNode = mock(SchemaNode.class);
- when(mockSchemaNode.getPath()).thenReturn(null);
- SchemaContextUtil.findParentModule(mockContext, mockSchemaNode);
- }
-
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = NullPointerException.class)
public void findDataSchemaNodeIllegalArgumentTest() {
- final SchemaContext mockContext = mock(SchemaContext.class);
- SchemaContextUtil.findDataSchemaNode(mockContext, null);
+ SchemaContextUtil.findDataSchemaNode(mock(SchemaContext.class), null);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = NullPointerException.class)
public void findDataSchemaNodeIllegalArgumentTest2() {
- final SchemaPath mockSchemaPath = mock(SchemaPath.class);
- SchemaContextUtil.findDataSchemaNode(null, mockSchemaPath);
+ SchemaContextUtil.findDataSchemaNode(null, SchemaPath.create(true,
+ QName.create(URI.create("uri:my-module"), Revision.of("2014-10-07"), "foo")));
}
@Test
public void findDataSchemaNodeTest() throws URISyntaxException, IOException, YangSyntaxErrorException,
ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module module = context.findModule(new URI("uri:my-module"), Revision.of("2014-10-07")).get();
- final Module importedModule = context.findModule(new URI("uri:imported-module"),
+ final Module module = context.findModule(URI.create("uri:my-module"), Revision.of("2014-10-07")).get();
+ final Module importedModule = context.findModule(URI.create("uri:imported-module"),
Revision.of("2014-10-07")).get();
final SchemaNode testNode = ((ContainerSchemaNode) importedModule.getDataChildByName(QName.create(
// final RevisionAwareXPath nonCondXPath) {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module module = context.findModule(new URI("uri:my-module"), Revision.of("2014-10-07")).get();
+ final Module module = context.findModule(URI.create("uri:my-module"), Revision.of("2014-10-07")).get();
final GroupingDefinition grouping = getGroupingByName(module, "my-grouping");
final SchemaNode testNode = grouping.getDataChildByName(QName.create(module.getQNameModule(),
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = NullPointerException.class)
public void findDataSchemaNodeFromXPathIllegalArgumentTest() {
- final SchemaContext mockContext = mock(SchemaContext.class);
- final Module module = mock(Module.class);
-
- SchemaContextUtil.findDataSchemaNode(mockContext, module, null);
+ SchemaContextUtil.findDataSchemaNode(mock(SchemaContext.class), mock(Module.class), null);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = NullPointerException.class)
public void findDataSchemaNodeFromXPathIllegalArgumentTest2() {
final SchemaContext mockContext = mock(SchemaContext.class);
final PathExpression xpath = new PathExpressionImpl("my:my-grouping/my:my-leaf-in-gouping2", true);
SchemaContextUtil.findDataSchemaNode(mockContext, null, xpath);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = NullPointerException.class)
public void findDataSchemaNodeFromXPathIllegalArgumentTest3() {
final Module module = mock(Module.class);
final PathExpression xpath = new PathExpressionImpl("my:my-grouping/my:my-leaf-in-gouping2", true);
final Module module = mock(Module.class);
final PathExpression xpath = mock(PathExpression.class);
- when(xpath.getOriginalString()).thenReturn(null);
+ when(xpath.getOriginalString()).thenReturn("");
assertNull(SchemaContextUtil.findDataSchemaNode(mockContext, module, xpath));
}
YangSyntaxErrorException, ReactorException {
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), Revision.of("2014-10-07")).get();
+ final Module myModule = context.findModule(URI.create("uri:my-module"), Revision.of("2014-10-07")).get();
// find grouping in container
DataNodeContainer dataContainer = (DataNodeContainer) myModule.getDataChildByName(QName.create(
final SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
- final Module myModule = context.findModule(new URI("uri:my-module"), Revision.of("2014-10-07")).get();
+ final Module myModule = context.findModule(URI.create("uri:my-module"), Revision.of("2014-10-07")).get();
final ChoiceSchemaNode choice = (ChoiceSchemaNode) getRpcByName(myModule, "my-name").getInput()
.getDataChildByName(QName.create(myModule.getQNameModule(), "my-choice"));
final SchemaNode testNode = choice.findCaseNodes("case-two").iterator().next()