RepositorySizeQuotaIT: change try/catch to assertThrows

It offers the same functionality with less boilerplate code.

Change-Id: If5e4876e8bb21a40da28fe977ea0227022bbf32e
diff --git a/javatests/com/google/gerrit/acceptance/server/quota/RepositorySizeQuotaIT.java b/javatests/com/google/gerrit/acceptance/server/quota/RepositorySizeQuotaIT.java
index 018b4e6..24c90fc 100644
--- a/javatests/com/google/gerrit/acceptance/server/quota/RepositorySizeQuotaIT.java
+++ b/javatests/com/google/gerrit/acceptance/server/quota/RepositorySizeQuotaIT.java
@@ -15,9 +15,9 @@
 package com.google.gerrit.acceptance.server.quota;
 
 import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth.assert_;
 import static com.google.gerrit.server.quota.QuotaGroupDefinitions.REPOSITORY_SIZE_GROUP;
 import static com.google.gerrit.server.quota.QuotaResponse.ok;
+import static com.google.gerrit.testing.GerritJUnit.assertThrows;
 import static org.easymock.EasyMock.anyLong;
 import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
@@ -98,16 +98,10 @@
     expect(quotaBackendWithUser.project(project)).andReturn(quotaBackendWithResource).anyTimes();
     replay(quotaBackendWithResource);
     replay(quotaBackendWithUser);
-    try {
-      pushCommit();
-      assert_().fail("expected TooLargeObjectInPackException");
-    } catch (TooLargePackException e) {
-      String msg = e.getMessage();
-      assertThat(msg)
-          .contains(
-              String.format(
-                  "Pack exceeds the limit of %d bytes, rejecting the pack", availableTokens));
-    }
+    assertThat(assertThrows(TooLargePackException.class, () -> pushCommit()).getMessage())
+        .contains(
+            String.format(
+                "Pack exceeds the limit of %d bytes, rejecting the pack", availableTokens));
     verify(quotaBackendWithUser);
     verify(quotaBackendWithResource);
   }
@@ -121,12 +115,9 @@
     expect(quotaBackendWithUser.project(project)).andReturn(quotaBackendWithResource).anyTimes();
     replay(quotaBackendWithResource);
     replay(quotaBackendWithUser);
-    try {
-      pushCommit();
-      assert_().fail("expected TransportException");
-    } catch (TransportException e) {
-      // TransportException has not much info about the cause
-    }
+
+    assertThrows(TransportException.class, () -> pushCommit());
+
     verify(quotaBackendWithUser);
     verify(quotaBackendWithResource);
   }