Plugin mPlugin = new Plugin();
mPlugin.setGroupId( "test" );
mPlugin.setArtifactId( "test-artifact" );
mPlugin.setVersion( "1.0-SNAPSHOT" );
Xpp3Dom mConfigChild = new Xpp3Dom( "test" );
mConfigChild.setValue( "value" );
Xpp3Dom mConfigChild2 = new Xpp3Dom( "test2" );
mConfigChild2.setValue( "value2" );
Xpp3Dom mConfig = new Xpp3Dom( "configuration" );
mConfig.addChild( mConfigChild );
mConfig.addChild( mConfigChild2 );
mPlugin.setConfiguration( mConfig );
Build mBuild = new Build();
mBuild.addPlugin( mPlugin );
Model model = new Model();
model.setBuild( mBuild );
Plugin pPlugin = new Plugin();
pPlugin.setGroupId( "test" );
pPlugin.setArtifactId( "test-artifact" );
pPlugin.setVersion( "1.0-SNAPSHOT" );
PluginExecution pExec = new PluginExecution();
pExec.setId("profile-injected");
Xpp3Dom pConfigChild = new Xpp3Dom( "test" );
pConfigChild.setValue( "replacedValue" );
Xpp3Dom pConfig = new Xpp3Dom( "configuration" );
pConfig.addChild( pConfigChild );
pExec.setConfiguration( pConfig );
pPlugin.addExecution( pExec );
BuildBase pBuild = new BuildBase();
pBuild.addPlugin( pPlugin );
Profile profile = new Profile();
profile.setId( "testId" );
profile.setBuild( pBuild );
new DefaultProfileInjector().inject( profile, model );
Build rBuild = model.getBuild();
Plugin rPlugin = (Plugin) rBuild.getPlugins().get( 0 );
PluginExecution rExec = (PluginExecution) rPlugin.getExecutionsAsMap().get( "profile-injected" );
assertNotNull( rExec );
Xpp3Dom rExecConfig = (Xpp3Dom) rExec.getConfiguration();
Xpp3Dom rChild = rExecConfig.getChild( "test" );
assertEquals( "replacedValue", rChild.getValue() );
Xpp3Dom rConfig = (Xpp3Dom) rPlugin.getConfiguration();
assertNotNull( rConfig );
Xpp3Dom rChild2 = rConfig.getChild( "test2" );
assertEquals( "value2", rChild2.getValue() );
}