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

@ -286,7 +286,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
public void testValidateEscrowFile_tldNotFound() throws Exception {
xmlInput = DEPOSIT_BADTLD_XML.openBufferedStream();
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
thrown.expect(IllegalArgumentException.class, "Tld 'badtld' not found in the registry");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Tld 'badtld' not found in the registry");
rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badtld.xml");
}
@ -295,9 +296,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
public void testValidateEscrowFile_tldWrongState() throws Exception {
xmlInput = DEPOSIT_GETLD_XML.openBufferedStream();
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
thrown.expect(
IllegalArgumentException.class,
"Tld 'getld' is in state GENERAL_AVAILABILITY and cannot be imported");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Tld 'getld' is in state GENERAL_AVAILABILITY and cannot be imported");
rdeImportUtils.validateEscrowFileForImport("invalid-deposit-getld.xml");
}
@ -306,8 +306,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
public void testValidateEscrowFile_badRegistrar() throws Exception {
xmlInput = DEPOSIT_BADREGISTRAR_XML.openBufferedStream();
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
thrown.expect(
IllegalArgumentException.class, "Registrar 'RegistrarY' not found in the registry");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Registrar 'RegistrarY' not found in the registry");
rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badregistrar.xml");
}