Merge "Try fetching hwservice before waiting for it."
diff --git a/test/java_test/src/com/android/commands/hidl_test_java/HidlTestJava.java b/test/java_test/src/com/android/commands/hidl_test_java/HidlTestJava.java
index 8749837..a96b0c7 100644
--- a/test/java_test/src/com/android/commands/hidl_test_java/HidlTestJava.java
+++ b/test/java_test/src/com/android/commands/hidl_test_java/HidlTestJava.java
@@ -28,6 +28,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.NoSuchElementException;
 
 public final class HidlTestJava {
     private static final String TAG = "HidlTestJava";
@@ -235,6 +236,14 @@
                      new ArrayList[]{new ArrayList(Arrays.asList(1,2)),
                                      new ArrayList(Arrays.asList(3,4))});
 
+        {
+            // Test proper exceptions are thrown
+            try {
+                IBase proxy = IBase.getService("this-doesn't-exist");
+            } catch (Exception e) {
+                ExpectTrue(e instanceof NoSuchElementException);
+            }
+        }
 
         {
             // Test access through base interface binder.