//-------------------------------------------------------------------------
        public virtual void test_requirementsAndCurrency()
        {
            FxSwapTradeCalculationFunction function = new FxSwapTradeCalculationFunction();
            ISet <Measure>       measures           = function.supportedMeasures();
            FunctionRequirements reqs = function.requirements(TRADE, measures, PARAMS, REF_DATA);

            assertThat(reqs.OutputCurrencies).containsExactly(GBP, USD);
            assertThat(reqs.ValueRequirements).isEqualTo(ImmutableSet.of(DISCOUNT_CURVE_GBP_ID, DISCOUNT_CURVE_USD_ID));
            assertThat(reqs.TimeSeriesRequirements).Empty;
            assertThat(function.naturalCurrency(TRADE, REF_DATA)).isEqualTo(GBP);
        }
        public virtual void test_simpleMeasures()
        {
            FxSwapTradeCalculationFunction function = new FxSwapTradeCalculationFunction();
            ScenarioMarketData             md       = marketData();
            RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0));
            DiscountingFxSwapTradePricer pricer     = DiscountingFxSwapTradePricer.DEFAULT;
            MultiCurrencyAmount          expectedPv = pricer.presentValue(RTRADE, provider);
            double expectedParSpread = pricer.parSpread(RTRADE, provider);
            MultiCurrencyAmount expectedCurrencyExp = pricer.currencyExposure(RTRADE, provider);
            MultiCurrencyAmount expectedCash        = pricer.currentCash(RTRADE, provider);

            ISet <Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE, Measures.PAR_SPREAD, Measures.CURRENCY_EXPOSURE, Measures.CURRENT_CASH, Measures.FORWARD_FX_RATE, Measures.RESOLVED_TARGET);

            assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PRESENT_VALUE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv)))).containsEntry(Measures.PAR_SPREAD, Result.success(DoubleScenarioArray.of(ImmutableList.of(expectedParSpread)))).containsEntry(Measures.CURRENCY_EXPOSURE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExp)))).containsEntry(Measures.CURRENT_CASH, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCash)))).containsEntry(Measures.RESOLVED_TARGET, Result.success(RTRADE));
        }
        public virtual void test_pv01()
        {
            FxSwapTradeCalculationFunction function = new FxSwapTradeCalculationFunction();
            ScenarioMarketData             md       = marketData();
            RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0));
            DiscountingFxSwapTradePricer   pricer               = DiscountingFxSwapTradePricer.DEFAULT;
            PointSensitivities             pvPointSens          = pricer.presentValueSensitivity(RTRADE, provider);
            CurrencyParameterSensitivities pvParamSens          = provider.parameterSensitivity(pvPointSens);
            MultiCurrencyAmount            expectedPv01         = pvParamSens.total().multipliedBy(1e-4);
            CurrencyParameterSensitivities expectedBucketedPv01 = pvParamSens.multipliedBy(1e-4);

            ISet <Measure> measures = ImmutableSet.of(Measures.PV01_CALIBRATED_SUM, Measures.PV01_CALIBRATED_BUCKETED);

            assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PV01_CALIBRATED_SUM, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01)))).containsEntry(Measures.PV01_CALIBRATED_BUCKETED, Result.success(ScenarioArray.of(ImmutableList.of(expectedBucketedPv01))));
        }