elharo commented on code in PR #157:
URL:
https://github.com/apache/maven-jarsigner-plugin/pull/157#discussion_r3838413840
##########
src/test/java/org/apache/maven/plugins/jarsigner/JarsignerVerifyMojoTest.java:
##########
@@ -166,4 +167,24 @@ public void testErrorWhenNotSignedOnNonExistingSigning()
throws Exception {
mojoException.getMessage(),
containsString(mainArtifact.getFile().getPath()));
}
+
+ /** Includes with null elements should not cause NPE in String.join
replacement */
+ @Test
+ public void testIncludesWithNullElement() throws Exception {
+ Artifact mainArtifact =
TestArtifacts.createJarArtifact(dummyMavenProjectDir, "my-project.jar");
+ when(project.getArtifact()).thenReturn(mainArtifact);
+
when(jarSigner.execute(any(JarSignerVerifyRequest.class))).thenReturn(RESULT_OK);
+ configuration.put("archiveDirectory", dummyMavenProjectDir.getPath());
+ configuration.put("processMainArtifact", "false");
+
+ JarsignerVerifyMojo mojo = mojoTestCreator.configure(configuration);
+
+ Field includesField =
AbstractJarsignerMojo.class.getDeclaredField("includes");
+ includesField.setAccessible(true);
Review Comment:
do not use setAccessible or reflection. Test only via public API and
integration tests.
--
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]