### Question:
SDNCQueryTasks { public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) { String response = sdncVfModuleResources.queryVfModule(vfModule); execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response); } else { throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value"); } } catch (BBObjectNotFoundException bbException) { logger.error("Error occurred if bb object not found in SDNCQueryTasks queryVfModuleForVolumeGroup ", bbException); if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO); } } catch (BadResponseException ex) { logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } }  void queryVnf(BuildingBlockExecution execution); void queryVfModule(BuildingBlockExecution execution); void queryVfModuleForVolumeGroup(BuildingBlockExecution execution); static final String SDNCQUERY_RESPONSE; }### Answer:
@Test public void queryVfModuleForVolumeGroupTest() throws Exception { String sdncQueryResponse = "response"; vfModule.setSelflink("vfModuleSelfLink"); doReturn(sdncQueryResponse).when(sdncVfModuleResources).queryVfModule(vfModule); assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); verify(sdncVfModuleResources, times(1)).queryVfModule(vfModule); }
@Test public void queryVfModuleForVolumeGroupNoSelfLinkExceptionTest() throws Exception { expectedException.expect(BpmnError.class); vfModule.setSelflink(""); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); }
@Test public void queryVfModuleForVolumeGroupNonVfObjectExceptionTest() throws Exception { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); }