public virtual void test_of_noMetadata() { IList <ParameterMetadata> combinedParamMeta = new List <ParameterMetadata>(); ((IList <ParameterMetadata>)combinedParamMeta).AddRange(PARAM_METADATA_BASE); ((IList <ParameterMetadata>)combinedParamMeta).AddRange(PARAM_METADATA_SPREAD); CurveMetadata expectedMetadata = DefaultCurveMetadata.builder().curveName(BASE_NAME + "+" + SPREAD_NAME).xValueType(YEAR_FRACTION).yValueType(ZERO_RATE).dayCount(ACT_365F).parameterMetadata(combinedParamMeta).build(); assertEquals(COMBINED_CURVE.BaseCurve, BASE_CURVE); assertEquals(COMBINED_CURVE.SpreadCurve, SPREAD_CURVE); assertEquals(COMBINED_CURVE.Metadata, expectedMetadata); assertEquals(COMBINED_CURVE.Name, expectedMetadata.CurveName); assertEquals(COMBINED_CURVE.ParameterCount, BASE_CURVE.ParameterCount + SPREAD_CURVE.ParameterCount); assertEquals(COMBINED_CURVE.getParameter(1), BASE_CURVE.getParameter(1)); assertEquals(COMBINED_CURVE.getParameter(6), SPREAD_CURVE.getParameter(3)); assertEquals(COMBINED_CURVE.getParameterMetadata(0), BASE_CURVE.getParameterMetadata(0)); assertEquals(COMBINED_CURVE.getParameterMetadata(4), SPREAD_CURVE.getParameterMetadata(1)); }
public virtual void test_of() { CurveMetadata baseMetadata = DefaultCurveMetadata.builder().curveName(BASE_NAME).xValueType(YEAR_FRACTION).yValueType(ZERO_RATE).dayCount(ACT_365F).build(); CurveMetadata spreadMetadata = DefaultCurveMetadata.builder().curveName(SPREAD_NAME).xValueType(YEAR_FRACTION).yValueType(ZERO_RATE).dayCount(ACT_365F).build(); InterpolatedNodalCurve baseCurve = InterpolatedNodalCurve.of(baseMetadata, XVALUES_BASE, YVALUES_BASE, NATURAL_CUBIC_SPLINE, LINEAR, LINEAR); InterpolatedNodalCurve spreadCurve = InterpolatedNodalCurve.of(spreadMetadata, XVALUES_SPREAD, YVALUES_SPREAD, PCHIP, LINEAR, LINEAR); CurveMetadata combinedMetadata = DefaultCurveMetadata.builder().curveName("CombinedCurve").xValueType(YEAR_FRACTION).yValueType(ZERO_RATE).dayCount(ACT_365F).build(); CombinedCurve test = CombinedCurve.of(baseCurve, spreadCurve, combinedMetadata); assertEquals(test.BaseCurve, baseCurve); assertEquals(test.SpreadCurve, spreadCurve); assertEquals(test.Metadata, combinedMetadata); assertEquals(test.Name, combinedMetadata.CurveName); assertEquals(test.ParameterCount, baseCurve.ParameterCount + spreadCurve.ParameterCount); assertEquals(test.getParameter(1), baseCurve.getParameter(1)); assertEquals(test.getParameter(6), spreadCurve.getParameter(3)); assertEquals(test.getParameterMetadata(2), baseCurve.getParameterMetadata(2)); assertEquals(test.getParameterMetadata(5), spreadCurve.getParameterMetadata(2)); }