mirror of
https://github.com/google/nomulus
synced 2026-09-05 23:57:01 +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:
@@ -313,8 +313,8 @@ public class MutatingCommandTest {
|
||||
.build());
|
||||
}
|
||||
};
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Cannot apply multiple changes for the same entity");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Cannot apply multiple changes for the same entity");
|
||||
command.init();
|
||||
}
|
||||
|
||||
@@ -326,9 +326,8 @@ public class MutatingCommandTest {
|
||||
stageEntityChange(host1, host2);
|
||||
}
|
||||
};
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Both entity versions in an update must have the same Key.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Both entity versions in an update must have the same Key.");
|
||||
command.init();
|
||||
}
|
||||
|
||||
@@ -340,9 +339,8 @@ public class MutatingCommandTest {
|
||||
stageEntityChange(registrar1, registrar2);
|
||||
}
|
||||
};
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Both entity versions in an update must have the same Key.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Both entity versions in an update must have the same Key.");
|
||||
command.init();
|
||||
}
|
||||
|
||||
@@ -354,9 +352,8 @@ public class MutatingCommandTest {
|
||||
stageEntityChange(host1, registrar1);
|
||||
}
|
||||
};
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Both entity versions in an update must have the same Key.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Both entity versions in an update must have the same Key.");
|
||||
command.init();
|
||||
}
|
||||
|
||||
@@ -370,7 +367,8 @@ public class MutatingCommandTest {
|
||||
};
|
||||
command.init();
|
||||
persistResource(newHost1);
|
||||
thrown.expect(IllegalStateException.class, "Entity changed since init() was called.");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Entity changed since init() was called.");
|
||||
command.execute();
|
||||
}
|
||||
|
||||
@@ -384,7 +382,8 @@ public class MutatingCommandTest {
|
||||
};
|
||||
command.init();
|
||||
persistResource(newHost1);
|
||||
thrown.expect(IllegalStateException.class, "Entity changed since init() was called.");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Entity changed since init() was called.");
|
||||
command.execute();
|
||||
}
|
||||
|
||||
@@ -398,7 +397,8 @@ public class MutatingCommandTest {
|
||||
};
|
||||
command.init();
|
||||
persistResource(newHost1);
|
||||
thrown.expect(IllegalStateException.class, "Entity changed since init() was called.");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Entity changed since init() was called.");
|
||||
command.execute();
|
||||
}
|
||||
|
||||
@@ -412,7 +412,8 @@ public class MutatingCommandTest {
|
||||
};
|
||||
command.init();
|
||||
deleteResource(host1);
|
||||
thrown.expect(IllegalStateException.class, "Entity changed since init() was called.");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Entity changed since init() was called.");
|
||||
command.execute();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user