### Question:
WorkflowAction { protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass, AAIObjectName name) { List<T> vnfcs = new ArrayList<>(); AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId)); AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri); Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships(); if (!relationshipsOp.isPresent()) { logger.debug("No relationships were found for vfModule in AAI"); } else { Relationships relationships = relationshipsOp.get(); List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(name); for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) { Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass); vnfcOp.ifPresent(vnfcs::add); } } return vnfcs; }  void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils); void setBbInputSetup(BBInputSetup bbInputSetup); void selectExecutionList(DelegateExecution execution); void handleRuntimeException(DelegateExecution execution);  }### Answer:
@Test public void getRelatedResourcesInVfModuleTest() throws Exception { org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc(); vnfc.setModelInvariantId("modelInvariantId"); vnfc.setVnfcName("testVnfcName"); String vfncPayload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/BuildingBlocks/vnfcResponse.json"))); AAIResultWrapper vfncWrapper = new AAIResultWrapper(vfncPayload); String configurationPayload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/BuildingBlocks/configurationResponse.json"))); AAIResultWrapper configurationWrapper = new AAIResultWrapper(configurationPayload); List<AAIResultWrapper> configurationResultWrappers = new ArrayList<AAIResultWrapper>(); configurationResultWrappers.add(configurationWrapper); AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName())); when(bbSetupUtils.getAAIResourceDepthOne(uri)).thenReturn(vfncWrapper); doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(), anyObject()); org.onap.aai.domain.yang.Configuration configuration = SPY_workflowAction.getRelatedResourcesInVnfc(vnfc, org.onap.aai.domain.yang.Configuration.class, Types.CONFIGURATION); assertEquals("testConfigurationId", configuration.getConfigurationId()); }