ScopedStorage: Error message if startsWith fails

When testing the FUSE passthrough patch set I noticed that
CtsScopedStorageDeviceOnlyTest was failing at
testOpenContentResolverFirstWriteFilePath, but no error message was
printed to help figuring out what was the actual value and what
expected.

Changing the startsWith assertions to print an error message in case of
failure that tells the evaluated string and the expected prefix.

A similar change for CtsScopedStorageCoreHostTest has been recently
merged.

Bug: 168023149
Test: CtsScopedStorageCoreHostTest
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I8a2449bd56b272c07373d9dd72ac74e7a1ed8aaa
Merged-In: I8a2449bd56b272c07373d9dd72ac74e7a1ed8aaa
diff --git a/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/ScopedStorageDeviceTest.java b/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/ScopedStorageDeviceTest.java
index f6d137c..b41e634 100644
--- a/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/ScopedStorageDeviceTest.java
+++ b/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/ScopedStorageDeviceTest.java
@@ -2594,12 +2594,24 @@
         assertThat(readPfd.getStatSize()).isEqualTo(writePfd.getStatSize());
     }
 
+    private void assertStartsWith(String actual, String prefix) throws Exception {
+        String message = "String \"" + actual + "\" should start with \"" + prefix + "\"";
+
+        assertWithMessage(message).that(actual).startsWith(prefix);
+    }
+
     private void assertLowerFsFd(ParcelFileDescriptor pfd) throws Exception {
-        assertThat(Os.readlink("/proc/self/fd/" + pfd.getFd()).startsWith("/storage")).isTrue();
+        String path = Os.readlink("/proc/self/fd/" + pfd.getFd());
+        String prefix = "/storage";
+
+        assertStartsWith(path, prefix);
     }
 
     private void assertUpperFsFd(ParcelFileDescriptor pfd) throws Exception {
-        assertThat(Os.readlink("/proc/self/fd/" + pfd.getFd()).startsWith("/mnt/user")).isTrue();
+        String path = Os.readlink("/proc/self/fd/" + pfd.getFd());
+        String prefix = "/mnt/user";
+
+        assertStartsWith(path, prefix);
     }
 
     private void assertLowerFsFdWithPassthrough(ParcelFileDescriptor pfd) throws Exception {