-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
JarFileShadingTest.java
38 lines (29 loc) · 1.18 KB
/
JarFileShadingTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.testcontainers;
import org.assertj.core.api.ListAssert;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
public class JarFileShadingTest extends AbstractJarFileTest {
@Test
public void testPackages() throws Exception {
assertThatFileList(root).containsOnly("org", "META-INF");
assertThatFileList(root.resolve("org")).containsOnly("testcontainers");
}
@Test
public void testMetaInf() throws Exception {
assertThatFileList(root.resolve("META-INF")).containsOnly("MANIFEST.MF", "services");
}
@Test
public void testMetaInfServices() throws Exception {
assertThatFileList(root.resolve("META-INF").resolve("services"))
.allMatch(it -> it.startsWith("org.testcontainers."));
}
private ListAssert<String> assertThatFileList(Path path) throws IOException {
return (ListAssert) assertThat(Files.list(path))
.extracting(Path::getFileName)
.extracting(Path::toString)
.extracting(it -> it.endsWith("/") ? it.substring(0, it.length() - 1) : it);
}
}