File generatedCSTargetFile = new File( testDir, "test/" + CS_GEN_FILENAME );
fileWriter = new BufferedWriter( new FileWriter( generatedCSTargetFile ) );
fileWriter.write( CS_GEN_SOURCE );
fileWriter.close();
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.executeGoal( "install" );
verifier.assertFilePresent(
"target/" + BuildDirectories.BUILD_SOURCES_MAIN.getBuildDirectoryName() + "/It0018.cs" );
verifier.assertFilePresent(
"target/" + BuildDirectories.BUILD_SOURCES_MAIN.getBuildDirectoryName() + "/It0018Gen.cs" );
verifier.assertFilePresent(
"target/" + BuildDirectories.TEST_BUILD_SOURCES_MAIN.getBuildDirectoryName() + "/It0018.cs" );
verifier.assertFilePresent(
"target/" + BuildDirectories.TEST_BUILD_SOURCES_MAIN.getBuildDirectoryName() + "/It0018Gen.cs" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
// Delete the generated file
assertTrue( "Unable to delete generated source file", generatedCSSourceFile.delete() );
assertTrue( "Unable to delete generated test file", generatedCSTargetFile.delete() );
verifier.executeGoal( "install" );
// Verify that the deleted file is purged from the staging compilation directory
verifier.assertFileNotPresent(
"target/" + BuildDirectories.BUILD_SOURCES_MAIN.getBuildDirectoryName() + "/It0018Gen.cs" );
verifier.assertFileNotPresent(
"target/" + BuildDirectories.TEST_BUILD_SOURCES_GENERATED.getBuildDirectoryName() + "/It0018Gen.cs" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}