}
public void testShouldNotInterpolateDependencyVersionWithInvalidReference()
throws Exception
{
Model model = new Model();
model.setVersion( "3.8.1" );
Dependency dep = new Dependency();
dep.setVersion( "${something}" );
model.addDependency( dep );
/*
// This is the desired behaviour, however there are too many crappy poms in the repo and an issue with the
// timing of executing the interpolation
try
{
new RegexBasedModelInterpolator().interpolate( model, context );
fail( "Should have failed to interpolate with invalid reference" );
}
catch ( ModelInterpolationException expected )
{
assertTrue( true );
}
*/
ModelInterpolator interpolator = createInterpolator();
final SimpleProblemCollector collector = new SimpleProblemCollector();
Model out = interpolator.interpolateModel( model, new File("."), createModelBuildingRequest(context),
collector );
assertProblemFree( collector );
assertEquals( "${something}", ( out.getDependencies().get( 0 ) ).getVersion() );
}