public virtual void test_withNode_atEnd_withoutMetadata() { InterpolatedNodalCurve @base = InterpolatedNodalCurve.of(METADATA, XVALUES, YVALUES, INTERPOLATOR); LabelDateParameterMetadata item = LabelDateParameterMetadata.of(date(2015, 6, 30), TNR_1Y); InterpolatedNodalCurve test = @base.withNode(0.5d, 4d, item); assertThat(test.Name).isEqualTo(CURVE_NAME); assertThat(test.ParameterCount).isEqualTo(SIZE + 1); assertThat(test.Metadata).isEqualTo(METADATA); assertThat(test.XValues).isEqualTo(DoubleArray.of(0.5d, 1d, 2d, 3d)); assertThat(test.YValues).isEqualTo(DoubleArray.of(4d, 5d, 7d, 8d)); }
public virtual void test_withNode_replace_withMetadata() { InterpolatedNodalCurve @base = InterpolatedNodalCurve.of(METADATA_ENTRIES, XVALUES, YVALUES, INTERPOLATOR); LabelDateParameterMetadata item = LabelDateParameterMetadata.of(date(2015, 6, 30), TNR_1Y); InterpolatedNodalCurve test = @base.withNode(2d, 4d, item); IList <ParameterMetadata> list = new List <ParameterMetadata>(METADATA_ENTRIES.ParameterMetadata.get()); list[1] = item; assertThat(test.Name).isEqualTo(CURVE_NAME); assertThat(test.ParameterCount).isEqualTo(SIZE); assertThat(test.Metadata).isEqualTo(METADATA.withParameterMetadata(list)); assertThat(test.XValues).isEqualTo(DoubleArray.of(1d, 2d, 3d)); assertThat(test.YValues).isEqualTo(DoubleArray.of(5d, 4d, 8d)); }
//------------------------------------------------------------------------- public virtual void test_withNode_atStart_withMetadata() { InterpolatedNodalCurve @base = InterpolatedNodalCurve.of(METADATA_ENTRIES, XVALUES, YVALUES, INTERPOLATOR); LabelDateParameterMetadata item = LabelDateParameterMetadata.of(date(2015, 6, 30), TNR_1Y); InterpolatedNodalCurve test = @base.withNode(0.5d, 4d, item); IList <ParameterMetadata> list = new List <ParameterMetadata>(); list.Add(item); ((IList <ParameterMetadata>)list).AddRange(ParameterMetadata.listOfEmpty(SIZE)); assertThat(test.Name).isEqualTo(CURVE_NAME); assertThat(test.ParameterCount).isEqualTo(SIZE + 1); assertThat(test.Metadata).isEqualTo(METADATA_ENTRIES.withParameterMetadata(list)); assertThat(test.XValues).isEqualTo(DoubleArray.of(0.5d, 1d, 2d, 3d)); assertThat(test.YValues).isEqualTo(DoubleArray.of(4d, 5d, 7d, 8d)); }