- public void testToInstanceIdentifierMountPoint() throws FileNotFoundException {
- try {
- String mountPointPath = "simple-nodes:user/foo/boo";
- String nestedPath = "simple-nodes:user/foo/boo/simple-nodes:users";
- InstanceIdWithSchemaNode mountInstanceIdentifier = controllerContext.toInstanceIdentifier(mountPointPath);
- assertEquals("user", mountInstanceIdentifier.getSchemaNode().getQName().getLocalName());
-
- MountInstance mountInstance = mock(MountInstance.class);
- MountService mountService = mock(MountService.class);
-
- controllerContext.setMountService(mountService);
- // when(mountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(null);
-
- when(mountService.getMountPoint(eq(mountInstanceIdentifier.getInstanceIdentifier()))).thenReturn(
- mountInstance);
-
- when(mountInstance.getSchemaContext()).thenReturn(controllerContext.getGlobalSchema());
-
- InstanceIdWithSchemaNode mountedInstanceIdentifier = controllerContext.toInstanceIdentifier(nestedPath);
- assertEquals("users", mountedInstanceIdentifier.getSchemaNode().getQName().getLocalName());
-
- mountedInstanceIdentifier = controllerContext.toInstanceIdentifier(mountPointPath + "/" + mountPointPath);
- assertEquals("user", mountedInstanceIdentifier.getSchemaNode().getQName().getLocalName());
-
- mountedInstanceIdentifier = controllerContext
- .toInstanceIdentifier("simple-nodes:user/foo/var/simple-nodes:users");
- assertNull(mountedInstanceIdentifier);
-
- } finally {
- controllerContext.setMountService(null);
- }
+ public void testToInstanceIdentifierListWithNullKey() {
+ exception.expect(ResponseException.class);
+ exception.expectMessage("HTTP 400 Bad Request");
+ controllerContext.toInstanceIdentifier("simple-nodes:user/null/boo");
+ }