@Test public void testShouldCreateAsync() { FeeResponse feeResponse = FeeResponse.builder().fees(getFees()).build(); FeeRequest feeRequest = FeeRequest.builder().fees(getFees()).requestInfo(new RequestInfo()).build(); List<String> ids = new ArrayList<>(); ids.add("1"); when(sequenceGenUtil.getIds(Matchers.any(int.class), Matchers.any(String.class))).thenReturn(ids); when(propertiesManager.getCreateFeeTopicName()).thenReturn("egov-create"); when(kafkaTemplate.send(Matchers.any(String.class), Matchers.any(Object.class))) .thenReturn(new SendResult<>(null, null)); assertTrue(feeResponse.toString().equals(feeService.createAsync(feeRequest).toString())); }
public FeeResponse createAsync(FeeRequest feeRequest) { List<Fee> fees = feeRequest.getFees(); List<String> ids = sequenceGenUtil.getIds(fees.size(), "egmr_documents_id"); int index = 0; for (Fee fee : fees) fee.setId(ids.get(index++)); kafkaTemplate.send(propertiesManager.getCreateFeeTopicName(), feeRequest); return getFeeResponse(fees, feeRequest.getRequestInfo()); }
FeeService { public FeeResponse createAsync(FeeRequest feeRequest) { List<Fee> fees = feeRequest.getFees(); List<String> ids = sequenceGenUtil.getIds(fees.size(), "egmr_documents_id"); int index = 0; for (Fee fee : fees) fee.setId(ids.get(index++)); kafkaTemplate.send(propertiesManager.getCreateFeeTopicName(), feeRequest); return getFeeResponse(fees, feeRequest.getRequestInfo()); } }
FeeService { public FeeResponse createAsync(FeeRequest feeRequest) { List<Fee> fees = feeRequest.getFees(); List<String> ids = sequenceGenUtil.getIds(fees.size(), "egmr_documents_id"); int index = 0; for (Fee fee : fees) fee.setId(ids.get(index++)); kafkaTemplate.send(propertiesManager.getCreateFeeTopicName(), feeRequest); return getFeeResponse(fees, feeRequest.getRequestInfo()); }  }
FeeService { public FeeResponse createAsync(FeeRequest feeRequest) { List<Fee> fees = feeRequest.getFees(); List<String> ids = sequenceGenUtil.getIds(fees.size(), "egmr_documents_id"); int index = 0; for (Fee fee : fees) fee.setId(ids.get(index++)); kafkaTemplate.send(propertiesManager.getCreateFeeTopicName(), feeRequest); return getFeeResponse(fees, feeRequest.getRequestInfo()); }  FeeResponse getFee(FeeCriteria feeCriteria, RequestInfo requestInfo); FeeResponse createAsync(FeeRequest feeRequest); FeeResponse updateAsync(FeeRequest feeRequest); void createFee(FeeRequest feeRequest); void updateFee(FeeRequest feeRequest); }
FeeService { public FeeResponse createAsync(FeeRequest feeRequest) { List<Fee> fees = feeRequest.getFees(); List<String> ids = sequenceGenUtil.getIds(fees.size(), "egmr_documents_id"); int index = 0; for (Fee fee : fees) fee.setId(ids.get(index++)); kafkaTemplate.send(propertiesManager.getCreateFeeTopicName(), feeRequest); return getFeeResponse(fees, feeRequest.getRequestInfo()); }  FeeResponse getFee(FeeCriteria feeCriteria, RequestInfo requestInfo); FeeResponse createAsync(FeeRequest feeRequest); FeeResponse updateAsync(FeeRequest feeRequest); void createFee(FeeRequest feeRequest); void updateFee(FeeRequest feeRequest);  }