Automatically refactor more exception testing to use new JUnit rules

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179072309
This commit is contained in:
mcilwain 2017-12-14 11:40:04 -08:00 committed by Ben McIlwain
parent d5d29959b4
commit 9157930983
100 changed files with 3900 additions and 3192 deletions

View file

@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import com.google.common.collect.ImmutableList;
@ -92,8 +93,11 @@ public class UpdateReservedListCommandTest extends
public void testFailure_reservedListDoesntExist() throws Exception {
String errorMessage =
"Could not update reserved list xn--q9jyb4c_poobah because it doesn't exist.";
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage(errorMessage);
runCommand("--force", "--name=xn--q9jyb4c_poobah", "--input=" + reservedTermsPath);
IllegalArgumentException thrown =
expectThrows(
IllegalArgumentException.class,
() ->
runCommand("--force", "--name=xn--q9jyb4c_poobah", "--input=" + reservedTermsPath));
assertThat(thrown).hasMessageThat().contains(errorMessage);
}
}