diff options
Diffstat (limited to 'src/test/java/com/google/devtools')
-rw-r--r-- | src/test/java/com/google/devtools/build/android/PathsSubject.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/android/PathsSubject.java b/src/test/java/com/google/devtools/build/android/PathsSubject.java index f32ce8f8ab..5c4ad16ad3 100644 --- a/src/test/java/com/google/devtools/build/android/PathsSubject.java +++ b/src/test/java/com/google/devtools/build/android/PathsSubject.java @@ -26,6 +26,9 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; import javax.annotation.Nullable; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -55,6 +58,33 @@ public class PathsSubject extends Subject<PathsSubject, Path> { } } + void containsAllArchivedFilesIn(String... paths) throws IOException { + if (actual() == null) { + fail("should not be null."); + } + exists(); + + assertThat( + new ZipFile(actual().toFile()) + .stream() + .map(ZipEntry::getName) + .collect(Collectors.toSet())) + .containsAllIn(Arrays.asList(paths)); + } + + void containsNoArchivedFilesIn(String... paths) throws IOException { + if (actual() == null) { + fail("should not be null."); + } + exists(); + assertThat( + new ZipFile(actual().toFile()) + .stream() + .map(ZipEntry::getName) + .collect(Collectors.toSet())) + .containsNoneIn(Arrays.asList(paths)); + } + void xmlContentsIsEqualTo(String... contents) { if (actual() == null) { fail("should not be null."); |