public void test_builder() { ImmutableFxSwapConvention test = ImmutableFxSwapConvention.builder() .currencyPair(EUR_USD) .name("EUR::USD") .spotDateOffset(PLUS_TWO_DAYS) .businessDayAdjustment(BDA_FOLLOW) .build(); assertEquals(test.getName(), "EUR::USD"); assertEquals(test.getCurrencyPair(), EUR_USD); assertEquals(test.getSpotDateOffset(), PLUS_TWO_DAYS); assertEquals(test.getBusinessDayAdjustment(), BDA_FOLLOW); }
/** * Obtains a convention based on the specified currency pair, spot date offset and adjustment. * <p> * Use the {@linkplain #builder() builder} for unusual conventions. * * @param currencyPair the currency pair associated to the convention * @param spotDateOffset the spot date offset * @param businessDayAdjustment the business day adjustment to apply * @return the convention */ public static ImmutableFxSwapConvention of( CurrencyPair currencyPair, DaysAdjustment spotDateOffset, BusinessDayAdjustment businessDayAdjustment) { ArgChecker.notNull(businessDayAdjustment, "businessDayAdjustment"); return ImmutableFxSwapConvention.builder() .currencyPair(currencyPair) .spotDateOffset(spotDateOffset) .businessDayAdjustment(businessDayAdjustment) .build(); }
public void coverage() { ImmutableFxSwapConvention test = ImmutableFxSwapConvention.of(EUR_USD, PLUS_TWO_DAYS, BDA_FOLLOW); coverImmutableBean(test); ImmutableFxSwapConvention test2 = ImmutableFxSwapConvention.builder() .name("GBP/USD") .currencyPair(GBP_USD) .spotDateOffset(PLUS_ONE_DAY) .businessDayAdjustment(BDA_MODFOLLOW) .build(); coverBeanEquals(test, test2); }