public void testPropertyFiles_MainAndExtra()
throws Exception
{
File testPom = new File( getBasedir(), defaultPomFilePath );
ResourcesMojo mojo = (ResourcesMojo) lookupMojo( "resources", testPom );
MavenProjectResourcesStub project = new MavenProjectResourcesStub( "resourcePropertyFiles_MainAndExtra" );
List resources = project.getBuild().getResources();
LinkedList filterList = new LinkedList();
LinkedList extraFilterList = new LinkedList();
assertNotNull( mojo );
project.addFile( "main-extra.properties", "current working directory=${dir}; old working directory=${dir2}" );
project.addFile( "filter.properties", "dir:testdir" );
project.addFile( "extra-filter.properties", "dir2:testdir2" );
project.setResourceFiltering( 0, true );
project.cleanBuildEnvironment();
project.setupBuildEnvironment();
filterList.add( project.getResourcesDirectory() + "filter.properties" );
extraFilterList.add( project.getResourcesDirectory() + "extra-filter.properties" );
// setVariableValueToObject(mojo,"encoding","UTF-8");
setVariableValueToObject( mojo, "project", project );
setVariableValueToObject( mojo, "resources", resources );
setVariableValueToObject( mojo, "outputDirectory", new File( project.getBuild().getOutputDirectory() ) );
setVariableValueToObject( mojo, "buildFilters", filterList );
setVariableValueToObject( mojo, "filters", extraFilterList );
setVariableValueToObject( mojo, "useBuildFilters", Boolean.TRUE );
mojo.execute();
String resourcesDir = project.getOutputDirectory();
String checkString = "current working directory=testdir; old working directory=testdir2";
File file = new File( resourcesDir, "main-extra.properties" );
assertContent( file.getAbsolutePath(), checkString );
}