TagsIT,ListBranchesIT,ListProjectsIT: Migrate from try-catch-fail to assertThrows
Change-Id: I7572ee73d49cca8b814f79740760f0be778685ea
This commit is contained in:
@@ -173,11 +173,6 @@ public class ListBranchesIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertBadRequest(ListRefsRequest<BranchInfo> req) throws Exception {
|
private void assertBadRequest(ListRefsRequest<BranchInfo> req) throws Exception {
|
||||||
try {
|
assertThrows(BadRequestException.class, () -> req.get());
|
||||||
req.get();
|
|
||||||
fail("Expected BadRequestException");
|
|
||||||
} catch (BadRequestException e) {
|
|
||||||
// Expected
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ package com.google.gerrit.acceptance.rest.project;
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.gerrit.acceptance.rest.project.ProjectAssert.assertThatNameList;
|
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.server.group.SystemGroupBackend.REGISTERED_USERS;
|
||||||
|
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
|
||||||
import static java.util.stream.Collectors.toList;
|
import static java.util.stream.Collectors.toList;
|
||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
@@ -334,11 +335,6 @@ public class ListProjectsIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertBadRequest(ListRequest req) throws Exception {
|
private void assertBadRequest(ListRequest req) throws Exception {
|
||||||
try {
|
assertThrows(BadRequestException.class, () -> req.get());
|
||||||
req.get();
|
|
||||||
fail("Expected BadRequestException");
|
|
||||||
} catch (BadRequestException expected) {
|
|
||||||
// Expected.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -370,12 +370,7 @@ public class TagsIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertBadRequest(ListRefsRequest<TagInfo> req) throws Exception {
|
private void assertBadRequest(ListRefsRequest<TagInfo> req) throws Exception {
|
||||||
try {
|
assertThrows(BadRequestException.class, () -> req.get());
|
||||||
req.get();
|
|
||||||
fail("Expected BadRequestException");
|
|
||||||
} catch (BadRequestException e) {
|
|
||||||
// Expected
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void grantTagPermissions() throws Exception {
|
private void grantTagPermissions() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user