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

@ -127,8 +127,8 @@ public class IcannHttpReporterTest {
@Test
public void testFail_invalidFilename_nonSixDigitYearMonth() throws Exception {
thrown.expect(
IllegalArgumentException.class,
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage(
"Expected file format: tld-reportType-yyyyMM.csv, got test-transactions-20176.csv instead");
IcannHttpReporter reporter = createReporter();
reporter.send(FAKE_PAYLOAD, "test-transactions-20176.csv");
@ -136,8 +136,8 @@ public class IcannHttpReporterTest {
@Test
public void testFail_invalidFilename_notActivityOrTransactions() throws Exception {
thrown.expect(
IllegalArgumentException.class,
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage(
"Expected file format: tld-reportType-yyyyMM.csv, got test-invalid-201706.csv instead");
IcannHttpReporter reporter = createReporter();
reporter.send(FAKE_PAYLOAD, "test-invalid-201706.csv");
@ -145,8 +145,8 @@ public class IcannHttpReporterTest {
@Test
public void testFail_invalidFilename_invalidTldName() throws Exception {
thrown.expect(
IllegalArgumentException.class,
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage(
"Expected file format: tld-reportType-yyyyMM.csv, got n!-n-activity-201706.csv instead");
IcannHttpReporter reporter = createReporter();
reporter.send(FAKE_PAYLOAD, "n!-n-activity-201706.csv");
@ -154,9 +154,8 @@ public class IcannHttpReporterTest {
@Test
public void testFail_invalidFilename_tldDoesntExist() throws Exception {
thrown.expect(
IllegalArgumentException.class,
"TLD hello does not exist");
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("TLD hello does not exist");
IcannHttpReporter reporter = createReporter();
reporter.send(FAKE_PAYLOAD, "hello-activity-201706.csv");
}