GeneratorPriceIndexCurveInterpolatedAnchorNode extends GeneratorPriceIndexCurve { @Override public PriceIndexCurveSimple generateCurve(final String name, final double[] x) { ArgumentChecker.isTrue(x.length == _nbPoints, "Incorrect dimension for the rates"); ArgumentChecker.notNull(name, "name"); return new PriceIndexCurveSimple(DoublesCurveInterpolatedAnchor.from(_nodePoints, x, _anchorNode, _anchorValue, _interpolator, name)); } GeneratorPriceIndexCurveInterpolatedAnchorNode(final double[] nodePoints, final Interpolator1D interpolator, 
      final double anchorNode, final double anchorValue); @Override int getNumberOfParameter(); double[] getNodePoints(); double getAnchorNode(); double getAnchorValue(); @Override PriceIndexCurveSimple generateCurve(final String name, final double[] x); @Override PriceIndexCurve generateCurve(final String name, final InflationProviderInterface multicurve, final double[] parameters);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullNameGenerate() { GENERATOR.generateCurve(null, NODES); }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongSize() { GENERATOR.generateCurve("name", new double[NB_NODES+1]); }
@Test public void generateCurve() { String name = "CRV"; double[] values = new double[NB_NODES]; PriceIndexCurveSimple generated = GENERATOR.generateCurve(name, values); assertTrue("GeneratorPriceIndexCurveInterpolatedAnchorNode", generated.getCurve() instanceof DoublesCurveInterpolatedAnchor); DoublesCurveInterpolatedAnchor curveAnchor = (DoublesCurveInterpolatedAnchor) generated.getCurve(); assertTrue("GeneratorPriceIndexCurveInterpolatedAnchorNode", curveAnchor.getInterpolator().equals(INTERPOLATOR_LINEAR)); assertTrue("GeneratorPriceIndexCurveInterpolatedAnchorNode", curveAnchor.getXData().length == 3); ArrayAsserts.assertArrayEquals("GeneratorPriceIndexCurveInterpolatedAnchorNode", curveAnchor.getXDataAsPrimitive(), ArrayUtils.addAll(new double[]{ANCHOR_NODE}, NODES), TOLERANCE_NODE); ArrayAsserts.assertArrayEquals("GeneratorPriceIndexCurveInterpolatedAnchorNode", curveAnchor.getYDataAsPrimitive(), ArrayUtils.addAll(new double[]{ANCHOR_VALUE}, values), TOLERANCE_NODE); }