diff options
author | corysmith <corysmith@google.com> | 2017-11-08 20:10:36 +0100 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2017-11-09 18:29:04 +0100 |
commit | 743ea216879dd0e3037d4b34eff92ba8af493554 (patch) | |
tree | a56fe6988297bc022a328c911b60b2f0249e0df6 /src/test/java/com | |
parent | f5a109157ed048ff253bb2ba70f3e4372ec125ba (diff) |
Fix resource shrinking to filter densities and include assets.
RELNOTES: None
PiperOrigin-RevId: 175033155
Diffstat (limited to 'src/test/java/com')
-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."); |