mirror of
https://github.com/google/nomulus.git
synced 2025-06-28 07:13:34 +02:00
Migrate final try/catch test assertions to use assert/expectThrows
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=182091814
This commit is contained in:
parent
fe7cc4f782
commit
c416b3892d
17 changed files with 124 additions and 172 deletions
|
@ -15,7 +15,6 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth.assertWithMessage;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
|
@ -175,13 +174,12 @@ public class CreateReservedListCommandTest extends
|
|||
}
|
||||
|
||||
private void runNameTestExpectedFailure(String name, String expectedErrorMsg) throws Exception {
|
||||
try {
|
||||
runCommandForced("--name=" + name, "--input=" + reservedTermsPath);
|
||||
assertWithMessage("Expected IllegalArgumentException to be thrown").fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertThat(ReservedList.get(name)).isEmpty();
|
||||
assertThat(e).hasMessageThat().isEqualTo(expectedErrorMsg);
|
||||
}
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--name=" + name, "--input=" + reservedTermsPath));
|
||||
assertThat(ReservedList.get(name)).isEmpty();
|
||||
assertThat(thrown).hasMessageThat().isEqualTo(expectedErrorMsg);
|
||||
}
|
||||
|
||||
private void runNameTestWithOverride(String name) throws Exception {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue