Get rid of custom ExceptionRule methods

The only remaining methods on ExceptionRule after this are methods that
also exist on ExpectedException, which will allow us to, in the next CL,
swap out the one for the other and then run the automated refactoring to
turn it all into assertThrows/expectThrows.

Note that there were some assertions about root causes that couldn't
easily be turned into ExpectedException invocations, so I simply
converted them directly to usages of assertThrows/expectThrows.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178623431
This commit is contained in:
mcilwain 2017-12-11 08:47:27 -08:00 committed by jianglai
parent 68a26f5b6e
commit b825a2b5a8
144 changed files with 1176 additions and 894 deletions

View file

@ -69,7 +69,8 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
@Test
public void testFailure_duplicateDomains() throws Exception {
thrown.expect(IllegalArgumentException.class, "Duplicate arguments found: \'example.tld\'");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Duplicate arguments found: \'example.tld\'");
runCommandForced(
"--client=NewRegistrar",
"--registrant=crr-admin",
@ -81,7 +82,8 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
@Test
public void testFailure_missingDomain() throws Exception {
thrown.expect(ParameterException.class, "Main parameters are required");
thrown.expect(ParameterException.class);
thrown.expectMessage("Main parameters are required");
runCommandForced(
"--client=NewRegistrar",
"--registrant=crr-admin",
@ -91,35 +93,40 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
@Test
public void testFailure_missingClientId() throws Exception {
thrown.expect(ParameterException.class, "--client");
thrown.expect(ParameterException.class);
thrown.expectMessage("--client");
runCommandForced(
"--admins=crr-admin", "--techs=crr-tech", "--registrant=crr-admin", "example.tld");
}
@Test
public void testFailure_missingRegistrant() throws Exception {
thrown.expect(IllegalArgumentException.class, "Registrant must be specified");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Registrant must be specified");
runCommandForced(
"--client=NewRegistrar", "--admins=crr-admin", "--techs=crr-tech", "example.tld");
}
@Test
public void testFailure_missingAdmins() throws Exception {
thrown.expect(IllegalArgumentException.class, "At least one admin must be specified");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("At least one admin must be specified");
runCommandForced(
"--client=NewRegistrar", "--registrant=crr-admin", "--techs=crr-tech", "example.tld");
}
@Test
public void testFailure_missingTechs() throws Exception {
thrown.expect(IllegalArgumentException.class, "At least one tech must be specified");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("At least one tech must be specified");
runCommandForced(
"--client=NewRegistrar", "--registrant=crr-admin", "--admins=crr-admin", "example.tld");
}
@Test
public void testFailure_tooManyNameServers() throws Exception {
thrown.expect(IllegalArgumentException.class, "There can be at most 13 nameservers");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("There can be at most 13 nameservers");
runCommandForced(
"--client=NewRegistrar",
"--registrant=crr-admin",
@ -134,7 +141,8 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
@Test
public void testFailure_badPeriod() throws Exception {
thrown.expect(ParameterException.class, "--period");
thrown.expect(ParameterException.class);
thrown.expectMessage("--period");
runCommandForced(
"--client=NewRegistrar",
"--registrant=crr-admin",