### Question:
FxSwap implements FxProduct, Resolvable<ResolvedFxSwap>, ImmutableBean, Serializable { public static FxSwap of(FxSingle nearLeg, FxSingle farLeg) { return new FxSwap(nearLeg, farLeg); } private  FxSwap(
      FxSingle nearLeg,
      FxSingle farLeg); static FxSwap of(FxSingle nearLeg, FxSingle farLeg); static FxSwap of(
      CurrencyAmount amount,
      FxRate nearRate,
      LocalDate nearDate,
      FxRate farRate,
      LocalDate farDate); static FxSwap of(
      CurrencyAmount amount,
      FxRate nearRate,
      LocalDate nearDate,
      FxRate farRate,
      LocalDate farDate,
      BusinessDayAdjustment paymentDateAdjustment); static FxSwap ofForwardPoints(
      CurrencyAmount amount,
      FxRate nearRate,
      double decimalForwardPoints,
      LocalDate nearDate,
      LocalDate farDate); static FxSwap ofForwardPoints(
      CurrencyAmount amount,
      FxRate nearRate,
      double decimalForwardPoints,
      LocalDate nearDate,
      LocalDate farDate,
      BusinessDayAdjustment paymentDateAdjustment); @Override CurrencyPair getCurrencyPair(); @Override ResolvedFxSwap resolve(ReferenceData refData); static FxSwap.Meta meta(); @Override FxSwap.Meta metaBean(); FxSingle getNearLeg(); FxSingle getFarLeg(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void test_of_wrongOrder() { assertThatIllegalArgumentException() .isThrownBy(() -> FxSwap.of(FAR_LEG, NEAR_LEG)); }
@Test public void test_of_wrongBaseCurrency() { FxSingle nearLeg = FxSingle.of(EUR_P1590, USD_M1600, DATE_2011_11_21); assertThatIllegalArgumentException() .isThrownBy(() -> FxSwap.of(nearLeg, FAR_LEG)); }
@Test public void test_of_wrongCounterCurrency() { FxSingle nearLeg = FxSingle.of(USD_P1550, EUR_P1590.negated(), DATE_2011_11_21); FxSingle farLeg = FxSingle.of(GBP_M1000, EUR_P1590, DATE_2011_12_21); assertThatIllegalArgumentException() .isThrownBy(() -> FxSwap.of(nearLeg, farLeg)); }
@Test public void test_of_sameSign() { FxSingle farLeg = FxSingle.of(GBP_M1000.negated(), USD_P1550.negated(), DATE_2011_12_21); assertThatIllegalArgumentException() .isThrownBy(() -> FxSwap.of(NEAR_LEG, farLeg)); }
@Test public void test_of_ratesCurrencyAmountMismatch() { assertThatIllegalArgumentException() .isThrownBy(() -> FxSwap.of( GBP_P1000, FxRate.of(EUR, USD, 1.1), date(2018, 6, 1), FxRate.of(EUR, USD, 1.15), date(2018, 7, 1))); }
@Test public void test_of_ratesRateMismatch() { assertThatIllegalArgumentException() .isThrownBy(() -> FxSwap.of( GBP_P1000, FxRate.of(GBP, USD, 1.1), date(2018, 6, 1), FxRate.of(EUR, USD, 1.15), date(2018, 7, 1))); }