From a6a9843ddb869d911795bd9a634e725d5952dfb2 Mon Sep 17 00:00:00 2001 From: cushon Date: Thu, 26 Apr 2018 19:48:14 -0700 Subject: For --checkHashMismatch=ERROR, emit all errors instead of stopping at the first one PiperOrigin-RevId: 194491274 --- .../google/devtools/build/android/ZipFilterActionTest.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/test/java/com/google/devtools/build/android') diff --git a/src/test/java/com/google/devtools/build/android/ZipFilterActionTest.java b/src/test/java/com/google/devtools/build/android/ZipFilterActionTest.java index 7af59aebb0..22ce6339b3 100644 --- a/src/test/java/com/google/devtools/build/android/ZipFilterActionTest.java +++ b/src/test/java/com/google/devtools/build/android/ZipFilterActionTest.java @@ -132,7 +132,7 @@ public class ZipFilterActionTest { private List outputEntriesWithArgs(ImmutableList args, File output) throws IOException { - ZipFilterAction.main(args.toArray(new String[0])); + ZipFilterAction.run(args.toArray(new String[0])); List filteredEntries = new ArrayList<>(); try (ZipFile zip = new ZipFile(output)) { Enumeration entries = zip.entries(); @@ -216,9 +216,8 @@ public class ZipFilterActionTest { callback.assertOp(FilterOperation.COPY); filter.accept("res/R.class", callback); callback.assertOp(FilterOperation.SKIP); - thrown.expect(IllegalStateException.class); - thrown.expectMessage("name matches but the hash does not."); filter.accept("baz.class", callback); + assertThat(filter.sawErrors()).isTrue(); } @Test public void testFlags() throws Exception { @@ -240,7 +239,7 @@ public class ZipFilterActionTest { "--checkHashMismatch", "IGNORE"); thrown.expect(ZipException.class); thrown.expectMessage("Zip file 'filter1' is malformed"); - ZipFilterAction.main(args.toArray(new String[0])); + ZipFilterAction.run(args.toArray(new String[0])); } @Test public void testFullIntegration() throws IOException { @@ -283,9 +282,8 @@ public class ZipFilterActionTest { "ERROR", "--outputMode", "DONT_CARE"); - thrown.expect(IllegalStateException.class); - thrown.expectMessage("name matches but the hash does not"); - ZipFilterAction.main(args.toArray(new String[0])); + int exitCode = ZipFilterAction.run(args.toArray(new String[0])); + assertThat(exitCode).isEqualTo(1); } @Test -- cgit v1.2.3