Replace grep by expect_log in java_integration_test#test_java_plugin

This fixes #1888: on my laptop (Mac Book Air), the test is highly
flaky (6-7 tests fails out of 10) but with this change, I observe
no failures. I cannot explains it but it seems to be some kind
of race in the stream handling.

--
Change-Id: I09eb9d5a1c8468c7a0299966a5ea20e7a5fc86f0
Reviewed-on: https://bazel-review.googlesource.com/c/6696/
MOS_MIGRATED_REVID=136459264
diff --git a/src/test/shell/integration/java_integration_test.sh b/src/test/shell/integration/java_integration_test.sh
index d9919c7..3ed4a18 100755
--- a/src/test/shell/integration/java_integration_test.sh
+++ b/src/test/shell/integration/java_integration_test.sh
@@ -603,15 +603,13 @@
 EOF
 
   bazel build //$pkg/java/test/client:client --use_ijars || fail "build failed"
-  unzip -l ${PRODUCT_NAME}-bin/$pkg/java/test/client/libclient.jar \
-    | grep -q " test/Generated.class" \
-    || fail "missing class file from annotation processing"
+  unzip -l ${PRODUCT_NAME}-bin/$pkg/java/test/client/libclient.jar > $TEST_log
+  expect_log " test/Generated.class" "missing class file from annotation processing"
 
   bazel build //$pkg/java/test/client:libclient-src.jar --use_ijars \
     || fail "build failed"
-  unzip -l ${PRODUCT_NAME}-bin/$pkg/java/test/client/libclient-src.jar \
-    | grep -q " test/Generated.java" \
-    || fail "missing source file from annotation processing"
+  unzip -l ${PRODUCT_NAME}-bin/$pkg/java/test/client/libclient-src.jar > $TEST_log
+  expect_log " test/Generated.java" "missing source file from annotation processing"
 }
 
 function test_jvm_flags_are_passed_verbatim() {