### Question:
IborCapFloorTradeCalculationFunction implements CalculationFunction<IborCapFloorTrade> { @Override public Map<Measure, Result<?>> calculate( IborCapFloorTrade trade, Set<Measure> measures, CalculationParameters parameters, ScenarioMarketData scenarioMarketData, ReferenceData refData) { ResolvedIborCapFloorTrade resolved = trade.resolve(refData); RatesMarketDataLookup ratesLookup = parameters.getParameter(RatesMarketDataLookup.class); RatesScenarioMarketData ratesMarketData = ratesLookup.marketDataView(scenarioMarketData); IborCapFloorMarketDataLookup capFloorLookup = parameters.getParameter(IborCapFloorMarketDataLookup.class); IborCapFloorScenarioMarketData capFloorMarketData = capFloorLookup.marketDataView(scenarioMarketData); Map<Measure, Result<?>> results = new HashMap<>(); for (Measure measure : measures) { results.put(measure, calculate(measure, resolved, ratesMarketData, capFloorMarketData)); } return results; } IborCapFloorTradeCalculationFunction(); @Override Class<IborCapFloorTrade> targetType(); @Override Set<Measure> supportedMeasures(); @Override Optional<String> identifier(IborCapFloorTrade target); @Override Currency naturalCurrency(IborCapFloorTrade trade, ReferenceData refData); @Override FunctionRequirements requirements(
      IborCapFloorTrade trade,
      Set<Measure> measures,
      CalculationParameters parameters,
      ReferenceData refData); @Override Map<Measure, Result<?>> calculate(
      IborCapFloorTrade trade,
      Set<Measure> measures,
      CalculationParameters parameters,
      ScenarioMarketData scenarioMarketData,
      ReferenceData refData);  }### Answer:
@Test public void test_simpleMeasures() { IborCapFloorTradeCalculationFunction function = new IborCapFloorTradeCalculationFunction(); ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); NormalIborCapFloorTradePricer pricer = NormalIborCapFloorTradePricer.DEFAULT; MultiCurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrentCash = pricer.currentCash(RTRADE, provider, VOLS); Set<Measure> measures = ImmutableSet.of( Measures.PRESENT_VALUE, Measures.CURRENCY_EXPOSURE, Measures.CURRENT_CASH); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)) .containsEntry( Measures.PRESENT_VALUE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv)))) .containsEntry( Measures.CURRENCY_EXPOSURE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)))) .containsEntry( Measures.CURRENT_CASH, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)))); }