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

@ -194,7 +194,8 @@ public class GhostrydeTest {
korruption(ciphertext, ciphertext.length / 2);
ByteArrayInputStream bsIn = new ByteArrayInputStream(ciphertext);
thrown.expect(IllegalStateException.class, "tampering");
thrown.expect(IllegalStateException.class);
thrown.expectMessage("tampering");
try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) {
ByteStreams.copy(decryptor, ByteStreams.nullOutputStream());
}
@ -247,8 +248,8 @@ public class GhostrydeTest {
}
ByteArrayInputStream bsIn = new ByteArrayInputStream(bsOut.toByteArray());
thrown.expect(
PGPException.class,
thrown.expect(PGPException.class);
thrown.expectMessage(
"Message was encrypted for keyid a59c132f3589a1d5 but ours is c9598c84ec70b9fd");
try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) {
ByteStreams.copy(decryptor, ByteStreams.nullOutputStream());