### Question:
SecurityPositionCalculationFunction implements CalculationFunction<SecurityPosition> { @Override public Map<Measure, Result<?>> calculate( SecurityPosition position, Set<Measure> measures, CalculationParameters parameters, ScenarioMarketData scenarioMarketData, ReferenceData refData) { Security security = refData.getValue(position.getSecurityId()); Map<Measure, Result<?>> results = new HashMap<>(); for (Measure measure : measures) { results.put(measure, calculate(measure, position, security, scenarioMarketData)); } return results; } SecurityPositionCalculationFunction(); @Override Class<SecurityPosition> targetType(); @Override Set<Measure> supportedMeasures(); @Override Optional<String> identifier(SecurityPosition target); @Override Currency naturalCurrency(SecurityPosition position, ReferenceData refData); @Override FunctionRequirements requirements(
      SecurityPosition position,
      Set<Measure> measures,
      CalculationParameters parameters,
      ReferenceData refData); @Override Map<Measure, Result<?>> calculate(
      SecurityPosition position,
      Set<Measure> measures,
      CalculationParameters parameters,
      ScenarioMarketData scenarioMarketData,
      ReferenceData refData);  }### Answer:
@Test public void test_presentValue() { SecurityPositionCalculationFunction function = new SecurityPositionCalculationFunction(); 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(POSITION, measures, PARAMS, md, REF_DATA)) .containsEntry( Measures.PRESENT_VALUE, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedPv)))); }