/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ImmutableFxSwapConvention beanToCopy) { this.currencyPair = beanToCopy.getCurrencyPair(); this.name = beanToCopy.name; this.spotDateOffset = beanToCopy.getSpotDateOffset(); this.businessDayAdjustment = beanToCopy.businessDayAdjustment; }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 1005147787: // currencyPair return ((ImmutableFxSwapConvention) bean).getCurrencyPair(); case 3373707: // name return ((ImmutableFxSwapConvention) bean).name; case 746995843: // spotDateOffset return ((ImmutableFxSwapConvention) bean).getSpotDateOffset(); case -1065319863: // businessDayAdjustment return ((ImmutableFxSwapConvention) bean).businessDayAdjustment; } return super.propertyGet(bean, propertyName, quiet); }
@Test(dataProvider = "spotLag") public void test_spot_lag(ImmutableFxSwapConvention convention, int lag) { assertEquals(convention.getSpotDateOffset().getDays(), lag); }
@Test(dataProvider = "calendar") public void test_calendar(ImmutableFxSwapConvention convention, HolidayCalendarId cal) { assertEquals(convention.getSpotDateOffset().getCalendar(), cal); assertEquals(convention.getBusinessDayAdjustment().getCalendar(), cal); }
public void test_of_bda() { ImmutableFxSwapConvention test = ImmutableFxSwapConvention.of(EUR_USD, PLUS_TWO_DAYS, BDA_FOLLOW); assertEquals(test.getName(), EUR_USD.toString()); assertEquals(test.getCurrencyPair(), EUR_USD); assertEquals(test.getSpotDateOffset(), PLUS_TWO_DAYS); assertEquals(test.getBusinessDayAdjustment(), BDA_FOLLOW); }
public void test_of_nobda() { ImmutableFxSwapConvention test = ImmutableFxSwapConvention.of(EUR_USD, PLUS_TWO_DAYS); assertEquals(test.getName(), EUR_USD.toString()); assertEquals(test.getCurrencyPair(), EUR_USD); assertEquals(test.getSpotDateOffset(), PLUS_TWO_DAYS); assertEquals(test.getBusinessDayAdjustment(), BusinessDayAdjustment.of(MODIFIED_FOLLOWING, EUTA_USNY)); }
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); }
public void test_metadata_end() { FxSwapCurveNode node = FxSwapCurveNode.of(TEMPLATE, QUOTE_ID_PTS); LocalDate valuationDate = LocalDate.of(2015, 1, 22); LocalDate endDate = CONVENTION.getBusinessDayAdjustment() .adjust(CONVENTION.getSpotDateOffset().adjust(valuationDate, REF_DATA).plus(FAR_PERIOD), REF_DATA); ParameterMetadata metadata = node.metadata(valuationDate, REF_DATA); assertEquals(((TenorDateParameterMetadata) metadata).getDate(), endDate); assertEquals(((TenorDateParameterMetadata) metadata).getTenor(), Tenor.of(FAR_PERIOD)); }