### Question:
AuditDataService { public void writeStackDataToRequestDb(AuditInventory auditInventory, AAIObjectAuditList auditList) throws JsonProcessingException { List<RequestProcessingData> requestProcessingDataList = requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(), auditInventory.getHeatStackName(), AUDIT_STACK_DATA); if (requestProcessingDataList.isEmpty()) { GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); String auditListString = objectMapper.getMapper().writeValueAsString(auditList);; RequestProcessingData requestProcessingData = new RequestProcessingData(); requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId()); requestProcessingData.setGroupingId(auditInventory.getVfModuleId()); requestProcessingData.setName(auditInventory.getHeatStackName()); requestProcessingData.setTag(AUDIT_STACK_DATA); requestProcessingData.setValue(auditListString); requestsDbClient.saveRequestProcessingData(requestProcessingData); } }  void writeStackDataToRequestDb(AuditInventory auditInventory, AAIObjectAuditList auditList); Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory);  }### Answer:
@Test public void testWriteStackDataToRequestDb() throws Exception { Mockito.doReturn(new ArrayList<RequestProcessingData>()).when(requestsDbClient) .getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), Mockito.any(), Mockito.any()); Mockito.doNothing().when(requestsDbClient).saveRequestProcessingData(Mockito.any()); AAIObjectAuditList auditList = new AAIObjectAuditList(); auditList.setHeatStackName("testHeatStackName"); AAIObjectAudit audit = new AAIObjectAudit(); Vserver vserver = new Vserver(); vserver.setVserverId("testVserverId"); audit.setAaiObject(vserver); auditList.getAuditList().add(audit); GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); String auditListString = objectMapper.getMapper().writeValueAsString(auditList); RequestProcessingData requestProcessingData = new RequestProcessingData(); requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId()); requestProcessingData.setGroupingId(auditInventory.getVfModuleId()); requestProcessingData.setName(auditInventory.getHeatStackName()); requestProcessingData.setTag("AuditStackData"); requestProcessingData.setValue(auditListString); auditDataService.writeStackDataToRequestDb(auditInventory, auditList); Mockito.verify(requestsDbClient, Mockito.times(1)).saveRequestProcessingData(requestProcessingData); }