public virtual void test_invalid()
 {
     // null fixed
     assertThrowsIllegalArg(() => AddFixedCurve.of(null, SPREAD_CURVE));
     // null spread
     assertThrowsIllegalArg(() => AddFixedCurve.of(FIXED_CURVE, null));
 }
 public virtual void getter()
 {
     assertEquals(ADD_FIXED_CURVE.Metadata, METADATA_SPREAD);
     assertEquals(ADD_FIXED_CURVE.ParameterCount, XVALUES_SPREAD.size());
     assertEquals(ADD_FIXED_CURVE.getParameter(0), ADD_FIXED_CURVE.SpreadCurve.getParameter(0));
     assertEquals(ADD_FIXED_CURVE.getParameterMetadata(0), ADD_FIXED_CURVE.SpreadCurve.getParameterMetadata(0));
     assertEquals(ADD_FIXED_CURVE.withParameter(0, 9d), AddFixedCurve.of(FIXED_CURVE, SPREAD_CURVE.withParameter(0, 9d)));
     assertEquals(ADD_FIXED_CURVE.withPerturbation((i, v, m) => v + 1d), AddFixedCurve.of(FIXED_CURVE, SPREAD_CURVE.withPerturbation((i, v, m) => v + 1d)));
     assertEquals(ADD_FIXED_CURVE.withMetadata(METADATA_FIXED), AddFixedCurve.of(FIXED_CURVE, SPREAD_CURVE.withMetadata(METADATA_FIXED)));
 }
        public virtual void underlyingCurve()
        {
            assertEquals(ADD_FIXED_CURVE.split(), ImmutableList.of(FIXED_CURVE, SPREAD_CURVE));
            CurveMetadata          metadata = DefaultCurveMetadata.builder().curveName(CurveName.of("newCurve")).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(ACT_365F).parameterMetadata(PARAM_METADATA_SPREAD).build();
            InterpolatedNodalCurve newCurve = InterpolatedNodalCurve.of(metadata, XVALUES_SPREAD, YVALUES_SPREAD, INTERPOLATOR);

            assertEquals(ADD_FIXED_CURVE.withUnderlyingCurve(0, newCurve), AddFixedCurve.of(newCurve, SPREAD_CURVE));
            assertEquals(ADD_FIXED_CURVE.withUnderlyingCurve(1, newCurve), AddFixedCurve.of(FIXED_CURVE, newCurve));
            assertThrowsIllegalArg(() => ADD_FIXED_CURVE.withUnderlyingCurve(2, newCurve));
        }
Example #4
0
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         AddFixedCurve other = (AddFixedCurve)obj;
         return(JodaBeanUtils.equal(fixedCurve, other.fixedCurve) && JodaBeanUtils.equal(spreadCurve, other.spreadCurve));
     }
     return(false);
 }
 //-------------------------------------------------------------------------
 public virtual void coverage()
 {
     coverImmutableBean(ADD_FIXED_CURVE);
     coverBeanEquals(ADD_FIXED_CURVE, AddFixedCurve.of(SPREAD_CURVE, FIXED_CURVE));
 }