### Question:
CashFlowEquivalentCalculator { public static ImmutableMap<Payment, PointSensitivityBuilder> cashFlowEquivalentAndSensitivitySwap( ResolvedSwap swap, RatesProvider ratesProvider) { validateSwap(swap); ImmutableMap<Payment, PointSensitivityBuilder> mapFixed = cashFlowEquivalentAndSensitivityFixedLeg(swap.getLegs(SwapLegType.FIXED).get(0), ratesProvider); ImmutableMap<Payment, PointSensitivityBuilder> mapIbor = cashFlowEquivalentAndSensitivityIborLeg(swap.getLegs(SwapLegType.IBOR).get(0), ratesProvider); return ImmutableMap.<Payment, PointSensitivityBuilder>builder().putAll(mapFixed).putAll(mapIbor).build(); } private  CashFlowEquivalentCalculator(); static ResolvedSwapLeg cashFlowEquivalentSwap(ResolvedSwap swap, RatesProvider ratesProvider); static ResolvedSwapLeg cashFlowEquivalentIborLeg(ResolvedSwapLeg iborLeg, RatesProvider ratesProvider); static ResolvedSwapLeg cashFlowEquivalentFixedLeg(ResolvedSwapLeg fixedLeg, RatesProvider ratesProvider); static ImmutableMap<Payment, PointSensitivityBuilder> cashFlowEquivalentAndSensitivitySwap(
      ResolvedSwap swap,
      RatesProvider ratesProvider); static ImmutableMap<Payment, PointSensitivityBuilder> cashFlowEquivalentAndSensitivityIborLeg(
      ResolvedSwapLeg iborLeg,
      RatesProvider ratesProvider); static ImmutableMap<Payment, PointSensitivityBuilder> cashFlowEquivalentAndSensitivityFixedLeg(
      ResolvedSwapLeg fixedLeg,
      RatesProvider ratesProvider);  }### Answer:
@Test public void test_cashFlowEquivalentAndSensitivity_compounding() { RatePaymentPeriod iborCmp = RatePaymentPeriod.builder() .paymentDate(PAYMENT2) .accrualPeriods(IBOR1, IBOR2) .dayCount(ACT_365F) .currency(GBP) .notional(-NOTIONAL) .build(); ResolvedSwapLeg iborLegCmp = ResolvedSwapLeg.builder() .type(IBOR) .payReceive(PAY) .paymentPeriods(iborCmp) .build(); ResolvedSwap swap1 = ResolvedSwap.of(iborLegCmp, FIXED_LEG); assertThatIllegalArgumentException() .isThrownBy(() -> CashFlowEquivalentCalculator.cashFlowEquivalentAndSensitivitySwap(swap1, PROVIDER)); RatePaymentPeriod fixedCmp = RatePaymentPeriod.builder() .paymentDate(PAYMENT2) .accrualPeriods(FIXED1, FIXED2) .dayCount(ACT_365F) .currency(GBP) .notional(NOTIONAL) .build(); ResolvedSwapLeg fixedLegCmp = ResolvedSwapLeg.builder() .type(FIXED) .payReceive(RECEIVE) .paymentPeriods(fixedCmp) .build(); ResolvedSwap swap2 = ResolvedSwap.of(IBOR_LEG, fixedLegCmp); assertThatIllegalArgumentException() .isThrownBy(() -> CashFlowEquivalentCalculator.cashFlowEquivalentAndSensitivitySwap(swap2, PROVIDER)); }