### Question:
SecurityTradeCalculationFunction implements CalculationFunction<SecurityTrade> { @Override public Map<Measure, Result<?>> calculate( SecurityTrade trade, Set<Measure> measures, CalculationParameters parameters, ScenarioMarketData scenarioMarketData, ReferenceData refData) { Security security = refData.getValue(trade.getSecurityId()); Map<Measure, Result<?>> results = new HashMap<>(); for (Measure measure : measures) { results.put(measure, calculate(measure, trade, security, scenarioMarketData)); } return results; } SecurityTradeCalculationFunction(); @Override Class<SecurityTrade> targetType(); @Override Set<Measure> supportedMeasures(); @Override Optional<String> identifier(SecurityTrade target); @Override Currency naturalCurrency(SecurityTrade trade, ReferenceData refData); @Override FunctionRequirements requirements(
      SecurityTrade trade,
      Set<Measure> measures,
      CalculationParameters parameters,
      ReferenceData refData); @Override Map<Measure, Result<?>> calculate(
      SecurityTrade trade,
      Set<Measure> measures,
      CalculationParameters parameters,
      ScenarioMarketData scenarioMarketData,
      ReferenceData refData);  }### Answer:
@Test public void test_presentValue() { SecurityTradeCalculationFunction function = new SecurityTradeCalculationFunction(); ScenarioMarketData md = marketData(); double unitPv = (MARKET_PRICE / TICK_SIZE) * TICK_VALUE; CurrencyAmount expectedPv = CurrencyAmount.of(CURRENCY, unitPv * QUANTITY); Set<Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)) .containsEntry( Measures.PRESENT_VALUE, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedPv)))); }