mirror of
https://github.com/google/nomulus
synced 2026-08-17 04:36:08 +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:
@@ -56,8 +56,8 @@ public class IcannReportingModuleTest {
|
||||
@Test
|
||||
public void testInvalidYearMonthParameter_throwsException() {
|
||||
when(req.getParameter("yearMonth")).thenReturn("201705");
|
||||
thrown.expect(
|
||||
BadRequestException.class, "yearMonth must be in yyyy-MM format, got 201705 instead");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("yearMonth must be in yyyy-MM format, got 201705 instead");
|
||||
IcannReportingModule.provideYearMonthOptional(req);
|
||||
}
|
||||
|
||||
@@ -88,9 +88,8 @@ public class IcannReportingModuleTest {
|
||||
|
||||
@Test
|
||||
public void testInvalidSubdir_throwsException() {
|
||||
thrown.expect(
|
||||
BadRequestException.class,
|
||||
"subdir must not start or end with a \"/\", got /whoops instead.");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("subdir must not start or end with a \"/\", got /whoops instead.");
|
||||
IcannReportingModule.provideSubdir(Optional.of("/whoops"), new YearMonth(2017, 6));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user