Stop using deprecated AbstractDaemonTest#fail
The method is deprecated and will soon be removed. Replace it with the
new assertThrows method.
Change-Id: I8334795a041cbbc6e35ac2c5e152c1f363f9cc3c
diff --git a/src/test/java/com/googlesource/gerrit/plugins/readonly/AbstractReadOnlyTest.java b/src/test/java/com/googlesource/gerrit/plugins/readonly/AbstractReadOnlyTest.java
index e24137f..ce8d081 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/readonly/AbstractReadOnlyTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/readonly/AbstractReadOnlyTest.java
@@ -15,6 +15,7 @@
package com.googlesource.gerrit.plugins.readonly;
import static com.google.common.truth.Truth.assertThat;
+import static com.google.gerrit.testing.GerritJUnit.assertThrows;
import static org.apache.http.HttpStatus.SC_SERVICE_UNAVAILABLE;
import com.google.gerrit.acceptance.GitUtil;
@@ -146,12 +147,9 @@
setReadOnly(true);
// Push should fail
- try {
- pushTo("refs/for/master");
- fail("expected TransportException");
- } catch (TransportException e) {
- assertThat(e).hasMessageThat().contains("READ ONLY");
- }
+ TransportException thrown =
+ assertThrows(TransportException.class, () -> pushTo("refs/for/master"));
+ assertThat(thrown).hasMessageThat().contains("READ ONLY");
// Disable read-only
setReadOnly(false);