public virtual void test_of_rateOutOfRange() { assertThrowsIllegalArg(() => ConstantRecoveryRates.of(LEGAL_ENTITY, VALUATION, -0.5)); assertThrowsIllegalArg(() => ConstantRecoveryRates.of(LEGAL_ENTITY, VALUATION, 1.5)); ConstantRecoveryRates test = ConstantRecoveryRates.of(LEGAL_ENTITY, VALUATION, RECOVERY_RATE); assertThrowsIllegalArg(() => test.getParameter(1)); assertThrowsIllegalArg(() => test.withParameter(1, 0.5)); }
public virtual void test_of() { ConstantRecoveryRates test = ConstantRecoveryRates.of(LEGAL_ENTITY, VALUATION, RECOVERY_RATE); assertEquals(test.LegalEntityId, LEGAL_ENTITY); assertEquals(test.RecoveryRate, RECOVERY_RATE); assertEquals(test.ValuationDate, VALUATION); assertEquals(test.recoveryRate(DATE_AFTER), RECOVERY_RATE); assertEquals(test.findData(CurveName.of("Rubbish")), null); assertEquals(test.getParameter(0), RECOVERY_RATE); assertEquals(test.ParameterCount, 1); assertEquals(test.getParameterMetadata(0), ParameterMetadata.empty()); assertEquals(test.withParameter(0, 0.5), ConstantRecoveryRates.of(LEGAL_ENTITY, VALUATION, 0.5)); }
public virtual void test_of_interface() { ConstantCurve curve = ConstantCurve.of(DefaultCurveMetadata.builder().yValueType(ValueType.RECOVERY_RATE).curveName("recoveryRate").build(), RECOVERY_RATE); ConstantRecoveryRates test = (ConstantRecoveryRates)RecoveryRates.of(LEGAL_ENTITY, VALUATION, curve); assertEquals(test.LegalEntityId, LEGAL_ENTITY); assertEquals(test.RecoveryRate, RECOVERY_RATE); assertEquals(test.ValuationDate, VALUATION); assertEquals(test.recoveryRate(DATE_AFTER), RECOVERY_RATE); assertEquals(test.findData(CurveName.of("Rubbish")), null); assertEquals(test.getParameter(0), RECOVERY_RATE); assertEquals(test.ParameterCount, 1); assertEquals(test.getParameterMetadata(0), ParameterMetadata.empty()); assertEquals(test.withParameter(0, 0.5), ConstantRecoveryRates.of(LEGAL_ENTITY, VALUATION, 0.5)); }