### Question:
AAIInstanceGroupResources { public void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup, ServiceInstance serviceInstance) { AAIResourceUri instanceGroupUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().instanceGroup(instanceGroup.getId())); org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); AAIResourceUri serviceInstanceURI = AAIUriFactory .createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstance.getServiceInstanceId())); injectionHelper.getAaiClient().createIfNotExists(instanceGroupUri, Optional.of(aaiInstanceGroup)) .connect(instanceGroupUri, serviceInstanceURI); }  void createInstanceGroup(InstanceGroup instanceGroup); void deleteInstanceGroup(InstanceGroup instanceGroup); void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf); void connectInstanceGroupToVnf(InstanceGroup instanceGroup, GenericVnf vnf, AAIEdgeLabel aaiLabel); boolean exists(InstanceGroup instanceGroup); void createInstanceGroupandConnectServiceInstance(InstanceGroup instanceGroup,
            ServiceInstance serviceInstance); boolean checkInstanceGroupNameInUse(String instanceGroupName);  }### Answer:
@Test public void createInstanceGroupandConnectServiceInstanceTest() { doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper) .mapInstanceGroup(instanceGroup); doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance); verify(MOCK_aaiObjectMapper, times(1)).mapInstanceGroup(instanceGroup); verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); }