TagsIT,ListBranchesIT,ListProjectsIT: Migrate from try-catch-fail to assertThrows

Change-Id: I7572ee73d49cca8b814f79740760f0be778685ea
This commit is contained in:
David Pursehouse
2019-05-22 16:54:44 +09:00
parent 3796451e56
commit 45be24a3b3
3 changed files with 4 additions and 18 deletions

View File

@@ -173,11 +173,6 @@ public class ListBranchesIT extends AbstractDaemonTest {
}
private void assertBadRequest(ListRefsRequest<BranchInfo> req) throws Exception {
try {
req.get();
fail("Expected BadRequestException");
} catch (BadRequestException e) {
// Expected
}
assertThrows(BadRequestException.class, () -> req.get());
}
}

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.acceptance.rest.project;
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.acceptance.rest.project.ProjectAssert.assertThatNameList;
import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
import static java.util.stream.Collectors.toList;
import com.google.common.base.Splitter;
@@ -334,11 +335,6 @@ public class ListProjectsIT extends AbstractDaemonTest {
}
private void assertBadRequest(ListRequest req) throws Exception {
try {
req.get();
fail("Expected BadRequestException");
} catch (BadRequestException expected) {
// Expected.
}
assertThrows(BadRequestException.class, () -> req.get());
}
}

View File

@@ -370,12 +370,7 @@ public class TagsIT extends AbstractDaemonTest {
}
private void assertBadRequest(ListRefsRequest<TagInfo> req) throws Exception {
try {
req.get();
fail("Expected BadRequestException");
} catch (BadRequestException e) {
// Expected
}
assertThrows(BadRequestException.class, () -> req.get());
}
private void grantTagPermissions() throws Exception {