@Test public void recognizedRevenue() { long contractId = 0; BigDecimal revenue = recognitionService.recognizedRevenue(contractId, LocalDate.now()); }
public BigDecimal recognizedRevenue(long contractId, LocalDate asOf) { List<RevenueRecognition> revenueRecognitions = recognitionRepository.findRecognitionsFor(contractId, asOf); BigDecimal result = new BigDecimal(0); for (RevenueRecognition revenueRecognition : revenueRecognitions) { result = result.add(revenueRecognition.getAmount()); } return result; }
RecognitionService { public BigDecimal recognizedRevenue(long contractId, LocalDate asOf) { List<RevenueRecognition> revenueRecognitions = recognitionRepository.findRecognitionsFor(contractId, asOf); BigDecimal result = new BigDecimal(0); for (RevenueRecognition revenueRecognition : revenueRecognitions) { result = result.add(revenueRecognition.getAmount()); } return result; } }
RecognitionService { public BigDecimal recognizedRevenue(long contractId, LocalDate asOf) { List<RevenueRecognition> revenueRecognitions = recognitionRepository.findRecognitionsFor(contractId, asOf); BigDecimal result = new BigDecimal(0); for (RevenueRecognition revenueRecognition : revenueRecognitions) { result = result.add(revenueRecognition.getAmount()); } return result; }  }
RecognitionService { public BigDecimal recognizedRevenue(long contractId, LocalDate asOf) { List<RevenueRecognition> revenueRecognitions = recognitionRepository.findRecognitionsFor(contractId, asOf); BigDecimal result = new BigDecimal(0); for (RevenueRecognition revenueRecognition : revenueRecognitions) { result = result.add(revenueRecognition.getAmount()); } return result; }  BigDecimal recognizedRevenue(long contractId, LocalDate asOf); void calculateRevenueRecognitions(long contractId); }
RecognitionService { public BigDecimal recognizedRevenue(long contractId, LocalDate asOf) { List<RevenueRecognition> revenueRecognitions = recognitionRepository.findRecognitionsFor(contractId, asOf); BigDecimal result = new BigDecimal(0); for (RevenueRecognition revenueRecognition : revenueRecognitions) { result = result.add(revenueRecognition.getAmount()); } return result; }  BigDecimal recognizedRevenue(long contractId, LocalDate asOf); void calculateRevenueRecognitions(long contractId);  }