ObjectIdsTest: Migrate from try-catch-fail to assertThrows
Change-Id: I7fd28a4f18933401f4975629b51ca8bab074ab2e
diff --git a/javatests/com/google/gerrit/git/ObjectIdsTest.java b/javatests/com/google/gerrit/git/ObjectIdsTest.java
index 36c10a4..8c87e00 100644
--- a/javatests/com/google/gerrit/git/ObjectIdsTest.java
+++ b/javatests/com/google/gerrit/git/ObjectIdsTest.java
@@ -15,8 +15,8 @@
package com.google.gerrit.git;
import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth.assert_;
import static com.google.gerrit.git.ObjectIds.abbreviateName;
+import static com.google.gerrit.testing.GerritJUnit.assertThrows;
import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;
import java.util.function.Function;
@@ -128,12 +128,7 @@
}
private static void assertRuntimeException(Func func) throws Exception {
- try {
- func.call();
- assert_().fail("Expected RuntimeException");
- } catch (RuntimeException e) {
- // Expected.
- }
+ assertThrows(RuntimeException.class, () -> func.call());
}
private static ObjectReader newReaderWithAmbiguousIds() throws Exception {