// ------------------------------------------------------------------------- public void test_collectIndices() { InflationInterpolatedRateComputation test = InflationInterpolatedRateComputation.of( GB_HICP, START_MONTH_FIRST, END_MONTH_FIRST, WEIGHT); ImmutableSet.Builder<Index> builder = ImmutableSet.builder(); test.collectIndices(builder); assertEquals(builder.build(), ImmutableSet.of(GB_HICP)); }
// ------------------------------------------------------------------------- public void coverage() { InflationInterpolatedRateComputation test1 = InflationInterpolatedRateComputation.of( GB_HICP, START_MONTH_FIRST, END_MONTH_FIRST, WEIGHT); coverImmutableBean(test1); InflationInterpolatedRateComputation test2 = InflationInterpolatedRateComputation.of( CH_CPI, YearMonth.of(2010, 1), YearMonth.of(2010, 7), WEIGHT + 0.1d); coverBeanEquals(test1, test2); }
// ------------------------------------------------------------------------- public void test_of() { InflationInterpolatedRateComputation test = InflationInterpolatedRateComputation.of( GB_HICP, START_MONTH_FIRST, END_MONTH_FIRST, WEIGHT); assertEquals(test.getIndex(), GB_HICP); assertEquals(test.getStartObservation().getFixingMonth(), START_MONTH_FIRST); assertEquals(test.getStartSecondObservation().getFixingMonth(), START_MONTH_SECOND); assertEquals(test.getEndObservation().getFixingMonth(), END_MONTH_FIRST); assertEquals(test.getEndSecondObservation().getFixingMonth(), END_MONTH_SECOND); assertEquals(test.getWeight(), WEIGHT, 1.0e-14); }
public void test_wrongMonthOrder() { assertThrowsIllegalArg( () -> InflationInterpolatedRateComputation.of( GB_HICP, END_MONTH_FIRST, START_MONTH_FIRST, WEIGHT)); assertThrowsIllegalArg( () -> InflationInterpolatedRateComputation.meta() .builder() .set( InflationInterpolatedRateComputation.meta().startObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 1))) .set( InflationInterpolatedRateComputation.meta().startSecondObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 1))) .set( InflationInterpolatedRateComputation.meta().endObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 7))) .set( InflationInterpolatedRateComputation.meta().endSecondObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 8))) .set(InflationInterpolatedRateComputation.meta().weight(), WEIGHT) .build()); assertThrowsIllegalArg( () -> InflationInterpolatedRateComputation.meta() .builder() .set( InflationInterpolatedRateComputation.meta().startObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 1))) .set( InflationInterpolatedRateComputation.meta().startSecondObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 2))) .set( InflationInterpolatedRateComputation.meta().endObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 7))) .set( InflationInterpolatedRateComputation.meta().endSecondObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 7))) .set(InflationInterpolatedRateComputation.meta().weight(), WEIGHT) .build()); assertThrowsIllegalArg( () -> InflationInterpolatedRateComputation.meta() .builder() .set( InflationInterpolatedRateComputation.meta().startObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 8))) .set( InflationInterpolatedRateComputation.meta().startSecondObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 9))) .set( InflationInterpolatedRateComputation.meta().endObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 7))) .set( InflationInterpolatedRateComputation.meta().endSecondObservation(), PriceIndexObservation.of(GB_HICP, YearMonth.of(2010, 8))) .set(InflationInterpolatedRateComputation.meta().weight(), WEIGHT) .build()); }
public void test_serialization() { InflationInterpolatedRateComputation test = InflationInterpolatedRateComputation.of( GB_HICP, START_MONTH_FIRST, END_MONTH_FIRST, WEIGHT); assertSerialization(test); }