+ public static ControllerContext newControllerContext(SchemaContext schemaContext) {
+ return newControllerContext(schemaContext, null);
+ }
+
+ public static ControllerContext newControllerContext(SchemaContext schemaContext, DOMMountPoint mountInstance) {
+ if (mountInstance != null) {
+ doReturn(schemaContext).when(mountInstance).getSchemaContext();
+ }
+
+ final DOMMountPointService mockMountService = mock(DOMMountPointService.class);
+ doReturn(Optional.fromNullable(mountInstance)).when(mockMountService)
+ .getMountPoint(any(YangInstanceIdentifier.class));
+
+ SchemaService mockSchemaService = mock(SchemaService.class);
+ doReturn(schemaContext).when(mockSchemaService).getGlobalContext();
+
+ DOMSchemaService mockDomSchemaService = mock(DOMSchemaService.class);
+
+ return ControllerContext.newInstance(mockSchemaService, mockMountService, mockDomSchemaService);
+ }
+