Skip to content

Commit 65cc352

Browse files
authored
Assert the source archive itself is absent in testNoSources (#318)
Both testNoSources cases asserted that getTestTargetDir("project-005") does not exist. That helper returns the project's target directory, not the artifact, so the assertion does not actually check what its message claims - and it is tied to whether a directory happens to be present rather than to whether the mojo produced an archive. Assert the specific jar instead, reusing the existing getSourceArchive and getTestSourceArchive helpers so each test checks the same artifact path its positive counterpart asserts. Fixes #308
1 parent 8510aba commit 65cc352

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void testNoSources(AbstractSourceJarMojo mojo) throws Exception {
109109
mojo.execute();
110110

111111
// Now make sure that no archive got created
112-
final File expectedFile = getTestTargetDir("project-005");
112+
final File expectedFile = getSourceArchive(getTestTargetDir("project-005"), "project-005");
113113
assertFalse(
114114
expectedFile.exists(),
115115
"Source archive should not have been created[" + expectedFile.getAbsolutePath() + "]");

‎src/test/java/org/apache/maven/plugins/source/TestSourceJarMojoTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public void testNoSources(AbstractSourceJarMojo mojo) throws Exception {
103103
mojo.execute();
104104

105105
// Now make sure that no archive got created
106-
final File expectedFile = getTestTargetDir("project-005");
106+
final File expectedFile = getTestSourceArchive(getTestTargetDir("project-005"), "project-005");
107107
assertFalse(
108108
expectedFile.exists(),
109109
"Test source archive should not have been created[" + expectedFile.getAbsolutePath() + "]");

0 commit comments

Comments
 (0)