public void test_builder_min() { CapitalIndexedBond test = CapitalIndexedBond.builder() .securityId(SECURITY_ID) .notional(NOTIONAL) .currency(USD) .dayCount(ACT_ACT_ISDA) .rateCalculation(RATE_CALC) .legalEntityId(LEGAL_ENTITY) .yieldConvention(US_IL_REAL) .settlementDateOffset(SETTLE_OFFSET) .accrualSchedule(SCHEDULE) .build(); assertEquals(test.getSecurityId(), SECURITY_ID); assertEquals(test.getCurrency(), USD); assertEquals(test.getDayCount(), ACT_ACT_ISDA); assertEquals(test.getExCouponPeriod(), DaysAdjustment.NONE); assertEquals(test.getLegalEntityId(), LEGAL_ENTITY); assertEquals(test.getNotional(), NOTIONAL); assertEquals(test.getAccrualSchedule(), SCHEDULE); assertEquals(test.getRateCalculation(), RATE_CALC); assertEquals(test.getSettlementDateOffset(), SETTLE_OFFSET); assertEquals(test.getYieldConvention(), US_IL_REAL); }
static CapitalIndexedBond sut1() { return CapitalIndexedBond.builder() .securityId(SECURITY_ID) .notional(NOTIONAL) .currency(USD) .dayCount(ACT_ACT_ISDA) .rateCalculation(RATE_CALC) .exCouponPeriod(EX_COUPON) .legalEntityId(LEGAL_ENTITY) .yieldConvention(GB_IL_FLOAT) .settlementDateOffset(SETTLE_OFFSET) .accrualSchedule(SCHEDULE) .build(); }
static CapitalIndexedBond sut() { return CapitalIndexedBond.builder() .securityId(SECURITY_ID) .notional(NOTIONAL) .currency(USD) .dayCount(ACT_ACT_ISDA) .rateCalculation(RATE_CALC) .exCouponPeriod(EX_COUPON) .legalEntityId(LEGAL_ENTITY) .yieldConvention(US_IL_REAL) .settlementDateOffset(SETTLE_OFFSET) .accrualSchedule(SCHEDULE) .build(); }
public void test_builder_fail() { // negative settlement date offset assertThrowsIllegalArg(() -> CapitalIndexedBond.builder() .securityId(SECURITY_ID) .notional(NOTIONAL) .currency(USD) .dayCount(ACT_ACT_ISDA) .rateCalculation(RATE_CALC) .exCouponPeriod(EX_COUPON) .legalEntityId(LEGAL_ENTITY) .yieldConvention(US_IL_REAL) .settlementDateOffset(DaysAdjustment.ofBusinessDays(-2, USNY)) .accrualSchedule(SCHEDULE) .build()); // positive ex-coupon days assertThrowsIllegalArg(() -> CapitalIndexedBond.builder() .securityId(SECURITY_ID) .notional(NOTIONAL) .currency(USD) .dayCount(ACT_ACT_ISDA) .rateCalculation(RATE_CALC) .exCouponPeriod( DaysAdjustment.ofCalendarDays(7, BusinessDayAdjustment.of(BusinessDayConventions.FOLLOWING, USNY))) .legalEntityId(LEGAL_ENTITY) .yieldConvention(US_IL_REAL) .settlementDateOffset(SETTLE_OFFSET) .accrualSchedule(SCHEDULE) .build()); }
static CapitalIndexedBond sut2() { return CapitalIndexedBond.builder() .securityId(SECURITY_ID2) .notional(5.0e7) .currency(GBP) .dayCount(NL_365) .rateCalculation( InflationRateCalculation.builder() .index(GB_RPI) .lag(Period.ofMonths(2)) .indexCalculationMethod(INTERPOLATED) .firstIndexValue(124.556) .build()) .exCouponPeriod(EX_COUPON) .legalEntityId(LegalEntityId.of("OG-Ticker", "US-Govt-1")) .yieldConvention(GB_IL_FLOAT) .settlementDateOffset(DaysAdjustment.ofBusinessDays(2, GBLO)) .accrualSchedule( PeriodicSchedule.of( START, END, FREQUENCY, BusinessDayAdjustment.of(BusinessDayConventions.FOLLOWING, GBLO), StubConvention.NONE, RollConventions.NONE)) .build(); }