### Question:
SwaptionTradeCalculationFunction implements CalculationFunction<SwaptionTrade> { @Override public Map<Measure, Result<?>> calculate( SwaptionTrade trade, Set<Measure> measures, CalculationParameters parameters, ScenarioMarketData scenarioMarketData, ReferenceData refData) { ResolvedSwaptionTrade resolved = trade.resolve(refData); RatesMarketDataLookup ratesLookup = parameters.getParameter(RatesMarketDataLookup.class); RatesScenarioMarketData ratesMarketData = ratesLookup.marketDataView(scenarioMarketData); SwaptionMarketDataLookup swaptionLookup = parameters.getParameter(SwaptionMarketDataLookup.class); SwaptionScenarioMarketData swaptionMarketData = swaptionLookup.marketDataView(scenarioMarketData); Map<Measure, Result<?>> results = new HashMap<>(); for (Measure measure : measures) { results.put(measure, calculate(measure, resolved, ratesMarketData, swaptionMarketData)); } return results; } SwaptionTradeCalculationFunction(); @Override Class<SwaptionTrade> targetType(); @Override Set<Measure> supportedMeasures(); @Override Optional<String> identifier(SwaptionTrade target); @Override Currency naturalCurrency(SwaptionTrade trade, ReferenceData refData); @Override FunctionRequirements requirements(
      SwaptionTrade trade,
      Set<Measure> measures,
      CalculationParameters parameters,
      ReferenceData refData); @Override Map<Measure, Result<?>> calculate(
      SwaptionTrade trade,
      Set<Measure> measures,
      CalculationParameters parameters,
      ScenarioMarketData scenarioMarketData,
      ReferenceData refData);  }### Answer:
@Test public void test_simpleMeasures() { SwaptionTradeCalculationFunction function = new SwaptionTradeCalculationFunction(); ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); NormalSwaptionTradePricer pricer = NormalSwaptionTradePricer.DEFAULT; ResolvedSwaptionTrade resolved = TRADE.resolve(REF_DATA); CurrencyAmount expectedPv = pricer.presentValue(resolved, provider, NORMAL_VOL_SWAPTION_PROVIDER_USD); Set<Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE, Measures.RESOLVED_TARGET); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)) .containsEntry( Measures.PRESENT_VALUE, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedPv)))) .containsEntry( Measures.RESOLVED_TARGET, Result.success(RTRADE)); }