mirror of
https://github.com/google/nomulus.git
synced 2025-05-21 03:39:36 +02:00
Automatically refactor some exception testing to use new JUnit rules
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=176550995
This commit is contained in:
parent
f041b1bac0
commit
c7484b25e0
13 changed files with 199 additions and 194 deletions
|
@ -15,9 +15,9 @@
|
|||
package google.registry.keyring.api;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.LogsSubject.assertAboutLogs;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -242,11 +242,7 @@ public class ComparatorKeyringTest {
|
|||
when(secondKeyring.getRdeSigningKey()).thenReturn(keyPair);
|
||||
Keyring comparatorKeyring = ComparatorKeyring.create(actualKeyring, secondKeyring);
|
||||
|
||||
try {
|
||||
comparatorKeyring.getRdeSigningKey();
|
||||
fail("Should have thrown KeyringException");
|
||||
} catch (KeyringException expected) {
|
||||
}
|
||||
assertThrows(KeyringException.class, () -> comparatorKeyring.getRdeSigningKey());
|
||||
|
||||
assertAboutLogs()
|
||||
.that(testLogHandler)
|
||||
|
@ -282,11 +278,7 @@ public class ComparatorKeyringTest {
|
|||
when(secondKeyring.getRdeSigningKey()).thenThrow(new KeyringException("message"));
|
||||
Keyring comparatorKeyring = ComparatorKeyring.create(actualKeyring, secondKeyring);
|
||||
|
||||
try {
|
||||
comparatorKeyring.getRdeSigningKey();
|
||||
fail("Should have thrown KeyringException");
|
||||
} catch (KeyringException expected) {
|
||||
}
|
||||
assertThrows(KeyringException.class, () -> comparatorKeyring.getRdeSigningKey());
|
||||
|
||||
assertAboutLogs().that(testLogHandler).hasNoLogsAtLevel(Level.SEVERE);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue