Remove unnecessary "throws" declarations

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201058582
This commit is contained in:
mcilwain 2018-06-18 14:25:42 -07:00 committed by Ben McIlwain
parent a7256f5edd
commit 5d80f124ca
377 changed files with 2297 additions and 2373 deletions

View file

@ -131,19 +131,19 @@ public class AllocateDomainCommandTest extends CommandTestCase<AllocateDomainCom
}
@Test
public void testFailure_notAsSuperuser() throws Exception {
public void testFailure_notAsSuperuser() {
assertThrows(IllegalArgumentException.class, () -> runCommand("--ids=1-TLD", "--force"));
}
@Test
public void testFailure_forceAndDryRunIncompatible() throws Exception {
public void testFailure_forceAndDryRunIncompatible() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--ids=1-TLD", "--force", "--dry_run", "--superuser"));
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() -> runCommand("--ids=1-TLD", "--force", "--unrecognized=foo", "--superuser"));

View file

@ -27,7 +27,6 @@ import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.AbstractDataStoreFactory;
import com.google.api.client.util.store.DataStore;
import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.io.Serializable;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -41,7 +40,7 @@ public class AuthModuleTest {
private static final Credential FAKE_CREDENTIAL = new Credential(
new Credential.AccessMethod() {
@Override
public void intercept(HttpRequest request, String accessToken) throws IOException {}
public void intercept(HttpRequest request, String accessToken) {}
@Override
public String getAccessTokenFromRequest(HttpRequest request) {

View file

@ -62,17 +62,17 @@ public class CheckDomainClaimsCommandTest extends EppToolCommandTestCase<CheckDo
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(ParameterException.class, () -> runCommand("example.tld"));
}
@Test
public void testFailure_NoMainParameter() throws Exception {
public void testFailure_NoMainParameter() {
assertThrows(ParameterException.class, () -> runCommand("--client=NewRegistrar"));
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() -> runCommand("--client=NewRegistrar", "--unrecognized=foo", "example.tld"));

View file

@ -62,17 +62,17 @@ public class CheckDomainCommandTest extends EppToolCommandTestCase<CheckDomainCo
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(ParameterException.class, () -> runCommand("example.tld"));
}
@Test
public void testFailure_NoMainParameter() throws Exception {
public void testFailure_NoMainParameter() {
assertThrows(ParameterException.class, () -> runCommand("--client=NewRegistrar"));
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() -> runCommand("--client=NewRegistrar", "--unrecognized=foo", "example.tld"));

View file

@ -161,30 +161,30 @@ public abstract class CommandTestCase<C extends Command> {
* Asserts whether standard out matches an expected string, allowing for differences in
* ImmutableObject hash codes (i.e. "(@1234567)").
*/
protected void assertStdoutForImmutableObjectIs(String expected) throws Exception {
protected void assertStdoutForImmutableObjectIs(String expected) {
assertThat(stripImmutableObjectHashCodes(getStdoutAsString()).trim())
.isEqualTo(stripImmutableObjectHashCodes(expected).trim());
}
protected void assertStdoutIs(String expected) throws Exception {
protected void assertStdoutIs(String expected) {
assertThat(getStdoutAsString()).isEqualTo(expected);
}
protected void assertInStdout(String... expected) throws Exception {
protected void assertInStdout(String... expected) {
String stdout = getStdoutAsString();
for (String line : expected) {
assertThat(stdout).contains(line);
}
}
protected void assertInStderr(String... expected) throws Exception {
protected void assertInStderr(String... expected) {
String stderror = new String(stderr.toByteArray(), UTF_8);
for (String line : expected) {
assertThat(stderror).contains(line);
}
}
protected void assertNotInStdout(String expected) throws Exception {
protected void assertNotInStdout(String expected) {
assertThat(getStdoutAsString()).doesNotContain(expected);
}

View file

@ -83,7 +83,7 @@ public class CreateAnchorTenantCommandTest
}
@Test
public void testFailure_mainParameter() throws Exception {
public void testFailure_mainParameter() {
assertThrows(
ParameterException.class,
() ->
@ -98,7 +98,7 @@ public class CreateAnchorTenantCommandTest
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(
ParameterException.class,
() ->
@ -110,7 +110,7 @@ public class CreateAnchorTenantCommandTest
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() ->
@ -124,7 +124,7 @@ public class CreateAnchorTenantCommandTest
}
@Test
public void testFailure_missingDomainName() throws Exception {
public void testFailure_missingDomainName() {
assertThrows(
ParameterException.class,
() ->
@ -137,7 +137,7 @@ public class CreateAnchorTenantCommandTest
}
@Test
public void testFailure_missingContact() throws Exception {
public void testFailure_missingContact() {
assertThrows(
ParameterException.class,
() ->
@ -150,7 +150,7 @@ public class CreateAnchorTenantCommandTest
}
@Test
public void testFailure_notAsSuperuser() throws Exception {
public void testFailure_notAsSuperuser() {
assertThrows(
IllegalArgumentException.class,
() ->

View file

@ -21,8 +21,6 @@ import static org.mockito.Mockito.when;
import com.google.api.services.dns.Dns;
import com.google.api.services.dns.model.ManagedZone;
import com.google.api.services.dns.model.ManagedZoneDnsSecConfig;
import java.io.IOException;
import java.security.GeneralSecurityException;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@ -49,7 +47,7 @@ public class CreateCdnsTldTest extends CommandTestCase<CreateCdnsTld> {
/** Fake the command class so we can override createDnsService() */
class CreateCdnsTldForTest extends CreateCdnsTld {
@Override
Dns createDnsService() throws IOException, GeneralSecurityException {
Dns createDnsService() {
return dnsService;
}
}

View file

@ -59,12 +59,12 @@ public class CreateContactCommandTest extends EppToolCommandTestCase<CreateConta
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(ParameterException.class, this::runCommandForced);
}
@Test
public void testFailure_tooManyStreetLines() throws Exception {
public void testFailure_tooManyStreetLines() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -77,13 +77,13 @@ public class CreateContactCommandTest extends EppToolCommandTestCase<CreateConta
}
@Test
public void testFailure_badPhone() throws Exception {
public void testFailure_badPhone() {
assertThrows(
ParameterException.class, () -> runCommandForced("--client=NewRegistrar", "--phone=3"));
}
@Test
public void testFailure_badFax() throws Exception {
public void testFailure_badFax() {
assertThrows(
ParameterException.class, () -> runCommandForced("--client=NewRegistrar", "--fax=3"));
}

View file

@ -80,7 +80,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
}
@Test
public void testFailure_nonexistentParentRegistrar() throws Exception {
public void testFailure_nonexistentParentRegistrar() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -94,7 +94,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
}
@Test
public void testFailure_nonexistentCreditId() throws Exception {
public void testFailure_nonexistentCreditId() {
long badId = creditId + 1;
NullPointerException thrown =
assertThrows(
@ -109,7 +109,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
}
@Test
public void testFailure_negativeBalance() throws Exception {
public void testFailure_negativeBalance() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -123,7 +123,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
}
@Test
public void testFailure_noRegistrar() throws Exception {
public void testFailure_noRegistrar() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -136,7 +136,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
}
@Test
public void testFailure_noCreditId() throws Exception {
public void testFailure_noCreditId() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -149,7 +149,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
}
@Test
public void testFailure_noBalance() throws Exception {
public void testFailure_noBalance() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -162,7 +162,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
}
@Test
public void testFailure_noEffectiveTime() throws Exception {
public void testFailure_noEffectiveTime() {
ParameterException thrown =
assertThrows(
ParameterException.class,

View file

@ -93,7 +93,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_nonexistentParentRegistrar() throws Exception {
public void testFailure_nonexistentParentRegistrar() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -108,7 +108,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_nonexistentTld() throws Exception {
public void testFailure_nonexistentTld() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -123,7 +123,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_nonexistentType() throws Exception {
public void testFailure_nonexistentType() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -138,7 +138,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_negativeBalance() throws Exception {
public void testFailure_negativeBalance() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -153,7 +153,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_noRegistrar() throws Exception {
public void testFailure_noRegistrar() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -167,7 +167,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_noType() throws Exception {
public void testFailure_noType() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -181,7 +181,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_noTld() throws Exception {
public void testFailure_noTld() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -195,7 +195,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_noBalance() throws Exception {
public void testFailure_noBalance() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -209,7 +209,7 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
}
@Test
public void testFailure_noEffectiveTime() throws Exception {
public void testFailure_noEffectiveTime() {
ParameterException thrown =
assertThrows(
ParameterException.class,

View file

@ -112,7 +112,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_duplicateDomains() throws Exception {
public void testFailure_duplicateDomains() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -128,7 +128,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_missingDomain() throws Exception {
public void testFailure_missingDomain() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -142,7 +142,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -156,7 +156,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_missingRegistrant() throws Exception {
public void testFailure_missingRegistrant() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -170,7 +170,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_missingAdmins() throws Exception {
public void testFailure_missingAdmins() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -184,7 +184,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_missingTechs() throws Exception {
public void testFailure_missingTechs() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -198,7 +198,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_tooManyNameServers() throws Exception {
public void testFailure_tooManyNameServers() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -217,7 +217,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_badPeriod() throws Exception {
public void testFailure_badPeriod() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -233,7 +233,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_dsRecordsNot4Parts() throws Exception {
public void testFailure_dsRecordsNot4Parts() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -249,7 +249,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_keyTagNotNumber() throws Exception {
public void testFailure_keyTagNotNumber() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -265,7 +265,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_algNotNumber() throws Exception {
public void testFailure_algNotNumber() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -281,7 +281,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_digestTypeNotNumber() throws Exception {
public void testFailure_digestTypeNotNumber() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -297,7 +297,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_digestNotHex() throws Exception {
public void testFailure_digestNotHex() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -313,7 +313,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
}
@Test
public void testFailure_digestNotEvenLengthed() throws Exception {
public void testFailure_digestNotEvenLengthed() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,

View file

@ -44,12 +44,12 @@ public class CreateHostCommandTest extends EppToolCommandTestCase<CreateHostComm
}
@Test
public void testFailure_missingHost() throws Exception {
public void testFailure_missingHost() {
assertThrows(ParameterException.class, () -> runCommandForced("--client=NewRegistrar"));
}
@Test
public void testFailure_invalidIpAddress() throws Exception {
public void testFailure_invalidIpAddress() {
createTld("tld");
IllegalArgumentException thrown =
assertThrows(

View file

@ -226,7 +226,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
}
@Test
public void testFailure_missingAssigneeOrFile() throws Exception {
public void testFailure_missingAssigneeOrFile() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommand("--tlds=tld"));
assertThat(thrown)
@ -235,7 +235,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
}
@Test
public void testFailure_bothAssigneeAndFile() throws Exception {
public void testFailure_bothAssigneeAndFile() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -246,7 +246,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
}
@Test
public void testFailure_bothMetadataAndFile() throws Exception {
public void testFailure_bothMetadataAndFile() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -257,7 +257,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
}
@Test
public void testFailure_bothAssigneeAndMetadataColumns() throws Exception {
public void testFailure_bothAssigneeAndMetadataColumns() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -268,7 +268,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
}
@Test
public void testFailure_badTld() throws Exception {
public void testFailure_badTld() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -292,7 +292,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
.contains("Entry for domain.tld does not have a value for key2 (index 2)");
}
private void assertLrpTokens(LrpTokenEntity... expected) throws Exception {
private void assertLrpTokens(LrpTokenEntity... expected) {
// Using ImmutableObject comparison here is tricky because updateTimestamp is not set on the
// expected LrpToken objects and will cause the assert to fail.
Iterable<LrpTokenEntity> actual = ofy().load().type(LrpTokenEntity.class);

View file

@ -50,7 +50,7 @@ public abstract class CreateOrUpdateReservedListCommandTestCase
}
@Test
public void testFailure_fileDoesntExist() throws Exception {
public void testFailure_fileDoesntExist() {
assertThrows(
ParameterException.class,
() ->
@ -59,7 +59,7 @@ public abstract class CreateOrUpdateReservedListCommandTestCase
}
@Test
public void testFailure_fileDoesntParse() throws Exception {
public void testFailure_fileDoesntParse() {
assertThrows(
IllegalArgumentException.class,
() -> runCommandForced("--name=xn--q9jyb4c-blork", "--input=" + invalidReservedTermsPath));

View file

@ -100,7 +100,7 @@ public class CreatePremiumListCommandTest<C extends CreatePremiumListCommand>
}
@Test
public void testRun_noInputFileSpecified_throwsException() throws Exception {
public void testRun_noInputFileSpecified_throwsException() {
ParameterException thrown = assertThrows(ParameterException.class, this::runCommand);
assertThat(thrown).hasMessageThat().contains("The following option is required");
}

View file

@ -440,7 +440,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_billingAccountMap_doesNotContainEntryForTldAllowed() throws Exception {
public void testFailure_billingAccountMap_doesNotContainEntryForTldAllowed() {
createTlds("foo");
IllegalArgumentException thrown =
@ -699,7 +699,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_badPhoneNumber() throws Exception {
public void testFailure_badPhoneNumber() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -722,7 +722,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_badPhoneNumber2() throws Exception {
public void testFailure_badPhoneNumber2() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -789,7 +789,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingRegistrarType() throws Exception {
public void testFailure_missingRegistrarType() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -809,7 +809,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_invalidRegistrarType() throws Exception {
public void testFailure_invalidRegistrarType() {
assertThrows(
ParameterException.class,
() ->
@ -827,7 +827,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_invalidRegistrarState() throws Exception {
public void testFailure_invalidRegistrarState() {
assertThrows(
ParameterException.class,
() ->
@ -848,7 +848,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_allowedTldDoesNotExist() throws Exception {
public void testFailure_allowedTldDoesNotExist() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -869,7 +869,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_invalidIpWhitelistFlag() throws Exception {
public void testFailure_invalidIpWhitelistFlag() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -890,7 +890,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testSuccess_ipWhitelistFlagWithNull() throws Exception {
public void testSuccess_ipWhitelistFlagWithNull() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -911,7 +911,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_invalidCertFileContents() throws Exception {
public void testFailure_invalidCertFileContents() {
assertThrows(
Exception.class,
() ->
@ -932,7 +932,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_invalidFailoverCertFileContents() throws Exception {
public void testFailure_invalidFailoverCertFileContents() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -953,7 +953,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_certHashAndCertFile() throws Exception {
public void testFailure_certHashAndCertFile() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -975,7 +975,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_certHashNotBase64() throws Exception {
public void testFailure_certHashNotBase64() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -998,7 +998,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_certHashNotA256BitValue() throws Exception {
public void testFailure_certHashNotA256BitValue() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1021,7 +1021,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingName() throws Exception {
public void testFailure_missingName() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1042,7 +1042,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingPassword() throws Exception {
public void testFailure_missingPassword() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1063,7 +1063,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_emptyPassword() throws Exception {
public void testFailure_emptyPassword() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1085,7 +1085,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_clientIdTooShort() throws Exception {
public void testFailure_clientIdTooShort() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1105,7 +1105,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_clientIdTooLong() throws Exception {
public void testFailure_clientIdTooLong() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1125,7 +1125,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(
ParameterException.class,
() ->
@ -1145,7 +1145,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingStreetLines() throws Exception {
public void testFailure_missingStreetLines() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1164,7 +1164,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingCity() throws Exception {
public void testFailure_missingCity() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1186,7 +1186,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
@Test
public void testFailure_missingState() throws Exception {
public void testFailure_missingState() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1207,7 +1207,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingZip() throws Exception {
public void testFailure_missingZip() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1228,7 +1228,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingCc() throws Exception {
public void testFailure_missingCc() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1249,7 +1249,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_invalidCc() throws Exception {
public void testFailure_invalidCc() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1271,7 +1271,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_tooManyStreetLines() throws Exception {
public void testFailure_tooManyStreetLines() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1294,7 +1294,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_tooFewStreetLines() throws Exception {
public void testFailure_tooFewStreetLines() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1314,7 +1314,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingIanaIdForRealRegistrar() throws Exception {
public void testFailure_missingIanaIdForRealRegistrar() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1333,7 +1333,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_negativeIanaId() throws Exception {
public void testFailure_negativeIanaId() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1353,7 +1353,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_nonIntegerIanaId() throws Exception {
public void testFailure_nonIntegerIanaId() {
assertThrows(
ParameterException.class,
() ->
@ -1373,7 +1373,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_negativeBillingId() throws Exception {
public void testFailure_negativeBillingId() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1394,7 +1394,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_nonIntegerBillingId() throws Exception {
public void testFailure_nonIntegerBillingId() {
assertThrows(
ParameterException.class,
() ->
@ -1415,7 +1415,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingPhonePasscode() throws Exception {
public void testFailure_missingPhonePasscode() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1434,7 +1434,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_missingIcannReferralEmail() throws Exception {
public void testFailure_missingIcannReferralEmail() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1455,7 +1455,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_passcodeTooShort() throws Exception {
public void testFailure_passcodeTooShort() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1475,7 +1475,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_passcodeTooLong() throws Exception {
public void testFailure_passcodeTooLong() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1495,7 +1495,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_invalidPasscode() throws Exception {
public void testFailure_invalidPasscode() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1515,7 +1515,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_twoClientsSpecified() throws Exception {
public void testFailure_twoClientsSpecified() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -1536,7 +1536,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() ->
@ -1557,7 +1557,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_alreadyExists() throws Exception {
public void testFailure_alreadyExists() {
persistNewRegistrar("existing", "Existing Registrar", Registrar.Type.REAL, 1L);
IllegalStateException thrown =
assertThrows(
@ -1580,7 +1580,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_registrarNameSimilarToExisting() throws Exception {
public void testFailure_registrarNameSimilarToExisting() {
// Note that "tHeRe GiStRaR" normalizes identically to "The Registrar", which is created by
// AppEngineRule.
IllegalArgumentException thrown =
@ -1608,7 +1608,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_clientIdNormalizesToExisting() throws Exception {
public void testFailure_clientIdNormalizesToExisting() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1634,7 +1634,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_clientIdIsInvalidFormat() throws Exception {
public void testFailure_clientIdIsInvalidFormat() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1659,7 +1659,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_phone() throws Exception {
public void testFailure_phone() {
assertThrows(
ParameterException.class,
() ->
@ -1680,7 +1680,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
}
@Test
public void testFailure_fax() throws Exception {
public void testFailure_fax() {
assertThrows(
ParameterException.class,
() ->

View file

@ -55,7 +55,7 @@ public class CreateRegistrarGroupsCommandTest extends
}
@Test
public void test_throwsExceptionForNonExistentRegistrar() throws Exception {
public void test_throwsExceptionForNonExistentRegistrar() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,

View file

@ -35,7 +35,7 @@ public class CreateReservedListCommandTest extends
CreateOrUpdateReservedListCommandTestCase<CreateReservedListCommand> {
@Before
public void initTest() throws Exception {
public void initTest() {
createTlds("xn--q9jyb4c", "soy");
}
@ -87,7 +87,7 @@ public class CreateReservedListCommandTest extends
}
@Test
public void testFailure_reservedListWithThatNameAlreadyExists() throws Exception {
public void testFailure_reservedListWithThatNameAlreadyExists() {
ReservedList rl = persistReservedList("xn--q9jyb4c_foo", "jones,FULLY_BLOCKED");
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(rl).build());
IllegalArgumentException thrown =
@ -173,7 +173,7 @@ public class CreateReservedListCommandTest extends
runNameTestExpectedFailure("soy_$oy", INVALID_FORMAT_ERROR_MESSAGE);
}
private void runNameTestExpectedFailure(String name, String expectedErrorMsg) throws Exception {
private void runNameTestExpectedFailure(String name, String expectedErrorMsg) {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,

View file

@ -77,7 +77,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_multipleArguments() throws Exception {
public void testFailure_multipleArguments() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -88,7 +88,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_multipleDuplicateArguments() throws Exception {
public void testFailure_multipleDuplicateArguments() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -310,7 +310,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_invalidAddGracePeriod() throws Exception {
public void testFailure_invalidAddGracePeriod() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -324,7 +324,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_invalidSunrushAddGracePeriod() throws Exception {
public void testFailure_invalidSunrushAddGracePeriod() {
Exception e =
assertThrows(
IllegalArgumentException.class,
@ -338,7 +338,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_invalidRedemptionGracePeriod() throws Exception {
public void testFailure_invalidRedemptionGracePeriod() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -352,7 +352,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_invalidPendingDeleteLength() throws Exception {
public void testFailure_invalidPendingDeleteLength() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -366,7 +366,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_invalidTldState() throws Exception {
public void testFailure_invalidTldState() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -380,7 +380,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_bothTldStateFlags() throws Exception {
public void testFailure_bothTldStateFlags() {
DateTime now = DateTime.now(UTC);
IllegalArgumentException thrown =
assertThrows(
@ -399,7 +399,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_negativeInitialRenewBillingCost() throws Exception {
public void testFailure_negativeInitialRenewBillingCost() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -413,7 +413,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_invalidEapCurrency() throws Exception {
public void testFailure_invalidEapCurrency() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -429,7 +429,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_noTldName() throws Exception {
public void testFailure_noTldName() {
ParameterException thrown = assertThrows(ParameterException.class, this::runCommandForced);
assertThat(thrown)
.hasMessageThat()
@ -437,7 +437,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_noDnsWriter() throws Exception {
public void testFailure_noDnsWriter() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -446,7 +446,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_alreadyExists() throws Exception {
public void testFailure_alreadyExists() {
createTld("xn--q9jyb4c");
IllegalStateException thrown =
assertThrows(
@ -458,7 +458,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_tldStartsWithDigit() throws Exception {
public void testFailure_tldStartsWithDigit() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -598,7 +598,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_setPremiumListThatDoesntExist() throws Exception {
public void testFailure_setPremiumListThatDoesntExist() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -612,7 +612,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_addLrpPeriod_backwardsInterval() throws Exception {
public void testFailure_addLrpPeriod_backwardsInterval() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -629,7 +629,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_addLrpPeriod_badInterval() throws Exception {
public void testFailure_addLrpPeriod_badInterval() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -643,7 +643,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
@Test
public void testFailure_specifiedDnsWriters_dontExist() throws Exception {
public void testFailure_specifiedDnsWriters_dontExist() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -675,8 +675,7 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
}
private void runFailureReservedListsTest(
String reservedLists, Class<? extends Exception> errorClass, String errorMsg)
throws Exception {
String reservedLists, Class<? extends Exception> errorClass, String errorMsg) {
Exception e =
assertThrows(
errorClass,

View file

@ -21,7 +21,6 @@ import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.common.net.HostAndPort;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -33,7 +32,7 @@ public class DefaultRequestFactoryModuleTest {
private static final Credential FAKE_CREDENTIAL = new Credential(
new Credential.AccessMethod() {
@Override
public void intercept(HttpRequest request, String accessToken) throws IOException {}
public void intercept(HttpRequest request, String accessToken) {}
@Override
public String getAccessTokenFromRequest(HttpRequest request) {
@ -49,7 +48,7 @@ public class DefaultRequestFactoryModuleTest {
}
@Test
public void test_provideHttpRequestFactory_localhost() throws Exception {
public void test_provideHttpRequestFactory_localhost() {
// Make sure that localhost creates a request factory with an initializer.
HttpRequestFactory factory =
module.provideHttpRequestFactory(
@ -61,7 +60,7 @@ public class DefaultRequestFactoryModuleTest {
}
@Test
public void test_provideHttpRequestFactory_remote() throws Exception {
public void test_provideHttpRequestFactory_remote() {
// Make sure that example.com creates a request factory with the UNITTEST client id but no
// initializer.
HttpRequestFactory factory =

View file

@ -111,7 +111,7 @@ public class DeleteCreditCommandTest extends CommandTestCase<DeleteCreditCommand
}
@Test
public void testFailure_nonexistentParentRegistrar() throws Exception {
public void testFailure_nonexistentParentRegistrar() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -120,7 +120,7 @@ public class DeleteCreditCommandTest extends CommandTestCase<DeleteCreditCommand
}
@Test
public void testFailure_nonexistentCreditId() throws Exception {
public void testFailure_nonexistentCreditId() {
long badId = creditAId + creditBId + 1;
NullPointerException thrown =
assertThrows(
@ -130,14 +130,14 @@ public class DeleteCreditCommandTest extends CommandTestCase<DeleteCreditCommand
}
@Test
public void testFailure_noRegistrar() throws Exception {
public void testFailure_noRegistrar() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> runCommandForced("--credit_id=" + creditAId));
assertThat(thrown).hasMessageThat().contains("--registrar");
}
@Test
public void testFailure_noCreditId() throws Exception {
public void testFailure_noCreditId() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> runCommandForced("--registrar=TheRegistrar"));
assertThat(thrown).hasMessageThat().contains("--credit_id");

View file

@ -59,28 +59,28 @@ public class DeleteDomainCommandTest extends EppToolCommandTestCase<DeleteDomain
}
@Test
public void testFailure_noReason() throws Exception {
public void testFailure_noReason() {
assertThrows(
ParameterException.class,
() -> runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--force"));
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(
ParameterException.class,
() -> runCommand("--domain_name=example.tld", "--force", "--reason=Test"));
}
@Test
public void testFailure_missingDomainName() throws Exception {
public void testFailure_missingDomainName() {
assertThrows(
ParameterException.class,
() -> runCommand("--client=NewRegistrar", "--force", "--reason=Test"));
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() ->
@ -93,7 +93,7 @@ public class DeleteDomainCommandTest extends EppToolCommandTestCase<DeleteDomain
}
@Test
public void testFailure_mainParameter() throws Exception {
public void testFailure_mainParameter() {
assertThrows(
ParameterException.class,
() ->

View file

@ -58,28 +58,28 @@ public class DeleteHostCommandTest extends EppToolCommandTestCase<DeleteHostComm
}
@Test
public void testFailure_noReason() throws Exception {
public void testFailure_noReason() {
assertThrows(
ParameterException.class,
() -> runCommand("--client=NewRegistrar", "--host=ns1.example.tld", "--force"));
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(
ParameterException.class,
() -> runCommand("--host=ns1.example.tld", "--force", "--reason=Test"));
}
@Test
public void testFailure_missingHostName() throws Exception {
public void testFailure_missingHostName() {
assertThrows(
ParameterException.class,
() -> runCommand("--client=NewRegistrar", "--force", "--reason=Test"));
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() ->
@ -92,7 +92,7 @@ public class DeleteHostCommandTest extends EppToolCommandTestCase<DeleteHostComm
}
@Test
public void testFailure_mainParameter() throws Exception {
public void testFailure_mainParameter() {
assertThrows(
ParameterException.class,
() ->

View file

@ -47,7 +47,7 @@ public class DeletePremiumListCommandTest extends CommandTestCase<DeletePremiumL
}
@Test
public void testFailure_whenPremiumListDoesNotExist() throws Exception {
public void testFailure_whenPremiumListDoesNotExist() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommandForced("--name=foo"));
assertThat(thrown)
@ -56,7 +56,7 @@ public class DeletePremiumListCommandTest extends CommandTestCase<DeletePremiumL
}
@Test
public void testFailure_whenPremiumListIsInUse() throws Exception {
public void testFailure_whenPremiumListIsInUse() {
PremiumList premiumList = persistPremiumList("xn--q9jyb4c", "blah,USD 100");
createTld("xn--q9jyb4c");
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setPremiumList(premiumList).build());

View file

@ -44,7 +44,7 @@ public class DeleteReservedListCommandTest extends CommandTestCase<DeleteReserve
}
@Test
public void testFailure_whenReservedListDoesNotExist() throws Exception {
public void testFailure_whenReservedListDoesNotExist() {
String expectedError =
"Cannot delete the reserved list doesntExistReservedList because it doesn't exist.";
IllegalArgumentException thrown =
@ -55,7 +55,7 @@ public class DeleteReservedListCommandTest extends CommandTestCase<DeleteReserve
}
@Test
public void testFailure_whenReservedListIsInUse() throws Exception {
public void testFailure_whenReservedListIsInUse() {
createTld("xn--q9jyb4c");
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(reservedList).build());
IllegalArgumentException thrown =

View file

@ -62,24 +62,24 @@ public class DeleteTldCommandTest extends CommandTestCase<DeleteTldCommand> {
}
@Test
public void testFailure_whenTldDoesNotExist() throws Exception {
public void testFailure_whenTldDoesNotExist() {
assertThrows(RegistryNotFoundException.class, () -> runCommandForced("--tld=nonexistenttld"));
}
@Test
public void testFailure_whenTldIsReal() throws Exception {
public void testFailure_whenTldIsReal() {
assertThrows(IllegalStateException.class, () -> runCommandForced("--tld=" + TLD_REAL));
}
@Test
public void testFailure_whenDomainsArePresent() throws Exception {
public void testFailure_whenDomainsArePresent() {
persistDeletedDomain("domain." + TLD_TEST, DateTime.parse("2000-01-01TZ"));
assertThrows(IllegalStateException.class, () -> runCommandForced("--tld=" + TLD_TEST));
}
@Test
public void testFailure_whenRegistrarLinksToTld() throws Exception {
public void testFailure_whenRegistrarLinksToTld() {
allowRegistrarAccess("TheRegistrar", TLD_TEST);
assertThrows(IllegalStateException.class, () -> runCommandForced("--tld=" + TLD_TEST));

View file

@ -39,7 +39,7 @@ public class DomainApplicationInfoCommandTest
}
@Test
public void testFailure_invalidPhase() throws Exception {
public void testFailure_invalidPhase() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -51,21 +51,21 @@ public class DomainApplicationInfoCommandTest
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(
ParameterException.class,
() -> runCommand("--domain_name=example.tld", "--phase=sunrush", "--id=123"));
}
@Test
public void testFailure_missingPhase() throws Exception {
public void testFailure_missingPhase() {
assertThrows(
ParameterException.class,
() -> runCommand("--client=NewRegistrar", "--domain_name=example.tld", "--id=123"));
}
@Test
public void testFailure_missingApplicationId() throws Exception {
public void testFailure_missingApplicationId() {
assertThrows(
ParameterException.class,
() ->
@ -74,7 +74,7 @@ public class DomainApplicationInfoCommandTest
}
@Test
public void testFailure_mainParameter() throws Exception {
public void testFailure_mainParameter() {
assertThrows(
ParameterException.class,
() ->
@ -87,7 +87,7 @@ public class DomainApplicationInfoCommandTest
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() ->

View file

@ -54,7 +54,7 @@ public class EncryptEscrowDepositCommandTest
}
@Before
public void before() throws Exception {
public void before() {
command.encryptor = createEncryptor();
}

View file

@ -32,7 +32,7 @@ public abstract class EppToolCommandTestCase<C extends EppToolCommand> extends C
EppToolVerifier eppVerifier;
@Before
public void init() throws Exception {
public void init() {
// Create two TLDs for commands that allow multiple TLDs at once.
createTlds("tld", "tld2");
eppVerifier = EppToolVerifier.create(command).expectClientId("NewRegistrar");

View file

@ -77,19 +77,19 @@ public class ExecuteEppCommandTest extends EppToolCommandTestCase<ExecuteEppComm
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(ParameterException.class, () -> runCommand("--force", "foo.xml"));
}
@Test
public void testFailure_forceAndDryRunIncompatible() throws Exception {
public void testFailure_forceAndDryRunIncompatible() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--client=NewRegistrar", "--force", "--dry_run", eppFile));
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() -> runCommand("--client=NewRegistrar", "--unrecognized=foo", "--force", "foo.xml"));

View file

@ -33,7 +33,6 @@ import google.registry.testing.FakeClock;
import google.registry.testing.FakeSleeper;
import google.registry.util.Retrier;
import google.registry.util.StringGenerator.Alphabets;
import java.io.IOException;
import java.util.function.Function;
import javax.annotation.Nullable;
import org.joda.time.DateTime;
@ -46,7 +45,7 @@ public class GenerateAllocationTokensCommandTest
extends CommandTestCase<GenerateAllocationTokensCommand> {
@Before
public void init() throws IOException {
public void init() {
command.stringGenerator = new DeterministicStringGenerator(Alphabets.BASE_58);
command.retrier =
new Retrier(new FakeSleeper(new FakeClock(DateTime.parse("2000-01-01TZ"))), 3);
@ -117,13 +116,13 @@ public class GenerateAllocationTokensCommandTest
}
@Test
public void testFailure_mustSpecifyNumberOfTokens() throws Exception {
public void testFailure_mustSpecifyNumberOfTokens() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> runCommand("--prefix", "FEET"));
assertThat(thrown).hasMessageThat().contains("The following option is required: -n, --number");
}
private void assertAllocationTokens(AllocationToken... expectedTokens) throws Exception {
private void assertAllocationTokens(AllocationToken... expectedTokens) {
// Using ImmutableObject comparison here is tricky because the creation/updated timestamps are
// neither easy nor valuable to test here.
ImmutableMap<String, AllocationToken> actualTokens =

View file

@ -320,17 +320,17 @@ public class GenerateAuctionDataCommandTest extends CommandTestCase<GenerateAuct
}
@Test
public void testFailure_missingTldName() throws Exception {
public void testFailure_missingTldName() {
assertThrows(ParameterException.class, this::runCommand);
}
@Test
public void testFailure_tooManyParameters() throws Exception {
public void testFailure_tooManyParameters() {
assertThrows(IllegalArgumentException.class, () -> runCommand("xn--q9jyb4c", "foobar"));
}
@Test
public void testFailure_nonexistentTld() throws Exception {
public void testFailure_nonexistentTld() {
assertThrows(IllegalArgumentException.class, () -> runCommand("foobarbaz"));
}
}

View file

@ -203,12 +203,12 @@ public class GenerateDnsReportCommandTest extends CommandTestCase<GenerateDnsRep
}
@Test
public void testFailure_tldDoesNotExist() throws Exception {
public void testFailure_tldDoesNotExist() {
assertThrows(IllegalArgumentException.class, () -> runCommand("--tld=foobar"));
}
@Test
public void testFailure_missingTldParameter() throws Exception {
public void testFailure_missingTldParameter() {
assertThrows(ParameterException.class, () -> runCommand(""));
}
}

View file

@ -41,7 +41,7 @@ public class GenerateEscrowDepositCommandTest
@Mock ModulesService modulesService;
@Before
public void before() throws Exception {
public void before() {
createTld("tld");
createTld("anothertld");
command = new GenerateEscrowDepositCommand();
@ -52,7 +52,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_missingTld() throws Exception {
public void testCommand_missingTld() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -62,7 +62,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_emptyTld() throws Exception {
public void testCommand_emptyTld() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -77,7 +77,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_invalidTld() throws Exception {
public void testCommand_invalidTld() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -92,7 +92,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_missingWatermark() throws Exception {
public void testCommand_missingWatermark() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -103,7 +103,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_emptyWatermark() throws Exception {
public void testCommand_emptyWatermark() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -112,7 +112,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_missingOutdir() throws Exception {
public void testCommand_missingOutdir() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -123,7 +123,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_emptyOutdir() throws Exception {
public void testCommand_emptyOutdir() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -138,7 +138,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_invalidWatermark() throws Exception {
public void testCommand_invalidWatermark() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -153,7 +153,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_invalidMode() throws Exception {
public void testCommand_invalidMode() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -170,7 +170,7 @@ public class GenerateEscrowDepositCommandTest
}
@Test
public void testCommand_invalidRevision() throws Exception {
public void testCommand_invalidRevision() {
ParameterException thrown =
assertThrows(
ParameterException.class,

View file

@ -87,7 +87,7 @@ public class GetApplicationCommandTest extends CommandTestCase<GetApplicationCom
}
@Test
public void testFailure_noApplicationId() throws Exception {
public void testFailure_noApplicationId() {
assertThrows(ParameterException.class, this::runCommand);
}

View file

@ -61,7 +61,7 @@ public class GetApplicationIdsCommandTest extends CommandTestCase<GetApplication
}
@Test
public void testFailure_tldDoesNotExist() throws Exception {
public void testFailure_tldDoesNotExist() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommand("example.foo"));
assertThat(thrown).hasMessageThat().contains("Domain name is not under a recognized TLD");
@ -76,7 +76,7 @@ public class GetApplicationIdsCommandTest extends CommandTestCase<GetApplication
}
@Test
public void testFailure_noDomainName() throws Exception {
public void testFailure_noDomainName() {
assertThrows(ParameterException.class, this::runCommand);
}

View file

@ -79,7 +79,7 @@ public class GetContactCommandTest extends CommandTestCase<GetContactCommand> {
}
@Test
public void testFailure_noContact() throws Exception {
public void testFailure_noContact() {
assertThrows(ParameterException.class, this::runCommand);
}

View file

@ -95,7 +95,7 @@ public class GetDomainCommandTest extends CommandTestCase<GetDomainCommand> {
}
@Test
public void testFailure_noDomainName() throws Exception {
public void testFailure_noDomainName() {
assertThrows(ParameterException.class, this::runCommand);
}

View file

@ -106,7 +106,7 @@ public class GetHostCommandTest extends CommandTestCase<GetHostCommand> {
}
@Test
public void testFailure_noHostName() throws Exception {
public void testFailure_noHostName() {
assertThrows(ParameterException.class, this::runCommand);
}
}

View file

@ -80,7 +80,7 @@ public class GetLrpTokenCommandTest extends CommandTestCase<GetLrpTokenCommand>
}
@Test
public void testFailure_noArgs() throws Exception {
public void testFailure_noArgs() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, this::runCommand);
assertThat(thrown)

View file

@ -36,19 +36,19 @@ public class GetRegistrarCommandTest extends CommandTestCase<GetRegistrarCommand
}
@Test
public void testFailure_registrarDoesNotExist() throws Exception {
public void testFailure_registrarDoesNotExist() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommand("ClientZ"));
assertThat(thrown).hasMessageThat().contains("Registrar with id ClientZ does not exist");
}
@Test
public void testFailure_noRegistrarName() throws Exception {
public void testFailure_noRegistrarName() {
assertThrows(ParameterException.class, this::runCommand);
}
@Test
public void testFailure_oneRegistrarDoesNotExist() throws Exception {
public void testFailure_oneRegistrarDoesNotExist() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommand("NewRegistrar", "ClientZ"));
assertThat(thrown).hasMessageThat().contains("Registrar with id ClientZ does not exist");

View file

@ -68,7 +68,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
}
@Test
public void testFailure_domain_oneDoesNotExist() throws Exception {
public void testFailure_domain_oneDoesNotExist() {
persistActiveDomain("example.tld");
NullPointerException thrown =
assertThrows(
@ -117,7 +117,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
}
@Test
public void testFailure_contact_oneDoesNotExist() throws Exception {
public void testFailure_contact_oneDoesNotExist() {
persistActiveContact("sh8013");
NullPointerException thrown =
assertThrows(
@ -166,7 +166,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
}
@Test
public void testFailure_host_oneDoesNotExist() throws Exception {
public void testFailure_host_oneDoesNotExist() {
persistActiveHost("ns1.example.tld");
NullPointerException thrown =
assertThrows(
@ -203,7 +203,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
}
@Test
public void testFailure_keyDoesNotExist() throws Exception {
public void testFailure_keyDoesNotExist() {
NullPointerException thrown =
assertThrows(
NullPointerException.class,
@ -214,7 +214,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
}
@Test
public void testFailure_nonsenseKey() throws Exception {
public void testFailure_nonsenseKey() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class, () -> runCommand("agR0ZXN0chULEgpEb21haW5CYXN"));
@ -222,7 +222,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase<GetResourceByKe
}
@Test
public void testFailure_noParameters() throws Exception {
public void testFailure_noParameters() {
assertThrows(ParameterException.class, this::runCommand);
}
}

View file

@ -38,17 +38,17 @@ public class GetTldCommandTest extends CommandTestCase<GetTldCommand> {
@Test
public void testFailure_tldDoesNotExist() throws Exception {
public void testFailure_tldDoesNotExist() {
assertThrows(IllegalArgumentException.class, () -> runCommand("xn--q9jyb4c"));
}
@Test
public void testFailure_noTldName() throws Exception {
public void testFailure_noTldName() {
assertThrows(ParameterException.class, this::runCommand);
}
@Test
public void testFailure_oneTldDoesNotExist() throws Exception {
public void testFailure_oneTldDoesNotExist() {
createTld("xn--q9jyb4c");
assertThrows(IllegalArgumentException.class, () -> runCommand("xn--q9jyb4c", "example"));
}

View file

@ -64,7 +64,7 @@ public class GhostrydeCommandTest extends CommandTestCase<GhostrydeCommand> {
private Keyring keyring;
@Before
public void before() throws Exception {
public void before() {
keyring = new FakeKeyringModule().get();
command.ghostryde = new Ghostryde(1024);
command.rdeStagingDecryptionKey = keyring::getRdeStagingDecryptionKey;

View file

@ -49,7 +49,7 @@ public class ListCursorsCommandTest extends CommandTestCase<ListCursorsCommand>
}
@Test
public void testListCursors_badCursor_throwsIae() throws Exception {
public void testListCursors_badCursor_throwsIae() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> runCommand("--type=love"));
assertThat(thrown).hasMessageThat().contains("Invalid value for --type parameter.");

View file

@ -35,7 +35,7 @@ public class LoadTestCommandTest extends CommandTestCase<LoadTestCommand> {
Connection connection = mock(Connection.class);
@Before
public void setUp() throws Exception {
public void setUp() {
command.setConnection(connection);
createTld("example");
persistNewRegistrar("acme", "ACME", Registrar.Type.REAL, 99L);

View file

@ -77,7 +77,7 @@ public class LockDomainCommandTest extends EppToolCommandTestCase<LockDomainComm
}
@Test
public void testFailure_domainDoesntExist() throws Exception {
public void testFailure_domainDoesntExist() {
IllegalArgumentException e =
assertThrows(
IllegalArgumentException.class,
@ -105,7 +105,7 @@ public class LockDomainCommandTest extends EppToolCommandTestCase<LockDomainComm
}
@Test
public void testFailure_duplicateDomainsAreSpecified() throws Exception {
public void testFailure_duplicateDomainsAreSpecified() {
IllegalArgumentException e =
assertThrows(
IllegalArgumentException.class,

View file

@ -282,7 +282,7 @@ public class MutatingCommandTest {
}
@Test
public void testFailure_nullEntityChange() throws Exception {
public void testFailure_nullEntityChange() {
MutatingCommand command = new MutatingCommand() {
@Override
protected void init() {
@ -293,7 +293,7 @@ public class MutatingCommandTest {
}
@Test
public void testFailure_updateSameEntityTwice() throws Exception {
public void testFailure_updateSameEntityTwice() {
MutatingCommand command =
new MutatingCommand() {
@Override
@ -310,7 +310,7 @@ public class MutatingCommandTest {
}
@Test
public void testFailure_updateDifferentLongId() throws Exception {
public void testFailure_updateDifferentLongId() {
MutatingCommand command = new MutatingCommand() {
@Override
protected void init() {
@ -324,7 +324,7 @@ public class MutatingCommandTest {
}
@Test
public void testFailure_updateDifferentStringId() throws Exception {
public void testFailure_updateDifferentStringId() {
MutatingCommand command =
new MutatingCommand() {
@Override
@ -339,7 +339,7 @@ public class MutatingCommandTest {
}
@Test
public void testFailure_updateDifferentKind() throws Exception {
public void testFailure_updateDifferentKind() {
MutatingCommand command =
new MutatingCommand() {
@Override

View file

@ -183,7 +183,7 @@ public class RegistrarContactCommandTest extends CommandTestCase<RegistrarContac
}
@Test
public void testUpdate_cannotUnsetOnlyWhoisAbuseContact() throws Exception {
public void testUpdate_cannotUnsetOnlyWhoisAbuseContact() {
Registrar registrar = loadRegistrar("NewRegistrar");
persistSimpleResource(
new RegistrarContact.Builder()
@ -322,7 +322,7 @@ public class RegistrarContactCommandTest extends CommandTestCase<RegistrarContac
}
@Test
public void testDelete_failsOnDomainWhoisAbuseContact() throws Exception {
public void testDelete_failsOnDomainWhoisAbuseContact() {
RegistrarContact registrarContact = loadRegistrar("NewRegistrar").getContacts().asList().get(0);
persistSimpleResource(
registrarContact.asBuilder().setVisibleInDomainWhoisAsAbuse(true).build());

View file

@ -26,12 +26,12 @@ import org.junit.runners.JUnit4;
public class RegistryToolEnvironmentTest {
@Test
public void testGet_withoutSetup_throws() throws Exception {
public void testGet_withoutSetup_throws() {
assertThrows(IllegalStateException.class, RegistryToolEnvironment::get);
}
@Test
public void testSetup_changesEnvironmentReturnedByGet() throws Exception {
public void testSetup_changesEnvironmentReturnedByGet() {
RegistryToolEnvironment.UNITTEST.setup();
assertThat(RegistryToolEnvironment.get()).isEqualTo(RegistryToolEnvironment.UNITTEST);
@ -40,25 +40,25 @@ public class RegistryToolEnvironmentTest {
}
@Test
public void testFromArgs_shortNotation_works() throws Exception {
public void testFromArgs_shortNotation_works() {
assertThat(RegistryToolEnvironment.parseFromArgs(new String[] { "-e", "alpha" }))
.isEqualTo(RegistryToolEnvironment.ALPHA);
}
@Test
public void testFromArgs_longNotation_works() throws Exception {
public void testFromArgs_longNotation_works() {
assertThat(RegistryToolEnvironment.parseFromArgs(new String[] { "--environment", "alpha" }))
.isEqualTo(RegistryToolEnvironment.ALPHA);
}
@Test
public void testFromArgs_uppercase_works() throws Exception {
public void testFromArgs_uppercase_works() {
assertThat(RegistryToolEnvironment.parseFromArgs(new String[] { "-e", "QA" }))
.isEqualTo(RegistryToolEnvironment.QA);
}
@Test
public void testFromArgs_equalsNotation_works() throws Exception {
public void testFromArgs_equalsNotation_works() {
assertThat(RegistryToolEnvironment.parseFromArgs(new String[] { "-e=sandbox" }))
.isEqualTo(RegistryToolEnvironment.SANDBOX);
assertThat(RegistryToolEnvironment.parseFromArgs(new String[] { "--environment=sandbox" }))
@ -66,7 +66,7 @@ public class RegistryToolEnvironmentTest {
}
@Test
public void testFromArgs_envFlagAfterCommandName_getsIgnored() throws Exception {
public void testFromArgs_envFlagAfterCommandName_getsIgnored() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -75,14 +75,14 @@ public class RegistryToolEnvironmentTest {
}
@Test
public void testFromArgs_missingEnvironmentFlag_throwsIae() throws Exception {
public void testFromArgs_missingEnvironmentFlag_throwsIae() {
assertThrows(
IllegalArgumentException.class,
() -> RegistryToolEnvironment.parseFromArgs(new String[] {}));
}
@Test
public void testFromArgs_extraEnvFlagAfterCommandName_getsIgnored() throws Exception {
public void testFromArgs_extraEnvFlagAfterCommandName_getsIgnored() {
String[] args = new String[] {
"-e", "alpha",
"registrar_activity_report",
@ -92,7 +92,7 @@ public class RegistryToolEnvironmentTest {
}
@Test
public void testFromArgs_loggingFlagWithUnderscores_isntConsideredCommand() throws Exception {
public void testFromArgs_loggingFlagWithUnderscores_isntConsideredCommand() {
String[] args = new String[] {
"--logging_properties_file", "my_file.properties",
"-e", "alpha",
@ -102,7 +102,7 @@ public class RegistryToolEnvironmentTest {
}
@Test
public void testFromArgs_badName_throwsIae() throws Exception {
public void testFromArgs_badName_throwsIae() {
assertThrows(
IllegalArgumentException.class,
() -> RegistryToolEnvironment.parseFromArgs(new String[] {"-e", "alphaville"}));

View file

@ -47,7 +47,7 @@ public class RegistryToolTest {
}
@Test
public void test_commandMap_namesAreInAlphabeticalOrder() throws Exception {
public void test_commandMap_namesAreInAlphabeticalOrder() {
assertThat(RegistryTool.COMMAND_MAP.keySet()).isStrictlyOrdered();
}
@ -67,7 +67,7 @@ public class RegistryToolTest {
}
@Test
public void test_commandMap_namesAreDerivedFromClassNames() throws Exception {
public void test_commandMap_namesAreDerivedFromClassNames() {
for (Map.Entry<String, ? extends Class<? extends Command>> commandEntry :
RegistryTool.COMMAND_MAP.entrySet()) {
String className = commandEntry.getValue().getSimpleName();
@ -78,7 +78,7 @@ public class RegistryToolTest {
}
@Test
public void test_commandMap_allCommandsHaveDescriptions() throws Exception {
public void test_commandMap_allCommandsHaveDescriptions() {
for (Map.Entry<String, ? extends Class<? extends Command>> commandEntry :
RegistryTool.COMMAND_MAP.entrySet()) {
Parameters parameters = commandEntry.getValue().getAnnotation(Parameters.class);

View file

@ -387,7 +387,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_missingIpWhitelist() throws Exception {
public void testFailure_missingIpWhitelist() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -400,7 +400,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_missingRegistrar() throws Exception {
public void testFailure_missingRegistrar() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -413,7 +413,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_missingCertificateFileAndCertificateHash() throws Exception {
public void testFailure_missingCertificateFileAndCertificateHash() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -427,7 +427,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_suppliedCertificateFileAndCertificateHash() throws Exception {
public void testFailure_suppliedCertificateFileAndCertificateHash() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -445,7 +445,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_missingDnsWriter() throws Exception {
public void testFailure_missingDnsWriter() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -458,7 +458,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_invalidCert() throws Exception {
public void testFailure_invalidCert() {
CertificateParsingException thrown =
assertThrows(
CertificateParsingException.class,
@ -472,7 +472,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_invalidRegistrar() throws Exception {
public void testFailure_invalidRegistrar() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -486,7 +486,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_invalidDnsWriter() throws Exception {
public void testFailure_invalidDnsWriter() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -502,7 +502,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_registrarTooShort() throws Exception {
public void testFailure_registrarTooShort() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -516,7 +516,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_registrarTooLong() throws Exception {
public void testFailure_registrarTooLong() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -530,7 +530,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_registrarInvalidCharacter() throws Exception {
public void testFailure_registrarInvalidCharacter() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -544,7 +544,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_invalidPremiumList() throws Exception {
public void testFailure_invalidPremiumList() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -559,7 +559,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_tldExists() throws Exception {
public void testFailure_tldExists() {
createTld("blobio-sunrise");
IllegalStateException thrown =
assertThrows(
@ -574,7 +574,7 @@ public class SetupOteCommandTest extends CommandTestCase<SetupOteCommand> {
}
@Test
public void testFailure_registrarExists() throws Exception {
public void testFailure_registrarExists() {
Registrar registrar = loadRegistrar("TheRegistrar").asBuilder()
.setClientId("blobio-1")
.setRegistrarName("blobio-1")

View file

@ -143,7 +143,7 @@ public class ShellCommandTest {
public ArrayList<ImmutableList<String>> calls = new ArrayList<>();
@Override
public void run(String[] args) throws Exception {
public void run(String[] args) {
calls.add(ImmutableList.copyOf(args));
}
}
@ -166,7 +166,7 @@ public class ShellCommandTest {
}
@Test
public void testNonExistentCommand() throws Exception {
public void testNonExistentCommand() {
try (RegistryCli cli =
new RegistryCli("unittest", ImmutableMap.of("test_command", TestCommand.class))) {
@ -194,7 +194,7 @@ public class ShellCommandTest {
}
@Test
public void testCompletion_commands() throws Exception {
public void testCompletion_commands() {
performJCommanderCompletorTest("", 0, "testCommand ", "testAnotherCommand ", "help ");
performJCommanderCompletorTest("n", 1);
performJCommanderCompletorTest("test", 4, "testCommand ", "testAnotherCommand ");
@ -204,7 +204,7 @@ public class ShellCommandTest {
}
@Test
public void testCompletion_help() throws Exception {
public void testCompletion_help() {
performJCommanderCompletorTest("h", 1, "help ");
performJCommanderCompletorTest("help ", 0, "testCommand ", "testAnotherCommand ", "help ");
performJCommanderCompletorTest("help testC", 5, "testCommand ");
@ -212,7 +212,7 @@ public class ShellCommandTest {
}
@Test
public void testCompletion_documentation() throws Exception {
public void testCompletion_documentation() {
performJCommanderCompletorTest(
"testCommand ",
0,
@ -232,7 +232,7 @@ public class ShellCommandTest {
}
@Test
public void testCompletion_arguments() throws Exception {
public void testCompletion_arguments() {
performJCommanderCompletorTest("testCommand -", 1, "-x ", "--xparam ", "--xorg ");
performJCommanderCompletorTest("testCommand --wrong", 7);
performJCommanderCompletorTest("testCommand noise --", 2, "--xparam ", "--xorg ");
@ -240,7 +240,7 @@ public class ShellCommandTest {
}
@Test
public void testCompletion_enum() throws Exception {
public void testCompletion_enum() {
performJCommanderCompletorTest("testCommand --xorg P", 1, "PRIVATE ", "PUBLIC ");
performJCommanderCompletorTest("testCommand --xorg PU", 2, "PUBLIC ");
performJCommanderCompletorTest(
@ -248,7 +248,7 @@ public class ShellCommandTest {
}
@Test
public void testEncapsulatedOutputStream_basicFuncionality() throws Exception {
public void testEncapsulatedOutputStream_basicFuncionality() {
ByteArrayOutputStream backing = new ByteArrayOutputStream();
PrintStream out = new PrintStream(new ShellCommand.EncapsulatingOutputStream(backing, "out: "));
out.println("first line");
@ -259,7 +259,7 @@ public class ShellCommandTest {
}
@Test
public void testEncapsulatedOutputStream_emptyStream() throws Exception {
public void testEncapsulatedOutputStream_emptyStream() {
ByteArrayOutputStream backing = new ByteArrayOutputStream();
PrintStream out = new PrintStream(new ShellCommand.EncapsulatingOutputStream(backing, "out: "));
out.flush();

View file

@ -150,7 +150,7 @@ public class UniformRapidSuspensionCommandTest
}
@Test
public void testFailure_locksToPreserveWithoutUndo() throws Exception {
public void testFailure_locksToPreserveWithoutUndo() {
persistActiveDomain("evil.tld");
IllegalArgumentException thrown =
assertThrows(
@ -162,7 +162,7 @@ public class UniformRapidSuspensionCommandTest
}
@Test
public void testFailure_domainNameRequired() throws Exception {
public void testFailure_domainNameRequired() {
persistActiveDomain("evil.tld");
ParameterException thrown =
assertThrows(
@ -172,7 +172,7 @@ public class UniformRapidSuspensionCommandTest
}
@Test
public void testFailure_extraFieldInDsData() throws Exception {
public void testFailure_extraFieldInDsData() {
persistActiveDomain("evil.tld");
IllegalArgumentException thrown =
assertThrows(
@ -185,7 +185,7 @@ public class UniformRapidSuspensionCommandTest
}
@Test
public void testFailure_missingFieldInDsData() throws Exception {
public void testFailure_missingFieldInDsData() {
persistActiveDomain("evil.tld");
IllegalArgumentException thrown =
assertThrows(
@ -198,7 +198,7 @@ public class UniformRapidSuspensionCommandTest
}
@Test
public void testFailure_malformedDsData() throws Exception {
public void testFailure_malformedDsData() {
persistActiveDomain("evil.tld");
IllegalArgumentException thrown =
assertThrows(

View file

@ -89,7 +89,7 @@ public class UnlockDomainCommandTest extends EppToolCommandTestCase<UnlockDomain
}
@Test
public void testFailure_domainDoesntExist() throws Exception {
public void testFailure_domainDoesntExist() {
IllegalArgumentException e =
assertThrows(
IllegalArgumentException.class,
@ -113,7 +113,7 @@ public class UnlockDomainCommandTest extends EppToolCommandTestCase<UnlockDomain
}
@Test
public void testFailure_duplicateDomainsAreSpecified() throws Exception {
public void testFailure_duplicateDomainsAreSpecified() {
IllegalArgumentException e =
assertThrows(
IllegalArgumentException.class,

View file

@ -249,7 +249,7 @@ public class UpdateApplicationStatusCommandTest
}
@Test
public void testFailure_applicationAlreadyAllocated() throws Exception {
public void testFailure_applicationAlreadyAllocated() {
persistResource(reloadResource(domainApplication).asBuilder()
.setApplicationStatus(ALLOCATED)
.build());
@ -269,7 +269,7 @@ public class UpdateApplicationStatusCommandTest
}
@Test
public void testFailure_applicationDoesNotExist() throws Exception {
public void testFailure_applicationDoesNotExist() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -278,7 +278,7 @@ public class UpdateApplicationStatusCommandTest
}
@Test
public void testFailure_historyClientIdDoesNotExist() throws Exception {
public void testFailure_historyClientIdDoesNotExist() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,

View file

@ -130,7 +130,7 @@ public class UpdateClaimsNoticeCommandTest extends CommandTestCase<UpdateClaimsN
}
@Test
public void testFailure_badClaimsNotice() throws Exception {
public void testFailure_badClaimsNotice() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -142,7 +142,7 @@ public class UpdateClaimsNoticeCommandTest extends CommandTestCase<UpdateClaimsN
}
@Test
public void testFailure_claimsNoticeForWrongLabel() throws Exception {
public void testFailure_claimsNoticeForWrongLabel() {
persistResource(newDomainApplication("bad-label.xn--q9jyb4c"));
Exception e =
assertThrows(
@ -157,7 +157,7 @@ public class UpdateClaimsNoticeCommandTest extends CommandTestCase<UpdateClaimsN
}
@Test
public void testFailure_sunriseApplication() throws Exception {
public void testFailure_sunriseApplication() {
// Add an encoded signed mark to the application to make it a sunrise application.
domainApplication = persistResource(domainApplication.asBuilder()
.setEncodedSignedMarks(ImmutableList.of(EncodedSignedMark.create("base64", "AAAAA")))

View file

@ -110,14 +110,14 @@ public class UpdateCursorsCommandTest extends CommandTestCase<UpdateCursorsComma
}
@Test
public void testFailure_badTld() throws Exception {
public void testFailure_badTld() {
assertThrows(
RegistryNotFoundException.class,
() -> runCommandForced("--type=brda", "--timestamp=1984-12-18T00:00:00Z", "bar"));
}
@Test
public void testFailure_badCursorType() throws Exception {
public void testFailure_badCursorType() {
ParameterException thrown =
assertThrows(
ParameterException.class,

View file

@ -198,7 +198,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_cantUpdateRegistryLockedDomainEvenAsSuperuser() throws Exception {
public void testFailure_cantUpdateRegistryLockedDomainEvenAsSuperuser() {
HostResource host = persistActiveHost("ns1.zdns.google");
ImmutableSet<Key<HostResource>> nameservers = ImmutableSet.of(Key.create(host));
persistResource(
@ -223,7 +223,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_duplicateDomains() throws Exception {
public void testFailure_duplicateDomains() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -238,7 +238,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_missingDomain() throws Exception {
public void testFailure_missingDomain() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -249,7 +249,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -258,7 +258,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_addTooManyNameServers() throws Exception {
public void testFailure_addTooManyNameServers() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -277,7 +277,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_providedNameserversAndAddNameservers() throws Exception {
public void testFailure_providedNameserversAndAddNameservers() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -295,7 +295,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_providedNameserversAndRemoveNameservers() throws Exception {
public void testFailure_providedNameserversAndRemoveNameservers() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -313,7 +313,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_providedAdminsAndAddAdmins() throws Exception {
public void testFailure_providedAdminsAndAddAdmins() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -331,7 +331,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_providedAdminsAndRemoveAdmins() throws Exception {
public void testFailure_providedAdminsAndRemoveAdmins() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -349,7 +349,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_providedTechsAndAddTechs() throws Exception {
public void testFailure_providedTechsAndAddTechs() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -366,7 +366,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_providedTechsAndRemoveTechs() throws Exception {
public void testFailure_providedTechsAndRemoveTechs() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -383,7 +383,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_providedStatusesAndAddStatuses() throws Exception {
public void testFailure_providedStatusesAndAddStatuses() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -401,7 +401,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_providedStatusesAndRemoveStatuses() throws Exception {
public void testFailure_providedStatusesAndRemoveStatuses() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -419,7 +419,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_provideDsRecordsAndAddDsRecords() throws Exception {
public void testFailure_provideDsRecordsAndAddDsRecords() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -437,7 +437,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_provideDsRecordsAndRemoveDsRecords() throws Exception {
public void testFailure_provideDsRecordsAndRemoveDsRecords() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -455,7 +455,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_clearDsRecordsAndAddDsRecords() throws Exception {
public void testFailure_clearDsRecordsAndAddDsRecords() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -473,7 +473,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase<UpdateDomain
}
@Test
public void testFailure_clearDsRecordsAndRemoveDsRecords() throws Exception {
public void testFailure_clearDsRecordsAndRemoveDsRecords() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,

View file

@ -63,7 +63,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_noPasscodeOnChangeToReal() throws Exception {
public void testFailure_noPasscodeOnChangeToReal() {
persistResource(
loadRegistrar("NewRegistrar")
.asBuilder()
@ -217,7 +217,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_billingAccountMap_doesNotContainEntryForTldAllowed() throws Exception {
public void testFailure_billingAccountMap_doesNotContainEntryForTldAllowed() {
createTlds("foo");
assertThat(loadRegistrar("NewRegistrar").getBillingAccountMap()).isEmpty();
IllegalArgumentException thrown =
@ -270,7 +270,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_changeBillingMethodWhenBalanceIsNonZero() throws Exception {
public void testFailure_changeBillingMethodWhenBalanceIsNonZero() {
createTlds("xn--q9jyb4c");
Registrar registrar = loadRegistrar("NewRegistrar");
persistResource(
@ -470,83 +470,83 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_invalidRegistrarType() throws Exception {
public void testFailure_invalidRegistrarType() {
assertThrows(
ParameterException.class,
() -> runCommand("--registrar_type=INVALID_TYPE", "--force", "NewRegistrar"));
}
@Test
public void testFailure_invalidRegistrarState() throws Exception {
public void testFailure_invalidRegistrarState() {
assertThrows(
ParameterException.class,
() -> runCommand("--registrar_state=INVALID_STATE", "--force", "NewRegistrar"));
}
@Test
public void testFailure_negativeIanaId() throws Exception {
public void testFailure_negativeIanaId() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--iana_id=-1", "--force", "NewRegistrar"));
}
@Test
public void testFailure_nonIntegerIanaId() throws Exception {
public void testFailure_nonIntegerIanaId() {
assertThrows(
ParameterException.class, () -> runCommand("--iana_id=ABC123", "--force", "NewRegistrar"));
}
@Test
public void testFailure_negativeBillingId() throws Exception {
public void testFailure_negativeBillingId() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--billing_id=-1", "--force", "NewRegistrar"));
}
@Test
public void testFailure_nonIntegerBillingId() throws Exception {
public void testFailure_nonIntegerBillingId() {
assertThrows(
ParameterException.class,
() -> runCommand("--billing_id=ABC123", "--force", "NewRegistrar"));
}
@Test
public void testFailure_passcodeTooShort() throws Exception {
public void testFailure_passcodeTooShort() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--passcode=0123", "--force", "NewRegistrar"));
}
@Test
public void testFailure_passcodeTooLong() throws Exception {
public void testFailure_passcodeTooLong() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--passcode=012345", "--force", "NewRegistrar"));
}
@Test
public void testFailure_invalidPasscode() throws Exception {
public void testFailure_invalidPasscode() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--passcode=code1", "--force", "NewRegistrar"));
}
@Test
public void testFailure_allowedTldDoesNotExist() throws Exception {
public void testFailure_allowedTldDoesNotExist() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--allowed_tlds=foobar", "--force", "NewRegistrar"));
}
@Test
public void testFailure_addAllowedTldDoesNotExist() throws Exception {
public void testFailure_addAllowedTldDoesNotExist() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--add_allowed_tlds=foobar", "--force", "NewRegistrar"));
}
@Test
public void testFailure_allowedTldsAndAddAllowedTlds() throws Exception {
public void testFailure_allowedTldsAndAddAllowedTlds() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -554,21 +554,21 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_invalidIpWhitelist() throws Exception {
public void testFailure_invalidIpWhitelist() {
assertThrows(
IllegalArgumentException.class,
() -> runCommand("--ip_whitelist=foobarbaz", "--force", "NewRegistrar"));
}
@Test
public void testFailure_invalidCertFileContents() throws Exception {
public void testFailure_invalidCertFileContents() {
assertThrows(
Exception.class,
() -> runCommand("--cert_file=" + writeToTmpFile("ABCDEF"), "--force", "NewRegistrar"));
}
@Test
public void testFailure_certHashAndCertFile() throws Exception {
public void testFailure_certHashAndCertFile() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -580,12 +580,12 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(ParameterException.class, () -> runCommand("--force"));
}
@Test
public void testFailure_missingStreetLines() throws Exception {
public void testFailure_missingStreetLines() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -599,7 +599,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_missingCity() throws Exception {
public void testFailure_missingCity() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -615,7 +615,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_missingState() throws Exception {
public void testFailure_missingState() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -631,7 +631,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_missingZip() throws Exception {
public void testFailure_missingZip() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -647,7 +647,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_missingCc() throws Exception {
public void testFailure_missingCc() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -663,7 +663,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_missingInvalidCc() throws Exception {
public void testFailure_missingInvalidCc() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -680,7 +680,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_tooManyStreetLines() throws Exception {
public void testFailure_tooManyStreetLines() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -698,7 +698,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_tooFewStreetLines() throws Exception {
public void testFailure_tooFewStreetLines() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -713,21 +713,21 @@ public class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarC
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() -> runCommand("--force", "--unrecognized_flag=foo", "NewRegistrar"));
}
@Test
public void testFailure_doesNotExist() throws Exception {
public void testFailure_doesNotExist() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommand("--force", "ClientZ"));
assertThat(thrown).hasMessageThat().contains("Registrar ClientZ not found");
}
@Test
public void testFailure_registrarNameSimilarToExisting() throws Exception {
public void testFailure_registrarNameSimilarToExisting() {
// Note that "tHeRe GiStRaR" normalizes identically to "The Registrar", which is created by
// AppEngineRule.
assertThrows(

View file

@ -90,7 +90,7 @@ public class UpdateReservedListCommandTest extends
}
@Test
public void testFailure_reservedListDoesntExist() throws Exception {
public void testFailure_reservedListDoesntExist() {
String errorMessage =
"Could not update reserved list xn--q9jyb4c_poobah because it doesn't exist.";
IllegalArgumentException thrown =

View file

@ -58,7 +58,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_applyAllRemoveOne_failsDueToOverlap() throws Exception {
public void testFailure_applyAllRemoveOne_failsDueToOverlap() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -72,7 +72,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_illegalStatus() throws Exception {
public void testFailure_illegalStatus() {
// The EPP status is a valid one by RFC, but invalid for this command.
assertThrows(
IllegalArgumentException.class,
@ -86,7 +86,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_unrecognizedStatus() throws Exception {
public void testFailure_unrecognizedStatus() {
// Handles a status passed to the command that doesn't correspond to any
// EPP-valid status.
assertThrows(
@ -101,7 +101,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_mainParameter() throws Exception {
public void testFailure_mainParameter() {
assertThrows(
ParameterException.class,
() ->
@ -115,7 +115,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_noOp() throws Exception {
public void testFailure_noOp() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -130,7 +130,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(
ParameterException.class,
() ->
@ -142,7 +142,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() ->
@ -156,7 +156,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_noReasonWhenNotRegistrarRequested() throws Exception {
public void testFailure_noReasonWhenNotRegistrarRequested() {
assertThrows(
IllegalArgumentException.class,
() ->
@ -168,7 +168,7 @@ public class UpdateServerLocksCommandTest extends EppToolCommandTestCase<UpdateS
}
@Test
public void testFailure_missingRegistrarRequest() throws Exception {
public void testFailure_missingRegistrarRequest() {
assertThrows(
ParameterException.class,
() ->

View file

@ -463,7 +463,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_invalidAddGracePeriod() throws Exception {
public void testFailure_invalidAddGracePeriod() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -472,7 +472,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_invalidRedemptionGracePeriod() throws Exception {
public void testFailure_invalidRedemptionGracePeriod() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -481,7 +481,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_invalidPendingDeleteLength() throws Exception {
public void testFailure_invalidPendingDeleteLength() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -490,7 +490,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_invalidTldState() throws Exception {
public void testFailure_invalidTldState() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -503,7 +503,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_invalidTldStateTransitionTime() throws Exception {
public void testFailure_invalidTldStateTransitionTime() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -515,7 +515,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_tldStatesOutOfOrder() throws Exception {
public void testFailure_tldStatesOutOfOrder() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -529,7 +529,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_duplicateTldStateTransitions() throws Exception {
public void testFailure_duplicateTldStateTransitions() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -542,7 +542,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_duplicateTldStateTransitionTimes() throws Exception {
public void testFailure_duplicateTldStateTransitionTimes() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -556,7 +556,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_outOfOrderTldStateTransitionTimes() throws Exception {
public void testFailure_outOfOrderTldStateTransitionTimes() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -572,7 +572,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_bothTldStateFlags() throws Exception {
public void testFailure_bothTldStateFlags() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -589,7 +589,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_setCurrentTldState_outOfOrder() throws Exception {
public void testFailure_setCurrentTldState_outOfOrder() {
persistResource(
Registry.get("xn--q9jyb4c").asBuilder()
.setTldStateTransitions(
@ -605,7 +605,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_setCurrentTldState_laterTransitionScheduled() throws Exception {
public void testFailure_setCurrentTldState_laterTransitionScheduled() {
persistResource(
Registry.get("xn--q9jyb4c").asBuilder()
.setTldStateTransitions(
@ -623,7 +623,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_setCurrentTldState_inProduction() throws Exception {
public void testFailure_setCurrentTldState_inProduction() {
persistResource(
Registry.get("xn--q9jyb4c").asBuilder()
.setTldStateTransitions(
@ -646,7 +646,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_invalidRenewBillingCost() throws Exception {
public void testFailure_invalidRenewBillingCost() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -660,7 +660,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_negativeRenewBillingCost() throws Exception {
public void testFailure_negativeRenewBillingCost() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -672,7 +672,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_invalidRenewCostTransitionTime() throws Exception {
public void testFailure_invalidRenewCostTransitionTime() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -684,7 +684,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_duplicateRenewCostTransitionTimes() throws Exception {
public void testFailure_duplicateRenewCostTransitionTimes() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -699,7 +699,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_outOfOrderRenewCostTransitionTimes() throws Exception {
public void testFailure_outOfOrderRenewCostTransitionTimes() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -715,7 +715,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_noTldName() throws Exception {
public void testFailure_noTldName() {
ParameterException thrown = assertThrows(ParameterException.class, this::runCommandForced);
assertThat(thrown)
.hasMessageThat()
@ -723,14 +723,14 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_oneTldDoesNotExist() throws Exception {
public void testFailure_oneTldDoesNotExist() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommandForced("foo", "xn--q9jyb4c"));
assertThat(thrown).hasMessageThat().contains("TLD foo does not exist");
}
@Test
public void testFailure_duplicateArguments() throws Exception {
public void testFailure_duplicateArguments() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class, () -> runCommandForced("xn--q9jyb4c", "xn--q9jyb4c"));
@ -738,14 +738,14 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_tldDoesNotExist() throws Exception {
public void testFailure_tldDoesNotExist() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommandForced("foobarbaz"));
assertThat(thrown).hasMessageThat().contains("TLD foobarbaz does not exist");
}
@Test
public void testFailure_specifiedDnsWriter_doesntExist() throws Exception {
public void testFailure_specifiedDnsWriter_doesntExist() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -756,7 +756,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_setNonExistentReservedLists() throws Exception {
public void testFailure_setNonExistentReservedLists() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -767,7 +767,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantAddDuplicateReservedList() throws Exception {
public void testFailure_cantAddDuplicateReservedList() {
persistResource(Registry.get("xn--q9jyb4c").asBuilder()
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
.build());
@ -779,7 +779,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantRemoveReservedListThatIsntPresent() throws Exception {
public void testFailure_cantRemoveReservedListThatIsntPresent() {
persistResource(Registry.get("xn--q9jyb4c").asBuilder()
.setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2"))
.build());
@ -791,7 +791,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantAddAndRemoveSameReservedListSimultaneously() throws Exception {
public void testFailure_cantAddAndRemoveSameReservedListSimultaneously() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -804,7 +804,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantAddDuplicateAllowedRegistrants() throws Exception {
public void testFailure_cantAddDuplicateAllowedRegistrants() {
persistResource(
Registry.get("xn--q9jyb4c").asBuilder()
.setAllowedRegistrantContactIds(ImmutableSet.of("alice", "bob"))
@ -817,7 +817,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantRemoveAllowedRegistrantThatIsntPresent() throws Exception {
public void testFailure_cantRemoveAllowedRegistrantThatIsntPresent() {
persistResource(
Registry.get("xn--q9jyb4c").asBuilder()
.setAllowedRegistrantContactIds(ImmutableSet.of("alice"))
@ -830,7 +830,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantAddAndRemoveSameAllowedRegistrantsSimultaneously() throws Exception {
public void testFailure_cantAddAndRemoveSameAllowedRegistrantsSimultaneously() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -843,7 +843,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantAddDuplicateAllowedNameservers() throws Exception {
public void testFailure_cantAddDuplicateAllowedNameservers() {
persistResource(
Registry.get("xn--q9jyb4c").asBuilder()
.setAllowedFullyQualifiedHostNames(
@ -857,7 +857,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantRemoveAllowedNameserverThatIsntPresent() throws Exception {
public void testFailure_cantRemoveAllowedNameserverThatIsntPresent() {
persistResource(
Registry.get("xn--q9jyb4c").asBuilder()
.setAllowedFullyQualifiedHostNames(
@ -871,7 +871,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_cantAddAndRemoveSameAllowedNameserversSimultaneously() throws Exception {
public void testFailure_cantAddAndRemoveSameAllowedNameserversSimultaneously() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1001,7 +1001,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_setPremiumListThatDoesntExist() throws Exception {
public void testFailure_setPremiumListThatDoesntExist() {
IllegalArgumentException thrown =
assertThrows(
IllegalArgumentException.class,
@ -1018,7 +1018,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_updateLrpPeriod_backwardsInterval() throws Exception {
public void testFailure_updateLrpPeriod_backwardsInterval() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -1032,7 +1032,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
@Test
public void testFailure_updateLrpPeriod_badInterval() throws Exception {
public void testFailure_updateLrpPeriod_badInterval() {
ParameterException thrown =
assertThrows(
ParameterException.class, () -> runCommandForced("--lrp_period=foobar", "xn--q9jyb4c"));
@ -1051,8 +1051,7 @@ public class UpdateTldCommandTest extends CommandTestCase<UpdateTldCommand> {
}
private void runFailureReservedListsTest(
String reservedLists, Class<? extends Exception> errorClass, String errorMsg)
throws Exception {
String reservedLists, Class<? extends Exception> errorClass, String errorMsg) {
Exception e =
assertThrows(
errorClass, () -> runCommandForced("--reserved_lists", reservedLists, "xn--q9jyb4c"));

View file

@ -146,17 +146,17 @@ public class UploadClaimsListCommandTest extends CommandTestCase<UploadClaimsLis
}
@Test
public void testFailure_fileDoesNotExist() throws Exception {
public void testFailure_fileDoesNotExist() {
assertThrows(FileNotFoundException.class, () -> runCommand("--force", "nonexistent_file.csv"));
}
@Test
public void testFailure_noFileNamePassed() throws Exception {
public void testFailure_noFileNamePassed() {
assertThrows(IllegalArgumentException.class, () -> runCommand("--force"));
}
@Test
public void testFailure_tooManyArguments() throws Exception {
public void testFailure_tooManyArguments() {
assertThrows(IllegalArgumentException.class, () -> runCommand("--force", "foo", "bar"));
}
}

View file

@ -63,7 +63,7 @@ public class ValidateLoginCredentialsCommandTest
}
@Test
public void testFailure_loginWithBadPassword() throws Exception {
public void testFailure_loginWithBadPassword() {
EppException thrown =
assertThrows(
BadRegistrarPasswordException.class,
@ -77,7 +77,7 @@ public class ValidateLoginCredentialsCommandTest
}
@Test
public void testFailure_loginWithBadCertificateHash() throws Exception {
public void testFailure_loginWithBadCertificateHash() {
EppException thrown =
assertThrows(
EppException.class,
@ -91,7 +91,7 @@ public class ValidateLoginCredentialsCommandTest
}
@Test
public void testFailure_loginWithBadIp() throws Exception {
public void testFailure_loginWithBadIp() {
EppException thrown =
assertThrows(
EppException.class,
@ -105,7 +105,7 @@ public class ValidateLoginCredentialsCommandTest
}
@Test
public void testFailure_missingClientId() throws Exception {
public void testFailure_missingClientId() {
assertThrows(
ParameterException.class,
() ->
@ -114,7 +114,7 @@ public class ValidateLoginCredentialsCommandTest
}
@Test
public void testFailure_missingPassword() throws Exception {
public void testFailure_missingPassword() {
assertThrows(
ParameterException.class,
() ->
@ -123,7 +123,7 @@ public class ValidateLoginCredentialsCommandTest
}
@Test
public void testFailure_unknownFlag() throws Exception {
public void testFailure_unknownFlag() {
assertThrows(
ParameterException.class,
() ->
@ -136,7 +136,7 @@ public class ValidateLoginCredentialsCommandTest
}
@Test
public void testFailure_certHashAndCertFile() throws Exception {
public void testFailure_certHashAndCertFile() {
assertThrows(
IllegalArgumentException.class,
() ->

View file

@ -66,14 +66,14 @@ public class VerifyOteCommandTest extends CommandTestCase<VerifyOteCommand> {
}
@Test
public void testFailure_registrarDoesntExist() throws Exception {
public void testFailure_registrarDoesntExist() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommand("blobio"));
assertThat(thrown).hasMessageThat().contains("Registrar blobio does not exist.");
}
@Test
public void testFailure_noRegistrarsNoCheckAll() throws Exception {
public void testFailure_noRegistrarsNoCheckAll() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> runCommand(""));
assertThat(thrown)

View file

@ -29,59 +29,59 @@ public class DateParameterTest {
private final DateParameter instance = new DateParameter();
@Test
public void testConvert_onlyDate() throws Exception {
public void testConvert_onlyDate() {
String exampleDate = "2014-01-01";
assertThat(instance.convert(exampleDate)).isEqualTo(DateTime.parse("2014-01-01T00:00:00Z"));
}
@Test
public void testConvert_numeric_throwsException() throws Exception {
public void testConvert_numeric_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("1234"));
}
@Test
public void testConvert_validDateAndTime_throwsException() throws Exception {
public void testConvert_validDateAndTime_throwsException() {
assertThrows(
IllegalArgumentException.class, () -> instance.convert("2014-01-01T01:02:03.004Z"));
}
@Test
public void testConvert_invalidDate_throwsException() throws Exception {
public void testConvert_invalidDate_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("2014-13-33"));
}
@Test
public void testConvert_null_throwsException() throws Exception {
public void testConvert_null_throwsException() {
assertThrows(NullPointerException.class, () -> instance.convert(null));
}
@Test
public void testConvert_empty_throwsException() throws Exception {
public void testConvert_empty_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert(""));
}
@Test
public void testConvert_sillyString_throwsException() throws Exception {
public void testConvert_sillyString_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("foo"));
}
@Test
public void testConvert_partialDate_throwsException() throws Exception {
public void testConvert_partialDate_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("2014-01"));
}
@Test
public void testConvert_onlyTime_throwsException() throws Exception {
public void testConvert_onlyTime_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("T01:02:03"));
}
@Test
public void testConvert_partialDateAndPartialTime_throwsException() throws Exception {
public void testConvert_partialDateAndPartialTime_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("9T9"));
}
@Test
public void testConvert_dateAndPartialTime_throwsException() throws Exception {
public void testConvert_dateAndPartialTime_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("2014-01-01T01:02"));
}
}

View file

@ -30,88 +30,88 @@ public class DateTimeParameterTest {
private final DateTimeParameter instance = new DateTimeParameter();
@Test
public void testConvert_numeric_returnsMillisFromEpochUtc() throws Exception {
public void testConvert_numeric_returnsMillisFromEpochUtc() {
assertThat(instance.convert("1234")).isEqualTo(new DateTime(1234L, UTC));
}
@Test
public void testConvert_iso8601_returnsSameAsDateTimeParse() throws Exception {
public void testConvert_iso8601_returnsSameAsDateTimeParse() {
String exampleDate = "2014-01-01T01:02:03.004Z";
assertThat(instance.convert(exampleDate))
.isEqualTo(DateTime.parse(exampleDate));
}
@Test
public void testConvert_isoDateTimeWithMillis_returnsSameAsDateTimeParse() throws Exception {
public void testConvert_isoDateTimeWithMillis_returnsSameAsDateTimeParse() {
String exampleDate = "2014-01-01T01:02:03.004Z";
assertThat(instance.convert(exampleDate)).isEqualTo(DateTime.parse(exampleDate));
}
@Test
public void testConvert_weirdTimezone_convertsToUtc() throws Exception {
public void testConvert_weirdTimezone_convertsToUtc() {
assertThat(instance.convert("1984-12-18T00:00:00-0520"))
.isEqualTo(DateTime.parse("1984-12-18T05:20:00Z"));
}
@Test
public void testConvert_null_throwsException() throws Exception {
public void testConvert_null_throwsException() {
assertThrows(NullPointerException.class, () -> instance.convert(null));
}
@Test
public void testConvert_empty_throwsException() throws Exception {
public void testConvert_empty_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert(""));
}
@Test
public void testConvert_sillyString_throwsException() throws Exception {
public void testConvert_sillyString_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("foo"));
}
@Test
public void testConvert_partialDate_throwsException() throws Exception {
public void testConvert_partialDate_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("2014-01"));
}
@Test
public void testConvert_onlyDate_throwsException() throws Exception {
public void testConvert_onlyDate_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("2014-01-01"));
}
@Test
public void testConvert_partialTime_throwsException() throws Exception {
public void testConvert_partialTime_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("T01:02"));
}
@Test
public void testConvert_onlyTime_throwsException() throws Exception {
public void testConvert_onlyTime_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("T01:02:03"));
}
@Test
public void testConvert_partialDateAndPartialTime_throwsException() throws Exception {
public void testConvert_partialDateAndPartialTime_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("9T9"));
}
@Test
public void testConvert_dateAndPartialTime_throwsException() throws Exception {
public void testConvert_dateAndPartialTime_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("2014-01-01T01:02"));
}
@Test
public void testConvert_noTimeZone_throwsException() throws Exception {
public void testConvert_noTimeZone_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("2014-01-01T01:02:03"));
}
@Test
public void testValidate_sillyString_throwsParameterException() throws Exception {
public void testValidate_sillyString_throwsParameterException() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
assertThat(thrown).hasMessageThat().contains("--time=foo not an ISO");
}
@Test
public void testValidate_correctInput_doesntThrow() throws Exception {
public void testValidate_correctInput_doesntThrow() {
instance.validate("--time", "123");
}
}

View file

@ -30,57 +30,57 @@ public class DurationParameterTest {
private final DurationParameter instance = new DurationParameter();
@Test
public void testConvert_isoHours() throws Exception {
public void testConvert_isoHours() {
assertThat(instance.convert("PT36H")).isEqualTo(Duration.standardHours(36));
}
@Test
public void testConvert_isoDaysAndHours() throws Exception {
public void testConvert_isoDaysAndHours() {
assertThat(instance.convert("P1DT12H")).isEqualTo(Duration.standardHours(36));
}
@Test
public void testConvert_isoLowercase_isAllowed() throws Exception {
public void testConvert_isoLowercase_isAllowed() {
assertThat(instance.convert("pt36h")).isEqualTo(Duration.standardHours(36));
}
@Test
public void testIsoMissingP_notAllowed() throws Exception {
public void testIsoMissingP_notAllowed() {
assertThrows(IllegalArgumentException.class, () -> Period.parse("T36H"));
}
@Test
public void testIsoMissingPT_notAllowed() throws Exception {
public void testIsoMissingPT_notAllowed() {
assertThrows(IllegalArgumentException.class, () -> Period.parse("36H"));
}
@Test
public void testConvert_isoMissingP_notAllowed() throws Exception {
public void testConvert_isoMissingP_notAllowed() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("T36H"));
}
@Test
public void testConvert_null_throws() throws Exception {
public void testConvert_null_throws() {
assertThrows(NullPointerException.class, () -> instance.convert(null));
}
@Test
public void testConvert_empty_throws() throws Exception {
public void testConvert_empty_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert(""));
}
@Test
public void testConvert_numeric_throws() throws Exception {
public void testConvert_numeric_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("1234"));
}
@Test
public void testConvert_sillyString_throws() throws Exception {
public void testConvert_sillyString_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("foo"));
}
@Test
public void testValidate_sillyString_throws() throws Exception {
public void testValidate_sillyString_throws() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
assertThat(thrown).hasMessageThat().contains("--time=foo not an");

View file

@ -31,12 +31,12 @@ public class EnumParameterTest {
private final TldStateParameter instance = new TldStateParameter();
@Test
public void testSuccess_convertEnum() throws Exception {
public void testSuccess_convertEnum() {
assertThat(instance.convert("PREDELEGATION")).isEqualTo(TldState.PREDELEGATION);
}
@Test
public void testFailure_badValue() throws Exception {
public void testFailure_badValue() {
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, () -> instance.convert("GENERAL_SUNRUSH"));
assertThat(thrown)

View file

@ -27,25 +27,25 @@ public class HostAndPortParameterTest {
private final HostAndPortParameter instance = new HostAndPortParameter();
@Test
public void testConvert_hostOnly() throws Exception {
public void testConvert_hostOnly() {
assertThat(instance.convert("foo.bar").getHost()).isEqualTo("foo.bar");
assertThat(instance.convert("foo.bar").getPortOrDefault(31337)).isEqualTo(31337);
}
@Test
public void testConvert_hostAndPort() throws Exception {
public void testConvert_hostAndPort() {
assertThat(instance.convert("foo.bar:1234").getHost()).isEqualTo("foo.bar");
assertThat(instance.convert("foo.bar:1234").getPortOrDefault(31337)).isEqualTo(1234);
}
@Test
public void testConvert_ipv6_hostOnly() throws Exception {
public void testConvert_ipv6_hostOnly() {
assertThat(instance.convert("[feed:a:bee]").getHost()).isEqualTo("feed:a:bee");
assertThat(instance.convert("[feed:a:bee]").getPortOrDefault(31337)).isEqualTo(31337);
}
@Test
public void testConvert_ipv6_hostAndPort() throws Exception {
public void testConvert_ipv6_hostAndPort() {
assertThat(instance.convert("[feed:a:bee]:1234").getHost()).isEqualTo("feed:a:bee");
assertThat(instance.convert("[feed:a:bee]:1234").getPortOrDefault(31337)).isEqualTo(1234);
}

View file

@ -30,7 +30,7 @@ public class IntervalParameterTest {
private final IntervalParameter instance = new IntervalParameter();
@Test
public void testConvert() throws Exception {
public void testConvert() {
assertThat(instance.convert("2004-06-09T12:30:00Z/2004-07-10T13:30:00Z"))
.isEqualTo(new Interval(
DateTime.parse("2004-06-09T12:30:00Z"),
@ -38,34 +38,34 @@ public class IntervalParameterTest {
}
@Test
public void testConvert_singleDate() throws Exception {
public void testConvert_singleDate() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("2004-06-09T12:30:00Z"));
}
@Test
public void testConvert_backwardsInterval() throws Exception {
public void testConvert_backwardsInterval() {
assertThrows(
IllegalArgumentException.class,
() -> instance.convert("2004-07-10T13:30:00Z/2004-06-09T12:30:00Z"));
}
@Test
public void testConvert_empty_throws() throws Exception {
public void testConvert_empty_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert(""));
}
@Test
public void testConvert_null_throws() throws Exception {
public void testConvert_null_throws() {
assertThrows(NullPointerException.class, () -> instance.convert(null));
}
@Test
public void testConvert_sillyString_throws() throws Exception {
public void testConvert_sillyString_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("foo"));
}
@Test
public void testValidate_sillyString_throws() throws Exception {
public void testValidate_sillyString_throws() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
assertThat(thrown).hasMessageThat().contains("--time=foo not an");

View file

@ -35,64 +35,64 @@ public class KeyValueMapParameterTest {
private final CurrencyUnitToStringMap currencyUnitToStringMap = new CurrencyUnitToStringMap();
@Test
public void testSuccess_convertStringToString_singleEntry() throws Exception {
public void testSuccess_convertStringToString_singleEntry() {
assertThat(stringToStringInstance.convert("key=foo"))
.isEqualTo(ImmutableMap.of("key", "foo"));
}
@Test
public void testSuccess_convertStringToInteger_singleEntry() throws Exception {
public void testSuccess_convertStringToInteger_singleEntry() {
assertThat(stringToIntegerInstance.convert("key=1"))
.isEqualTo(ImmutableMap.of("key", 1));
}
@Test
public void testSuccess_convertCurrencyUnitToString_singleEntry() throws Exception {
public void testSuccess_convertCurrencyUnitToString_singleEntry() {
assertThat(currencyUnitToStringMap.convert("USD=123abc"))
.isEqualTo(ImmutableMap.of(CurrencyUnit.USD, "123abc"));
}
@Test
public void testSuccess_convertStringToString() throws Exception {
public void testSuccess_convertStringToString() {
assertThat(stringToStringInstance.convert("key=foo,key2=bar"))
.isEqualTo(ImmutableMap.of("key", "foo", "key2", "bar"));
}
@Test
public void testSuccess_convertStringToInteger() throws Exception {
public void testSuccess_convertStringToInteger() {
assertThat(stringToIntegerInstance.convert("key=1,key2=2"))
.isEqualTo(ImmutableMap.of("key", 1, "key2", 2));
}
@Test
public void testSuccess_convertCurrencyUnitToString() throws Exception {
public void testSuccess_convertCurrencyUnitToString() {
assertThat(currencyUnitToStringMap.convert("USD=123abc,JPY=xyz789"))
.isEqualTo(ImmutableMap.of(CurrencyUnit.USD, "123abc", CurrencyUnit.JPY, "xyz789"));
}
@Test
public void testSuccess_convertStringToString_empty() throws Exception {
public void testSuccess_convertStringToString_empty() {
assertThat(stringToStringInstance.convert("")).isEmpty();
}
@Test
public void testSuccess_convertStringToInteger_empty() throws Exception {
public void testSuccess_convertStringToInteger_empty() {
assertThat(stringToIntegerInstance.convert("")).isEmpty();
}
@Test
public void testSuccess_convertCurrencyUnitToString_empty() throws Exception {
public void testSuccess_convertCurrencyUnitToString_empty() {
assertThat(currencyUnitToStringMap.convert("")).isEmpty();
}
@Test
public void testFailure_convertStringToInteger_badType() throws Exception {
public void testFailure_convertStringToInteger_badType() {
assertThrows(
NumberFormatException.class, () -> stringToIntegerInstance.convert("key=1,key2=foo"));
}
@Test
public void testFailure_convertCurrencyUnitToString_badType() throws Exception {
public void testFailure_convertCurrencyUnitToString_badType() {
IllegalCurrencyException thrown =
assertThrows(
IllegalCurrencyException.class,
@ -101,36 +101,36 @@ public class KeyValueMapParameterTest {
}
@Test
public void testFailure_convertStringToString_badSeparator() throws Exception {
public void testFailure_convertStringToString_badSeparator() {
assertThrows(
IllegalArgumentException.class, () -> stringToStringInstance.convert("key=foo&key2=bar"));
}
@Test
public void testFailure_convertStringToInteger_badSeparator() throws Exception {
public void testFailure_convertStringToInteger_badSeparator() {
assertThrows(
IllegalArgumentException.class, () -> stringToIntegerInstance.convert("key=1&key2=2"));
}
@Test
public void testFailure_convertCurrencyUnitToString_badSeparator() throws Exception {
public void testFailure_convertCurrencyUnitToString_badSeparator() {
assertThrows(
IllegalArgumentException.class,
() -> currencyUnitToStringMap.convert("USD=123abc&JPY=xyz789"));
}
@Test
public void testFailure_convertStringToString_badFormat() throws Exception {
public void testFailure_convertStringToString_badFormat() {
assertThrows(IllegalArgumentException.class, () -> stringToStringInstance.convert("foo"));
}
@Test
public void testFailure_convertStringToInteger_badFormat() throws Exception {
public void testFailure_convertStringToInteger_badFormat() {
assertThrows(IllegalArgumentException.class, () -> stringToIntegerInstance.convert("foo"));
}
@Test
public void testFailure_convertCurrencyUnitToString_badFormat() throws Exception {
public void testFailure_convertCurrencyUnitToString_badFormat() {
assertThrows(IllegalArgumentException.class, () -> currencyUnitToStringMap.convert("foo"));
}
}

View file

@ -29,54 +29,54 @@ public class MoneyParameterTest {
private final MoneyParameter instance = new MoneyParameter();
@Test
public void testConvert_withCurrency() throws Exception {
public void testConvert_withCurrency() {
assertThat(instance.convert("USD 777.99")).isEqualTo(Money.parse("USD 777.99"));
}
@Test
public void testConvert_negative() throws Exception {
public void testConvert_negative() {
assertThat(instance.convert("USD -777.99")).isEqualTo(Money.parse("USD -777.99"));
}
@Test
public void testConvert_missingSpace_isForgiving() throws Exception {
public void testConvert_missingSpace_isForgiving() {
assertThat(instance.convert("USD777.99")).isEqualTo(Money.parse("USD 777.99"));
}
@Test
public void testConvert_lowercase_isForgiving() throws Exception {
public void testConvert_lowercase_isForgiving() {
assertThat(instance.convert("usd777.99")).isEqualTo(Money.parse("USD 777.99"));
}
@Test
public void testConvert_badCurrency_throws() throws Exception {
public void testConvert_badCurrency_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("FOO 1337"));
}
@Test
public void testConvert_null_throws() throws Exception {
public void testConvert_null_throws() {
assertThrows(NullPointerException.class, () -> instance.convert(null));
}
@Test
public void testConvert_empty_throws() throws Exception {
public void testConvert_empty_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert(""));
}
@Test
public void testConvert_sillyString_throws() throws Exception {
public void testConvert_sillyString_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("foo"));
}
@Test
public void testValidate_sillyString_throws() throws Exception {
public void testValidate_sillyString_throws() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> instance.validate("--money", "foo"));
assertThat(thrown).hasMessageThat().contains("--money=foo not valid");
}
@Test
public void testValidate_correctInput() throws Exception {
public void testValidate_correctInput() {
instance.validate("--money", "USD 777");
}
}

View file

@ -47,17 +47,17 @@ public class PathParameterTest {
private final PathParameter vanilla = new PathParameter();
@Test
public void testConvert_etcPasswd_returnsPath() throws Exception {
public void testConvert_etcPasswd_returnsPath() {
assertThat((Object) vanilla.convert("/etc/passwd")).isEqualTo(Paths.get("/etc/passwd"));
}
@Test
public void testConvert_null_throws() throws Exception {
public void testConvert_null_throws() {
assertThrows(NullPointerException.class, () -> vanilla.convert(null));
}
@Test
public void testConvert_empty_throws() throws Exception {
public void testConvert_empty_throws() {
assertThrows(IllegalArgumentException.class, () -> vanilla.convert(""));
}
@ -79,7 +79,7 @@ public class PathParameterTest {
}
@Test
public void testConvert_uriNotProvided() throws Exception {
public void testConvert_uriNotProvided() {
assertThrows(FileSystemNotFoundException.class, () -> vanilla.convert("bog://bucket/lolcat"));
}
@ -93,7 +93,7 @@ public class PathParameterTest {
}
@Test
public void testInputFileValidate_missingFile_throws() throws Exception {
public void testInputFileValidate_missingFile_throws() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -102,7 +102,7 @@ public class PathParameterTest {
}
@Test
public void testInputFileValidate_directory_throws() throws Exception {
public void testInputFileValidate_directory_throws() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -129,18 +129,18 @@ public class PathParameterTest {
}
@Test
public void testInputFileValidate_characterDeviceBehindSymbolicLinks_works() throws Exception {
public void testInputFileValidate_characterDeviceBehindSymbolicLinks_works() {
assumeTrue(Files.exists(Paths.get("/dev/stdin")));
outputFile.validate("input", "/dev/stdin");
}
@Test
public void testOutputFileValidate_missingFile_works() throws Exception {
public void testOutputFileValidate_missingFile_works() {
outputFile.validate("input", new File(folder.getRoot(), "foo").toString());
}
@Test
public void testOutputFileValidate_directory_throws() throws Exception {
public void testOutputFileValidate_directory_throws() {
ParameterException thrown =
assertThrows(
ParameterException.class,
@ -158,7 +158,7 @@ public class PathParameterTest {
}
@Test
public void testOutputFileValidate_parentDirMissing_throws() throws Exception {
public void testOutputFileValidate_parentDirMissing_throws() {
Path file = Paths.get(folder.getRoot().toString(), "MISSINGNO", "foo.txt");
ParameterException thrown =
assertThrows(ParameterException.class, () -> outputFile.validate("input", file.toString()));

View file

@ -27,22 +27,22 @@ public class PhoneNumberParameterTest {
private final OptionalPhoneNumberParameter instance = new OptionalPhoneNumberParameter();
@Test
public void testConvert_e164() throws Exception {
public void testConvert_e164() {
assertThat(instance.convert("+1.2125550777")).hasValue("+1.2125550777");
}
@Test
public void testConvert_sillyString_throws() throws Exception {
public void testConvert_sillyString_throws() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("foo"));
}
@Test
public void testConvert_empty_returnsAbsent() throws Exception {
public void testConvert_empty_returnsAbsent() {
assertThat(instance.convert("")).isEmpty();
}
@Test
public void testConvert_nullString_returnsAbsent() throws Exception {
public void testConvert_nullString_returnsAbsent() {
assertThat(instance.convert("null")).isEmpty();
}
}

View file

@ -29,44 +29,44 @@ public class YearMonthParameterTest {
private final YearMonthParameter instance = new YearMonthParameter();
@Test
public void testConvert_awfulMonth() throws Exception {
public void testConvert_awfulMonth() {
assertThat(instance.convert("1984-12")).isEqualTo(new YearMonth(1984, 12));
}
@Test
public void testConvert_null_throwsException() throws Exception {
public void testConvert_null_throwsException() {
assertThrows(NullPointerException.class, () -> instance.convert(null));
}
@Test
public void testConvert_empty_throwsException() throws Exception {
public void testConvert_empty_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert(""));
}
@Test
public void testConvert_sillyString_throwsException() throws Exception {
public void testConvert_sillyString_throwsException() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("foo"));
}
@Test
public void testConvert_wrongOrder() throws Exception {
public void testConvert_wrongOrder() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("12-1984"));
}
@Test
public void testConvert_noHyphen() throws Exception {
public void testConvert_noHyphen() {
assertThrows(IllegalArgumentException.class, () -> instance.convert("198412"));
}
@Test
public void testValidate_sillyString_throwsParameterException() throws Exception {
public void testValidate_sillyString_throwsParameterException() {
ParameterException thrown =
assertThrows(ParameterException.class, () -> instance.validate("--time", "foo"));
assertThat(thrown).hasMessageThat().contains("--time=foo not a valid");
}
@Test
public void testValidate_correctInput_doesntThrow() throws Exception {
public void testValidate_correctInput_doesntThrow() {
instance.validate("--time", "1984-12");
}
}

View file

@ -61,7 +61,7 @@ public class CreateGroupsActionTest {
}
@Test
public void test_invalidRequest_missingClientId() throws Exception {
public void test_invalidRequest_missingClientId() {
BadRequestException thrown = assertThrows(BadRequestException.class, () -> runAction(null));
assertThat(thrown)
.hasMessageThat()
@ -69,7 +69,7 @@ public class CreateGroupsActionTest {
}
@Test
public void test_invalidRequest_invalidClientId() throws Exception {
public void test_invalidRequest_invalidClientId() {
BadRequestException thrown =
assertThrows(BadRequestException.class, () -> runAction("completelyMadeUpClientId"));
assertThat(thrown)

View file

@ -44,7 +44,7 @@ public class CreatePremiumListActionTest {
FakeJsonResponse response;
@Before
public void init() throws Exception {
public void init() {
createTlds("foo", "xn--q9jyb4c", "how");
deletePremiumList(PremiumList.getUncached("foo").get());
action = new CreatePremiumListAction();
@ -53,14 +53,14 @@ public class CreatePremiumListActionTest {
}
@Test
public void test_invalidRequest_missingInput_returnsErrorStatus() throws Exception {
public void test_invalidRequest_missingInput_returnsErrorStatus() {
action.name = "foo";
action.run();
assertThat(response.getResponseMap().get("status")).isEqualTo("error");
}
@Test
public void test_invalidRequest_listAlreadyExists_returnsErrorStatus() throws Exception {
public void test_invalidRequest_listAlreadyExists_returnsErrorStatus() {
action.name = "how";
action.inputData = "richer,JPY 5000";
action.run();
@ -72,7 +72,7 @@ public class CreatePremiumListActionTest {
}
@Test
public void test_nonExistentTld_successWithOverride() throws Exception {
public void test_nonExistentTld_successWithOverride() {
action.name = "zanzibar";
action.inputData = "zanzibar,USD 100";
action.override = true;
@ -82,7 +82,7 @@ public class CreatePremiumListActionTest {
}
@Test
public void test_success() throws Exception {
public void test_success() {
action.name = "foo";
action.inputData = "rich,USD 25\nricher,USD 1000\n";
action.run();

View file

@ -42,12 +42,12 @@ public class DeleteEntityActionTest {
DeleteEntityAction action = new DeleteEntityAction();
@Before
public void init() throws Exception {
public void init() {
action.response = response;
}
@Test
public void test_deleteSingleRawEntitySuccessfully() throws Exception {
public void test_deleteSingleRawEntitySuccessfully() {
Entity entity = new Entity("single", "raw");
getDatastoreService().put(entity);
action.rawKeys = KeyFactory.keyToString(entity.getKey());
@ -57,7 +57,7 @@ public class DeleteEntityActionTest {
}
@Test
public void test_deleteSingleRegisteredEntitySuccessfully() throws Exception {
public void test_deleteSingleRegisteredEntitySuccessfully() {
ReservedList ofyEntity = new ReservedList.Builder().setName("foo").build();
ofy().saveWithoutBackup().entity(ofyEntity).now();
action.rawKeys = KeyFactory.keyToString(create(ofyEntity).getRaw());
@ -67,7 +67,7 @@ public class DeleteEntityActionTest {
}
@Test
public void test_deleteOneRawEntityAndOneRegisteredEntitySuccessfully() throws Exception {
public void test_deleteOneRawEntityAndOneRegisteredEntitySuccessfully() {
Entity entity = new Entity("first", "raw");
getDatastoreService().put(entity);
String rawKey = KeyFactory.keyToString(entity.getKey());
@ -81,7 +81,7 @@ public class DeleteEntityActionTest {
}
@Test
public void test_deleteNonExistentEntityRepliesWithError() throws Exception {
public void test_deleteNonExistentEntityRepliesWithError() {
Entity entity = new Entity("not", "here");
String rawKey = KeyFactory.keyToString(entity.getKey());
action.rawKeys = rawKey;
@ -90,7 +90,7 @@ public class DeleteEntityActionTest {
}
@Test
public void test_deleteOneEntityAndNonExistentEntityRepliesWithError() throws Exception {
public void test_deleteOneEntityAndNonExistentEntityRepliesWithError() {
ReservedList ofyEntity = new ReservedList.Builder().setName("first_registered").build();
ofy().saveWithoutBackup().entity(ofyEntity).now();
String ofyKey = KeyFactory.keyToString(create(ofyEntity).getRaw());

View file

@ -34,14 +34,14 @@ public class ListHostsActionTest extends ListActionTestCase {
ListHostsAction action;
@Before
public void init() throws Exception {
public void init() {
createTld("foo");
action = new ListHostsAction();
action.clock = new FakeClock(DateTime.parse("2000-01-01TZ"));
}
@Test
public void testRun_noParameters() throws Exception {
public void testRun_noParameters() {
testRunSuccess(
action,
null,
@ -50,7 +50,7 @@ public class ListHostsActionTest extends ListActionTestCase {
}
@Test
public void testRun_twoLinesWithRepoId() throws Exception {
public void testRun_twoLinesWithRepoId() {
persistActiveHost("example2.foo");
persistActiveHost("example1.foo");
testRunSuccess(
@ -65,7 +65,7 @@ public class ListHostsActionTest extends ListActionTestCase {
}
@Test
public void testRun_twoLinesWithWildcard() throws Exception {
public void testRun_twoLinesWithWildcard() {
persistActiveHost("example2.foo");
persistActiveHost("example1.foo");
testRunSuccess(
@ -80,7 +80,7 @@ public class ListHostsActionTest extends ListActionTestCase {
}
@Test
public void testRun_twoLinesWithWildcardAndAnotherField() throws Exception {
public void testRun_twoLinesWithWildcardAndAnotherField() {
persistActiveHost("example2.foo");
persistActiveHost("example1.foo");
testRunSuccess(
@ -95,7 +95,7 @@ public class ListHostsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withBadField_returnsError() throws Exception {
public void testRun_withBadField_returnsError() {
persistActiveHost("example2.foo");
persistActiveHost("example1.foo");
testRunError(

View file

@ -31,14 +31,14 @@ public class ListPremiumListsActionTest extends ListActionTestCase {
ListPremiumListsAction action;
@Before
public void init() throws Exception {
public void init() {
persistPremiumList("xn--q9jyb4c", "rich,USD 100");
persistPremiumList("how", "richer,JPY 5000");
action = new ListPremiumListsAction();
}
@Test
public void testRun_noParameters() throws Exception {
public void testRun_noParameters() {
testRunSuccess(
action,
Optional.empty(),
@ -49,7 +49,7 @@ public class ListPremiumListsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withParameters() throws Exception {
public void testRun_withParameters() {
testRunSuccess(
action,
Optional.of("revisionKey,description"),
@ -62,7 +62,7 @@ public class ListPremiumListsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withWildcard() throws Exception {
public void testRun_withWildcard() {
testRunSuccess(
action,
Optional.of("*"),
@ -75,7 +75,7 @@ public class ListPremiumListsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withBadField_returnsError() throws Exception {
public void testRun_withBadField_returnsError() {
testRunError(
action,
Optional.of("badfield"),

View file

@ -34,7 +34,7 @@ public class ListRegistrarsActionTest extends ListActionTestCase {
ListRegistrarsAction action;
@Before
public void init() throws Exception {
public void init() {
action = new ListRegistrarsAction();
createTlds("xn--q9jyb4c", "example");
// Ensure that NewRegistrar only has access to xn--q9jyb4c and that TheRegistrar only has access
@ -52,7 +52,7 @@ public class ListRegistrarsActionTest extends ListActionTestCase {
}
@Test
public void testRun_noParameters() throws Exception {
public void testRun_noParameters() {
testRunSuccess(
action,
Optional.empty(),
@ -63,7 +63,7 @@ public class ListRegistrarsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withParameters() throws Exception {
public void testRun_withParameters() {
testRunSuccess(
action,
Optional.of("allowedTlds"),
@ -76,7 +76,7 @@ public class ListRegistrarsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withWildcard() throws Exception {
public void testRun_withWildcard() {
testRunSuccess(
action,
Optional.of("*"),
@ -89,7 +89,7 @@ public class ListRegistrarsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withBadField_returnsError() throws Exception {
public void testRun_withBadField_returnsError() {
testRunError(
action,
Optional.of("badfield"),

View file

@ -35,7 +35,7 @@ public class ListReservedListsActionTest extends ListActionTestCase {
ListReservedListsAction action;
@Before
public void init() throws Exception {
public void init() {
ReservedList rl1 = persistReservedList("xn--q9jyb4c-published", true, "blah,FULLY_BLOCKED");
ReservedList rl2 = persistReservedList("xn--q9jyb4c-private", false, "dugong,FULLY_BLOCKED");
createTld("xn--q9jyb4c");
@ -44,7 +44,7 @@ public class ListReservedListsActionTest extends ListActionTestCase {
}
@Test
public void testRun_noParameters() throws Exception {
public void testRun_noParameters() {
testRunSuccess(
action,
Optional.empty(),
@ -55,7 +55,7 @@ public class ListReservedListsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withParameters() throws Exception {
public void testRun_withParameters() {
testRunSuccess(
action,
Optional.of("shouldPublish"),
@ -68,7 +68,7 @@ public class ListReservedListsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withWildcard() throws Exception {
public void testRun_withWildcard() {
testRunSuccess(
action,
Optional.of("*"),
@ -81,7 +81,7 @@ public class ListReservedListsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withBadField_returnsError() throws Exception {
public void testRun_withBadField_returnsError() {
testRunError(
action,
Optional.of("badfield"),

View file

@ -24,28 +24,26 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Unit tests for {@link ListTldsAction}.
*/
/** Unit tests for {@link ListTldsAction}. */
@RunWith(JUnit4.class)
public class ListTldsActionTest extends ListActionTestCase {
ListTldsAction action;
@Before
public void init() throws Exception {
public void init() {
createTld("xn--q9jyb4c");
action = new ListTldsAction();
action.clock = new FakeClock(DateTime.parse("2000-01-01TZ"));
}
@Test
public void testRun_noParameters() throws Exception {
public void testRun_noParameters() {
testRunSuccess(action, Optional.empty(), Optional.empty(), Optional.empty(), "xn--q9jyb4c");
}
@Test
public void testRun_withParameters() throws Exception {
public void testRun_withParameters() {
testRunSuccess(
action,
Optional.of("tldType"),
@ -57,7 +55,7 @@ public class ListTldsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withWildcard() throws Exception {
public void testRun_withWildcard() {
testRunSuccess(
action,
Optional.of("*"),
@ -69,7 +67,7 @@ public class ListTldsActionTest extends ListActionTestCase {
}
@Test
public void testRun_withBadField_returnsError() throws Exception {
public void testRun_withBadField_returnsError() {
testRunError(
action,
Optional.of("badfield"),

View file

@ -35,7 +35,7 @@ import org.junit.runners.JUnit4;
public class PollMapreduceActionTest extends MapreduceTestCase<PollMapreduceAction> {
@Before
public void init() throws Exception {
public void init() {
action = new PollMapreduceAction();
}

View file

@ -47,7 +47,7 @@ public class UpdatePremiumListActionTest {
FakeJsonResponse response;
@Before
public void init() throws Exception {
public void init() {
createTlds("foo", "xn--q9jyb4c", "how");
action = new UpdatePremiumListAction();
response = new FakeJsonResponse();
@ -55,14 +55,14 @@ public class UpdatePremiumListActionTest {
}
@Test
public void test_invalidRequest_missingInput_returnsErrorStatus() throws Exception {
public void test_invalidRequest_missingInput_returnsErrorStatus() {
action.name = "foo";
action.run();
assertThat(response.getResponseMap().get("status")).isEqualTo("error");
}
@Test
public void test_invalidRequest_listDoesNotExist_returnsErrorStatus() throws Exception {
public void test_invalidRequest_listDoesNotExist_returnsErrorStatus() {
action.name = "bamboozle";
action.inputData = "richer,JPY 5000";
action.run();
@ -74,7 +74,7 @@ public class UpdatePremiumListActionTest {
}
@Test
public void test_success() throws Exception {
public void test_success() {
action.name = "foo";
action.inputData = "rich,USD 75\nricher,USD 5000\npoor, USD 0.99";
action.run();

View file

@ -146,7 +146,7 @@ public class VerifyOteActionTest {
}
@Test
public void testSuccess_summarize_allPass() throws Exception {
public void testSuccess_summarize_allPass() {
Map<String, Object> response =
action.handleJsonRequest(
ImmutableMap.of("summarize", "true", "registrars", ImmutableList.of("blobio")));
@ -156,7 +156,7 @@ public class VerifyOteActionTest {
}
@Test
public void testSuccess_summarize_someFailures() throws Exception {
public void testSuccess_summarize_someFailures() {
deleteResource(hostDeleteHistoryEntry);
deleteResource(domainCreateHistoryEntry);
deleteResource(domainRestoreHistoryEntry);
@ -169,7 +169,7 @@ public class VerifyOteActionTest {
}
@Test
public void testSuccess_passNotSummarized() throws Exception {
public void testSuccess_passNotSummarized() {
Map<String, Object> response =
action.handleJsonRequest(
ImmutableMap.of("summarize", "false", "registrars", ImmutableList.of("blobio")));
@ -205,7 +205,7 @@ public class VerifyOteActionTest {
}
@Test
public void testFailure_missingHostDelete() throws Exception {
public void testFailure_missingHostDelete() {
deleteResource(hostDeleteHistoryEntry);
Map<String, Object> response =