### Question:
NamingServiceDeleteTasks { public void deleteInstanceGroupName(BuildingBlockExecution execution) throws BBObjectNotFoundException { InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); try { namingServiceResources.deleteInstanceGroupName(instanceGroup); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } }  void deleteInstanceGroupName(BuildingBlockExecution execution); void deleteServiceInstanceName(BuildingBlockExecution execution);  }### Answer:
@Test public void deleteInstanceGroupTest() throws Exception { doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup); namingServiceDeleteTasks.deleteInstanceGroupName(execution); verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup); }
@Test public void deleteInstanceGroupExceptionTest() throws Exception { expectedException.expect(BBObjectNotFoundException.class); lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, "notfound"); doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)); doReturn("").when(namingServiceResources).deleteInstanceGroupName(instanceGroup); namingServiceDeleteTasks.deleteInstanceGroupName(execution); verify(namingServiceResources, times(1)).deleteInstanceGroupName(instanceGroup); }