Merge "Better test assertions"
diff --git a/tests/hostside/java/com/android/microdroid/test/MicrodroidTestCase.java b/tests/hostside/java/com/android/microdroid/test/MicrodroidTestCase.java
index 57882ce..0be3a38 100644
--- a/tests/hostside/java/com/android/microdroid/test/MicrodroidTestCase.java
+++ b/tests/hostside/java/com/android/microdroid/test/MicrodroidTestCase.java
@@ -131,10 +131,9 @@
Map<TestDescription, TestResult> results = getLastDeviceRunResults().getTestResults();
assertThat(results).hasSize(1);
TestResult result = results.values().toArray(new TestResult[0])[0];
- assertTrue(
- "The test should fail with a permission error",
- result.getStackTrace()
- .contains("android.permission.MANAGE_VIRTUAL_MACHINE permission"));
+ assertWithMessage("The test should fail with a permission error")
+ .that(result.getStackTrace())
+ .contains("android.permission.MANAGE_VIRTUAL_MACHINE permission");
}
private static JSONObject newPartition(String label, String path) {
@@ -601,7 +600,8 @@
// Check UID and elapsed_time by comparing each other.
assertEquals(atomVmCreationRequested.getUid(), atomVmBooted.getUid());
assertEquals(atomVmCreationRequested.getUid(), atomVmExited.getUid());
- assertTrue(atomVmBooted.getElapsedTimeMillis() < atomVmExited.getElapsedTimeMillis());
+ assertThat(atomVmBooted.getElapsedTimeMillis())
+ .isLessThan(atomVmExited.getElapsedTimeMillis());
}
@Test