public void test_builder_full() { ImmutableIborFixingDepositConvention test = ImmutableIborFixingDepositConvention.builder() .name("Name") .businessDayAdjustment(BDA_MOD_FOLLOW) .currency(EUR) .dayCount(ACT_365F) .fixingDateOffset(FIXING_ADJ) .index(EUR_LIBOR_3M) .spotDateOffset(SPOT_ADJ) .build(); assertEquals(test.getName(), "Name"); assertEquals(test.getBusinessDayAdjustment(), BDA_MOD_FOLLOW); assertEquals(test.getCurrency(), EUR); assertEquals(test.getDayCount(), ACT_365F); assertEquals(test.getFixingDateOffset(), FIXING_ADJ); assertEquals(test.getIndex(), EUR_LIBOR_3M); assertEquals(test.getSpotDateOffset(), SPOT_ADJ); }
public void test_toTrade() { IborFixingDepositConvention convention = ImmutableIborFixingDepositConvention.builder() .businessDayAdjustment(BDA_MOD_FOLLOW) .currency(EUR) .dayCount(ACT_365F) .fixingDateOffset(FIXING_ADJ) .index(EUR_LIBOR_3M) .spotDateOffset(SPOT_ADJ) .build(); LocalDate tradeDate = LocalDate.of(2015, 1, 22); Period depositPeriod = Period.ofMonths(3);
/** * Obtains a convention based on the specified index. * <p> * The standard convention for an Ibor fixing deposit is based exclusively on the index. * This creates an instance that contains the index. * The instance is not dereferenced using the {@code FraConvention} name, as such * the result of this method and {@link IborFixingDepositConvention#of(IborIndex)} can differ. * <p> * Use the {@linkplain #builder() builder} for unusual conventions. * * @param index the index, the convention values are extracted from the index * @return the convention */ public static ImmutableIborFixingDepositConvention of(IborIndex index) { return ImmutableIborFixingDepositConvention.builder() .index(index) .build(); }
/** * Returns a builder that allows this bean to be mutated. * @return the mutable builder, not null */ public Builder toBuilder() { return new Builder(this); }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */ public static ImmutableIborFixingDepositConvention.Builder builder() { return new ImmutableIborFixingDepositConvention.Builder(); }
public void test_builder_indexOnly() { ImmutableIborFixingDepositConvention test = ImmutableIborFixingDepositConvention.builder() .index(GBP_LIBOR_6M) .build(); assertEquals(test.getBusinessDayAdjustment(), BusinessDayAdjustment.of(MODIFIED_FOLLOWING, GBP_LIBOR_6M.getFixingCalendar())); assertEquals(test.getCurrency(), GBP_LIBOR_6M.getCurrency()); assertEquals(test.getDayCount(), GBP_LIBOR_6M.getDayCount()); assertEquals(test.getFixingDateOffset(), GBP_LIBOR_6M.getFixingDateOffset()); assertEquals(test.getIndex(), GBP_LIBOR_6M); assertEquals(test.getSpotDateOffset(), GBP_LIBOR_6M.getEffectiveDateOffset()); }
public void coverage() { ImmutableIborFixingDepositConvention test1 = ImmutableIborFixingDepositConvention.of(GBP_LIBOR_6M); coverImmutableBean(test1); ImmutableIborFixingDepositConvention test2 = ImmutableIborFixingDepositConvention.of(EUR_LIBOR_3M) .toBuilder() .name("Foo") .build(); coverBeanEquals(test1, test2); coverPrivateConstructor(IborFixingDepositConventions.class); coverPrivateConstructor(IborFixingDepositConventionLookup.class); }
@Override public ImmutableIborFixingDepositConvention.Builder builder() { return new ImmutableIborFixingDepositConvention.Builder(); }