//------------------------------------------------------------------------- public virtual void test_withInfo() { DefaultCurveMetadata @base = DefaultCurveMetadata.of(CURVE_NAME); assertThat(@base.findInfo(CurveInfoType.DAY_COUNT).Present).False; DefaultCurveMetadata test = @base.withInfo(CurveInfoType.DAY_COUNT, ACT_360); assertThat(@base.findInfo(CurveInfoType.DAY_COUNT).Present).False; assertThat(test.findInfo(CurveInfoType.DAY_COUNT).Present).True; }
public virtual void test_builder1() { DefaultCurveMetadata test = DefaultCurveMetadata.builder().curveName(CURVE_NAME.ToString()).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.DISCOUNT_FACTOR).dayCount(ACT_360).jacobian(JACOBIAN_DATA).addInfo(CurveInfoType.DAY_COUNT, null).parameterMetadata(ImmutableList.of(ParameterMetadata.empty())).build(); assertThat(test.CurveName).isEqualTo(CURVE_NAME); assertThat(test.XValueType).isEqualTo(ValueType.YEAR_FRACTION); assertThat(test.YValueType).isEqualTo(ValueType.DISCOUNT_FACTOR); assertThat(test.findInfo(CurveInfoType.DAY_COUNT)).Empty; assertThat(test.getInfo(CurveInfoType.JACOBIAN)).isEqualTo(JACOBIAN_DATA); assertThat(test.findInfo(CurveInfoType.JACOBIAN)).isEqualTo(JACOBIAN_DATA); assertThat(test.findInfo(CurveInfoType.of("Rubbish"))).isEqualTo(null); assertThat(test.ParameterMetadata.Present).True; assertThat(test.ParameterMetadata.get()).containsExactly(ParameterMetadata.empty()); }
public virtual void test_builder4() { DefaultCurveMetadata test = DefaultCurveMetadata.builder().curveName(CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.DISCOUNT_FACTOR).parameterMetadata(ParameterMetadata.empty()).parameterMetadata(ParameterMetadata.empty()).build(); assertThat(test.CurveName).isEqualTo(CURVE_NAME); assertThat(test.XValueType).isEqualTo(ValueType.YEAR_FRACTION); assertThat(test.YValueType).isEqualTo(ValueType.DISCOUNT_FACTOR); assertThrowsIllegalArg(() => test.getInfo(CurveInfoType.DAY_COUNT)); assertThat(test.findInfo(CurveInfoType.DAY_COUNT)).isEqualTo(null); assertThat(test.findInfo(CurveInfoType.JACOBIAN)).isEqualTo(null); assertThat(test.findInfo(CurveInfoType.of("Rubbish"))).isEqualTo(null); assertThat(test.ParameterMetadata.Present).True; assertThat(test.ParameterMetadata.get()).containsExactly(ParameterMetadata.empty()); }