Show reason on failure
Switch to using Truth, which shows us the actual output of "vm run" if
it isn't what we expect, so we can try to figure out what happened.
Bug: 232390891
Test: atest MicrodroidTestCase#testCustomVirtualMachinePermission
Test: Induce failure, see output from the vm command
Change-Id: I35821de7d8e7625180ac41fa543ea8077f351d42
diff --git a/tests/hostside/java/android/virt/test/MicrodroidTestCase.java b/tests/hostside/java/android/virt/test/MicrodroidTestCase.java
index e2d4be1..ec2afaa 100644
--- a/tests/hostside/java/android/virt/test/MicrodroidTestCase.java
+++ b/tests/hostside/java/android/virt/test/MicrodroidTestCase.java
@@ -16,7 +16,6 @@
package android.virt.test;
-import static android.virt.test.CommandResultSubject.assertThat;
import static android.virt.test.CommandResultSubject.command_results;
import static com.android.tradefed.testtype.DeviceJUnit4ClassRunner.TestLogData;
@@ -503,11 +502,8 @@
final String ret =
android.runForResult(VIRT_APEX + "bin/vm run", configPath).getStderr().trim();
- assertTrue(
- "The test should fail with a permission error",
- ret.contains(
- "does not have the android.permission.USE_CUSTOM_VIRTUAL_MACHINE"
- + " permission"));
+ assertThat(ret).contains("does not have the android.permission.USE_CUSTOM_VIRTUAL_MACHINE"
+ + " permission");
}
@Before