Copilot commented on code in PR #306:
URL:
https://github.com/apache/maven-remote-resources-plugin/pull/306#discussion_r4234689312
##########
src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java:
##########
@@ -254,6 +254,38 @@ public void testFilteredBundles() throws Exception {
assertTrue(data.contains("projectsSortedByOrganization: {"));
}
+ public void testFilteredAppendedResource() throws Exception {
+ final MavenProjectResourcesStub project =
createTestProject("default-appended-filtered-resource");
+ final ProcessRemoteResourcesMojo mojo =
lookupProcessMojoWithSettings(project, new String[] {"test:test:1.4"});
+
+ setupDefaultProject(project);
+
+ String path = pathOf(new DefaultArtifact(
+ "test", "test", VersionRange.createFromVersion("1.4"), null,
"jar", "", new DefaultArtifactHandler()));
+ File bundleJar = new File(path);
+ bundleJar.getParentFile().mkdirs();
+ buildResourceBundle(
+ "default-appended-filtered-resource-create",
+ null,
+ new String[] {"BUNDLE_FILTER.txt.vm", "APPENDED_FILTER.txt"},
+ bundleJar);
+
+ File appendedResourcesDirectory = new File(project.getBasedir(),
"src/main/appended-resources");
+ appendedResourcesDirectory.mkdirs();
+ FileUtils.fileWrite(
+ new File(appendedResourcesDirectory,
"APPENDED_FILTER.txt.vm").getAbsolutePath(),
+ "appended: $project.name");
+ setVariableValueToObject(mojo, "appendedResourcesDirectory",
appendedResourcesDirectory);
+
+ mojo.execute();
+
+ File outputDirectory = (File) getVariableValueFromObject(mojo,
"outputDirectory");
+ String appendedData = FileUtils.fileRead(new File(outputDirectory,
"APPENDED_FILTER.txt"));
+ assertTrue(appendedData.contains("appended: Test Project
default-appended-filtered-resource"));
Review Comment:
This test does not detect the regression it is intended to cover: the former
static `Velocity.evaluate` also expands `$project.name`, so reverting the
production change leaves this test green. Exercise the instance engine's
configured classpath loader—for example, parse the bundled template from the
appended template—so the test fails when evaluation returns to the default
static runtime.
--
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]