mirror of
https://github.com/google/nomulus
synced 2026-09-11 02:26:29 +00:00
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:
@@ -111,26 +111,30 @@ public class DeleteCreditCommandTest extends CommandTestCase<DeleteCreditCommand
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentParentRegistrar() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Registrar FakeRegistrar not found");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrar FakeRegistrar not found");
|
||||
runCommandForced("--registrar=FakeRegistrar", "--credit_id=" + creditAId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentCreditId() throws Exception {
|
||||
long badId = creditAId + creditBId + 1;
|
||||
thrown.expect(NullPointerException.class, "ID " + badId);
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("ID " + badId);
|
||||
runCommandForced("--registrar=TheRegistrar", "--credit_id=" + badId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_noRegistrar() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--registrar");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--registrar");
|
||||
runCommandForced("--credit_id=" + creditAId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_noCreditId() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--credit_id");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--credit_id");
|
||||
runCommandForced("--registrar=TheRegistrar");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user