aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar corysmith <corysmith@google.com>2017-11-08 20:10:36 +0100
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-11-09 18:29:04 +0100
commit743ea216879dd0e3037d4b34eff92ba8af493554 (patch)
treea56fe6988297bc022a328c911b60b2f0249e0df6 /src/test/java/com/google/devtools/build
parentf5a109157ed048ff253bb2ba70f3e4372ec125ba (diff)
Fix resource shrinking to filter densities and include assets.
RELNOTES: None PiperOrigin-RevId: 175033155
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r--src/test/java/com/google/devtools/build/android/PathsSubject.java30
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.");