Manually migrate some ExceptionRules to Junit 4.13 style asserts

These testing helper functions can't be handled by the automatic refactoring
tool because they're taking in expected exception details as parameters.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178832406
This commit is contained in:
mcilwain 2017-12-12 16:21:26 -08:00 committed by jianglai
parent c2ed7429d3
commit 52ce49a02c
12 changed files with 60 additions and 56 deletions

View file

@ -21,6 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.JPY;
@ -934,11 +935,11 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
private void runFailureReservedListsTest(
String reservedLists,
Class<? extends Exception> errorClass,
String errorMsg) throws Exception {
thrown.expect(errorClass);
thrown.expectMessage(errorMsg);
runCommandForced("--reserved_lists", reservedLists, "xn--q9jyb4c");
String reservedLists, Class<? extends Exception> errorClass, String errorMsg)
throws Exception {
Exception e =
expectThrows(
errorClass, () -> runCommandForced("--reserved_lists", reservedLists, "xn--q9jyb4c"));
assertThat(e).hasMessageThat().isEqualTo(errorMsg);
}
}