Skip to content

Commit

Permalink
add test for MergeWithTagAndWarn
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
  • Loading branch information
chrisrueger committed Oct 30, 2024
1 parent 03462b0 commit e57320e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions biz.aQute.bndlib.tests/test/test/IncludeResourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -516,4 +516,27 @@ public void testIncludeResourceDuplicatesTagWithoutStrategyEnumButNonExistingTag

}
}

@Test
public void testIncludeResourceDuplicatesMergeWithTagAndWarn() throws Exception {

try (Builder a = new Builder();) {
a.addClasspath(new File("jar/jarA.jar"));
a.addClasspath(a.getFile("jar/jarB.jar"));
a.setIncludeResource(
"@jar/jarA.jar!/META-INF/services/*, @jar/jarB.jar!/META-INF/services/*;onduplicate:='MERGE,metainfservices,WARN'");
Jar jar = a.build();
assertFalse(a.check());
assertEquals("Duplicate file: META-INF/services/foo", a.getWarnings()
.get(0));

assertTrue(jar.getDirectories()
.containsKey("META-INF/services"));

Resource resource = jar.getResource("META-INF/services/foo");
assertEquals("a\nb", IO.collect(resource.openInputStream()));

}
}

}

0 comments on commit e57320e

Please sign in to comment.