### Question:
ConfigAssignVnf { public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) { logger.info("Start preProcessAbstractCDSProcessing "); try { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf(); configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId()); configAssignPropertiesForVnf .setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid()); configAssignPropertiesForVnf .setVnfCustomizationUuid(genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid()); configAssignPropertiesForVnf.setVnfId(genericVnf.getVnfId()); configAssignPropertiesForVnf.setVnfName(genericVnf.getVnfName()); setUserParamsInConfigAssignPropertiesForVnf(configAssignPropertiesForVnf, execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams(), genericVnf); ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf(); configAssignRequestVnf.setResolutionKey(genericVnf.getVnfName()); configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf); String blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName(); String blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion(); logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion); AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean(); abstractCDSPropertiesBean.setBlueprintName(blueprintName); abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion); abstractCDSPropertiesBean.setRequestObject(configAssignRequestVnf.toString()); GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID); abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId()); abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString()); abstractCDSPropertiesBean.setActionName(ACTION_NAME); abstractCDSPropertiesBean.setMode(MODE); execution.setVariable("executionObject", abstractCDSPropertiesBean); } catch (Exception ex) { logger.error("An exception occurred when creating ConfigAssignPropertiesForVnf for CDS request", ex); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex); } } @Autowired  ConfigAssignVnf(ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder); void preProcessAbstractCDSProcessing(BuildingBlockExecution execution);  }### Answer:
@Test public void prepareAbstractCDSPropertiesBean_success() throws Exception { BuildingBlockExecution buildingBlockExecution = createBuildingBlockExecution(createService(createVnfList())); prepareExtractPojosForBB(buildingBlockExecution); testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution); verifyConfigAssignPropertiesJsonContent(buildingBlockExecution); }
@Test public void invalidServiceJsonContentWhenPrepareCDSBean_flowExIsThrown() throws Exception { BuildingBlockExecution buildingBlockExecution = createBuildingBlockExecution("{invalidJsonContent}"); prepareExtractPojosForBB(buildingBlockExecution); testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution); verify(exceptionBuilderMock).buildAndThrowWorkflowException(eq(buildingBlockExecution), eq(7000), any(IOException.class)); }
@Test public void vnfIsNotFoundWhenPrepareCDSBean_flowExIsThrown() throws Exception { BuildingBlockExecution buildingBlockExecution = createBuildingBlockExecution(createService(Collections.emptyList())); prepareExtractPojosForBB(buildingBlockExecution); testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution); verify(exceptionBuilderMock).buildAndThrowWorkflowException(eq(buildingBlockExecution), eq(7000), any(VnfNotFoundException.class)); }