mirror of
https://github.com/google/nomulus.git
synced 2025-07-20 09:46:03 +02:00
Merge JUnitBackport's expectThrows into assertThrows
More information: https://github.com/junit-team/junit5/issues/531 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187034408
This commit is contained in:
parent
f96a0b7da9
commit
606b470cd0
180 changed files with 1325 additions and 1381 deletions
|
@ -20,7 +20,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
@Test
|
||||
public void testFailure_nonexistentParentRegistrar() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -97,7 +97,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
public void testFailure_nonexistentCreditId() throws Exception {
|
||||
long badId = creditId + 1;
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -111,7 +111,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
@Test
|
||||
public void testFailure_negativeBalance() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -125,7 +125,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
@Test
|
||||
public void testFailure_noRegistrar() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -138,7 +138,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
@Test
|
||||
public void testFailure_noCreditId() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -151,7 +151,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
@Test
|
||||
public void testFailure_noBalance() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -164,7 +164,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
@Test
|
||||
public void testFailure_noEffectiveTime() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_nonexistentParentRegistrar() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -110,7 +110,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_nonexistentTld() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -125,7 +125,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_nonexistentType() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -140,7 +140,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_negativeBalance() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -155,7 +155,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_noRegistrar() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -169,7 +169,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_noType() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -183,7 +183,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_noTld() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -197,7 +197,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_noBalance() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -211,7 +211,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
@Test
|
||||
public void testFailure_noEffectiveTime() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import google.registry.testing.DeterministicStringGenerator;
|
||||
|
@ -75,7 +75,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_duplicateDomains() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -91,7 +91,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_missingDomain() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -105,7 +105,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_missingClientId() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -119,7 +119,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_missingRegistrant() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -133,7 +133,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_missingAdmins() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -147,7 +147,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_missingTechs() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -161,7 +161,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_tooManyNameServers() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -180,7 +180,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_badPeriod() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -196,96 +196,96 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
@Test
|
||||
public void testFailure_dsRecordsNot4Parts() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 2 3 ab cd",
|
||||
"example.tld"));
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 2 3 ab cd",
|
||||
"example.tld"));
|
||||
assertThat(thrown).hasMessageThat().contains("should have 4 parts, but has 5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_keyTagNotNumber() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=x 2 3 abcd",
|
||||
"example.tld"));
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=x 2 3 abcd",
|
||||
"example.tld"));
|
||||
assertThat(thrown).hasMessageThat().contains("\"x\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_algNotNumber() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 x 3 abcd",
|
||||
"example.tld"));
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 x 3 abcd",
|
||||
"example.tld"));
|
||||
assertThat(thrown).hasMessageThat().contains("\"x\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_digestTypeNotNumber() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 2 x abcd",
|
||||
"example.tld"));
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 2 x abcd",
|
||||
"example.tld"));
|
||||
assertThat(thrown).hasMessageThat().contains("\"x\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_digestNotHex() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 2 3 xbcd",
|
||||
"example.tld"));
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 2 3 xbcd",
|
||||
"example.tld"));
|
||||
assertThat(thrown).hasMessageThat().contains("XBCD");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_digestNotEvenLengthed() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 2 3 abcde",
|
||||
"example.tld"));
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
"--admins=crr-admin",
|
||||
"--techs=crr-tech",
|
||||
"--ds_records=1 2 3 abcde",
|
||||
"example.tld"));
|
||||
assertThat(thrown).hasMessageThat().contains("length 5");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ package google.registry.tools;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import org.junit.Test;
|
||||
|
@ -53,7 +52,7 @@ public class CreateHostCommandTest extends EppToolCommandTestCase<CreateHostComm
|
|||
public void testFailure_invalidIpAddress() throws Exception {
|
||||
createTld("tld");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
@ -228,7 +228,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
|
|||
@Test
|
||||
public void testFailure_missingAssigneeOrFile() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand("--tlds=tld"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand("--tlds=tld"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Exactly one of either assignee or filename must be specified.");
|
||||
|
@ -237,7 +237,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
|
|||
@Test
|
||||
public void testFailure_bothAssigneeAndFile() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommand("--assignee=domain.tld", "--tlds=tld", "--input=" + assigneeFilePath));
|
||||
assertThat(thrown)
|
||||
|
@ -248,7 +248,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
|
|||
@Test
|
||||
public void testFailure_bothMetadataAndFile() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommand("--tlds=tld", "--input=" + assigneeFilePath, "--metadata=key=foo"));
|
||||
assertThat(thrown)
|
||||
|
@ -259,7 +259,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
|
|||
@Test
|
||||
public void testFailure_bothAssigneeAndMetadataColumns() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommand("--assignee=domain.tld", "--tlds=tld", "--metadata_columns=foo=1"));
|
||||
assertThat(thrown)
|
||||
|
@ -270,7 +270,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
|
|||
@Test
|
||||
public void testFailure_badTld() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommand("--assignee=domain.tld", "--tlds=foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("TLDs do not exist: foo");
|
||||
|
@ -280,7 +280,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
|
|||
public void testFailure_oneAssignee_byFile_insufficientMetadata() throws Exception {
|
||||
Files.asCharSink(assigneeFile, UTF_8).write("domain.tld,foo");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.tools;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.request.JsonResponse.JSON_SAFETY_PREFIX;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyMapOf;
|
||||
|
@ -95,14 +95,14 @@ public class CreatePremiumListCommandTest<C extends CreatePremiumListCommand>
|
|||
.thenReturn(
|
||||
JSON_SAFETY_PREFIX + "{\"status\":\"error\",\"error\":\"foo already exists\"}");
|
||||
VerifyException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
VerifyException.class, () -> runCommandForced("-i=" + premiumTermsPath, "-n=foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("Server error:");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRun_noInputFileSpecified_throwsException() throws Exception {
|
||||
ParameterException thrown = expectThrows(ParameterException.class, this::runCommand);
|
||||
ParameterException thrown = assertThrows(ParameterException.class, this::runCommand);
|
||||
assertThat(thrown).hasMessageThat().contains("The following option is required");
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class CreatePremiumListCommandTest<C extends CreatePremiumListCommand>
|
|||
readResourceUtf8(
|
||||
CreatePremiumListCommandTest.class, "testdata/example_invalid_premium_terms.csv"));
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("-i=" + premiumTermsPath, "-n=foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("Could not parse line in premium list");
|
||||
|
|
|
@ -22,7 +22,6 @@ import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH;
|
|||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
@ -445,7 +444,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
createTlds("foo");
|
||||
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -702,7 +701,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_badPhoneNumber() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -725,7 +724,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_badPhoneNumber2() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -792,7 +791,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_missingRegistrarType() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -978,7 +977,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_certHashNotBase64() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1001,7 +1000,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_certHashNotA256BitValue() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1024,7 +1023,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_missingName() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1045,7 +1044,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_missingPassword() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1066,7 +1065,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_emptyPassword() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1437,7 +1436,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_missingIcannReferralEmail() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1561,7 +1560,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
public void testFailure_alreadyExists() throws Exception {
|
||||
persistNewRegistrar("existing", "Existing Registrar", Registrar.Type.REAL, 1L);
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1585,7 +1584,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
// Note that "tHeRe GiStRaR" normalizes identically to "The Registrar", which is created by
|
||||
// AppEngineRule.
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1611,7 +1610,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_clientIdNormalizesToExisting() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1637,7 +1636,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_clientIdIsInvalidFormat() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class CreateRegistrarGroupsCommandTest extends
|
|||
@Test
|
||||
public void test_throwsExceptionForNonExistentRegistrar() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("FakeRegistrarThatDefinitelyDoesNotExist"));
|
||||
assertThat(thrown)
|
||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED
|
|||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.tools.CreateReservedListCommand.INVALID_FORMAT_ERROR_MESSAGE;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class CreateReservedListCommandTest extends
|
|||
ReservedList rl = persistReservedList("xn--q9jyb4c_foo", "jones,FULLY_BLOCKED");
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(rl).build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--name=xn--q9jyb4c_foo", "--input=" + reservedTermsPath));
|
||||
assertThat(thrown).hasMessageThat().contains("A reserved list already exists by this name");
|
||||
|
@ -175,7 +175,7 @@ public class CreateReservedListCommandTest extends
|
|||
|
||||
private void runNameTestExpectedFailure(String name, String expectedErrorMsg) throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--name=" + name, "--input=" + reservedTermsPath));
|
||||
assertThat(ReservedList.get(name)).isEmpty();
|
||||
|
|
|
@ -19,7 +19,7 @@ import static com.google.common.truth.Truth8.assertThat;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.JPY;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
@ -79,7 +79,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_multipleArguments() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -90,7 +90,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_multipleDuplicateArguments() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -312,7 +312,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidAddGracePeriod() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -325,21 +325,22 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_invalidSunrushAddGracePeriod() throws Exception {
|
||||
Exception e = expectThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--sunrush_add_grace_period=5d",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c"));
|
||||
Exception e =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
"--sunrush_add_grace_period=5d",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
"--dns_writers=VoidDnsWriter",
|
||||
"xn--q9jyb4c"));
|
||||
assertThat(e).hasMessageThat().isEqualTo("Invalid format: \"5d\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_invalidRedemptionGracePeriod() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -353,7 +354,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidPendingDeleteLength() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -367,7 +368,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidTldState() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -382,7 +383,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
public void testFailure_bothTldStateFlags() throws Exception {
|
||||
DateTime now = DateTime.now(UTC);
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -400,7 +401,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_negativeInitialRenewBillingCost() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -414,7 +415,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidEapCurrency() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -429,7 +430,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_noTldName() throws Exception {
|
||||
ParameterException thrown = expectThrows(ParameterException.class, this::runCommandForced);
|
||||
ParameterException thrown = assertThrows(ParameterException.class, this::runCommandForced);
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Main parameters are required (\"Names of the TLDs\")");
|
||||
|
@ -438,7 +439,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_noDnsWriter() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C"));
|
||||
assertThat(thrown).hasMessageThat().contains("At least one DNS writer must be specified");
|
||||
|
@ -448,7 +449,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
public void testFailure_alreadyExists() throws Exception {
|
||||
createTld("xn--q9jyb4c");
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -459,7 +460,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_tldStartsWithDigit() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("1foo", "--roid_suffix=1FOO", "--dns_writers=VoidDnsWriter"));
|
||||
assertThat(thrown).hasMessageThat().contains("TLDs cannot begin with a number");
|
||||
|
@ -598,7 +599,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_setPremiumListThatDoesntExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -612,7 +613,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_addLrpPeriod_backwardsInterval() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -629,7 +630,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_addLrpPeriod_badInterval() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -643,7 +644,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_specifiedDnsWriters_dontExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -676,7 +677,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
String reservedLists, Class<? extends Exception> errorClass, String errorMsg)
|
||||
throws Exception {
|
||||
Exception e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
errorClass,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
|
@ -113,7 +113,7 @@ public class DeleteCreditCommandTest extends CommandTestCase<DeleteCreditCommand
|
|||
@Test
|
||||
public void testFailure_nonexistentParentRegistrar() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--registrar=FakeRegistrar", "--credit_id=" + creditAId));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar FakeRegistrar not found");
|
||||
|
@ -123,7 +123,7 @@ public class DeleteCreditCommandTest extends CommandTestCase<DeleteCreditCommand
|
|||
public void testFailure_nonexistentCreditId() throws Exception {
|
||||
long badId = creditAId + creditBId + 1;
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() -> runCommandForced("--registrar=TheRegistrar", "--credit_id=" + badId));
|
||||
assertThat(thrown).hasMessageThat().contains("ID " + badId);
|
||||
|
@ -132,14 +132,14 @@ public class DeleteCreditCommandTest extends CommandTestCase<DeleteCreditCommand
|
|||
@Test
|
||||
public void testFailure_noRegistrar() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> runCommandForced("--credit_id=" + creditAId));
|
||||
assertThrows(ParameterException.class, () -> runCommandForced("--credit_id=" + creditAId));
|
||||
assertThat(thrown).hasMessageThat().contains("--registrar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_noCreditId() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> runCommandForced("--registrar=TheRegistrar"));
|
||||
assertThrows(ParameterException.class, () -> runCommandForced("--registrar=TheRegistrar"));
|
||||
assertThat(thrown).hasMessageThat().contains("--credit_id");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
|||
import static google.registry.testing.DatastoreHelper.loadPremiumListEntries;
|
||||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.registry.label.PremiumList;
|
||||
|
@ -49,7 +49,7 @@ public class DeletePremiumListCommandTest extends CommandTestCase<DeletePremiumL
|
|||
@Test
|
||||
public void testFailure_whenPremiumListDoesNotExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommandForced("--name=foo"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommandForced("--name=foo"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Cannot delete the premium list foo because it doesn't exist.");
|
||||
|
@ -61,7 +61,7 @@ public class DeletePremiumListCommandTest extends CommandTestCase<DeletePremiumL
|
|||
createTld("xn--q9jyb4c");
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setPremiumList(premiumList).build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--name=" + premiumList.getName()));
|
||||
assertThat(PremiumList.get(premiumList.getName())).isPresent();
|
||||
|
|
|
@ -19,7 +19,7 @@ import static com.google.common.truth.Truth8.assertThat;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.model.registry.label.ReservedList;
|
||||
|
@ -48,7 +48,7 @@ public class DeleteReservedListCommandTest extends CommandTestCase<DeleteReserve
|
|||
String expectedError =
|
||||
"Cannot delete the reserved list doesntExistReservedList because it doesn't exist.";
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--name=doesntExistReservedList"));
|
||||
assertThat(thrown).hasMessageThat().contains(expectedError);
|
||||
|
@ -59,7 +59,7 @@ public class DeleteReservedListCommandTest extends CommandTestCase<DeleteReserve
|
|||
createTld("xn--q9jyb4c");
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(reservedList).build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--name=" + reservedList.getName()));
|
||||
assertThat(ReservedList.get(reservedList.getName())).isPresent();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
|
@ -75,7 +75,7 @@ public class EppToolCommandTest extends EppToolCommandTestCase<EppToolCommand> {
|
|||
@Test
|
||||
public void testFailure_nonexistentClientId() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--client=fakeclient", "fake-xml"));
|
||||
assertThat(thrown).hasMessageThat().contains("fakeclient");
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.tools;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class GenerateAllocationTokensCommandTest
|
|||
@Test
|
||||
public void testFailure_mustSpecifyNumberOfTokens() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> runCommand("--prefix", "FEET"));
|
||||
assertThrows(ParameterException.class, () -> runCommand("--prefix", "FEET"));
|
||||
assertThat(thrown).hasMessageThat().contains("The following option is required: -n, --number");
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.tools;
|
|||
import static com.google.appengine.api.taskqueue.QueueFactory.getQueue;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_missingTld() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommand("--watermark=2017-01-01T00:00:00Z", "--mode=thin", "-r 42", "-o test"));
|
||||
|
@ -64,7 +64,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_emptyTld() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -79,7 +79,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_invalidTld() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -94,7 +94,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_missingWatermark() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() -> runCommand("--tld=tld", "--mode=full", "-r 42", "-o test"));
|
||||
assertThat(thrown)
|
||||
|
@ -105,7 +105,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_emptyWatermark() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommand("--tld=tld", "--watermark=", "--mode=full", "-r 42", "-o test"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid format: \"\"");
|
||||
|
@ -114,7 +114,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_missingOutdir() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -125,7 +125,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_emptyOutdir() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -140,7 +140,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_invalidWatermark() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -155,7 +155,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_invalidMode() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -172,7 +172,7 @@ public class GenerateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testCommand_invalidRevision() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
|
|
@ -20,7 +20,6 @@ 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;
|
||||
|
@ -64,7 +63,7 @@ public class GetApplicationIdsCommandTest extends CommandTestCase<GetApplication
|
|||
@Test
|
||||
public void testFailure_tldDoesNotExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand("example.foo"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand("example.foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("Domain name is not under a recognized TLD");
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomainApplication;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
|
@ -82,7 +82,7 @@ public class GetLrpTokenCommandTest extends CommandTestCase<GetLrpTokenCommand>
|
|||
@Test
|
||||
public void testFailure_noArgs() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, this::runCommand);
|
||||
assertThrows(IllegalArgumentException.class, this::runCommand);
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Exactly one of either token or assignee must be specified.");
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import org.junit.Test;
|
||||
|
@ -39,7 +38,7 @@ public class GetRegistrarCommandTest extends CommandTestCase<GetRegistrarCommand
|
|||
@Test
|
||||
public void testFailure_registrarDoesNotExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand("ClientZ"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand("ClientZ"));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar with id ClientZ does not exist");
|
||||
}
|
||||
|
||||
|
@ -51,7 +50,7 @@ public class GetRegistrarCommandTest extends CommandTestCase<GetRegistrarCommand
|
|||
@Test
|
||||
public void testFailure_oneRegistrarDoesNotExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand("NewRegistrar", "ClientZ"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand("NewRegistrar", "ClientZ"));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar with id ClientZ does not exist");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import static google.registry.testing.DatastoreHelper.persistDeletedContact;
|
|||
import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistDeletedHost;
|
||||
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;
|
||||
|
@ -72,7 +71,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
|
|||
public void testFailure_domain_oneDoesNotExist() throws Exception {
|
||||
persistActiveDomain("example.tld");
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -121,7 +120,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
|
|||
public void testFailure_contact_oneDoesNotExist() throws Exception {
|
||||
persistActiveContact("sh8013");
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -170,7 +169,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
|
|||
public void testFailure_host_oneDoesNotExist() throws Exception {
|
||||
persistActiveHost("ns1.example.tld");
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -206,7 +205,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
|
|||
@Test
|
||||
public void testFailure_keyDoesNotExist() throws Exception {
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() -> runCommand("agR0ZXN0chULEgpEb21haW5CYXNlIgUyLVRMRAw"));
|
||||
assertThat(thrown)
|
||||
|
@ -217,7 +216,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
|
|||
@Test
|
||||
public void testFailure_nonsenseKey() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> runCommand("agR0ZXN0chULEgpEb21haW5CYXN"));
|
||||
assertThat(thrown).hasMessageThat().contains("Could not parse Reference");
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.tools;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import google.registry.model.common.Cursor;
|
||||
|
@ -51,7 +51,7 @@ public class ListCursorsCommandTest extends CommandTestCase<ListCursorsCommand>
|
|||
@Test
|
||||
public void testListCursors_badCursor_throwsIae() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> runCommand("--type=love"));
|
||||
assertThrows(ParameterException.class, () -> runCommand("--type=love"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid value for --type parameter.");
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -47,7 +47,7 @@ public class ListDomainsCommandTest extends ListObjectsCommandTestCase<ListDomai
|
|||
public void test_tldsParamTooLong() throws Exception {
|
||||
String tldsParam = "--tld=foo,bar" + Strings.repeat(",baz", 300);
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand(tldsParam));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand(tldsParam));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Total length of TLDs is too long for URL parameter");
|
||||
|
|
|
@ -19,7 +19,7 @@ import static google.registry.model.eppcommon.StatusValue.SERVER_TRANSFER_PROHIB
|
|||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.tools.LockOrUnlockDomainCommand.REGISTRY_LOCK_STATUSES;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -75,7 +75,7 @@ public class LockDomainCommandTest extends EppToolCommandTestCase<LockDomainComm
|
|||
@Test
|
||||
public void testFailure_domainDoesntExist() throws Exception {
|
||||
IllegalArgumentException e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--client=NewRegistrar", "missing.tld"));
|
||||
assertThat(e).hasMessageThat().isEqualTo("Domain 'missing.tld' does not exist");
|
||||
|
@ -94,7 +94,7 @@ public class LockDomainCommandTest extends EppToolCommandTestCase<LockDomainComm
|
|||
@Test
|
||||
public void testFailure_duplicateDomainsAreSpecified() throws Exception {
|
||||
IllegalArgumentException e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--client=NewRegistrar", "dupe.tld", "dupe.tld"));
|
||||
assertThat(e).hasMessageThat().isEqualTo("Duplicate domain arguments found: 'dupe.tld'");
|
||||
|
|
|
@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
|||
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
|
||||
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 google.registry.model.host.HostResource;
|
||||
|
@ -273,7 +272,7 @@ public class MutatingCommandTest {
|
|||
+ "Update Registrar@Registrar2\n"
|
||||
+ "blockPremiumNames: false -> true\n");
|
||||
|
||||
IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute);
|
||||
IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute);
|
||||
assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called.");
|
||||
assertThat(ofy().load().entity(host1).now()).isNull();
|
||||
assertThat(ofy().load().entity(host2).now()).isEqualTo(newHost2);
|
||||
|
@ -304,7 +303,7 @@ public class MutatingCommandTest {
|
|||
host1, host1.asBuilder().setLastEppUpdateTime(DateTime.now(UTC)).build());
|
||||
}
|
||||
};
|
||||
IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, command::init);
|
||||
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::init);
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Cannot apply multiple changes for the same entity");
|
||||
|
@ -318,7 +317,7 @@ public class MutatingCommandTest {
|
|||
stageEntityChange(host1, host2);
|
||||
}
|
||||
};
|
||||
IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, command::init);
|
||||
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::init);
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Both entity versions in an update must have the same Key.");
|
||||
|
@ -333,7 +332,7 @@ public class MutatingCommandTest {
|
|||
stageEntityChange(registrar1, registrar2);
|
||||
}
|
||||
};
|
||||
IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, command::init);
|
||||
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::init);
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Both entity versions in an update must have the same Key.");
|
||||
|
@ -348,7 +347,7 @@ public class MutatingCommandTest {
|
|||
stageEntityChange(host1, registrar1);
|
||||
}
|
||||
};
|
||||
IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, command::init);
|
||||
IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::init);
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Both entity versions in an update must have the same Key.");
|
||||
|
@ -365,7 +364,7 @@ public class MutatingCommandTest {
|
|||
};
|
||||
command.init();
|
||||
persistResource(newHost1);
|
||||
IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute);
|
||||
IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute);
|
||||
assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called.");
|
||||
}
|
||||
|
||||
|
@ -380,7 +379,7 @@ public class MutatingCommandTest {
|
|||
};
|
||||
command.init();
|
||||
persistResource(newHost1);
|
||||
IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute);
|
||||
IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute);
|
||||
assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called.");
|
||||
}
|
||||
|
||||
|
@ -395,7 +394,7 @@ public class MutatingCommandTest {
|
|||
};
|
||||
command.init();
|
||||
persistResource(newHost1);
|
||||
IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute);
|
||||
IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute);
|
||||
assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called.");
|
||||
}
|
||||
|
||||
|
@ -410,7 +409,7 @@ public class MutatingCommandTest {
|
|||
};
|
||||
command.init();
|
||||
deleteResource(host1);
|
||||
IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute);
|
||||
IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute);
|
||||
assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
|||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistSimpleResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -193,7 +193,7 @@ public class RegistrarContactCommandTest extends CommandTestCase<RegistrarContac
|
|||
.setVisibleInDomainWhoisAsAbuse(true)
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -326,7 +326,7 @@ public class RegistrarContactCommandTest extends CommandTestCase<RegistrarContac
|
|||
persistSimpleResource(
|
||||
registrarContact.asBuilder().setVisibleInDomainWhoisAsAbuse(true).build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -22,7 +22,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
|||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
|
@ -205,7 +205,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_missingIpWhitelist() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -218,7 +218,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_missingRegistrar() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -231,7 +231,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_missingCertificateFile() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -242,7 +242,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_missingDnsWriter() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -255,7 +255,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidCert() throws Exception {
|
||||
CertificateParsingException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
CertificateParsingException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -269,7 +269,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidRegistrar() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -283,7 +283,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidDnsWriter() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -299,7 +299,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_registrarTooShort() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -313,7 +313,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_registrarTooLong() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -327,7 +327,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_registrarInvalidCharacter() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -341,7 +341,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidPremiumList() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -357,7 +357,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
public void testFailure_tldExists() throws Exception {
|
||||
createTld("blobio-sunrise");
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -376,7 +376,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
|
|||
.build();
|
||||
persistResource(registrar);
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.newDomainResource;
|
|||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -153,7 +153,7 @@ public class UniformRapidSuspensionCommandTest
|
|||
public void testFailure_locksToPreserveWithoutUndo() throws Exception {
|
||||
persistActiveDomain("evil.tld");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -165,7 +165,7 @@ public class UniformRapidSuspensionCommandTest
|
|||
public void testFailure_domainNameRequired() throws Exception {
|
||||
persistActiveDomain("evil.tld");
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() -> runCommandForced("--hosts=urs1.example.com,urs2.example.com"));
|
||||
assertThat(thrown).hasMessageThat().contains("--domain_name");
|
||||
|
@ -175,7 +175,7 @@ public class UniformRapidSuspensionCommandTest
|
|||
public void testFailure_extraFieldInDsData() throws Exception {
|
||||
persistActiveDomain("evil.tld");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -188,7 +188,7 @@ public class UniformRapidSuspensionCommandTest
|
|||
public void testFailure_missingFieldInDsData() throws Exception {
|
||||
persistActiveDomain("evil.tld");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -201,7 +201,7 @@ public class UniformRapidSuspensionCommandTest
|
|||
public void testFailure_malformedDsData() throws Exception {
|
||||
persistActiveDomain("evil.tld");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--domain_name=evil.tld", "--dsdata=[1,2,3]"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid --dsdata JSON");
|
||||
|
|
|
@ -21,7 +21,7 @@ import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBIT
|
|||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -87,7 +87,7 @@ public class UnlockDomainCommandTest extends EppToolCommandTestCase<UnlockDomain
|
|||
@Test
|
||||
public void testFailure_domainDoesntExist() throws Exception {
|
||||
IllegalArgumentException e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--client=NewRegistrar", "missing.tld"));
|
||||
assertThat(e).hasMessageThat().isEqualTo("Domain 'missing.tld' does not exist");
|
||||
|
@ -102,7 +102,7 @@ public class UnlockDomainCommandTest extends EppToolCommandTestCase<UnlockDomain
|
|||
@Test
|
||||
public void testFailure_duplicateDomainsAreSpecified() throws Exception {
|
||||
IllegalArgumentException e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--client=NewRegistrar", "dupe.tld", "dupe.tld"));
|
||||
assertThat(e).hasMessageThat().isEqualTo("Duplicate domain arguments found: 'dupe.tld'");
|
||||
|
|
|
@ -28,7 +28,6 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
|||
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
|
||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
|
@ -256,7 +255,7 @@ public class UpdateApplicationStatusCommandTest
|
|||
.build());
|
||||
|
||||
IllegalStateException e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -281,7 +280,7 @@ public class UpdateApplicationStatusCommandTest
|
|||
@Test
|
||||
public void testFailure_historyClientIdDoesNotExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -21,7 +21,6 @@ import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
|||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
@ -146,7 +145,7 @@ public class UpdateClaimsNoticeCommandTest extends CommandTestCase<UpdateClaimsN
|
|||
public void testFailure_claimsNoticeForWrongLabel() throws Exception {
|
||||
persistResource(newDomainApplication("bad-label.xn--q9jyb4c"));
|
||||
Exception e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
Exception.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
|
|
@ -19,7 +19,6 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import google.registry.model.common.Cursor;
|
||||
|
@ -120,7 +119,7 @@ public class UpdateCursorsCommandTest extends CommandTestCase<UpdateCursorsComma
|
|||
@Test
|
||||
public void testFailure_badCursorType() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() -> runCommandForced("--type=rbda", "--timestamp=1984-12-18T00:00:00Z", "foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid value for --type parameter");
|
||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.newContactResource;
|
|||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveHost;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -209,7 +209,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
.build());
|
||||
|
||||
Exception e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -225,7 +225,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_duplicateDomains() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -240,7 +240,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_missingDomain() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -251,7 +251,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_missingClientId() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() -> runCommandForced("--registrant=crr-admin", "--password=2fooBAR", "example.tld"));
|
||||
assertThat(thrown).hasMessageThat().contains("--client");
|
||||
|
@ -260,7 +260,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_addTooManyNameServers() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -279,7 +279,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_providedNameserversAndAddNameservers() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -297,7 +297,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_providedNameserversAndRemoveNameservers() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -315,7 +315,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_providedAdminsAndAddAdmins() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -333,7 +333,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_providedAdminsAndRemoveAdmins() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -351,7 +351,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_providedTechsAndAddTechs() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -368,7 +368,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_providedTechsAndRemoveTechs() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -385,7 +385,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_providedStatusesAndAddStatuses() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -403,7 +403,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_providedStatusesAndRemoveStatuses() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -421,7 +421,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_provideDsRecordsAndAddDsRecords() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -439,7 +439,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_provideDsRecordsAndRemoveDsRecords() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -457,7 +457,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_clearDsRecordsAndAddDsRecords() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -475,7 +475,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
|
|||
@Test
|
||||
public void testFailure_clearDsRecordsAndRemoveDsRecords() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
|
|
@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.createTlds;
|
|||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
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;
|
||||
|
@ -73,7 +72,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
|
|||
.setPhonePasscode(null)
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommand("--registrar_type=REAL", "--iana_id=1000", "--force", "NewRegistrar"));
|
||||
assertThat(thrown).hasMessageThat().contains("--passcode is required for REAL registrars.");
|
||||
|
@ -222,7 +221,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
|
|||
createTlds("foo");
|
||||
assertThat(loadRegistrar("NewRegistrar").getBillingAccountMap()).isEmpty();
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -284,7 +283,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
|
|||
.build());
|
||||
assertThat(registrar.getBillingMethod()).isEqualTo(BillingMethod.EXTERNAL);
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> runCommand("--billing_method=braintree", "--force", "NewRegistrar"));
|
||||
assertThat(thrown)
|
||||
|
@ -723,7 +722,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
|
|||
@Test
|
||||
public void testFailure_doesNotExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand("--force", "ClientZ"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand("--force", "ClientZ"));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar ClientZ not found");
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -94,7 +94,7 @@ public class UpdateReservedListCommandTest extends
|
|||
String errorMessage =
|
||||
"Could not update reserved list xn--q9jyb4c_poobah because it doesn't exist.";
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommand("--force", "--name=xn--q9jyb4c_poobah", "--input=" + reservedTermsPath));
|
||||
|
|
|
@ -23,7 +23,6 @@ import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
|||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
|
@ -116,7 +115,7 @@ public class UpdateSmdCommandTest extends CommandTestCase<UpdateSmdCommand> {
|
|||
public void testFailure_invalidSmd() throws Exception {
|
||||
String smdFile = writeToTmpFile(INVALID_SMD);
|
||||
Exception e =
|
||||
expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThat(e).hasCauseThat().isInstanceOf(ParameterValuePolicyErrorException.class);
|
||||
}
|
||||
|
||||
|
@ -127,7 +126,7 @@ public class UpdateSmdCommandTest extends CommandTestCase<UpdateSmdCommand> {
|
|||
SignedMarkRevocationList.create(now, ImmutableMap.of(ACTIVE_SMD_ID, now)).save();
|
||||
String smdFile = writeToTmpFile(ACTIVE_SMD);
|
||||
Exception e =
|
||||
expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThat(e).hasCauseThat().isInstanceOf(ParameterValuePolicyErrorException.class);
|
||||
}
|
||||
|
||||
|
@ -135,7 +134,7 @@ public class UpdateSmdCommandTest extends CommandTestCase<UpdateSmdCommand> {
|
|||
public void testFailure_revokedTmv() throws Exception {
|
||||
String smdFile = writeToTmpFile(REVOKED_TMV_SMD);
|
||||
Exception e =
|
||||
expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThat(e).hasCauseThat().isInstanceOf(ParameterValuePolicyErrorException.class);
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ public class UpdateSmdCommandTest extends CommandTestCase<UpdateSmdCommand> {
|
|||
public void testFailure_unparseableXml() throws Exception {
|
||||
String smdFile = writeToTmpFile(base64().encode("This is not XML!".getBytes(UTF_8)));
|
||||
Exception e =
|
||||
expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThat(e).hasCauseThat().isInstanceOf(ParameterValueSyntaxErrorException.class);
|
||||
}
|
||||
|
||||
|
@ -151,7 +150,7 @@ public class UpdateSmdCommandTest extends CommandTestCase<UpdateSmdCommand> {
|
|||
public void testFailure_badlyEncodedData() throws Exception {
|
||||
String smdFile = writeToTmpFile("Bad base64 data ~!@#$#@%%$#^$%^&^**&^)(*)(_".getBytes(UTF_8));
|
||||
Exception e =
|
||||
expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThat(e).hasCauseThat().isInstanceOf(ParameterValueSyntaxErrorException.class);
|
||||
}
|
||||
|
||||
|
@ -159,7 +158,7 @@ public class UpdateSmdCommandTest extends CommandTestCase<UpdateSmdCommand> {
|
|||
public void testFailure_wrongLabel() throws Exception {
|
||||
String smdFile = writeToTmpFile(DIFFERENT_LABEL_SMD);
|
||||
Exception e =
|
||||
expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile));
|
||||
assertThat(e).hasCauseThat().isInstanceOf(RequiredParameterMissingException.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
|||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.JPY;
|
||||
|
@ -465,7 +465,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidAddGracePeriod() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--add_grace_period=5m", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid format: \"5m\"");
|
||||
|
@ -474,7 +474,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidRedemptionGracePeriod() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--redemption_grace_period=5m", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid format: \"5m\"");
|
||||
|
@ -483,7 +483,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidPendingDeleteLength() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--pending_delete_length=5m", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("Invalid format: \"5m\"");
|
||||
|
@ -492,7 +492,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidTldState() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -505,7 +505,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidTldStateTransitionTime() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced("--tld_state_transitions=tomorrow=INVALID_STATE", "xn--q9jyb4c"));
|
||||
|
@ -517,7 +517,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_tldStatesOutOfOrder() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -531,7 +531,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_duplicateTldStateTransitions() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -544,7 +544,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_duplicateTldStateTransitionTimes() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -558,7 +558,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_outOfOrderTldStateTransitionTimes() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -574,7 +574,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_bothTldStateFlags() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -598,7 +598,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
now.minusMonths(1), TldState.GENERAL_AVAILABILITY))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--set_current_tld_state=SUNRISE", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("The TLD states are chronologically out of order");
|
||||
|
@ -614,7 +614,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
now.plusMonths(1), TldState.GENERAL_AVAILABILITY))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--set_current_tld_state=SUNRISE", "xn--q9jyb4c"));
|
||||
assertThat(thrown)
|
||||
|
@ -632,7 +632,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
now.minusMonths(1), TldState.GENERAL_AVAILABILITY))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandInEnvironment(
|
||||
|
@ -648,7 +648,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidRenewBillingCost() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -662,7 +662,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_negativeRenewBillingCost() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -674,7 +674,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_invalidRenewCostTransitionTime() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced("--renew_billing_cost_transitions=tomorrow=USD 1", "xn--q9jyb4c"));
|
||||
|
@ -686,7 +686,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_duplicateRenewCostTransitionTimes() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -701,7 +701,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_outOfOrderRenewCostTransitionTimes() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -716,7 +716,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_noTldName() throws Exception {
|
||||
ParameterException thrown = expectThrows(ParameterException.class, this::runCommandForced);
|
||||
ParameterException thrown = assertThrows(ParameterException.class, this::runCommandForced);
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Main parameters are required (\"Names of the TLDs\")");
|
||||
|
@ -725,14 +725,14 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_oneTldDoesNotExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommandForced("foo", "xn--q9jyb4c"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommandForced("foo", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("TLD foo does not exist");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_duplicateArguments() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> runCommandForced("xn--q9jyb4c", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("Duplicate arguments found: 'xn--q9jyb4c'");
|
||||
}
|
||||
|
@ -740,14 +740,14 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_tldDoesNotExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommandForced("foobarbaz"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommandForced("foobarbaz"));
|
||||
assertThat(thrown).hasMessageThat().contains("TLD foobarbaz does not exist");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_specifiedDnsWriter_doesntExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("xn--q9jyb4c", "--dns_writers=InvalidDnsWriter"));
|
||||
assertThat(thrown)
|
||||
|
@ -758,7 +758,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_setNonExistentReservedLists() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--reserved_lists", "xn--q9jyb4c_ZZZ", "xn--q9jyb4c"));
|
||||
assertThat(thrown)
|
||||
|
@ -772,7 +772,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--add_reserved_lists=xn--q9jyb4c_r1", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("xn--q9jyb4c_r1");
|
||||
|
@ -784,7 +784,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--remove_reserved_lists=xn--q9jyb4c_Z", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("xn--q9jyb4c_Z");
|
||||
|
@ -793,7 +793,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_cantAddAndRemoveSameReservedListSimultaneously() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -810,7 +810,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice", "bob"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--add_allowed_registrants=alice", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("alice");
|
||||
|
@ -823,7 +823,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
.setAllowedRegistrantContactIds(ImmutableSet.of("alice"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--remove_allowed_registrants=bob", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("bob");
|
||||
|
@ -832,7 +832,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_cantAddAndRemoveSameAllowedRegistrantsSimultaneously() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -850,7 +850,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
ImmutableSet.of("ns1.example.com", "ns2.example.com"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--add_allowed_nameservers=ns1.example.com", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("ns1.example.com");
|
||||
|
@ -864,7 +864,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
ImmutableSet.of("ns1.example.com"))
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--remove_allowed_nameservers=ns2.example.com", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("ns2.example.com");
|
||||
|
@ -873,7 +873,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_cantAddAndRemoveSameAllowedNameserversSimultaneously() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1002,7 +1002,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_setPremiumListThatDoesntExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> runCommandForced("--premium_list=phonies", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("The premium list 'phonies' doesn't exist");
|
||||
|
@ -1019,7 +1019,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_updateLrpPeriod_backwardsInterval() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() ->
|
||||
runCommandForced(
|
||||
|
@ -1033,7 +1033,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_updateLrpPeriod_badInterval() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class, () -> runCommandForced("--lrp_period=foobar", "xn--q9jyb4c"));
|
||||
assertThat(thrown).hasMessageThat().contains("--lrp_period=foobar not an ISO-8601 interval");
|
||||
}
|
||||
|
@ -1053,7 +1053,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
|
|||
String reservedLists, Class<? extends Exception> errorClass, String errorMsg)
|
||||
throws Exception {
|
||||
Exception e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
errorClass, () -> runCommandForced("--reserved_lists", reservedLists, "xn--q9jyb4c"));
|
||||
assertThat(e).hasMessageThat().isEqualTo(errorMsg);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.tools;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import google.registry.rde.RdeTestData;
|
||||
import google.registry.xml.XmlException;
|
||||
|
@ -102,7 +102,7 @@ public class ValidateEscrowDepositCommandTest
|
|||
@Test
|
||||
public void testRun_badXml() throws Exception {
|
||||
String file = writeToTmpFile(RdeTestData.loadFile("deposit_full.xml").substring(0, 2000));
|
||||
XmlException thrown = expectThrows(XmlException.class, () -> runCommand("--input=" + file));
|
||||
XmlException thrown = assertThrows(XmlException.class, () -> runCommand("--input=" + file));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
|
|
|
@ -20,7 +20,6 @@ import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
|||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -66,7 +65,7 @@ public class ValidateLoginCredentialsCommandTest
|
|||
@Test
|
||||
public void testFailure_loginWithBadPassword() throws Exception {
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadRegistrarPasswordException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -80,7 +79,7 @@ public class ValidateLoginCredentialsCommandTest
|
|||
@Test
|
||||
public void testFailure_loginWithBadCertificateHash() throws Exception {
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
EppException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
@ -94,7 +93,7 @@ public class ValidateLoginCredentialsCommandTest
|
|||
@Test
|
||||
public void testFailure_loginWithBadIp() throws Exception {
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
EppException.class,
|
||||
() ->
|
||||
runCommand(
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.tools;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.mockito.Matchers.anyMapOf;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Matchers.eq;
|
||||
|
@ -68,14 +68,14 @@ public class VerifyOteCommandTest extends CommandTestCase<VerifyOteCommand> {
|
|||
@Test
|
||||
public void testFailure_registrarDoesntExist() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand("blobio"));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand("blobio"));
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar blobio does not exist.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_noRegistrarsNoCheckAll() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> runCommand(""));
|
||||
assertThrows(IllegalArgumentException.class, () -> runCommand(""));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Must provide at least one registrar name, or supply --check-all with no names.");
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools.params;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
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;
|
||||
|
@ -107,7 +106,7 @@ public class DateTimeParameterTest {
|
|||
@Test
|
||||
public void testValidate_sillyString_throwsParameterException() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
|
||||
assertThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("--time=foo not an ISO");
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools.params;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import org.joda.time.Duration;
|
||||
|
@ -83,7 +82,7 @@ public class DurationParameterTest {
|
|||
@Test
|
||||
public void testValidate_sillyString_throws() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
|
||||
assertThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("--time=foo not an");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.tools.params;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import google.registry.model.registry.Registry.TldState;
|
||||
import org.junit.Test;
|
||||
|
@ -38,7 +38,7 @@ public class EnumParameterTest {
|
|||
@Test
|
||||
public void testFailure_badValue() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> instance.convert("GENERAL_SUNRUSH"));
|
||||
assertThrows(IllegalArgumentException.class, () -> instance.convert("GENERAL_SUNRUSH"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools.params;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import org.joda.time.DateTime;
|
||||
|
@ -68,7 +67,7 @@ public class IntervalParameterTest {
|
|||
@Test
|
||||
public void testValidate_sillyString_throws() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
|
||||
assertThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("--time=foo not an");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools.params;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.tools.params.KeyValueMapParameter.CurrencyUnitToStringMap;
|
||||
|
@ -95,7 +94,7 @@ public class KeyValueMapParameterTest {
|
|||
@Test
|
||||
public void testFailure_convertCurrencyUnitToString_badType() throws Exception {
|
||||
IllegalCurrencyException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalCurrencyException.class,
|
||||
() -> currencyUnitToStringMap.convert("USD=123abc,XYZ=xyz789"));
|
||||
assertThat(thrown).hasMessageThat().contains("XYZ");
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools.params;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import org.joda.money.Money;
|
||||
|
@ -72,7 +71,7 @@ public class MoneyParameterTest {
|
|||
@Test
|
||||
public void testValidate_sillyString_throws() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> instance.validate("--money", "foo"));
|
||||
assertThrows(ParameterException.class, () -> instance.validate("--money", "foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("--money=foo not valid");
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools.params;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
|
@ -96,7 +95,7 @@ public class PathParameterTest {
|
|||
@Test
|
||||
public void testInputFileValidate_missingFile_throws() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() -> inputFile.validate("input", new File(folder.getRoot(), "foo").toString()));
|
||||
assertThat(thrown).hasMessageThat().contains("not found");
|
||||
|
@ -105,7 +104,7 @@ public class PathParameterTest {
|
|||
@Test
|
||||
public void testInputFileValidate_directory_throws() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() -> inputFile.validate("input", folder.getRoot().toString()));
|
||||
assertThat(thrown).hasMessageThat().contains("is a directory");
|
||||
|
@ -116,7 +115,7 @@ public class PathParameterTest {
|
|||
Path file = Paths.get(folder.newFile().toString());
|
||||
Files.setPosixFilePermissions(file, PosixFilePermissions.fromString("-w-------"));
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> inputFile.validate("input", file.toString()));
|
||||
assertThrows(ParameterException.class, () -> inputFile.validate("input", file.toString()));
|
||||
assertThat(thrown).hasMessageThat().contains("not readable");
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ public class PathParameterTest {
|
|||
@Test
|
||||
public void testOutputFileValidate_directory_throws() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ParameterException.class,
|
||||
() -> outputFile.validate("input", folder.getRoot().toString()));
|
||||
assertThat(thrown).hasMessageThat().contains("is a directory");
|
||||
|
@ -154,7 +153,7 @@ public class PathParameterTest {
|
|||
Path file = Paths.get(folder.newFile().toString());
|
||||
Files.setPosixFilePermissions(file, PosixFilePermissions.fromString("r--------"));
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> outputFile.validate("input", file.toString()));
|
||||
assertThrows(ParameterException.class, () -> outputFile.validate("input", file.toString()));
|
||||
assertThat(thrown).hasMessageThat().contains("not writable");
|
||||
}
|
||||
|
||||
|
@ -162,7 +161,7 @@ public class PathParameterTest {
|
|||
public void testOutputFileValidate_parentDirMissing_throws() throws Exception {
|
||||
Path file = Paths.get(folder.getRoot().toString(), "MISSINGNO", "foo.txt");
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> outputFile.validate("input", file.toString()));
|
||||
assertThrows(ParameterException.class, () -> outputFile.validate("input", file.toString()));
|
||||
assertThat(thrown).hasMessageThat().contains("parent dir doesn't exist");
|
||||
}
|
||||
|
||||
|
@ -170,7 +169,7 @@ public class PathParameterTest {
|
|||
public void testOutputFileValidate_parentDirIsFile_throws() throws Exception {
|
||||
Path file = Paths.get(folder.newFile().toString(), "foo.txt");
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> outputFile.validate("input", file.toString()));
|
||||
assertThrows(ParameterException.class, () -> outputFile.validate("input", file.toString()));
|
||||
assertThat(thrown).hasMessageThat().contains("parent is non-directory");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.tools.params;
|
|||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import org.joda.time.YearMonth;
|
||||
|
@ -62,7 +61,7 @@ public class YearMonthParameterTest {
|
|||
@Test
|
||||
public void testValidate_sillyString_throwsParameterException() throws Exception {
|
||||
ParameterException thrown =
|
||||
expectThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
|
||||
assertThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
|
||||
assertThat(thrown).hasMessageThat().contains("--time=foo not a valid");
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.tools.server;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_OK;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
@ -62,7 +62,7 @@ public class CreateGroupsActionTest {
|
|||
|
||||
@Test
|
||||
public void test_invalidRequest_missingClientId() throws Exception {
|
||||
BadRequestException thrown = expectThrows(BadRequestException.class, () -> runAction(null));
|
||||
BadRequestException thrown = assertThrows(BadRequestException.class, () -> runAction(null));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains("Error creating Google Groups, missing parameter: clientId");
|
||||
|
@ -71,7 +71,7 @@ public class CreateGroupsActionTest {
|
|||
@Test
|
||||
public void test_invalidRequest_invalidClientId() throws Exception {
|
||||
BadRequestException thrown =
|
||||
expectThrows(BadRequestException.class, () -> runAction("completelyMadeUpClientId"));
|
||||
assertThrows(BadRequestException.class, () -> runAction("completelyMadeUpClientId"));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
|
@ -99,7 +99,7 @@ public class CreateGroupsActionTest {
|
|||
"newregistrar-technical-contacts@domain-registry.example",
|
||||
Role.MEMBER);
|
||||
InternalServerErrorException e =
|
||||
expectThrows(InternalServerErrorException.class, () -> runAction("NewRegistrar"));
|
||||
assertThrows(InternalServerErrorException.class, () -> runAction("NewRegistrar"));
|
||||
String responseString = e.toString();
|
||||
assertThat(responseString).contains("abuse => Success");
|
||||
assertThat(responseString).contains("billing => Success");
|
||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.appengine.api.datastore.DatastoreServiceFactory.getData
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.googlecode.objectify.Key.create;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.google.appengine.api.datastore.Entity;
|
||||
import com.google.appengine.api.datastore.KeyFactory;
|
||||
|
@ -85,7 +85,7 @@ public class DeleteEntityActionTest {
|
|||
Entity entity = new Entity("not", "here");
|
||||
String rawKey = KeyFactory.keyToString(entity.getKey());
|
||||
action.rawKeys = rawKey;
|
||||
BadRequestException thrown = expectThrows(BadRequestException.class, action::run);
|
||||
BadRequestException thrown = assertThrows(BadRequestException.class, action::run);
|
||||
assertThat(thrown).hasMessageThat().contains("Could not find entity with key " + rawKey);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public class DeleteEntityActionTest {
|
|||
Entity entity = new Entity("non", "existent");
|
||||
String rawKey = KeyFactory.keyToString(entity.getKey());
|
||||
action.rawKeys = String.format("%s,%s", ofyKey, rawKey);
|
||||
BadRequestException thrown = expectThrows(BadRequestException.class, action::run);
|
||||
BadRequestException thrown = assertThrows(BadRequestException.class, action::run);
|
||||
assertThat(thrown).hasMessageThat().contains("Could not find entity with key " + rawKey);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue