You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/04/07 13:14:04 UTC
[maven-integration-testing] 21/21: Additional assertions on files
being present
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch MNG-4660
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
commit ac4f4936ac1e69fa6a2ce858459d9982d5f4a291
Author: Maarten Mulders <ma...@infosupport.com>
AuthorDate: Tue Apr 7 14:16:39 2020 +0200
Additional assertions on files being present
---
.../maven/it/MavenITmng4660OutdatedPackagedArtifact.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java
index de00b93..d3b4c91 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4660OutdatedPackagedArtifact.java
@@ -27,6 +27,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import static org.junit.Assert.assertThat;
+import static org.hamcrest.Matchers.greaterThan;
+
/**
* This is a test case for a new check introduced with <a href="https://issues.apache.org/jira/browse/MNG-4660">MNG-4660</a>.
* That check verifies if a packaged artifact within the Reactor is up-to-date with the outputDirectory of the same project.
@@ -62,13 +65,21 @@ public class MavenITmng4660OutdatedPackagedArtifact extends AbstractMavenIntegra
// 2. Create a properties file with some content and compile only that module (module A).
final Verifier verifier2 = newVerifier( testDir.getAbsolutePath() );
- verifier2.deleteDirectory( "module-a/target/classes" );
+ final Path resourcesDirectory = Files.createDirectories( Paths.get( testDir.toString(), "module-a", "src", "main", "resources" ) );
+ final Path fileToWrite = resourcesDirectory.resolve( "example.properties" );
+ FileUtils.fileWrite( fileToWrite.toString(), "x=42" );
verifier2.setAutoclean( false );
verifier2.addCliOption( "--projects" );
verifier2.addCliOption( ":module-a" );
verifier2.executeGoal( "compile" );
+ Path module1PropertiesFile = testDir.toPath().resolve( "module-a/target/classes/example.properties" )
+ .toAbsolutePath();
+
+ verifier2.assertFilePresent( module1PropertiesFile.toString() );
+ assertThat( Files.getLastModifiedTime( module1PropertiesFile ), greaterThan ( Files.getLastModifiedTime( module1Jar ) ) );
+
Path module1Class = testDir.toPath().resolve( "module-a/target/classes/org/apache/maven/it/Example.class" )
.toAbsolutePath();
verifier2.verifyErrorFreeLog();