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

@ -20,6 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainApplication;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
import static google.registry.testing.JUnitBackports.assertThrows;
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;
@ -131,12 +132,14 @@ public class UpdateClaimsNoticeCommandTest extends CommandTestCase<UpdateClaimsN
@Test
public void testFailure_badClaimsNotice() throws Exception {
thrown.expect(IllegalArgumentException.class);
runCommand(
"--id=1-Q9JYB4C",
"--tcn_id=foobarbaz",
"--expiration_time=2010-08-16T09:00:00.0Z",
"--accepted_time=2009-08-16T09:00:00.0Z");
assertThrows(
IllegalArgumentException.class,
() ->
runCommand(
"--id=1-Q9JYB4C",
"--tcn_id=foobarbaz",
"--expiration_time=2010-08-16T09:00:00.0Z",
"--accepted_time=2009-08-16T09:00:00.0Z"));
}
@Test
@ -160,12 +163,13 @@ public class UpdateClaimsNoticeCommandTest extends CommandTestCase<UpdateClaimsN
domainApplication = persistResource(domainApplication.asBuilder()
.setEncodedSignedMarks(ImmutableList.of(EncodedSignedMark.create("base64", "AAAAA")))
.build());
thrown.expect(IllegalArgumentException.class);
runCommand(
"--id=1-Q9JYB4C",
"--tcn_id=370d0b7c9223372036854775807",
"--expiration_time=2010-08-16T09:00:00.0Z",
"--accepted_time=2009-08-16T09:00:00.0Z");
assertThrows(
IllegalArgumentException.class,
() ->
runCommand(
"--id=1-Q9JYB4C",
"--tcn_id=370d0b7c9223372036854775807",
"--expiration_time=2010-08-16T09:00:00.0Z",
"--accepted_time=2009-08-16T09:00:00.0Z"));
}
}