public void test_ofCurves_missingCurve() { CurveGroupDefinition definition = CurveGroupDefinition.builder() .name(CurveGroupName.of("group")) .addCurve(DISCOUNT_NAME, GBP, GBP_LIBOR_1M) .addForwardCurve(IBOR_NAME, USD_LIBOR_1M, USD_LIBOR_2M) .addForwardCurve(OVERNIGHT_NAME, EUR_EONIA) .build(); assertThrowsIllegalArg( () -> CurveGroup.ofCurves(definition, DISCOUNT_CURVE, IBOR_CURVE), "No curve found named 'Overnight' when building curve group 'group'"); }
public void test_ofCurves() { CurveGroupDefinition definition = CurveGroupDefinition.builder() .name(CurveGroupName.of("group")) .addCurve(DISCOUNT_NAME, GBP, GBP_LIBOR_1M) .addForwardCurve(IBOR_NAME, USD_LIBOR_1M, USD_LIBOR_2M) .addForwardCurve(OVERNIGHT_NAME, EUR_EONIA) .build(); CurveGroup group = CurveGroup.ofCurves(definition, DISCOUNT_CURVE, OVERNIGHT_CURVE, IBOR_CURVE); assertThat(group.findDiscountCurve(GBP)).hasValue(DISCOUNT_CURVE); assertThat(group.findForwardCurve(USD_LIBOR_1M)).hasValue(IBOR_CURVE); assertThat(group.findForwardCurve(USD_LIBOR_2M)).hasValue(IBOR_CURVE); assertThat(group.findForwardCurve(EUR_EONIA)).hasValue(OVERNIGHT_CURVE); }