@Test
 public void parSpreadMarketQuoteDiscountingCalculator() {
   final double psmq = SWAP_MULTI_LEG.accept(PSMQDC, MULTICURVES);
   final double pv =
       -MULTICURVES
           .getFxRates()
           .convert(
               SWAP_MULTI_LEG.accept(PVDC, MULTICURVES), SWAP_MULTI_LEG.getLegs()[0].getCurrency())
           .getAmount();
   final double pvbp = SWAP_MULTI_LEG.getLegs()[0].accept(PVMQSC, MULTICURVES);
   assertEquals(
       "SwapMultileg: parSpreadMarketQuoteDiscountingCalculator", psmq, pv / pvbp, TOLERANCE_RATE);
 }
 @Test
 public void presentValueCurveSensitivityDiscountingCalculator() {
   final MultipleCurrencyMulticurveSensitivity pvcsSwap =
       SWAP_MULTI_LEG.accept(PVCSDC, MULTICURVES);
   MultipleCurrencyMulticurveSensitivity pvcsLegs =
       SWAP_MULTI_LEG.getLegs()[0].accept(PVCSDC, MULTICURVES);
   for (int loopleg = 1; loopleg < NB_LEGS; loopleg++) {
     pvcsLegs = pvcsLegs.plus(SWAP_MULTI_LEG.getLegs()[loopleg].accept(PVCSDC, MULTICURVES));
   }
   AssertSensitivityObjects.assertEquals(
       "SwapMultileg: presentValueCurveSensitivityDiscountingCalculator",
       pvcsLegs,
       pvcsSwap,
       TOLERANCE_PV_DELTA);
 }
 @Test
 public void presentValueDiscountingCalculator() {
   final MultipleCurrencyAmount pvSwap = SWAP_MULTI_LEG.accept(PVDC, MULTICURVES);
   MultipleCurrencyAmount pvLegs = MultipleCurrencyAmount.of(EUR, 0.0);
   for (int loopleg = 0; loopleg < NB_LEGS; loopleg++) {
     pvLegs = pvLegs.plus(SWAP_MULTI_LEG.getLegs()[loopleg].accept(PVDC, MULTICURVES));
   }
   assertEquals(
       "SwapMultileg: presentValueDiscountingCalculator",
       pvSwap.getAmount(EUR),
       pvLegs.getAmount(EUR),
       TOLERANCE_PV);
 }
 @Test
 public void parSpreadMarketQuoteCurveSensitivityDiscountingCalculator() {
   final double pv =
       MULTICURVES
           .getFxRates()
           .convert(
               SWAP_MULTI_LEG.accept(PVDC, MULTICURVES), SWAP_MULTI_LEG.getLegs()[0].getCurrency())
           .getAmount();
   final double pvbp = SWAP_MULTI_LEG.getLegs()[0].accept(PVMQSC, MULTICURVES);
   final MulticurveSensitivity pvcs =
       SWAP_MULTI_LEG
           .accept(PVCSDC, MULTICURVES)
           .converted(EUR, MULTICURVES.getFxRates())
           .getSensitivity(EUR);
   final MulticurveSensitivity pvbpcs = SWAP_MULTI_LEG.getLegs()[0].accept(PVMQSCSC, MULTICURVES);
   final MulticurveSensitivity psmqcsExpected =
       pvcs.multipliedBy(-1.0d / pvbp).plus(pvbpcs.multipliedBy(pv / (pvbp * pvbp))).cleaned();
   final MulticurveSensitivity psmqcs = SWAP_MULTI_LEG.accept(PSMQCSDC, MULTICURVES).cleaned();
   AssertSensitivityObjects.assertEquals(
       "SwapMultileg: presentValueCurveSensitivityDiscountingCalculator",
       psmqcs,
       psmqcsExpected,
       TOLERANCE_RATE_DELTA);
 }