mirror of
https://github.com/google/nomulus.git
synced 2025-05-17 17:59:41 +02:00
Automatically refactor more exception testing to use new JUnit rules
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=179072309
This commit is contained in:
parent
d5d29959b4
commit
9157930983
100 changed files with 3900 additions and 3192 deletions
|
@ -14,10 +14,13 @@
|
|||
|
||||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
|
@ -60,9 +63,9 @@ public class GetApplicationIdsCommandTest extends CommandTestCase<GetApplication
|
|||
|
||||
@Test
|
||||
public void testFailure_tldDoesNotExist() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Domain name is not under a recognized TLD");
|
||||
runCommand("example.foo");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand("example.foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("Domain name is not under a recognized TLD");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -75,8 +78,7 @@ public class GetApplicationIdsCommandTest extends CommandTestCase<GetApplication
|
|||
|
||||
@Test
|
||||
public void testFailure_noDomainName() throws Exception {
|
||||
thrown.expect(ParameterException.class);
|
||||
runCommand();
|
||||
assertThrows(ParameterException.class, () -> runCommand());
|
||||
}
|
||||
|
||||
private void persistDomainApplication(String domainName, String repoId) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue