// Path: src/test/java/com/redhat/rcm/version/testutil/TestProjectFixture.java
// public static File getResourceFile( final String path )
// {
//     final URL resource = Thread.currentThread()
//                                .getContextClassLoader()
//                                .getResource( path );
//     if ( resource == null )
//     {
//         fail( "Resource not found: " + path );
//     }
// 
//     return new File( resource.getPath() );
// }
// 
// Path: src/test/java/com/redhat/rcm/version/testutil/TestProjectFixture.java
// public static Model loadModel( final String path )
//     throws IOException
// {
//     final File pom = getResourceFile( path );
//     return loadModel( pom );
// }
// 
// Path: src/test/java/com/redhat/rcm/version/testutil/TestProjectFixture.java
// public static VersionManagerSession newVersionManagerSession( final File workspace, final File reports, final String suffix, final String modifier )
// {
//     return new SessionBuilder( workspace, reports ).withVersionSuffix( suffix )
//                                                    .withVersionModifier( modifier )
//                                                    .build();
// }


import static com.redhat.rcm.version.testutil.TestProjectFixture.getResourceFile;
import static com.redhat.rcm.version.testutil.TestProjectFixture.loadModel;
import static com.redhat.rcm.version.testutil.TestProjectFixture.newVersionManagerSession;
import static org.apache.commons.io.FileUtils.readFileToString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import org.apache.maven.mae.project.key.FullProjectKey;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.codehaus.plexus.util.FileUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import com.redhat.rcm.version.fixture.LoggingFixture;
import com.redhat.rcm.version.mgr.AbstractVersionManagerTest;
import com.redhat.rcm.version.mgr.session.VersionManagerSession;
import java.io.File;
import java.util.List;
        System.out.println( "Modified POM for " + name.getMethodName() + ":\n\n" + pomStr + "\n\n" );

        final Model changed = loadModel( out );

        assertThat( changed.getBuild(), notNullValue() );

        plugins = changed.getBuild().getPlugins();
        assertThat( plugins, notNullValue() );
        assertThat( plugins.size(), equalTo( 1 ) );

        plugin = plugins.get( 0 );
        config = plugin.getConfiguration();
        assertThat( config, notNullValue() );
        assertThat( config.toString().contains( "<delete dir=\"foobar\"" ), equalTo( true ) );
    }

    @Test
    public void pomRewriteInjectsXMLDeclaration()
        throws Exception
    {
        final File srcPom = getResourceFile( BASE + "no-xml-declaration.pom" );

        final File pom = new File( repo, srcPom.getName() );
        FileUtils.copyFile( srcPom, pom );

        final String orig = readFileToString( pom );
        assertThat( orig.contains( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ), equalTo( false ) );

        final Model model = loadModel( pom );

// Path: src/test/java/com/redhat/rcm/version/testutil/TestProjectFixture.java
// public static File getResourceFile( final String path )
// {
//     final URL resource = Thread.currentThread()
//                                .getContextClassLoader()
//                                .getResource( path );
//     if ( resource == null )
//     {
//         fail( "Resource not found: " + path );
//     }
// 
//     return new File( resource.getPath() );
// }
// 
// Path: src/test/java/com/redhat/rcm/version/testutil/TestProjectFixture.java
// public static Model loadModel( final String path )
//     throws IOException
// {
//     final File pom = getResourceFile( path );
//     return loadModel( pom );
// }
// 
// Path: src/test/java/com/redhat/rcm/version/testutil/TestProjectFixture.java
// public static VersionManagerSession newVersionManagerSession( final File workspace, final File reports, final String suffix, final String modifier )
// {
//     return new SessionBuilder( workspace, reports ).withVersionSuffix( suffix )
//                                                    .withVersionModifier( modifier )
//                                                    .build();
// }


// Path: src/test/java/com/redhat/rcm/version/util/PomUtilsTest.java
import static com.redhat.rcm.version.testutil.TestProjectFixture.getResourceFile;
import static com.redhat.rcm.version.testutil.TestProjectFixture.loadModel;
import static com.redhat.rcm.version.testutil.TestProjectFixture.newVersionManagerSession;
import static org.apache.commons.io.FileUtils.readFileToString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import org.apache.maven.mae.project.key.FullProjectKey;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.codehaus.plexus.util.FileUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import com.redhat.rcm.version.fixture.LoggingFixture;
import com.redhat.rcm.version.mgr.AbstractVersionManagerTest;
import com.redhat.rcm.version.mgr.session.VersionManagerSession;
import java.io.File;
import java.util.List;

        System.out.println( "Modified POM for " + name.getMethodName() + ":\n\n" + pomStr + "\n\n" );

        final Model changed = loadModel( out );

        assertThat( changed.getBuild(), notNullValue() );

        plugins = changed.getBuild().getPlugins();
        assertThat( plugins, notNullValue() );
        assertThat( plugins.size(), equalTo( 1 ) );

        plugin = plugins.get( 0 );
        config = plugin.getConfiguration();
        assertThat( config, notNullValue() );
        assertThat( config.toString().contains( "<delete dir=\"foobar\"" ), equalTo( true ) );
    }

    @Test
    public void pomRewriteInjectsXMLDeclaration()
        throws Exception
    {
        final File srcPom = getResourceFile( BASE + "no-xml-declaration.pom" );

        final File pom = new File( repo, srcPom.getName() );
        FileUtils.copyFile( srcPom, pom );

        final String orig = readFileToString( pom );
        assertThat( orig.contains( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ), equalTo( false ) );

        final Model model = loadModel( pom );

        final VersionManagerSession session = newVersionManagerSession( workspace, reports, null );