55import java .io .IOException ;
66import java .nio .file .Files ;
77import java .nio .file .Path ;
8+ import java .util .Arrays ;
89import java .util .Collections ;
910import lombok .Getter ;
1011import lombok .experimental .SuperBuilder ;
1314import org .junit .jupiter .api .Test ;
1415import org .junit .jupiter .api .io .TempDir ;
1516
16- class ManifestsTest {
17+ public class ManifestsTest {
1718
1819 @ TempDir
1920 Path tempDir ;
2021
2122 @ Getter @ SuperBuilder @ Jacksonized
2223 static class EmptyManifest extends BaseManifest {
23-
2424 }
2525
2626 @ Test
@@ -33,4 +33,39 @@ void loadFailsGracefullyWhenInvalid() throws IOException {
3333 final EmptyManifest manifest = Manifests .load (tempDir , id , EmptyManifest .class );
3434 assertThat (manifest ).isNull ();
3535 }
36- }
36+
37+ @ Test
38+ void allFilesPresent_withWildcardIgnoreAll () {
39+ EmptyManifest manifest = EmptyManifest .builder ()
40+ .files (Arrays .asList ("a.jar" , "b.jar" ))
41+ .build ();
42+
43+ boolean result = Manifests .allFilesPresent (tempDir , manifest , Collections .singletonList ("*" ));
44+ assertThat (result ).isTrue ();
45+ }
46+
47+ @ Test
48+ void allFilesPresent_withGlobPattern () throws IOException {
49+ Files .createDirectories (tempDir .resolve ("mods" ));
50+ Files .createFile (tempDir .resolve ("mods/present.jar" ));
51+
52+ EmptyManifest manifest = EmptyManifest .builder ()
53+ .files (Arrays .asList ("mods/present.jar" , "mods/missing.jar" ))
54+ .build ();
55+
56+ boolean result = Manifests .allFilesPresent (tempDir , manifest , Collections .singletonList ("mods/*.jar" ));
57+ assertThat (result ).isTrue ();
58+ }
59+
60+ @ Test
61+ void allFilesPresent_withExplicitFileNames () throws IOException {
62+ Files .createFile (tempDir .resolve ("keep.jar" ));
63+
64+ EmptyManifest manifest = EmptyManifest .builder ()
65+ .files (Arrays .asList ("keep.jar" , "remove.jar" ))
66+ .build ();
67+
68+ boolean result = Manifests .allFilesPresent (tempDir , manifest , Collections .singletonList ("remove.jar" ));
69+ assertThat (result ).isTrue ();
70+ }
71+ }
0 commit comments