Source:
public void testResults() { List<Trade> trades = ImmutableList.of(createTrade1()); List<Column> columns = ImmutableList.of( Column.of(Measure.LEG_INITIAL_NOTIONAL), Column.of(Measure.PRESENT_VALUE), Column.of(Measure.LEG_PRESENT_VALUE), Column.of(Measure.PV01), Column.of(Measure.ACCRUED_INTEREST)); ExampleMarketDataBuilder marketDataBuilder = ExampleMarketData.builder(); CalculationRules rules = CalculationRules.builder() .pricingRules(StandardComponents.pricingRules()) .marketDataRules(marketDataBuilder.rules()) .reportingRules(ReportingRules.fixedCurrency(Currency.USD)) .build(); LocalDate valuationDate = LocalDate.of(2009, 7, 31); MarketEnvironment marketSnapshot = marketDataBuilder.buildSnapshot(valuationDate); Results results = null; try (CalculationTaskRunner runner = CalculationTaskRunner.of(MoreExecutors.newDirectExecutorService())) { CalculationTasks tasks = runner.createTasks(trades, columns, rules); MarketDataRequirements reqs = tasks.getRequirements(); MarketEnvironment enhancedMarketData = marketDataFactory().buildMarketData(reqs, marketSnapshot, MarketDataConfig.empty()); results = runner.calculateSingleScenario(tasks, enhancedMarketData); } ReportCalculationResults calculationResults = ReportCalculationResults.of( valuationDate, trades, columns, results); TradeReportTemplate reportTemplate = ExampleData.loadTradeReportTemplate("swap-report-regression-test-template"); TradeReport tradeReport = TradeReport.of(calculationResults, reportTemplate); String expectedResults = ExampleData.loadExpectedResults("swap-report"); TradeReportRegressionTestUtils.assertAsciiTableEquals(tradeReport.toAsciiTableString(), expectedResults); }

Target:
public void testResults() { List<Trade> trades = ImmutableList.of(createTrade1()); List<Column> columns = ImmutableList.of( Column.of(Measure.LEG_INITIAL_NOTIONAL), Column.of(Measure.PRESENT_VALUE), Column.of(Measure.LEG_PRESENT_VALUE), Column.of(Measure.PV01), Column.of(Measure.ACCRUED_INTEREST)); ExampleMarketDataBuilder marketDataBuilder = ExampleMarketData.builder(); CalculationRules rules = CalculationRules.builder() .pricingRules(StandardComponents.pricingRules()) .marketDataRules(marketDataBuilder.rules()) .reportingRules(ReportingRules.fixedCurrency(Currency.USD)) .build(); LocalDate valuationDate = LocalDate.of(2009, 7, 31); MarketEnvironment marketSnapshot = marketDataBuilder.buildSnapshot(valuationDate); CalculationTasks tasks = CalculationTasks.of(trades, columns, rules); MarketDataRequirements reqs = tasks.getRequirements(); MarketEnvironment enhancedMarketData = marketDataFactory().buildMarketData(reqs, marketSnapshot, MarketDataConfig.empty()); CalculationTaskRunner runner = CalculationTaskRunner.of(MoreExecutors.newDirectExecutorService()); Results results = runner.calculateSingleScenario(tasks, enhancedMarketData); ReportCalculationResults calculationResults = ReportCalculationResults.of( valuationDate, trades, columns, results); TradeReportTemplate reportTemplate = ExampleData.loadTradeReportTemplate("swap-report-regression-test-template"); TradeReport tradeReport = TradeReport.of(calculationResults, reportTemplate); String expectedResults = ExampleData.loadExpectedResults("swap-report"); TradeReportRegressionTestUtils.assertAsciiTableEquals(tradeReport.toAsciiTableString(), expectedResults); }