elharo commented on code in PR #1075:
URL:
https://github.com/apache/maven-compiler-plugin/pull/1075#discussion_r3665242694
##########
src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTest.java:
##########
@@ -113,6 +115,27 @@ void testCompilerEmptySource(CompilerMojo compilerMojo)
throws Exception {
projectArtifact.getFile(), "MCOMPILER-94: artifact file should
be null if there is nothing to compile");
}
+ /**
+ * Tests that an empty source file does not cause compilation every time
because it has no class file.
+ */
+ @Test
+ @InjectMojo(goal = COMPILE, pom =
"classpath:/unit/compiler-empty-source-change-detection-test/plugin-config.xml")
+ void testCompilerEmptySourceChangeDetection(CompilerMojo compilerMojo)
throws Exception {
+ setUpCompilerMojoTestEnv(compilerMojo);
+
+ File source = new File(compilerMojo.getCompileSourceRoots().get(0),
"Empty.java");
+ Files.createDirectories(source.getParentFile().toPath());
+ Files.write(source.toPath(), new byte[0]);
+
+ Log log = mock(Log.class);
Review Comment:
Testing vs log messages is fragile. Any other way to verify this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]