diff --git a/java/google/registry/bigquery/BigqueryConnection.java b/java/google/registry/bigquery/BigqueryConnection.java index 8660ac753..43024e801 100644 --- a/java/google/registry/bigquery/BigqueryConnection.java +++ b/java/google/registry/bigquery/BigqueryConnection.java @@ -396,7 +396,7 @@ public class BigqueryConnection implements AutoCloseable { public ListenableFuture load( DestinationTable dest, SourceFormat sourceFormat, - Iterable sourceUris) throws Exception { + Iterable sourceUris) { Job job = new Job() .setConfiguration(new JobConfiguration() .setLoad(new JobConfigurationLoad() @@ -441,7 +441,7 @@ public class BigqueryConnection implements AutoCloseable { *

Returns a ListenableFuture that holds the ImmutableTable on success. */ public ListenableFuture> - queryToLocalTable(String querySql) throws Exception { + queryToLocalTable(String querySql) { Job job = new Job() .setConfiguration(new JobConfiguration() .setQuery(new JobConfigurationQuery() @@ -459,8 +459,7 @@ public class BigqueryConnection implements AutoCloseable { * *

Returns the results of the query in an ImmutableTable on success. */ - public ImmutableTable queryToLocalTableSync(String querySql) - throws Exception { + public ImmutableTable queryToLocalTableSync(String querySql) { Job job = new Job() .setConfiguration(new JobConfiguration() .setQuery(new JobConfigurationQuery() diff --git a/java/google/registry/mapreduce/inputs/ChildEntityReader.java b/java/google/registry/mapreduce/inputs/ChildEntityReader.java index 367319461..0a84a7051 100644 --- a/java/google/registry/mapreduce/inputs/ChildEntityReader.java +++ b/java/google/registry/mapreduce/inputs/ChildEntityReader.java @@ -193,7 +193,7 @@ class ChildEntityReader extend } @Override - public void beginShard() throws IOException { + public void beginShard() { eppResourceEntityReader.beginShard(); } diff --git a/java/google/registry/model/eppinput/EppInput.java b/java/google/registry/model/eppinput/EppInput.java index d1ccd15cf..bb9924fa7 100644 --- a/java/google/registry/model/eppinput/EppInput.java +++ b/java/google/registry/model/eppinput/EppInput.java @@ -434,7 +434,7 @@ public class EppInput extends ImmutableObject { } @Override - public String marshal(String ignored) throws Exception { + public String marshal(String ignored) { throw new UnsupportedOperationException(); } } diff --git a/java/google/registry/model/ofy/OfyFilter.java b/java/google/registry/model/ofy/OfyFilter.java index f2014648b..19417c0da 100644 --- a/java/google/registry/model/ofy/OfyFilter.java +++ b/java/google/registry/model/ofy/OfyFilter.java @@ -32,7 +32,7 @@ public class OfyFilter implements Filter { } @Override - public void init(FilterConfig config) throws ServletException { + public void init(FilterConfig config) { // Make sure that we've registered all types before we do anything else with Objectify. ObjectifyService.initOfy(); } diff --git a/java/google/registry/model/translators/EnumToAttributeAdapter.java b/java/google/registry/model/translators/EnumToAttributeAdapter.java index 9df1a8a22..df9acbcf3 100644 --- a/java/google/registry/model/translators/EnumToAttributeAdapter.java +++ b/java/google/registry/model/translators/EnumToAttributeAdapter.java @@ -43,12 +43,12 @@ public class EnumToAttributeAdapter & EnumToAttributeAdapter.E // Enums that can be unmarshalled from input can override this. @Override - public E unmarshal(EnumShim shim) throws Exception { + public E unmarshal(EnumShim shim) { throw new UnsupportedOperationException(); } @Override - public final EnumShim marshal(E enumeration) throws Exception { + public final EnumShim marshal(E enumeration) { EnumShim shim = new EnumShim(); shim.s = enumeration.getXmlName(); return shim; diff --git a/java/google/registry/rde/JSchSftpChannel.java b/java/google/registry/rde/JSchSftpChannel.java index b0917ff1a..d86b37251 100644 --- a/java/google/registry/rde/JSchSftpChannel.java +++ b/java/google/registry/rde/JSchSftpChannel.java @@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.jcraft.jsch.ChannelSftp; import java.io.Closeable; -import java.io.IOException; /** * {@link ChannelSftp} wrapper that implements {@link Closeable}. @@ -41,7 +40,7 @@ final class JSchSftpChannel implements Closeable { } @Override - public void close() throws IOException { + public void close() { channel.disconnect(); } } diff --git a/java/google/registry/rde/JSchSshSession.java b/java/google/registry/rde/JSchSshSession.java index 3efde43f4..0fa7646e0 100644 --- a/java/google/registry/rde/JSchSshSession.java +++ b/java/google/registry/rde/JSchSshSession.java @@ -23,7 +23,6 @@ import com.jcraft.jsch.Session; import com.jcraft.jsch.SftpException; import google.registry.config.RegistryConfig.Config; import java.io.Closeable; -import java.io.IOException; import java.net.URI; import javax.inject.Inject; import org.joda.time.Duration; @@ -118,7 +117,7 @@ final class JSchSshSession implements Closeable { /** @see com.jcraft.jsch.Session#disconnect() */ @Override - public void close() throws IOException { + public void close() { session.disconnect(); } } diff --git a/java/google/registry/rde/imports/RdeContactInput.java b/java/google/registry/rde/imports/RdeContactInput.java index 6ac2144e0..d51656914 100644 --- a/java/google/registry/rde/imports/RdeContactInput.java +++ b/java/google/registry/rde/imports/RdeContactInput.java @@ -31,7 +31,6 @@ import google.registry.model.contact.ContactResource; import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.xjc.JaxbFragment; import google.registry.xjc.rdecontact.XjcRdeContactElement; -import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Optional; @@ -74,8 +73,7 @@ public class RdeContactInput extends Input> { } @Override - public List>> createReaders() - throws IOException { + public List>> createReaders() { int numReaders = this.numReaders; RdeHeader header = newParser().getHeader(); int numberOfContacts = header.getContactCount().intValue(); diff --git a/java/google/registry/rde/imports/RdeContactReader.java b/java/google/registry/rde/imports/RdeContactReader.java index 04fa0f5a0..bded645da 100644 --- a/java/google/registry/rde/imports/RdeContactReader.java +++ b/java/google/registry/rde/imports/RdeContactReader.java @@ -82,7 +82,7 @@ public class RdeContactReader extends InputReader next() throws IOException { + public JaxbFragment next() { if (count < maxResults) { if (parser == null) { parser = newParser(); diff --git a/java/google/registry/rde/imports/RdeDomainInput.java b/java/google/registry/rde/imports/RdeDomainInput.java index f97d50d93..865bb79bd 100644 --- a/java/google/registry/rde/imports/RdeDomainInput.java +++ b/java/google/registry/rde/imports/RdeDomainInput.java @@ -31,7 +31,6 @@ import google.registry.model.domain.DomainResource; import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.xjc.JaxbFragment; import google.registry.xjc.rdedomain.XjcRdeDomainElement; -import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Optional; @@ -74,8 +73,7 @@ public class RdeDomainInput extends Input> { } @Override - public List>> createReaders() - throws IOException { + public List>> createReaders() { int numReaders = this.numReaders; RdeHeader header = newParser().getHeader(); int numberOfDomains = header.getDomainCount().intValue(); diff --git a/java/google/registry/rde/imports/RdeDomainReader.java b/java/google/registry/rde/imports/RdeDomainReader.java index 51df4c31f..4d6f5e9a4 100644 --- a/java/google/registry/rde/imports/RdeDomainReader.java +++ b/java/google/registry/rde/imports/RdeDomainReader.java @@ -79,7 +79,7 @@ public class RdeDomainReader extends InputReader next() throws IOException { + public JaxbFragment next() { if (count < maxResults) { if (parser == null) { parser = newParser(); diff --git a/java/google/registry/rde/imports/RdeHostInput.java b/java/google/registry/rde/imports/RdeHostInput.java index 9d4dd7955..2175e2ad8 100644 --- a/java/google/registry/rde/imports/RdeHostInput.java +++ b/java/google/registry/rde/imports/RdeHostInput.java @@ -29,7 +29,6 @@ import google.registry.model.host.HostResource; import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.xjc.JaxbFragment; import google.registry.xjc.rdehost.XjcRdeHostElement; -import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Optional; @@ -74,8 +73,7 @@ public class RdeHostInput extends Input> { } @Override - public List>> createReaders() - throws IOException { + public List>> createReaders() { int numReaders = this.numReaders; RdeHeader header = createParser().getHeader(); int numberOfHosts = header.getHostCount().intValue(); diff --git a/java/google/registry/rde/imports/RdeHostReader.java b/java/google/registry/rde/imports/RdeHostReader.java index e3bd598d3..7c4b0c2a3 100644 --- a/java/google/registry/rde/imports/RdeHostReader.java +++ b/java/google/registry/rde/imports/RdeHostReader.java @@ -82,7 +82,7 @@ public class RdeHostReader extends InputReader> } @Override - public JaxbFragment next() throws IOException { + public JaxbFragment next() { if (count < maxResults) { if (parser == null) { parser = newParser(); diff --git a/java/google/registry/reporting/icann/ActivityReportingQueryBuilder.java b/java/google/registry/reporting/icann/ActivityReportingQueryBuilder.java index 5868e9a81..18a1aeaf2 100644 --- a/java/google/registry/reporting/icann/ActivityReportingQueryBuilder.java +++ b/java/google/registry/reporting/icann/ActivityReportingQueryBuilder.java @@ -22,7 +22,6 @@ import com.google.common.io.Resources; import google.registry.config.RegistryConfig.Config; import google.registry.util.ResourceUtils; import google.registry.util.SqlTemplate; -import java.io.IOException; import java.net.URL; import javax.inject.Inject; import org.joda.time.LocalDate; @@ -51,7 +50,7 @@ public final class ActivityReportingQueryBuilder implements QueryBuilder { /** Returns the aggregate query which generates the activity report from the saved view. */ @Override - public String getReportQuery() throws IOException { + public String getReportQuery() { return String.format( "#standardSQL\nSELECT * FROM `%s.%s.%s`", projectId, @@ -61,7 +60,7 @@ public final class ActivityReportingQueryBuilder implements QueryBuilder { /** Sets the month we're doing activity reporting for, and returns the view query map. */ @Override - public ImmutableMap getViewQueryMap() throws IOException { + public ImmutableMap getViewQueryMap() { LocalDate firstDayOfMonth = yearMonth.toLocalDate(1); // The pattern-matching is inclusive, so we subtract 1 day to only report that month's data. LocalDate lastDayOfMonth = yearMonth.toLocalDate(1).plusMonths(1).minusDays(1); @@ -70,7 +69,7 @@ public final class ActivityReportingQueryBuilder implements QueryBuilder { /** Returns a map from view name to its associated SQL query. */ private ImmutableMap createQueryMap( - LocalDate firstDayOfMonth, LocalDate lastDayOfMonth) throws IOException { + LocalDate firstDayOfMonth, LocalDate lastDayOfMonth) { ImmutableMap.Builder queriesBuilder = ImmutableMap.builder(); String operationalRegistrarsQuery = @@ -141,7 +140,7 @@ public final class ActivityReportingQueryBuilder implements QueryBuilder { } /** Returns {@link String} for file in {@code reporting/sql/} directory. */ - private static String getQueryFromFile(String filename) throws IOException { + private static String getQueryFromFile(String filename) { return ResourceUtils.readResourceUtf8(getUrl(filename)); } diff --git a/java/google/registry/reporting/icann/IcannHttpReporter.java b/java/google/registry/reporting/icann/IcannHttpReporter.java index 14ed69a58..fc984d9f9 100644 --- a/java/google/registry/reporting/icann/IcannHttpReporter.java +++ b/java/google/registry/reporting/icann/IcannHttpReporter.java @@ -113,7 +113,7 @@ public class IcannHttpReporter { return success; } - private XjcIirdeaResult parseResult(byte[] content) throws XmlException, IOException { + private XjcIirdeaResult parseResult(byte[] content) throws XmlException { XjcIirdeaResponseElement response = XjcXmlTransformer.unmarshal( XjcIirdeaResponseElement.class, new ByteArrayInputStream(content)); diff --git a/java/google/registry/reporting/icann/QueryBuilder.java b/java/google/registry/reporting/icann/QueryBuilder.java index 2e229d1a1..0b770494c 100644 --- a/java/google/registry/reporting/icann/QueryBuilder.java +++ b/java/google/registry/reporting/icann/QueryBuilder.java @@ -15,14 +15,13 @@ package google.registry.reporting.icann; import com.google.common.collect.ImmutableMap; -import java.io.IOException; /** Interface defining the necessary methods to construct ICANN reporting SQL queries. */ public interface QueryBuilder { /** Returns a map from an intermediary view's table name to the query that generates it. */ - ImmutableMap getViewQueryMap() throws IOException; + ImmutableMap getViewQueryMap(); /** Returns a query that retrieves the overall report from the previously generated view. */ - String getReportQuery() throws IOException; + String getReportQuery(); } diff --git a/java/google/registry/reporting/icann/TransactionsReportingQueryBuilder.java b/java/google/registry/reporting/icann/TransactionsReportingQueryBuilder.java index 3034a5b0a..1642c9986 100644 --- a/java/google/registry/reporting/icann/TransactionsReportingQueryBuilder.java +++ b/java/google/registry/reporting/icann/TransactionsReportingQueryBuilder.java @@ -22,7 +22,6 @@ import com.google.common.io.Resources; import google.registry.config.RegistryConfig.Config; import google.registry.util.ResourceUtils; import google.registry.util.SqlTemplate; -import java.io.IOException; import java.net.URL; import javax.inject.Inject; import org.joda.time.DateTime; @@ -52,7 +51,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder { /** Returns the aggregate query which generates the transactions report from the saved view. */ @Override - public String getReportQuery() throws IOException { + public String getReportQuery() { return String.format( "#standardSQL\nSELECT * FROM `%s.%s.%s`", projectId, @@ -62,7 +61,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder { /** Sets the month we're doing transactions reporting for, and returns the view query map. */ @Override - public ImmutableMap getViewQueryMap() throws IOException { + public ImmutableMap getViewQueryMap() { // Set the earliest date to to yearMonth on day 1 at 00:00:00 DateTime earliestReportTime = yearMonth.toLocalDate(1).toDateTime(new LocalTime(0, 0, 0)); // Set the latest date to yearMonth on the last day at 23:59:59.999 @@ -72,7 +71,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder { /** Returns a map from view name to its associated SQL query. */ private ImmutableMap createQueryMap( - DateTime earliestReportTime, DateTime latestReportTime) throws IOException { + DateTime earliestReportTime, DateTime latestReportTime) { ImmutableMap.Builder queriesBuilder = ImmutableMap.builder(); String registrarIanaIdQuery = @@ -179,7 +178,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder { } /** Returns {@link String} for file in {@code reporting/sql/} directory. */ - private static String getQueryFromFile(String filename) throws IOException { + private static String getQueryFromFile(String filename) { return ResourceUtils.readResourceUtf8(getUrl(filename)); } diff --git a/java/google/registry/tools/AllocateDomainCommand.java b/java/google/registry/tools/AllocateDomainCommand.java index ed5a4a124..5141c8d14 100644 --- a/java/google/registry/tools/AllocateDomainCommand.java +++ b/java/google/registry/tools/AllocateDomainCommand.java @@ -63,7 +63,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand { private final List> applicationKeys = new ArrayList<>(); @Override - protected String postExecute() throws Exception { + protected String postExecute() { return ofy() .transactNewReadOnly( () -> { diff --git a/java/google/registry/tools/AppEngineConnection.java b/java/google/registry/tools/AppEngineConnection.java index 29cef13c5..97210e9d1 100644 --- a/java/google/registry/tools/AppEngineConnection.java +++ b/java/google/registry/tools/AppEngineConnection.java @@ -65,7 +65,7 @@ class AppEngineConnection implements Connection { memoize(() -> xsrfTokenManager.generateToken(getUserId())); @Override - public void prefetchXsrfToken() throws IOException { + public void prefetchXsrfToken() { // Cause XSRF token to be fetched, and then stay resident in cache (since it's memoized). xsrfToken.get(); } diff --git a/java/google/registry/tools/CheckSnapshotCommand.java b/java/google/registry/tools/CheckSnapshotCommand.java index bcc7e2a5d..79b93fdc4 100644 --- a/java/google/registry/tools/CheckSnapshotCommand.java +++ b/java/google/registry/tools/CheckSnapshotCommand.java @@ -34,7 +34,7 @@ public class CheckSnapshotCommand implements RemoteApiCommand { private String snapshotName; @Override - public void run() throws Exception { + public void run() { Iterable backups = DatastoreBackupService.get().findAllByNamePrefix(snapshotName); if (Iterables.isEmpty(backups)) { diff --git a/java/google/registry/tools/CompareDbBackups.java b/java/google/registry/tools/CompareDbBackups.java index ed5e5318b..445a9c6aa 100644 --- a/java/google/registry/tools/CompareDbBackups.java +++ b/java/google/registry/tools/CompareDbBackups.java @@ -22,7 +22,7 @@ import java.io.File; /** Compare two database backups. */ class CompareDbBackups { - public static void main(String[] args) throws Exception { + public static void main(String[] args) { if (args.length != 2) { System.err.println("Usage: compare_db_backups "); return; diff --git a/java/google/registry/tools/ConfirmingCommand.java b/java/google/registry/tools/ConfirmingCommand.java index 1b3274182..496dff30a 100644 --- a/java/google/registry/tools/ConfirmingCommand.java +++ b/java/google/registry/tools/ConfirmingCommand.java @@ -71,7 +71,7 @@ public abstract class ConfirmingCommand implements Command { * Perform any post-execution steps (e.g. verifying the result), and return a description String * to be printed if non-empty. */ - protected String postExecute() throws Exception { + protected String postExecute() { return ""; } diff --git a/java/google/registry/tools/ConvertIdnCommand.java b/java/google/registry/tools/ConvertIdnCommand.java index 40c91d045..6de9adefb 100644 --- a/java/google/registry/tools/ConvertIdnCommand.java +++ b/java/google/registry/tools/ConvertIdnCommand.java @@ -21,7 +21,6 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; import com.google.common.base.Ascii; import google.registry.util.Idn; -import java.io.IOException; import java.util.List; /** Command to convert IDN labels to/from punycode. */ @@ -34,7 +33,7 @@ final class ConvertIdnCommand implements Command { private List mainParameters; @Override - public void run() throws IOException { + public void run() { for (String label : mainParameters) { if (label.startsWith(ACE_PREFIX)) { System.out.println(Idn.toUnicode(Ascii.toLowerCase(label))); diff --git a/java/google/registry/tools/CreateCdnsTld.java b/java/google/registry/tools/CreateCdnsTld.java index 58f35d89e..4fded5ae8 100644 --- a/java/google/registry/tools/CreateCdnsTld.java +++ b/java/google/registry/tools/CreateCdnsTld.java @@ -62,7 +62,7 @@ class CreateCdnsTld extends ConfirmingCommand { private ManagedZone managedZone; @Override - protected void init() throws IOException, GeneralSecurityException { + protected void init() { managedZone = new ManagedZone() .setDescription(description) diff --git a/java/google/registry/tools/CreateCreditBalanceCommand.java b/java/google/registry/tools/CreateCreditBalanceCommand.java index 9fb4a9c30..1f426c2fd 100644 --- a/java/google/registry/tools/CreateCreditBalanceCommand.java +++ b/java/google/registry/tools/CreateCreditBalanceCommand.java @@ -56,7 +56,7 @@ final class CreateCreditBalanceCommand extends MutatingCommand { private DateTime effectiveTime; @Override - public void init() throws Exception { + public void init() { Registrar registrar = checkArgumentPresent( Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); diff --git a/java/google/registry/tools/CreateCreditCommand.java b/java/google/registry/tools/CreateCreditCommand.java index 2dfb346c2..58f6c2452 100644 --- a/java/google/registry/tools/CreateCreditCommand.java +++ b/java/google/registry/tools/CreateCreditCommand.java @@ -68,7 +68,7 @@ final class CreateCreditCommand extends MutatingCommand { private DateTime effectiveTime; @Override - protected void init() throws Exception { + protected void init() { DateTime now = DateTime.now(UTC); Registrar registrar = checkArgumentPresent( diff --git a/java/google/registry/tools/CreateOrUpdatePremiumListCommand.java b/java/google/registry/tools/CreateOrUpdatePremiumListCommand.java index c1b01142a..44d8b3b4a 100644 --- a/java/google/registry/tools/CreateOrUpdatePremiumListCommand.java +++ b/java/google/registry/tools/CreateOrUpdatePremiumListCommand.java @@ -81,7 +81,7 @@ abstract class CreateOrUpdatePremiumListCommand extends ConfirmingCommand } @Override - protected String prompt() throws Exception { + protected String prompt() { return String.format( "You are about to save the premium list %s with %d items: ", name, inputLineCount); } diff --git a/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java b/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java index 0b741c14b..e1f126565 100644 --- a/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java +++ b/java/google/registry/tools/CreateOrUpdateRegistrarCommand.java @@ -272,7 +272,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand { @Nullable abstract Registrar getOldRegistrar(String clientId); - protected void initRegistrarCommand() throws Exception {} + protected void initRegistrarCommand() {} @Override protected final void init() throws Exception { diff --git a/java/google/registry/tools/CreateOrUpdateTldCommand.java b/java/google/registry/tools/CreateOrUpdateTldCommand.java index dc1a7484e..caf73673a 100644 --- a/java/google/registry/tools/CreateOrUpdateTldCommand.java +++ b/java/google/registry/tools/CreateOrUpdateTldCommand.java @@ -269,7 +269,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand { /** Subclasses can override this to assert that the command can be run in this environment. */ void assertAllowedEnvironment() {} - protected abstract void initTldCommand() throws Exception; + protected abstract void initTldCommand(); @Override protected final void init() throws Exception { diff --git a/java/google/registry/tools/CreateRegistrarCommand.java b/java/google/registry/tools/CreateRegistrarCommand.java index c84a03d94..90b6d2dce 100644 --- a/java/google/registry/tools/CreateRegistrarCommand.java +++ b/java/google/registry/tools/CreateRegistrarCommand.java @@ -58,7 +58,7 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand } @Override - protected void initRegistrarCommand() throws Exception { + protected void initRegistrarCommand() { checkArgument(mainParameters.size() == 1, "Must specify exactly one client identifier."); checkArgumentNotNull(emptyToNull(password), "--password is a required field"); checkArgumentNotNull(registrarName, "--name is a required field"); @@ -95,7 +95,7 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand } @Override - protected String postExecute() throws Exception { + protected String postExecute() { if (!createGoogleGroups) { return ""; } diff --git a/java/google/registry/tools/CreateRegistrarGroupsCommand.java b/java/google/registry/tools/CreateRegistrarGroupsCommand.java index c40ad6dac..40b015c63 100644 --- a/java/google/registry/tools/CreateRegistrarGroupsCommand.java +++ b/java/google/registry/tools/CreateRegistrarGroupsCommand.java @@ -49,7 +49,7 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand } @Override - protected void init() throws IOException { + protected void init() { for (String clientId : clientIds) { Registrar registrar = checkArgumentPresent( diff --git a/java/google/registry/tools/CreateTldCommand.java b/java/google/registry/tools/CreateTldCommand.java index a4fc9c4c1..88c35e9eb 100644 --- a/java/google/registry/tools/CreateTldCommand.java +++ b/java/google/registry/tools/CreateTldCommand.java @@ -53,7 +53,7 @@ class CreateTldCommand extends CreateOrUpdateTldCommand { private Money initialRenewBillingCost; @Override - protected void initTldCommand() throws Exception { + protected void initTldCommand() { checkArgument(initialTldState == null || tldStateTransitions.isEmpty(), "Don't pass both --initial_tld_state and --tld_state_transitions"); checkArgument(initialRenewBillingCost == null || renewBillingCostTransitions.isEmpty(), diff --git a/java/google/registry/tools/DeleteCreditCommand.java b/java/google/registry/tools/DeleteCreditCommand.java index 349212a45..4a3849d3f 100644 --- a/java/google/registry/tools/DeleteCreditCommand.java +++ b/java/google/registry/tools/DeleteCreditCommand.java @@ -41,7 +41,7 @@ final class DeleteCreditCommand extends MutatingCommand { private long creditId; @Override - protected void init() throws Exception { + protected void init() { Registrar registrar = checkArgumentPresent( Registrar.loadByClientId(clientId), "Registrar %s not found", clientId); diff --git a/java/google/registry/tools/DeletePremiumListCommand.java b/java/google/registry/tools/DeletePremiumListCommand.java index 0ae7d36ac..c7e3e3191 100644 --- a/java/google/registry/tools/DeletePremiumListCommand.java +++ b/java/google/registry/tools/DeletePremiumListCommand.java @@ -43,7 +43,7 @@ final class DeletePremiumListCommand extends ConfirmingCommand implements Remote private String name; @Override - protected void init() throws Exception { + protected void init() { checkArgument( doesPremiumListExist(name), "Cannot delete the premium list %s because it doesn't exist.", @@ -62,7 +62,7 @@ final class DeletePremiumListCommand extends ConfirmingCommand implements Remote } @Override - protected String execute() throws Exception { + protected String execute() { deletePremiumList(premiumList); return String.format("Deleted premium list '%s'.\n", premiumList.getName()); } diff --git a/java/google/registry/tools/DeleteReservedListCommand.java b/java/google/registry/tools/DeleteReservedListCommand.java index 501de8469..bf4cd30c7 100644 --- a/java/google/registry/tools/DeleteReservedListCommand.java +++ b/java/google/registry/tools/DeleteReservedListCommand.java @@ -36,7 +36,7 @@ final class DeleteReservedListCommand extends MutatingCommand { private String name; @Override - protected void init() throws Exception { + protected void init() { checkArgument( ReservedList.get(name).isPresent(), "Cannot delete the reserved list %s because it doesn't exist.", diff --git a/java/google/registry/tools/DeleteTldCommand.java b/java/google/registry/tools/DeleteTldCommand.java index 257afb71a..c63b6f3bf 100644 --- a/java/google/registry/tools/DeleteTldCommand.java +++ b/java/google/registry/tools/DeleteTldCommand.java @@ -52,7 +52,7 @@ final class DeleteTldCommand extends ConfirmingCommand implements RemoteApiComma * accidental deletion of established TLDs with domains on them. */ @Override - protected void init() throws Exception { + protected void init() { registry = Registry.get(tld); checkState(registry.getTldType().equals(TldType.TEST), "Cannot delete a real TLD"); @@ -77,7 +77,7 @@ final class DeleteTldCommand extends ConfirmingCommand implements RemoteApiComma } @Override - protected String execute() throws Exception { + protected String execute() { ofy().transactNew(new VoidWork() { @Override public void vrun() { diff --git a/java/google/registry/tools/DeployInvoicingPipelineCommand.java b/java/google/registry/tools/DeployInvoicingPipelineCommand.java index 44d791aac..13e074f5d 100644 --- a/java/google/registry/tools/DeployInvoicingPipelineCommand.java +++ b/java/google/registry/tools/DeployInvoicingPipelineCommand.java @@ -25,7 +25,7 @@ public class DeployInvoicingPipelineCommand implements Command { @Inject InvoicingPipeline invoicingPipeline; @Override - public void run() throws Exception { + public void run() { invoicingPipeline.deploy(); } } diff --git a/java/google/registry/tools/GenerateAllocationTokensCommand.java b/java/google/registry/tools/GenerateAllocationTokensCommand.java index ff3b2db02..d376a26d7 100644 --- a/java/google/registry/tools/GenerateAllocationTokensCommand.java +++ b/java/google/registry/tools/GenerateAllocationTokensCommand.java @@ -72,7 +72,7 @@ public class GenerateAllocationTokensCommand implements RemoteApiCommand { private static final int BATCH_SIZE = 20; @Override - public void run() throws Exception { + public void run() { int tokensSaved = 0; do { ImmutableSet tokens = diff --git a/java/google/registry/tools/GenerateEscrowDepositCommand.java b/java/google/registry/tools/GenerateEscrowDepositCommand.java index 244a68f35..871f0d3cd 100644 --- a/java/google/registry/tools/GenerateEscrowDepositCommand.java +++ b/java/google/registry/tools/GenerateEscrowDepositCommand.java @@ -79,7 +79,7 @@ final class GenerateEscrowDepositCommand implements RemoteApiCommand { @Inject @Named("rde-report") Queue queue; @Override - public void run() throws Exception { + public void run() { if (tlds.isEmpty()) { throw new ParameterException("At least one TLD must be specified"); diff --git a/java/google/registry/tools/GetLrpTokenCommand.java b/java/google/registry/tools/GetLrpTokenCommand.java index 311f67566..608364c56 100644 --- a/java/google/registry/tools/GetLrpTokenCommand.java +++ b/java/google/registry/tools/GetLrpTokenCommand.java @@ -47,7 +47,7 @@ public final class GetLrpTokenCommand implements RemoteApiCommand { private boolean includeHistory = false; @Override - public void run() throws Exception { + public void run() { checkArgument( (tokenString == null) == (assignee != null), "Exactly one of either token or assignee must be specified."); diff --git a/java/google/registry/tools/GetSchemaCommand.java b/java/google/registry/tools/GetSchemaCommand.java index 382b9aeba..54b5c9c29 100644 --- a/java/google/registry/tools/GetSchemaCommand.java +++ b/java/google/registry/tools/GetSchemaCommand.java @@ -21,7 +21,7 @@ import google.registry.model.SchemaVersion; @Parameters(commandDescription = "Generate a model schema file") final class GetSchemaCommand implements Command { @Override - public void run() throws Exception { + public void run() { System.out.println(SchemaVersion.getSchema()); } } diff --git a/java/google/registry/tools/GetSchemaTreeCommand.java b/java/google/registry/tools/GetSchemaTreeCommand.java index 50765d995..305a176e2 100644 --- a/java/google/registry/tools/GetSchemaTreeCommand.java +++ b/java/google/registry/tools/GetSchemaTreeCommand.java @@ -51,7 +51,7 @@ final class GetSchemaTreeCommand implements Command { private Multimap, Class> superclassToSubclasses; @Override - public void run() throws Exception { + public void run() { // Get the @Parent type for each class. Map, Class> entityToParentType = new HashMap<>(); for (Class clazz : ALL_CLASSES) { diff --git a/java/google/registry/tools/HelpCommand.java b/java/google/registry/tools/HelpCommand.java index 5407cd9e6..50b80d9f0 100644 --- a/java/google/registry/tools/HelpCommand.java +++ b/java/google/registry/tools/HelpCommand.java @@ -36,7 +36,7 @@ final class HelpCommand implements Command { private List mainParameters = new ArrayList<>(); @Override - public void run() throws Exception { + public void run() { String target = getOnlyElement(mainParameters, null); if (target == null) { jcommander.usage(); diff --git a/java/google/registry/tools/ListCursorsCommand.java b/java/google/registry/tools/ListCursorsCommand.java index e6400f746..af146be8c 100644 --- a/java/google/registry/tools/ListCursorsCommand.java +++ b/java/google/registry/tools/ListCursorsCommand.java @@ -49,7 +49,7 @@ final class ListCursorsCommand implements RemoteApiCommand { private boolean filterEscrowEnabled; @Override - public void run() throws Exception { + public void run() { List lines = new ArrayList<>(); for (String tld : Registries.getTlds()) { Registry registry = Registry.get(tld); diff --git a/java/google/registry/tools/LoadTestCommand.java b/java/google/registry/tools/LoadTestCommand.java index 92c54167e..b0a89f1ed 100644 --- a/java/google/registry/tools/LoadTestCommand.java +++ b/java/google/registry/tools/LoadTestCommand.java @@ -84,7 +84,7 @@ class LoadTestCommand extends ConfirmingCommand implements ServerSideCommand { } @Override - protected boolean checkExecutionState() throws Exception { + protected boolean checkExecutionState() { if (RegistryToolEnvironment.get() == RegistryToolEnvironment.PRODUCTION) { System.err.println("You may not run a load test against production."); return false; diff --git a/java/google/registry/tools/LockDomainCommand.java b/java/google/registry/tools/LockDomainCommand.java index f903445d4..5751e6170 100644 --- a/java/google/registry/tools/LockDomainCommand.java +++ b/java/google/registry/tools/LockDomainCommand.java @@ -41,7 +41,7 @@ public class LockDomainCommand extends LockOrUnlockDomainCommand { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); @Override - protected void initMutatingEppToolCommand() throws Exception { + protected void initMutatingEppToolCommand() { // Project all domains as of the same time so that argument order doesn't affect behavior. DateTime now = DateTime.now(UTC); for (String domain : getDomains()) { diff --git a/java/google/registry/tools/MutatingEppToolCommand.java b/java/google/registry/tools/MutatingEppToolCommand.java index 90410a8e2..0f7568d53 100644 --- a/java/google/registry/tools/MutatingEppToolCommand.java +++ b/java/google/registry/tools/MutatingEppToolCommand.java @@ -30,7 +30,7 @@ public abstract class MutatingEppToolCommand extends EppToolCommand { boolean dryRun; @Override - protected boolean checkExecutionState() throws Exception { + protected boolean checkExecutionState() { checkArgument(!(force && isDryRun()), "--force and --dry_run are incompatible"); return true; } diff --git a/java/google/registry/tools/PendingEscrowCommand.java b/java/google/registry/tools/PendingEscrowCommand.java index 0fc5e6745..b269460a4 100644 --- a/java/google/registry/tools/PendingEscrowCommand.java +++ b/java/google/registry/tools/PendingEscrowCommand.java @@ -43,7 +43,7 @@ final class PendingEscrowCommand implements RemoteApiCommand { PendingDepositChecker checker; @Override - public void run() throws Exception { + public void run() { System.out.println( SORTER .sortedCopy(checker.getTldsAndWatermarksPendingDepositForRdeAndBrda().values()) diff --git a/java/google/registry/tools/ResaveEntitiesCommand.java b/java/google/registry/tools/ResaveEntitiesCommand.java index b4cdeb0b9..a9b6779dc 100644 --- a/java/google/registry/tools/ResaveEntitiesCommand.java +++ b/java/google/registry/tools/ResaveEntitiesCommand.java @@ -41,7 +41,7 @@ public final class ResaveEntitiesCommand extends MutatingCommand { List mainParameters; @Override - protected void init() throws Exception { + protected void init() { for (List batch : partition(mainParameters, BATCH_SIZE)) { for (String websafeKey : batch) { ImmutableObject entity = ofy().load().key(Key.create(websafeKey)).now(); diff --git a/java/google/registry/tools/ResaveEnvironmentEntitiesCommand.java b/java/google/registry/tools/ResaveEnvironmentEntitiesCommand.java index 32ce968a0..d83568021 100644 --- a/java/google/registry/tools/ResaveEnvironmentEntitiesCommand.java +++ b/java/google/registry/tools/ResaveEnvironmentEntitiesCommand.java @@ -37,7 +37,7 @@ final class ResaveEnvironmentEntitiesCommand implements RemoteApiCommand { private static final int BATCH_SIZE = 10; @Override - public void run() throws Exception { + public void run() { batchSave(Registry.class); batchSave(Registrar.class); batchSave(RegistrarContact.class); diff --git a/java/google/registry/tools/ResaveEppResourceCommand.java b/java/google/registry/tools/ResaveEppResourceCommand.java index 140db57b9..cee4f5ecb 100644 --- a/java/google/registry/tools/ResaveEppResourceCommand.java +++ b/java/google/registry/tools/ResaveEppResourceCommand.java @@ -47,7 +47,7 @@ public final class ResaveEppResourceCommand extends MutatingCommand { protected String uniqueId; @Override - protected void init() throws Exception { + protected void init() { Key resourceKey = checkArgumentNotNull( type.getKey(uniqueId, DateTime.now(UTC)), "Could not find active resource of type %s: %s", type, uniqueId); diff --git a/java/google/registry/tools/ServerSideCommand.java b/java/google/registry/tools/ServerSideCommand.java index f854c85b3..32b21eb4d 100644 --- a/java/google/registry/tools/ServerSideCommand.java +++ b/java/google/registry/tools/ServerSideCommand.java @@ -25,7 +25,7 @@ interface ServerSideCommand extends RemoteApiCommand { /** An http connection to AppEngine. */ interface Connection { - void prefetchXsrfToken() throws IOException; + void prefetchXsrfToken(); String send(String endpoint, Map params, MediaType contentType, byte[] payload) throws IOException; diff --git a/java/google/registry/tools/SetupOteCommand.java b/java/google/registry/tools/SetupOteCommand.java index 57ed2f8dc..a7d6cfa5d 100644 --- a/java/google/registry/tools/SetupOteCommand.java +++ b/java/google/registry/tools/SetupOteCommand.java @@ -221,7 +221,7 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman } @Override - protected String prompt() throws Exception { + protected String prompt() { // Each underlying command will confirm its own operation as well, so just provide // a summary of the steps in this command. if (eapOnly) { diff --git a/java/google/registry/tools/ShellCommand.java b/java/google/registry/tools/ShellCommand.java index 3db3b640a..dafb29bcd 100644 --- a/java/google/registry/tools/ShellCommand.java +++ b/java/google/registry/tools/ShellCommand.java @@ -248,7 +248,7 @@ public class ShellCommand implements Command { * *

Dumps the last line of output prior to doing this. */ - private void emitSuccess() throws IOException { + private void emitSuccess() { System.out.println(SUCCESS); System.out.flush(); } @@ -258,7 +258,7 @@ public class ShellCommand implements Command { * *

Dumps the last line of output prior to doing this. */ - private void emitFailure(Throwable e) throws IOException { + private void emitFailure(Throwable e) { System.out.println( FAILURE + e.getClass().getName() diff --git a/java/google/registry/tools/UniformRapidSuspensionCommand.java b/java/google/registry/tools/UniformRapidSuspensionCommand.java index 57748d045..9c0b70a0d 100644 --- a/java/google/registry/tools/UniformRapidSuspensionCommand.java +++ b/java/google/registry/tools/UniformRapidSuspensionCommand.java @@ -100,7 +100,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand { ImmutableSortedSet existingDsData; @Override - protected void initMutatingEppToolCommand() throws ParseException { + protected void initMutatingEppToolCommand() { superuser = true; DateTime now = DateTime.now(UTC); ImmutableSet newHostsSet = ImmutableSet.copyOf(newHosts); @@ -176,7 +176,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand { } @Override - protected String postExecute() throws Exception { + protected String postExecute() { if (undo) { return ""; } diff --git a/java/google/registry/tools/UnlockDomainCommand.java b/java/google/registry/tools/UnlockDomainCommand.java index 5e38babfc..afd5baffe 100644 --- a/java/google/registry/tools/UnlockDomainCommand.java +++ b/java/google/registry/tools/UnlockDomainCommand.java @@ -41,7 +41,7 @@ public class UnlockDomainCommand extends LockOrUnlockDomainCommand { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); @Override - protected void initMutatingEppToolCommand() throws Exception { + protected void initMutatingEppToolCommand() { // Project all domains as of the same time so that argument order doesn't affect behavior. DateTime now = DateTime.now(UTC); for (String domain : getDomains()) { diff --git a/java/google/registry/tools/UpdateApplicationStatusCommand.java b/java/google/registry/tools/UpdateApplicationStatusCommand.java index 8f0aeccc3..e34238c17 100644 --- a/java/google/registry/tools/UpdateApplicationStatusCommand.java +++ b/java/google/registry/tools/UpdateApplicationStatusCommand.java @@ -65,7 +65,7 @@ final class UpdateApplicationStatusCommand extends MutatingCommand { private String clientId = "CharlestonRoad"; @Override - protected void init() throws Exception { + protected void init() { checkArgumentPresent( Registrar.loadByClientId(clientId), "Registrar with client ID %s not found", clientId); for (final String applicationId : ids) { diff --git a/java/google/registry/tools/UpdateClaimsNoticeCommand.java b/java/google/registry/tools/UpdateClaimsNoticeCommand.java index 7bcb5e2f4..621dd51a7 100644 --- a/java/google/registry/tools/UpdateClaimsNoticeCommand.java +++ b/java/google/registry/tools/UpdateClaimsNoticeCommand.java @@ -62,7 +62,7 @@ final class UpdateClaimsNoticeCommand implements RemoteApiCommand { private String acceptedTime; @Override - public void run() throws Exception { + public void run() { final LaunchNotice launchNotice = LaunchNotice.create( tcnId, validatorId, DateTime.parse(expirationTime), DateTime.parse(acceptedTime)); diff --git a/java/google/registry/tools/UpdateCursorsCommand.java b/java/google/registry/tools/UpdateCursorsCommand.java index 3c1f8910f..6ef975ff5 100644 --- a/java/google/registry/tools/UpdateCursorsCommand.java +++ b/java/google/registry/tools/UpdateCursorsCommand.java @@ -47,7 +47,7 @@ final class UpdateCursorsCommand extends MutatingCommand { private DateTime newTimestamp; @Override - protected void init() throws Exception { + protected void init() { if (isNullOrEmpty(tlds)) { Cursor cursor = ofy().load().key(Cursor.createGlobalKey(cursorType)).now(); stageEntityChange(cursor, Cursor.createGlobal(cursorType, newTimestamp)); diff --git a/java/google/registry/tools/UpdateTldCommand.java b/java/google/registry/tools/UpdateTldCommand.java index 672e499ff..826d80fbb 100644 --- a/java/google/registry/tools/UpdateTldCommand.java +++ b/java/google/registry/tools/UpdateTldCommand.java @@ -127,7 +127,7 @@ class UpdateTldCommand extends CreateOrUpdateTldCommand { } @Override - protected void initTldCommand() throws Exception { + protected void initTldCommand() { // Due to per-instance caching on Registry, different instances can end up in different TLD // states at the same time, so --set_current_tld_state should never be used in production. checkArgument( diff --git a/java/google/registry/tools/UploadClaimsListCommand.java b/java/google/registry/tools/UploadClaimsListCommand.java index 371fd0ac7..0f0ac66bb 100644 --- a/java/google/registry/tools/UploadClaimsListCommand.java +++ b/java/google/registry/tools/UploadClaimsListCommand.java @@ -51,12 +51,12 @@ final class UploadClaimsListCommand extends ConfirmingCommand implements RemoteA } @Override - protected String prompt() throws Exception { + protected String prompt() { return String.format("\nNew claims list:\n%s", claimsList); } @Override - public String execute() throws IOException { + public String execute() { claimsList.save(); return String.format("Successfully uploaded claims list %s", claimsListFilename); } diff --git a/java/google/registry/tools/javascrap/PopulateNullRegistrarFieldsCommand.java b/java/google/registry/tools/javascrap/PopulateNullRegistrarFieldsCommand.java index 8cc216c3b..96105db0c 100644 --- a/java/google/registry/tools/javascrap/PopulateNullRegistrarFieldsCommand.java +++ b/java/google/registry/tools/javascrap/PopulateNullRegistrarFieldsCommand.java @@ -38,7 +38,7 @@ import java.util.Objects; public class PopulateNullRegistrarFieldsCommand extends MutatingCommand { @Override - protected void init() throws Exception { + protected void init() { for (Registrar registrar : ofy().load().type(Registrar.class).ancestor(getCrossTldKey())) { Builder changeBuilder = registrar.asBuilder(); changeBuilder.setRegistrarName( diff --git a/javatests/google/registry/backup/CommitLogCheckpointActionTest.java b/javatests/google/registry/backup/CommitLogCheckpointActionTest.java index ad7331b6c..67d179080 100644 --- a/javatests/google/registry/backup/CommitLogCheckpointActionTest.java +++ b/javatests/google/registry/backup/CommitLogCheckpointActionTest.java @@ -57,7 +57,7 @@ public class CommitLogCheckpointActionTest { CommitLogCheckpointAction task = new CommitLogCheckpointAction(); @Before - public void before() throws Exception { + public void before() { task.clock = new FakeClock(now); task.strategy = strategy; task.taskQueueUtils = new TaskQueueUtils(new Retrier(null, 1)); diff --git a/javatests/google/registry/backup/CommitLogCheckpointStrategyTest.java b/javatests/google/registry/backup/CommitLogCheckpointStrategyTest.java index 9ca27ce67..ce91a46a9 100644 --- a/javatests/google/registry/backup/CommitLogCheckpointStrategyTest.java +++ b/javatests/google/registry/backup/CommitLogCheckpointStrategyTest.java @@ -83,7 +83,7 @@ public class CommitLogCheckpointStrategyTest { } @Before - public void before() throws Exception { + public void before() { strategy.clock = clock; strategy.ofy = ofy; @@ -100,13 +100,13 @@ public class CommitLogCheckpointStrategyTest { } @Test - public void test_readBucketTimestamps_noCommitLogs() throws Exception { + public void test_readBucketTimestamps_noCommitLogs() { assertThat(strategy.readBucketTimestamps()) .containsExactly(1, START_OF_TIME, 2, START_OF_TIME, 3, START_OF_TIME); } @Test - public void test_readBucketTimestamps_withSomeCommitLogs() throws Exception { + public void test_readBucketTimestamps_withSomeCommitLogs() { DateTime startTime = clock.nowUtc(); writeCommitLogToBucket(1); clock.advanceOneMilli(); @@ -116,7 +116,7 @@ public class CommitLogCheckpointStrategyTest { } @Test - public void test_readBucketTimestamps_againAfterUpdate_reflectsUpdate() throws Exception { + public void test_readBucketTimestamps_againAfterUpdate_reflectsUpdate() { DateTime firstTime = clock.nowUtc(); writeCommitLogToBucket(1); writeCommitLogToBucket(2); diff --git a/javatests/google/registry/backup/DeleteOldCommitLogsActionTest.java b/javatests/google/registry/backup/DeleteOldCommitLogsActionTest.java index 67d8a09b4..fb9ce8e00 100644 --- a/javatests/google/registry/backup/DeleteOldCommitLogsActionTest.java +++ b/javatests/google/registry/backup/DeleteOldCommitLogsActionTest.java @@ -48,7 +48,7 @@ public class DeleteOldCommitLogsActionTest public final InjectRule inject = new InjectRule(); @Before - public void setup() throws Exception { + public void setup() { inject.setStaticField(Ofy.class, "clock", clock); action = new DeleteOldCommitLogsAction(); action.mrRunner = makeDefaultRunner(); diff --git a/javatests/google/registry/backup/GcsDiffFileListerTest.java b/javatests/google/registry/backup/GcsDiffFileListerTest.java index 86f843694..48a408bf6 100644 --- a/javatests/google/registry/backup/GcsDiffFileListerTest.java +++ b/javatests/google/registry/backup/GcsDiffFileListerTest.java @@ -119,7 +119,7 @@ public class GcsDiffFileListerTest { } @Test - public void testList_patchesHoles() throws Exception { + public void testList_patchesHoles() { // Fake out the GCS list() method to return only the first and last file. // We can't use Mockito.spy() because GcsService's impl is final. diffLister.gcsService = (GcsService) newProxyInstance( @@ -135,7 +135,7 @@ public class GcsDiffFileListerTest { boolean called = false; @Override - public Iterator call() throws Exception { + public Iterator call() { try { return called ? null : Iterators.forArray( new ListItem.Builder() @@ -181,7 +181,7 @@ public class GcsDiffFileListerTest { } @Test - public void testList_boundaries() throws Exception { + public void testList_boundaries() { assertThat(listDiffFiles(now.minusMinutes(4), now)) .containsExactly( now.minusMinutes(4), diff --git a/javatests/google/registry/batch/DeleteContactsAndHostsActionTest.java b/javatests/google/registry/batch/DeleteContactsAndHostsActionTest.java index 712c0e06d..48ca2c8bd 100644 --- a/javatests/google/registry/batch/DeleteContactsAndHostsActionTest.java +++ b/javatests/google/registry/batch/DeleteContactsAndHostsActionTest.java @@ -133,7 +133,7 @@ public class DeleteContactsAndHostsActionTest } @Before - public void setup() throws Exception { + public void setup() { enqueuer = new AsyncFlowEnqueuer( getQueue(QUEUE_ASYNC_DELETE), diff --git a/javatests/google/registry/batch/DeleteProberDataActionTest.java b/javatests/google/registry/batch/DeleteProberDataActionTest.java index a1e02ef23..3997e7673 100644 --- a/javatests/google/registry/batch/DeleteProberDataActionTest.java +++ b/javatests/google/registry/batch/DeleteProberDataActionTest.java @@ -129,7 +129,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase ofy().save().entity(Cursor.createGlobal(RECURRING_BILLING, cursorTime))); } @@ -111,7 +111,7 @@ public class ExpandRecurringBillingEventsActionTest ofy().clearSessionCache(); } - void assertCursorAt(DateTime expectedCursorTime) throws Exception { + void assertCursorAt(DateTime expectedCursorTime) { Cursor cursor = ofy().load().key(Cursor.createGlobalKey(RECURRING_BILLING)).now(); assertThat(cursor).isNotNull(); assertThat(cursor.getCursorTime()).isEqualTo(expectedCursorTime); @@ -643,7 +643,7 @@ public class ExpandRecurringBillingEventsActionTest } @Test - public void testFailure_cursorAfterExecutionTime() throws Exception { + public void testFailure_cursorAfterExecutionTime() { action.cursorTimeParam = Optional.of(clock.nowUtc().plusYears(1)); IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, this::runMapreduce); @@ -653,7 +653,7 @@ public class ExpandRecurringBillingEventsActionTest } @Test - public void testFailure_cursorAtExecutionTime() throws Exception { + public void testFailure_cursorAtExecutionTime() { // The clock advances one milli on runMapreduce. action.cursorTimeParam = Optional.of(clock.nowUtc().plusMillis(1)); IllegalArgumentException thrown = diff --git a/javatests/google/registry/batch/MapreduceEntityCleanupActionTest.java b/javatests/google/registry/batch/MapreduceEntityCleanupActionTest.java index 9682f24fe..96cf714c0 100644 --- a/javatests/google/registry/batch/MapreduceEntityCleanupActionTest.java +++ b/javatests/google/registry/batch/MapreduceEntityCleanupActionTest.java @@ -98,7 +98,7 @@ public class MapreduceEntityCleanupActionTest } } - private static String createMapreduce(String jobName) throws Exception { + private static String createMapreduce(String jobName) { MapReduceJob>> mapReduceJob = new MapReduceJob<>( new MapReduceSpecification.Builder>>() @@ -215,7 +215,7 @@ public class MapreduceEntityCleanupActionTest } @Test - public void testNonexistentJobName_fails() throws Exception { + public void testNonexistentJobName_fails() { setJobName("nonexistent"); action.run(); @@ -491,7 +491,7 @@ public class MapreduceEntityCleanupActionTest } @Test - public void testJobIdAndJobName_fails() throws Exception { + public void testJobIdAndJobName_fails() { setJobIdJobNameAndDaysOld( Optional.of("jobid"), Optional.of("jobname"), Optional.empty()); @@ -504,7 +504,7 @@ public class MapreduceEntityCleanupActionTest } @Test - public void testJobIdAndDaysOld_fails() throws Exception { + public void testJobIdAndDaysOld_fails() { setJobIdJobNameAndDaysOld(Optional.of("jobid"), Optional.empty(), Optional.of(0)); action.run(); @@ -517,7 +517,7 @@ public class MapreduceEntityCleanupActionTest } @Test - public void testJobIdAndNumJobs_fails() throws Exception { + public void testJobIdAndNumJobs_fails() { action = new MapreduceEntityCleanupAction( Optional.of("jobid"), Optional.empty(), // jobName @@ -539,7 +539,7 @@ public class MapreduceEntityCleanupActionTest } @Test - public void testDeleteZeroJobs_throwsUsageError() throws Exception { + public void testDeleteZeroJobs_throwsUsageError() { new MapreduceEntityCleanupAction( Optional.empty(), // jobId Optional.empty(), // jobName diff --git a/javatests/google/registry/batch/RefreshDnsOnHostRenameActionTest.java b/javatests/google/registry/batch/RefreshDnsOnHostRenameActionTest.java index c7158d937..b6473748d 100644 --- a/javatests/google/registry/batch/RefreshDnsOnHostRenameActionTest.java +++ b/javatests/google/registry/batch/RefreshDnsOnHostRenameActionTest.java @@ -75,7 +75,7 @@ public class RefreshDnsOnHostRenameActionTest private final FakeClock clock = new FakeClock(DateTime.parse("2015-01-15T11:22:33Z")); @Before - public void setup() throws Exception { + public void setup() { createTld("tld"); enqueuer = new AsyncFlowEnqueuer( diff --git a/javatests/google/registry/beam/BigqueryTemplatePipelineTest.java b/javatests/google/registry/beam/BigqueryTemplatePipelineTest.java index 41ac386b9..5a441e77c 100644 --- a/javatests/google/registry/beam/BigqueryTemplatePipelineTest.java +++ b/javatests/google/registry/beam/BigqueryTemplatePipelineTest.java @@ -61,7 +61,7 @@ public class BigqueryTemplatePipelineTest { } @Test - public void testEndToEndPipeline() throws Exception { + public void testEndToEndPipeline() { ImmutableList inputRows = ImmutableList.of( new TableRow(), diff --git a/javatests/google/registry/bigquery/BigqueryConnectionTest.java b/javatests/google/registry/bigquery/BigqueryConnectionTest.java index 554495e46..2e7e5e7d3 100644 --- a/javatests/google/registry/bigquery/BigqueryConnectionTest.java +++ b/javatests/google/registry/bigquery/BigqueryConnectionTest.java @@ -23,7 +23,7 @@ import org.junit.runners.JUnit4; public class BigqueryConnectionTest { @Test - public void testNothing() throws Exception { + public void testNothing() { // Placeholder test class for now. // TODO(b/16569089): figure out a good way for testing our Bigquery usage overall - maybe unit // tests here, maybe end-to-end testing. diff --git a/javatests/google/registry/bigquery/BigqueryUtilsTest.java b/javatests/google/registry/bigquery/BigqueryUtilsTest.java index 06af3de7f..d54bfcf13 100644 --- a/javatests/google/registry/bigquery/BigqueryUtilsTest.java +++ b/javatests/google/registry/bigquery/BigqueryUtilsTest.java @@ -40,7 +40,7 @@ public class BigqueryUtilsTest { private static final DateTime DATE_3 = DateTime.parse("2014-07-17T20:35:42.123Z"); @Test - public void test_toBigqueryTimestampString() throws Exception { + public void test_toBigqueryTimestampString() { assertThat(toBigqueryTimestampString(START_OF_TIME)).isEqualTo("1970-01-01 00:00:00.000"); assertThat(toBigqueryTimestampString(DATE_0)).isEqualTo("2014-07-17 20:35:42.000"); assertThat(toBigqueryTimestampString(DATE_1)).isEqualTo("2014-07-17 20:35:42.100"); @@ -50,7 +50,7 @@ public class BigqueryUtilsTest { } @Test - public void test_toBigqueryTimestampString_convertsToUtc() throws Exception { + public void test_toBigqueryTimestampString_convertsToUtc() { assertThat(toBigqueryTimestampString(START_OF_TIME.withZone(DateTimeZone.forOffsetHours(5)))) .isEqualTo("1970-01-01 00:00:00.000"); assertThat(toBigqueryTimestampString(DateTime.parse("1970-01-01T00:00:00-0500"))) @@ -58,13 +58,13 @@ public class BigqueryUtilsTest { } @Test - public void test_fromBigqueryTimestampString_startAndEndOfTime() throws Exception { + public void test_fromBigqueryTimestampString_startAndEndOfTime() { assertThat(fromBigqueryTimestampString("1970-01-01 00:00:00 UTC")).isEqualTo(START_OF_TIME); assertThat(fromBigqueryTimestampString("294247-01-10 04:00:54.775 UTC")).isEqualTo(END_OF_TIME); } @Test - public void test_fromBigqueryTimestampString_trailingZerosOkay() throws Exception { + public void test_fromBigqueryTimestampString_trailingZerosOkay() { assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42 UTC")).isEqualTo(DATE_0); assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42.0 UTC")).isEqualTo(DATE_0); assertThat(fromBigqueryTimestampString("2014-07-17 20:35:42.00 UTC")).isEqualTo(DATE_0); @@ -78,27 +78,27 @@ public class BigqueryUtilsTest { } @Test - public void testFailure_fromBigqueryTimestampString_nonUtcTimeZone() throws Exception { + public void testFailure_fromBigqueryTimestampString_nonUtcTimeZone() { assertThrows( IllegalArgumentException.class, () -> fromBigqueryTimestampString("2014-01-01 01:01:01 +05:00")); } @Test - public void testFailure_fromBigqueryTimestampString_noTimeZone() throws Exception { + public void testFailure_fromBigqueryTimestampString_noTimeZone() { assertThrows( IllegalArgumentException.class, () -> fromBigqueryTimestampString("2014-01-01 01:01:01")); } @Test - public void testFailure_fromBigqueryTimestampString_tooManyMillisecondDigits() throws Exception { + public void testFailure_fromBigqueryTimestampString_tooManyMillisecondDigits() { assertThrows( IllegalArgumentException.class, () -> fromBigqueryTimestampString("2014-01-01 01:01:01.1234 UTC")); } @Test - public void test_toBigqueryTimestamp_timeunitConversion() throws Exception { + public void test_toBigqueryTimestamp_timeunitConversion() { assertThat(toBigqueryTimestamp(1234567890L, TimeUnit.SECONDS)) .isEqualTo("1234567890.000000"); assertThat(toBigqueryTimestamp(1234567890123L, TimeUnit.MILLISECONDS)) @@ -110,14 +110,14 @@ public class BigqueryUtilsTest { } @Test - public void test_toBigqueryTimestamp_timeunitConversionForZero() throws Exception { + public void test_toBigqueryTimestamp_timeunitConversionForZero() { assertThat(toBigqueryTimestamp(0L, TimeUnit.SECONDS)).isEqualTo("0.000000"); assertThat(toBigqueryTimestamp(0L, TimeUnit.MILLISECONDS)).isEqualTo("0.000000"); assertThat(toBigqueryTimestamp(0L, TimeUnit.MICROSECONDS)).isEqualTo("0.000000"); } @Test - public void test_toBigqueryTimestamp_datetimeConversion() throws Exception { + public void test_toBigqueryTimestamp_datetimeConversion() { assertThat(toBigqueryTimestamp(START_OF_TIME)).isEqualTo("0.000000"); assertThat(toBigqueryTimestamp(DATE_0)).isEqualTo("1405629342.000000"); assertThat(toBigqueryTimestamp(DATE_1)).isEqualTo("1405629342.100000"); @@ -127,18 +127,18 @@ public class BigqueryUtilsTest { } @Test - public void test_toJobReferenceString_normalSucceeds() throws Exception { + public void test_toJobReferenceString_normalSucceeds() { assertThat(toJobReferenceString(new JobReference().setProjectId("foo").setJobId("bar"))) .isEqualTo("foo:bar"); } @Test - public void test_toJobReferenceString_emptyReferenceSucceeds() throws Exception { + public void test_toJobReferenceString_emptyReferenceSucceeds() { assertThat(toJobReferenceString(new JobReference())).isEqualTo("null:null"); } @Test - public void test_toJobReferenceString_nullThrowsNpe() throws Exception { + public void test_toJobReferenceString_nullThrowsNpe() { assertThrows(NullPointerException.class, () -> toJobReferenceString(null)); } } diff --git a/javatests/google/registry/config/RegistryEnvironmentTest.java b/javatests/google/registry/config/RegistryEnvironmentTest.java index 95cf4351a..b9b812c7e 100644 --- a/javatests/google/registry/config/RegistryEnvironmentTest.java +++ b/javatests/google/registry/config/RegistryEnvironmentTest.java @@ -23,7 +23,7 @@ import org.junit.runners.JUnit4; public class RegistryEnvironmentTest { @Test - public void testGet() throws Exception { + public void testGet() { RegistryEnvironment.get(); } } diff --git a/javatests/google/registry/cron/TldFanoutActionTest.java b/javatests/google/registry/cron/TldFanoutActionTest.java index e747a95ec..479eef54a 100644 --- a/javatests/google/registry/cron/TldFanoutActionTest.java +++ b/javatests/google/registry/cron/TldFanoutActionTest.java @@ -76,7 +76,7 @@ public class TldFanoutActionTest { return params.build(); } - private void run(ImmutableListMultimap params) throws Exception { + private void run(ImmutableListMultimap params) { TldFanoutAction action = new TldFanoutAction(); action.params = params; action.endpoint = getLast(params.get("endpoint")); @@ -94,7 +94,7 @@ public class TldFanoutActionTest { } @Before - public void before() throws Exception { + public void before() { createTlds("com", "net", "org", "example"); persistResource(Registry.get("example").asBuilder().setTldType(TldType.TEST).build()); } @@ -126,7 +126,7 @@ public class TldFanoutActionTest { } @Test - public void testFailure_noTlds() throws Exception { + public void testFailure_noTlds() { assertThrows(IllegalArgumentException.class, () -> run(getParamsMap())); } @@ -188,7 +188,7 @@ public class TldFanoutActionTest { } @Test - public void testFailure_runInEmptyAndTest() throws Exception { + public void testFailure_runInEmptyAndTest() { assertThrows( IllegalArgumentException.class, () -> @@ -199,7 +199,7 @@ public class TldFanoutActionTest { } @Test - public void testFailure_runInEmptyAndReal() throws Exception { + public void testFailure_runInEmptyAndReal() { assertThrows( IllegalArgumentException.class, () -> @@ -210,7 +210,7 @@ public class TldFanoutActionTest { } @Test - public void testFailure_runInEmptyAndExclude() throws Exception { + public void testFailure_runInEmptyAndExclude() { assertThrows( IllegalArgumentException.class, () -> diff --git a/javatests/google/registry/dns/DnsInjectionTest.java b/javatests/google/registry/dns/DnsInjectionTest.java index 4033390ea..e2f4c689c 100644 --- a/javatests/google/registry/dns/DnsInjectionTest.java +++ b/javatests/google/registry/dns/DnsInjectionTest.java @@ -92,7 +92,7 @@ public final class DnsInjectionTest { } @Test - public void testRefreshDns_missingDomain_throwsNotFound() throws Exception { + public void testRefreshDns_missingDomain_throwsNotFound() { when(req.getParameter("type")).thenReturn("domain"); when(req.getParameter("name")).thenReturn("example.lol"); NotFoundException thrown = @@ -110,7 +110,7 @@ public final class DnsInjectionTest { } @Test - public void testRefreshDns_missingHost_throwsNotFound() throws Exception { + public void testRefreshDns_missingHost_throwsNotFound() { when(req.getParameter("type")).thenReturn("host"); when(req.getParameter("name")).thenReturn("ns1.example.lol"); NotFoundException thrown = diff --git a/javatests/google/registry/dns/DnsQueueTest.java b/javatests/google/registry/dns/DnsQueueTest.java index 6328cab88..c6fef8c56 100644 --- a/javatests/google/registry/dns/DnsQueueTest.java +++ b/javatests/google/registry/dns/DnsQueueTest.java @@ -62,7 +62,7 @@ public class DnsQueueTest { } @Test - public void test_addHostRefreshTask_failsOnUnknownTld() throws Exception { + public void test_addHostRefreshTask_failsOnUnknownTld() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -92,7 +92,7 @@ public class DnsQueueTest { } @Test - public void test_addDomainRefreshTask_failsOnUnknownTld() throws Exception { + public void test_addDomainRefreshTask_failsOnUnknownTld() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, diff --git a/javatests/google/registry/dns/PublishDnsUpdatesActionTest.java b/javatests/google/registry/dns/PublishDnsUpdatesActionTest.java index cd6708386..b99e5978c 100644 --- a/javatests/google/registry/dns/PublishDnsUpdatesActionTest.java +++ b/javatests/google/registry/dns/PublishDnsUpdatesActionTest.java @@ -70,7 +70,7 @@ public class PublishDnsUpdatesActionTest { private PublishDnsUpdatesAction action; @Before - public void setUp() throws Exception { + public void setUp() { inject.setStaticField(Ofy.class, "clock", clock); createTld("xn--q9jyb4c"); persistResource( @@ -86,7 +86,7 @@ public class PublishDnsUpdatesActionTest { clock.advanceOneMilli(); } - private PublishDnsUpdatesAction createAction(String tld) throws Exception { + private PublishDnsUpdatesAction createAction(String tld) { PublishDnsUpdatesAction action = new PublishDnsUpdatesAction(); action.timeout = Duration.standardSeconds(10); action.tld = tld; diff --git a/javatests/google/registry/dns/ReadDnsQueueActionTest.java b/javatests/google/registry/dns/ReadDnsQueueActionTest.java index ed6237879..52116fbe1 100644 --- a/javatests/google/registry/dns/ReadDnsQueueActionTest.java +++ b/javatests/google/registry/dns/ReadDnsQueueActionTest.java @@ -91,7 +91,7 @@ public class ReadDnsQueueActionTest { .build(); @Before - public void before() throws Exception { + public void before() { // Because of b/73372999 - the FakeClock can't be in the past, or the TaskQueues stop working. // To make sure it's never in the past, we set the date far-far into the future clock.setTo(DateTime.parse("3000-01-01TZ")); @@ -115,7 +115,7 @@ public class ReadDnsQueueActionTest { dnsQueue = DnsQueue.createForTesting(clock); } - private void run() throws Exception { + private void run() { ReadDnsQueueAction action = new ReadDnsQueueAction(); action.tldUpdateBatchSize = TEST_TLD_UPDATE_BATCH_SIZE; action.requestedMaximumDuration = Duration.standardSeconds(10); diff --git a/javatests/google/registry/dns/RefreshDnsActionTest.java b/javatests/google/registry/dns/RefreshDnsActionTest.java index 1dd224749..3d882ffb6 100644 --- a/javatests/google/registry/dns/RefreshDnsActionTest.java +++ b/javatests/google/registry/dns/RefreshDnsActionTest.java @@ -63,7 +63,7 @@ public class RefreshDnsActionTest { } @Test - public void testSuccess_host() throws Exception { + public void testSuccess_host() { DomainResource domain = persistActiveDomain("example.xn--q9jyb4c"); persistActiveSubordinateHost("ns1.example.xn--q9jyb4c", domain); run(TargetType.HOST, "ns1.example.xn--q9jyb4c"); @@ -72,7 +72,7 @@ public class RefreshDnsActionTest { } @Test - public void testSuccess_externalHostNotEnqueued() throws Exception { + public void testSuccess_externalHostNotEnqueued() { persistActiveDomain("example.xn--q9jyb4c"); persistActiveHost("ns1.example.xn--q9jyb4c"); BadRequestException thrown = @@ -91,7 +91,7 @@ public class RefreshDnsActionTest { } @Test - public void testSuccess_domain() throws Exception { + public void testSuccess_domain() { persistActiveDomain("example.xn--q9jyb4c"); run(TargetType.DOMAIN, "example.xn--q9jyb4c"); verify(dnsQueue).addDomainRefreshTask("example.xn--q9jyb4c"); @@ -99,17 +99,17 @@ public class RefreshDnsActionTest { } @Test - public void testFailure_unqualifiedName() throws Exception { + public void testFailure_unqualifiedName() { assertThrows(BadRequestException.class, () -> run(TargetType.DOMAIN, "example")); } @Test - public void testFailure_hostDoesNotExist() throws Exception { + public void testFailure_hostDoesNotExist() { assertThrows(NotFoundException.class, () -> run(TargetType.HOST, "ns1.example.xn--q9jyb4c")); } @Test - public void testFailure_domainDoesNotExist() throws Exception { + public void testFailure_domainDoesNotExist() { assertThrows(NotFoundException.class, () -> run(TargetType.DOMAIN, "example.xn--q9jyb4c")); } } diff --git a/javatests/google/registry/dns/writer/clouddns/CloudDnsWriterTest.java b/javatests/google/registry/dns/writer/clouddns/CloudDnsWriterTest.java index 075ff23a3..0f40bcf5d 100644 --- a/javatests/google/registry/dns/writer/clouddns/CloudDnsWriterTest.java +++ b/javatests/google/registry/dns/writer/clouddns/CloudDnsWriterTest.java @@ -159,7 +159,7 @@ public class CloudDnsWriterTest { }); } - private void verifyZone(ImmutableSet expectedRecords) throws Exception { + private void verifyZone(ImmutableSet expectedRecords) { // Trigger zone changes writer.commit(); @@ -425,7 +425,7 @@ public class CloudDnsWriterTest { @Test @SuppressWarnings("unchecked") - public void retryMutateZoneOnError() throws Exception { + public void retryMutateZoneOnError() { CloudDnsWriter spyWriter = spy(writer); // First call - throw. Second call - do nothing. doThrow(ZoneStateException.class).doNothing().when(spyWriter).mutateZone(Matchers.any()); diff --git a/javatests/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java b/javatests/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java index 2ee7312af..91a8c0b20 100644 --- a/javatests/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java +++ b/javatests/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java @@ -121,7 +121,7 @@ public class DnsUpdateWriterTest { } @Test - public void testPublishAtomic_noCommit() throws Exception { + public void testPublishAtomic_noCommit() { HostResource host1 = persistActiveHost("ns.example1.tld"); DomainResource domain1 = persistActiveDomain("example1.tld") diff --git a/javatests/google/registry/export/BigqueryPollJobActionTest.java b/javatests/google/registry/export/BigqueryPollJobActionTest.java index 8ccebbacc..43355eb98 100644 --- a/javatests/google/registry/export/BigqueryPollJobActionTest.java +++ b/javatests/google/registry/export/BigqueryPollJobActionTest.java @@ -93,7 +93,7 @@ public class BigqueryPollJobActionTest { LoggerConfig.getConfig(BigqueryPollJobAction.class).addHandler(logHandler); } - private static TaskMatcher newPollJobTaskMatcher(String method) throws Exception { + private static TaskMatcher newPollJobTaskMatcher(String method) { return new TaskMatcher() .method(method) .url(BigqueryPollJobAction.PATH) diff --git a/javatests/google/registry/export/CheckSnapshotActionTest.java b/javatests/google/registry/export/CheckSnapshotActionTest.java index d75f62fa9..ef89939fc 100644 --- a/javatests/google/registry/export/CheckSnapshotActionTest.java +++ b/javatests/google/registry/export/CheckSnapshotActionTest.java @@ -62,7 +62,7 @@ public class CheckSnapshotActionTest { private final CheckSnapshotAction action = new CheckSnapshotAction(); @Before - public void before() throws Exception { + public void before() { inject.setStaticField(DatastoreBackupInfo.class, "clock", clock); action.requestMethod = Method.POST; action.snapshotName = "some_backup"; @@ -119,7 +119,7 @@ public class CheckSnapshotActionTest { } @Test - public void testPost_forPendingBackup_returnsNotModified() throws Exception { + public void testPost_forPendingBackup_returnsNotModified() { setPendingBackup(); NotModifiedException thrown = assertThrows(NotModifiedException.class, action::run); @@ -127,7 +127,7 @@ public class CheckSnapshotActionTest { } @Test - public void testPost_forStalePendingBackupBackup_returnsNoContent() throws Exception { + public void testPost_forStalePendingBackupBackup_returnsNoContent() { setPendingBackup(); when(backupService.findByName("some_backup")).thenReturn(backupInfo); @@ -182,7 +182,7 @@ public class CheckSnapshotActionTest { } @Test - public void testPost_forBadBackup_returnsBadRequest() throws Exception { + public void testPost_forBadBackup_returnsBadRequest() { when(backupService.findByName("some_backup")) .thenThrow(new IllegalArgumentException("No backup found")); @@ -191,7 +191,7 @@ public class CheckSnapshotActionTest { } @Test - public void testGet_returnsInformation() throws Exception { + public void testGet_returnsInformation() { action.requestMethod = Method.GET; action.run(); @@ -211,7 +211,7 @@ public class CheckSnapshotActionTest { } @Test - public void testGet_forBadBackup_returnsError() throws Exception { + public void testGet_forBadBackup_returnsError() { action.requestMethod = Method.GET; when(backupService.findByName("some_backup")) .thenThrow(new IllegalArgumentException("No backup found")); diff --git a/javatests/google/registry/export/DatastoreBackupInfoTest.java b/javatests/google/registry/export/DatastoreBackupInfoTest.java index d885cbcfa..504d48340 100644 --- a/javatests/google/registry/export/DatastoreBackupInfoTest.java +++ b/javatests/google/registry/export/DatastoreBackupInfoTest.java @@ -54,7 +54,7 @@ public class DatastoreBackupInfoTest { private Entity backupEntity; // Can't initialize until AppEngineRule has set up Datastore. @Before - public void before() throws Exception { + public void before() { inject.setStaticField(DatastoreBackupInfo.class, "clock", clock); backupEntity = new Entity("_unused_"); backupEntity.setProperty("name", "backup1"); @@ -101,28 +101,28 @@ public class DatastoreBackupInfoTest { } @Test - public void testFailure_missingName() throws Exception { + public void testFailure_missingName() { backupEntity.removeProperty("name"); assertThrows( NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity))); } @Test - public void testFailure_missingKinds() throws Exception { + public void testFailure_missingKinds() { backupEntity.removeProperty("kinds"); assertThrows( NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity))); } @Test - public void testFailure_missingStartTime() throws Exception { + public void testFailure_missingStartTime() { backupEntity.removeProperty("start_time"); assertThrows( NullPointerException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity))); } @Test - public void testFailure_badGcsFilenameFormat() throws Exception { + public void testFailure_badGcsFilenameFormat() { backupEntity.setProperty("gs_handle", new Text("foo")); assertThrows( IllegalArgumentException.class, () -> new DatastoreBackupInfo(persistEntity(backupEntity))); diff --git a/javatests/google/registry/export/DatastoreBackupServiceTest.java b/javatests/google/registry/export/DatastoreBackupServiceTest.java index 6bc4f0e22..8fe56e502 100644 --- a/javatests/google/registry/export/DatastoreBackupServiceTest.java +++ b/javatests/google/registry/export/DatastoreBackupServiceTest.java @@ -57,7 +57,7 @@ public class DatastoreBackupServiceTest { private final DatastoreBackupService backupService = DatastoreBackupService.get(); @Before - public void before() throws Exception { + public void before() { inject.setStaticField(DatastoreBackupService.class, "modulesService", modulesService); when(modulesService.getVersionHostname("default", "ah-builtin-python-bundle")) .thenReturn("ah-builtin-python-bundle.default.localhost"); @@ -95,7 +95,7 @@ public class DatastoreBackupServiceTest { } @Test - public void testSuccess_findAllByNamePrefix() throws Exception { + public void testSuccess_findAllByNamePrefix() { assertThat( transform(backupService.findAllByNamePrefix("backupA"), DatastoreBackupInfo::getName)) .containsExactly("backupA1", "backupA2", "backupA3"); @@ -109,18 +109,18 @@ public class DatastoreBackupServiceTest { } @Test - public void testSuccess_findByName() throws Exception { + public void testSuccess_findByName() { assertThat(backupService.findByName("backupA1").getName()).isEqualTo("backupA1"); assertThat(backupService.findByName("backupB4").getName()).isEqualTo("backupB42"); } @Test - public void testFailure_findByName_multipleMatchingBackups() throws Exception { + public void testFailure_findByName_multipleMatchingBackups() { assertThrows(IllegalArgumentException.class, () -> backupService.findByName("backupA")); } @Test - public void testFailure_findByName_noMatchingBackups() throws Exception { + public void testFailure_findByName_noMatchingBackups() { assertThrows(IllegalArgumentException.class, () -> backupService.findByName("backupX")); } } diff --git a/javatests/google/registry/export/ExportConstantsTest.java b/javatests/google/registry/export/ExportConstantsTest.java index aaccc9639..9cdf33ffd 100644 --- a/javatests/google/registry/export/ExportConstantsTest.java +++ b/javatests/google/registry/export/ExportConstantsTest.java @@ -53,17 +53,17 @@ public class ExportConstantsTest { ""); @Test - public void testBackupKinds_matchGoldenBackupKindsFile() throws Exception { + public void testBackupKinds_matchGoldenBackupKindsFile() { checkKindsMatchGoldenFile("backed-up", GOLDEN_BACKUP_KINDS_FILENAME, getBackupKinds()); } @Test - public void testReportingKinds_matchGoldenReportingKindsFile() throws Exception { + public void testReportingKinds_matchGoldenReportingKindsFile() { checkKindsMatchGoldenFile("reporting", GOLDEN_REPORTING_KINDS_FILENAME, getReportingKinds()); } @Test - public void testReportingKinds_areSubsetOfBackupKinds() throws Exception { + public void testReportingKinds_areSubsetOfBackupKinds() { assertThat(getBackupKinds()).containsAllIn(getReportingKinds()); } diff --git a/javatests/google/registry/export/ExportReservedTermsActionTest.java b/javatests/google/registry/export/ExportReservedTermsActionTest.java index a459af9c0..81175cf24 100644 --- a/javatests/google/registry/export/ExportReservedTermsActionTest.java +++ b/javatests/google/registry/export/ExportReservedTermsActionTest.java @@ -95,7 +95,7 @@ public class ExportReservedTermsActionTest { } @Test - public void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() throws Exception { + public void test_uploadFileToDrive_doesNothingIfReservedListsNotConfigured() { persistResource( Registry.get("tld") .asBuilder() @@ -108,7 +108,7 @@ public class ExportReservedTermsActionTest { } @Test - public void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() throws Exception { + public void test_uploadFileToDrive_doesNothingWhenDriveFolderIdIsNull() { persistResource(Registry.get("tld").asBuilder().setDriveFolderId(null).build()); runAction("tld"); verify(response).setStatus(SC_OK); @@ -129,7 +129,7 @@ public class ExportReservedTermsActionTest { } @Test - public void test_uploadFileToDrive_failsWhenTldDoesntExist() throws Exception { + public void test_uploadFileToDrive_failsWhenTldDoesntExist() { RuntimeException thrown = assertThrows(RuntimeException.class, () -> runAction("fakeTld")); verify(response).setStatus(SC_INTERNAL_SERVER_ERROR); assertThat(thrown) diff --git a/javatests/google/registry/export/ExportSnapshotActionTest.java b/javatests/google/registry/export/ExportSnapshotActionTest.java index e5ae3c060..4ba8c532f 100644 --- a/javatests/google/registry/export/ExportSnapshotActionTest.java +++ b/javatests/google/registry/export/ExportSnapshotActionTest.java @@ -46,7 +46,7 @@ public class ExportSnapshotActionTest { private final ExportSnapshotAction action = new ExportSnapshotAction(); @Before - public void before() throws Exception { + public void before() { action.clock = clock; action.backupService = backupService; action.response = response; diff --git a/javatests/google/registry/export/LoadSnapshotActionTest.java b/javatests/google/registry/export/LoadSnapshotActionTest.java index 479a66479..983612dec 100644 --- a/javatests/google/registry/export/LoadSnapshotActionTest.java +++ b/javatests/google/registry/export/LoadSnapshotActionTest.java @@ -180,7 +180,7 @@ public class LoadSnapshotActionTest { } @Test - public void testFailure_doPost_badGcsFilename() throws Exception { + public void testFailure_doPost_badGcsFilename() { action.snapshotFile = "gs://bucket/snapshot"; BadRequestException thrown = assertThrows(BadRequestException.class, action::run); assertThat(thrown) diff --git a/javatests/google/registry/export/SyncGroupMembersActionTest.java b/javatests/google/registry/export/SyncGroupMembersActionTest.java index 0455c33e8..8b301f249 100644 --- a/javatests/google/registry/export/SyncGroupMembersActionTest.java +++ b/javatests/google/registry/export/SyncGroupMembersActionTest.java @@ -98,7 +98,7 @@ public class SyncGroupMembersActionTest { } @Test - public void test_doPost_noneModified() throws Exception { + public void test_doPost_noneModified() { persistResource( loadRegistrar("NewRegistrar").asBuilder().setContactsRequireSyncing(false).build()); persistResource( diff --git a/javatests/google/registry/export/sheet/SyncRegistrarsSheetActionTest.java b/javatests/google/registry/export/sheet/SyncRegistrarsSheetActionTest.java index 7e48a081a..2da31a274 100644 --- a/javatests/google/registry/export/sheet/SyncRegistrarsSheetActionTest.java +++ b/javatests/google/registry/export/sheet/SyncRegistrarsSheetActionTest.java @@ -66,7 +66,7 @@ public class SyncRegistrarsSheetActionTest { } @Test - public void testPost_withoutParamsOrSystemProperty_dropsTask() throws Exception { + public void testPost_withoutParamsOrSystemProperty_dropsTask() { runAction(null, null); assertThat(response.getPayload()).startsWith("MISSINGNO"); verifyZeroInteractions(syncRegistrarsSheet); @@ -85,7 +85,7 @@ public class SyncRegistrarsSheetActionTest { } @Test - public void testPost_noModificationsToRegistrarEntities_doesNothing() throws Exception { + public void testPost_noModificationsToRegistrarEntities_doesNothing() { when(syncRegistrarsSheet.wereRegistrarsModified()).thenReturn(false); runAction("NewRegistrar", null); assertThat(response.getPayload()).startsWith("NOTMODIFIED"); @@ -102,7 +102,7 @@ public class SyncRegistrarsSheetActionTest { } @Test - public void testPost_failToAquireLock_servletDoesNothingAndReturns() throws Exception { + public void testPost_failToAquireLock_servletDoesNothingAndReturns() { action.lockHandler = new FakeLockHandler(false); runAction(null, "foobar"); assertThat(response.getPayload()).startsWith("LOCKED"); diff --git a/javatests/google/registry/export/sheet/SyncRegistrarsSheetTest.java b/javatests/google/registry/export/sheet/SyncRegistrarsSheetTest.java index f5d496f35..f697174c9 100644 --- a/javatests/google/registry/export/sheet/SyncRegistrarsSheetTest.java +++ b/javatests/google/registry/export/sheet/SyncRegistrarsSheetTest.java @@ -74,7 +74,7 @@ public class SyncRegistrarsSheetTest { } @Before - public void before() throws Exception { + public void before() { inject.setStaticField(Ofy.class, "clock", clock); createTld("example"); // Remove Registrar entities created by AppEngineRule. @@ -82,12 +82,12 @@ public class SyncRegistrarsSheetTest { } @Test - public void test_wereRegistrarsModified_noRegistrars_returnsFalse() throws Exception { + public void test_wereRegistrarsModified_noRegistrars_returnsFalse() { assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isFalse(); } @Test - public void test_wereRegistrarsModified_atDifferentCursorTimes() throws Exception { + public void test_wereRegistrarsModified_atDifferentCursorTimes() { persistNewRegistrar("SomeRegistrar", "Some Registrar Inc.", Registrar.Type.REAL, 8L); persistResource(Cursor.createGlobal(SYNC_REGISTRAR_SHEET, clock.nowUtc().minusHours(1))); assertThat(newSyncRegistrarsSheet().wereRegistrarsModified()).isTrue(); diff --git a/javatests/google/registry/flows/CheckApi2ActionTest.java b/javatests/google/registry/flows/CheckApi2ActionTest.java index 658738ba0..ebfa87dde 100644 --- a/javatests/google/registry/flows/CheckApi2ActionTest.java +++ b/javatests/google/registry/flows/CheckApi2ActionTest.java @@ -64,7 +64,7 @@ public class CheckApi2ActionTest { private DateTime endTime; @Before - public void init() throws Exception { + public void init() { createTld("example"); persistResource( Registry.get("example") diff --git a/javatests/google/registry/flows/CheckApiActionTest.java b/javatests/google/registry/flows/CheckApiActionTest.java index 8029d5a68..6e98c2949 100644 --- a/javatests/google/registry/flows/CheckApiActionTest.java +++ b/javatests/google/registry/flows/CheckApiActionTest.java @@ -46,7 +46,7 @@ public class CheckApiActionTest { final CheckApiAction action = new CheckApiAction(); @Before - public void init() throws Exception { + public void init() { createTld("example"); persistResource( Registry.get("example") @@ -70,42 +70,42 @@ public class CheckApiActionTest { } @Test - public void testFailure_nullDomain() throws Exception { + public void testFailure_nullDomain() { assertThat(getCheckResponse(null)).containsExactly( "status", "error", "reason", "Must supply a valid domain name on an authoritative TLD"); } @Test - public void testFailure_emptyDomain() throws Exception { + public void testFailure_emptyDomain() { assertThat(getCheckResponse("")).containsExactly( "status", "error", "reason", "Must supply a valid domain name on an authoritative TLD"); } @Test - public void testFailure_invalidDomain() throws Exception { + public void testFailure_invalidDomain() { assertThat(getCheckResponse("@#$%^")).containsExactly( "status", "error", "reason", "Must supply a valid domain name on an authoritative TLD"); } @Test - public void testFailure_singlePartDomain() throws Exception { + public void testFailure_singlePartDomain() { assertThat(getCheckResponse("foo")).containsExactly( "status", "error", "reason", "Must supply a valid domain name on an authoritative TLD"); } @Test - public void testFailure_nonExistentTld() throws Exception { + public void testFailure_nonExistentTld() { assertThat(getCheckResponse("foo.bar")).containsExactly( "status", "error", "reason", "Must supply a valid domain name on an authoritative TLD"); } @Test - public void testFailure_unauthorizedTld() throws Exception { + public void testFailure_unauthorizedTld() { createTld("foo"); persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of("foo")).build()); @@ -115,7 +115,7 @@ public class CheckApiActionTest { } @Test - public void testSuccess_availableStandard() throws Exception { + public void testSuccess_availableStandard() { assertThat(getCheckResponse("somedomain.example")).containsExactly( "status", "success", "available", true, @@ -123,7 +123,7 @@ public class CheckApiActionTest { } @Test - public void testSuccess_availableCapital() throws Exception { + public void testSuccess_availableCapital() { assertThat(getCheckResponse("SOMEDOMAIN.EXAMPLE")).containsExactly( "status", "success", "available", true, @@ -131,7 +131,7 @@ public class CheckApiActionTest { } @Test - public void testSuccess_availableUnicode() throws Exception { + public void testSuccess_availableUnicode() { assertThat(getCheckResponse("ééé.example")).containsExactly( "status", "success", "available", true, @@ -139,7 +139,7 @@ public class CheckApiActionTest { } @Test - public void testSuccess_availablePunycode() throws Exception { + public void testSuccess_availablePunycode() { assertThat(getCheckResponse("xn--9caaa.example")).containsExactly( "status", "success", "available", true, @@ -147,7 +147,7 @@ public class CheckApiActionTest { } @Test - public void testSuccess_availablePremium() throws Exception { + public void testSuccess_availablePremium() { assertThat(getCheckResponse("rich.example")).containsExactly( "status", "success", "available", true, @@ -155,7 +155,7 @@ public class CheckApiActionTest { } @Test - public void testSuccess_alreadyRegistered() throws Exception { + public void testSuccess_alreadyRegistered() { persistActiveDomain("somedomain.example"); assertThat(getCheckResponse("somedomain.example")).containsExactly( "status", "success", @@ -164,7 +164,7 @@ public class CheckApiActionTest { } @Test - public void testSuccess_reserved() throws Exception { + public void testSuccess_reserved() { assertThat(getCheckResponse("foo.example")).containsExactly( "status", "success", "available", false, diff --git a/javatests/google/registry/flows/EppCommitLogsTest.java b/javatests/google/registry/flows/EppCommitLogsTest.java index 6599bd0cc..e691621bc 100644 --- a/javatests/google/registry/flows/EppCommitLogsTest.java +++ b/javatests/google/registry/flows/EppCommitLogsTest.java @@ -60,7 +60,7 @@ public class EppCommitLogsTest extends ShardableTestCase { private EppLoader eppLoader; @Before - public void init() throws Exception { + public void init() { createTld("tld"); inject.setStaticField(Ofy.class, "clock", clock); } diff --git a/javatests/google/registry/flows/EppControllerTest.java b/javatests/google/registry/flows/EppControllerTest.java index 31ba85bb1..7c062e5df 100644 --- a/javatests/google/registry/flows/EppControllerTest.java +++ b/javatests/google/registry/flows/EppControllerTest.java @@ -133,7 +133,7 @@ public class EppControllerTest extends ShardableTestCase { } @Test - public void testHandleEppCommand_unmarshallableData_exportsMetric() throws Exception { + public void testHandleEppCommand_unmarshallableData_exportsMetric() { eppController.handleEppCommand( sessionMetadata, transportCredentials, @@ -154,7 +154,7 @@ public class EppControllerTest extends ShardableTestCase { } @Test - public void testHandleEppCommand_regularEppCommand_exportsBigQueryMetric() throws Exception { + public void testHandleEppCommand_regularEppCommand_exportsBigQueryMetric() { eppController.handleEppCommand( sessionMetadata, transportCredentials, @@ -176,7 +176,7 @@ public class EppControllerTest extends ShardableTestCase { } @Test - public void testHandleEppCommand_regularEppCommand_exportsEppMetrics() throws Exception { + public void testHandleEppCommand_regularEppCommand_exportsEppMetrics() { createTld("tld"); // Note that some of the EPP metric fields, like # of attempts and command name, are set in // FlowRunner, not EppController, and since FlowRunner is mocked out for these tests they won't @@ -202,7 +202,7 @@ public class EppControllerTest extends ShardableTestCase { } @Test - public void testHandleEppCommand_dryRunEppCommand_doesNotExportMetric() throws Exception { + public void testHandleEppCommand_dryRunEppCommand_doesNotExportMetric() { eppController.handleEppCommand( sessionMetadata, transportCredentials, diff --git a/javatests/google/registry/flows/EppLoginTlsTest.java b/javatests/google/registry/flows/EppLoginTlsTest.java index e2bbb06e1..30b9b1685 100644 --- a/javatests/google/registry/flows/EppLoginTlsTest.java +++ b/javatests/google/registry/flows/EppLoginTlsTest.java @@ -45,7 +45,7 @@ public class EppLoginTlsTest extends EppTestCase { } @Before - public void initTest() throws Exception { + public void initTest() { persistResource( loadRegistrar("NewRegistrar") .asBuilder() diff --git a/javatests/google/registry/flows/EppLoginUserTest.java b/javatests/google/registry/flows/EppLoginUserTest.java index 58e8c9363..ac06cf66f 100644 --- a/javatests/google/registry/flows/EppLoginUserTest.java +++ b/javatests/google/registry/flows/EppLoginUserTest.java @@ -41,7 +41,7 @@ public class EppLoginUserTest extends EppTestCase { .build(); @Before - public void initTest() throws Exception { + public void initTest() { User user = getUserService().getCurrentUser(); persistResource( new RegistrarContact.Builder() diff --git a/javatests/google/registry/flows/EppTestCase.java b/javatests/google/registry/flows/EppTestCase.java index 5e08d84ba..e3860292c 100644 --- a/javatests/google/registry/flows/EppTestCase.java +++ b/javatests/google/registry/flows/EppTestCase.java @@ -115,7 +115,7 @@ public class EppTestCase extends ShardableTestCase { return new CommandAsserter(inputFilename, inputSubstitutions); } - CommandAsserter assertThatLogin(String clientId, String password) throws Exception { + CommandAsserter assertThatLogin(String clientId, String password) { return assertThatCommand("login.xml", ImmutableMap.of("CLID", clientId, "PW", password)); } diff --git a/javatests/google/registry/flows/EppToolActionTest.java b/javatests/google/registry/flows/EppToolActionTest.java index f290e2a37..298229b11 100644 --- a/javatests/google/registry/flows/EppToolActionTest.java +++ b/javatests/google/registry/flows/EppToolActionTest.java @@ -50,22 +50,22 @@ public class EppToolActionTest { } @Test - public void testDryRunAndSuperuser() throws Exception { + public void testDryRunAndSuperuser() { doTest(true, true); } @Test - public void testDryRun() throws Exception { + public void testDryRun() { doTest(true, false); } @Test - public void testSuperuser() throws Exception { + public void testSuperuser() { doTest(false, true); } @Test - public void testNeitherDryRunNorSuperuser() throws Exception { + public void testNeitherDryRunNorSuperuser() { doTest(false, false); } } diff --git a/javatests/google/registry/flows/EppXmlTransformerTest.java b/javatests/google/registry/flows/EppXmlTransformerTest.java index e754ce098..87d0428ea 100644 --- a/javatests/google/registry/flows/EppXmlTransformerTest.java +++ b/javatests/google/registry/flows/EppXmlTransformerTest.java @@ -38,7 +38,7 @@ public class EppXmlTransformerTest extends ShardableTestCase { } @Test - public void testUnmarshalingWrongClassThrows() throws Exception { + public void testUnmarshalingWrongClassThrows() { assertThrows( ClassCastException.class, () -> diff --git a/javatests/google/registry/flows/ExtensionManagerTest.java b/javatests/google/registry/flows/ExtensionManagerTest.java index 58f9d0eb9..666db7fa3 100644 --- a/javatests/google/registry/flows/ExtensionManagerTest.java +++ b/javatests/google/registry/flows/ExtensionManagerTest.java @@ -53,7 +53,7 @@ public class ExtensionManagerTest { .build(); @Test - public void testDuplicateExtensionsForbidden() throws Exception { + public void testDuplicateExtensionsForbidden() { ExtensionManager manager = new TestInstanceBuilder() .setEppRequestSource(EppRequestSource.TOOL) @@ -90,7 +90,7 @@ public class ExtensionManagerTest { } @Test - public void testBlacklistedExtensions_forbiddenWhenUndeclared() throws Exception { + public void testBlacklistedExtensions_forbiddenWhenUndeclared() { ExtensionManager manager = new TestInstanceBuilder() .setEppRequestSource(EppRequestSource.TOOL) @@ -128,7 +128,7 @@ public class ExtensionManagerTest { } @Test - public void testMetadataExtension_forbiddenWhenNotToolSource() throws Exception { + public void testMetadataExtension_forbiddenWhenNotToolSource() { ExtensionManager manager = new TestInstanceBuilder() .setEppRequestSource(EppRequestSource.CONSOLE) @@ -154,7 +154,7 @@ public class ExtensionManagerTest { } @Test - public void testSuperuserExtension_forbiddenWhenNotSuperuser() throws Exception { + public void testSuperuserExtension_forbiddenWhenNotSuperuser() { ExtensionManager manager = new TestInstanceBuilder() .setEppRequestSource(EppRequestSource.TOOL) @@ -169,7 +169,7 @@ public class ExtensionManagerTest { } @Test - public void testSuperuserExtension_forbiddenWhenNotToolSource() throws Exception { + public void testSuperuserExtension_forbiddenWhenNotToolSource() { ExtensionManager manager = new TestInstanceBuilder() .setEppRequestSource(EppRequestSource.CONSOLE) @@ -184,7 +184,7 @@ public class ExtensionManagerTest { } @Test - public void testUnimplementedExtensionsForbidden() throws Exception { + public void testUnimplementedExtensionsForbidden() { ExtensionManager manager = new TestInstanceBuilder() .setEppRequestSource(EppRequestSource.TOOL) diff --git a/javatests/google/registry/flows/FlowReporterTest.java b/javatests/google/registry/flows/FlowReporterTest.java index 491b79a4b..9def9d6c7 100644 --- a/javatests/google/registry/flows/FlowReporterTest.java +++ b/javatests/google/registry/flows/FlowReporterTest.java @@ -44,7 +44,7 @@ public class FlowReporterTest extends ShardableTestCase { static class TestCommandFlow implements Flow { @Override - public ResponseOrGreeting run() throws EppException { + public ResponseOrGreeting run() { return mock(EppResponse.class); } } @@ -52,7 +52,7 @@ public class FlowReporterTest extends ShardableTestCase { @ReportingSpec(ActivityReportField.CONTACT_CHECK) static class TestReportingSpecCommandFlow implements Flow { @Override - public ResponseOrGreeting run() throws EppException { + public ResponseOrGreeting run() { return mock(EppResponse.class); } } diff --git a/javatests/google/registry/flows/FlowRunnerTest.java b/javatests/google/registry/flows/FlowRunnerTest.java index 420aed7fa..1995be773 100644 --- a/javatests/google/registry/flows/FlowRunnerTest.java +++ b/javatests/google/registry/flows/FlowRunnerTest.java @@ -61,7 +61,7 @@ public class FlowRunnerTest extends ShardableTestCase { static class TestCommandFlow implements Flow { @Override - public ResponseOrGreeting run() throws EppException { + public ResponseOrGreeting run() { return mock(EppResponse.class); } } diff --git a/javatests/google/registry/flows/FlowTestCase.java b/javatests/google/registry/flows/FlowTestCase.java index 7acc28150..b91869cd4 100644 --- a/javatests/google/registry/flows/FlowTestCase.java +++ b/javatests/google/registry/flows/FlowTestCase.java @@ -102,7 +102,7 @@ public abstract class FlowTestCase extends ShardableTestCase { private EppMetric.Builder eppMetricBuilder; @Before - public void init() throws Exception { + public void init() { sessionMetadata = new HttpSessionMetadata(new FakeHttpSession()); sessionMetadata.setClientId("TheRegistrar"); sessionMetadata.setServiceExtensionUris(ProtocolDefinition.getVisibleServiceExtensionUris()); @@ -167,11 +167,11 @@ public abstract class FlowTestCase extends ShardableTestCase { } } - protected void assertNoHistory() throws Exception { + protected void assertNoHistory() { assertThat(ofy().load().type(HistoryEntry.class)).isEmpty(); } - public T getOnlyGlobalResource(Class clazz) throws Exception { + public T getOnlyGlobalResource(Class clazz) { return Iterables.getOnlyElement(ofy().load().type(clazz)); } @@ -262,8 +262,8 @@ public abstract class FlowTestCase extends ShardableTestCase { } /** Assert that the list matches all the poll messages in the fake Datastore. */ - public void assertPollMessagesHelper(Iterable pollMessages, PollMessage... expected) - throws Exception { + public void assertPollMessagesHelper( + Iterable pollMessages, PollMessage... expected) { // Ordering is irrelevant but duplicates should be considered independently. assertThat( Streams.stream(pollMessages).map(POLL_MESSAGE_ID_STRIPPER).collect(toImmutableList())) diff --git a/javatests/google/registry/flows/ResourceFlowTestCase.java b/javatests/google/registry/flows/ResourceFlowTestCase.java index 4108ca5f4..f754a87ca 100644 --- a/javatests/google/registry/flows/ResourceFlowTestCase.java +++ b/javatests/google/registry/flows/ResourceFlowTestCase.java @@ -134,7 +134,7 @@ public abstract class ResourceFlowTestCase } /** Adds a contact that has a pending transfer on it from TheRegistrar to NewRegistrar. */ - protected void setupContactWithPendingTransfer() throws Exception { + protected void setupContactWithPendingTransfer() { contact = persistContactWithPendingTransfer( newContactResource("sh8013"), TRANSFER_REQUEST_TIME, diff --git a/javatests/google/registry/flows/contact/ContactTransferQueryFlowTest.java b/javatests/google/registry/flows/contact/ContactTransferQueryFlowTest.java index b276d0e65..634203424 100644 --- a/javatests/google/registry/flows/contact/ContactTransferQueryFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactTransferQueryFlowTest.java @@ -136,7 +136,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_badContactPassword() throws Exception { + public void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -152,7 +152,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_badContactRoid() throws Exception { + public void testFailure_badContactRoid() { // Set the contact to a different ROID, but don't persist it; this is just so the substitution // code above will write the wrong ROID into the file. contact = contact.asBuilder().setRepoId("DEADBEEF_TLD-ROID").build(); @@ -164,7 +164,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_neverBeenTransferred() throws Exception { + public void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -174,7 +174,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_unrelatedClient() throws Exception { + public void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( diff --git a/javatests/google/registry/flows/contact/ContactTransferRejectFlowTest.java b/javatests/google/registry/flows/contact/ContactTransferRejectFlowTest.java index ec9991503..6669eb446 100644 --- a/javatests/google/registry/flows/contact/ContactTransferRejectFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactTransferRejectFlowTest.java @@ -138,7 +138,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_badPassword() throws Exception { + public void testFailure_badPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -154,7 +154,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_neverBeenTransferred() throws Exception { + public void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -163,7 +163,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_clientApproved() throws Exception { + public void testFailure_clientApproved() { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = assertThrows( @@ -172,7 +172,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_clientRejected() throws Exception { + public void testFailure_clientRejected() { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = assertThrows( @@ -181,7 +181,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_clientCancelled() throws Exception { + public void testFailure_clientCancelled() { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = assertThrows( @@ -190,7 +190,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_serverApproved() throws Exception { + public void testFailure_serverApproved() { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = assertThrows( @@ -199,7 +199,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_serverCancelled() throws Exception { + public void testFailure_serverCancelled() { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = assertThrows( @@ -208,7 +208,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_gainingClient() throws Exception { + public void testFailure_gainingClient() { setClientIdForFlow("NewRegistrar"); EppException thrown = assertThrows( @@ -217,7 +217,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_unrelatedClient() throws Exception { + public void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( diff --git a/javatests/google/registry/flows/contact/ContactTransferRequestFlowTest.java b/javatests/google/registry/flows/contact/ContactTransferRequestFlowTest.java index e11fa3eda..156217692 100644 --- a/javatests/google/registry/flows/contact/ContactTransferRequestFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactTransferRequestFlowTest.java @@ -66,7 +66,7 @@ public class ContactTransferRequestFlowTest } @Before - public void setUp() throws Exception { + public void setUp() { setEppInput("contact_transfer_request.xml"); setClientIdForFlow("NewRegistrar"); contact = persistActiveContact("sh8013"); @@ -156,7 +156,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_noAuthInfo() throws Exception { + public void testFailure_noAuthInfo() { EppException thrown = assertThrows( MissingTransferRequestAuthInfoException.class, @@ -165,7 +165,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_badPassword() throws Exception { + public void testFailure_badPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -211,7 +211,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_pending() throws Exception { + public void testFailure_pending() { contact = persistResource( contact @@ -232,7 +232,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_sponsoringClient() throws Exception { + public void testFailure_sponsoringClient() { setClientIdForFlow("TheRegistrar"); EppException thrown = assertThrows( @@ -265,7 +265,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_clientTransferProhibited() throws Exception { + public void testFailure_clientTransferProhibited() { contact = persistResource( contact.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build()); @@ -278,7 +278,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_serverTransferProhibited() throws Exception { + public void testFailure_serverTransferProhibited() { contact = persistResource( contact.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build()); @@ -291,7 +291,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_pendingDelete() throws Exception { + public void testFailure_pendingDelete() { contact = persistResource(contact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build()); ResourceStatusProhibitsOperationException thrown = diff --git a/javatests/google/registry/flows/custom/TestDomainCreateFlowCustomLogic.java b/javatests/google/registry/flows/custom/TestDomainCreateFlowCustomLogic.java index b574fcbae..ac00748c1 100644 --- a/javatests/google/registry/flows/custom/TestDomainCreateFlowCustomLogic.java +++ b/javatests/google/registry/flows/custom/TestDomainCreateFlowCustomLogic.java @@ -16,7 +16,6 @@ package google.registry.flows.custom; import static google.registry.model.ofy.ObjectifyService.ofy; -import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.model.eppinput.EppInput; @@ -31,7 +30,7 @@ public class TestDomainCreateFlowCustomLogic extends DomainCreateFlowCustomLogic } @Override - public EntityChanges beforeSave(BeforeSaveParameters parameters) throws EppException { + public EntityChanges beforeSave(BeforeSaveParameters parameters) { if (parameters.newDomain().getFullyQualifiedDomainName().startsWith("custom-logic-test")) { PollMessage extraPollMessage = new PollMessage.OneTime.Builder() diff --git a/javatests/google/registry/flows/custom/TestDomainPricingCustomLogic.java b/javatests/google/registry/flows/custom/TestDomainPricingCustomLogic.java index a04781671..9529f45d2 100644 --- a/javatests/google/registry/flows/custom/TestDomainPricingCustomLogic.java +++ b/javatests/google/registry/flows/custom/TestDomainPricingCustomLogic.java @@ -14,7 +14,6 @@ package google.registry.flows.custom; -import google.registry.flows.EppException; import google.registry.flows.FlowMetadata; import google.registry.flows.SessionMetadata; import google.registry.flows.domain.DomainPricingLogic; @@ -39,7 +38,7 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic { @Override public FeesAndCredits customizeApplicationUpdatePrice( - ApplicationUpdatePriceParameters priceParameters) throws EppException { + ApplicationUpdatePriceParameters priceParameters) { return (priceParameters .domainApplication() .getFullyQualifiedDomainName() @@ -50,8 +49,7 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic { } @Override - public FeesAndCredits customizeRenewPrice(RenewPriceParameters priceParameters) - throws EppException { + public FeesAndCredits customizeRenewPrice(RenewPriceParameters priceParameters) { return (priceParameters.domainName().toString().startsWith("costly-renew")) ? addCustomFee( priceParameters.feesAndCredits(), Fee.create(ONE_HUNDRED_BUCKS, FeeType.RENEW)) @@ -59,8 +57,7 @@ public class TestDomainPricingCustomLogic extends DomainPricingCustomLogic { } @Override - public FeesAndCredits customizeTransferPrice(TransferPriceParameters priceParameters) - throws EppException { + public FeesAndCredits customizeTransferPrice(TransferPriceParameters priceParameters) { return (priceParameters.domainName().toString().startsWith("expensive")) ? addCustomFee( priceParameters.feesAndCredits(), Fee.create(ONE_HUNDRED_BUCKS, FeeType.TRANSFER)) diff --git a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java index dd5166449..35ad7a125 100644 --- a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java @@ -102,7 +102,7 @@ public class DomainAllocateFlowTest private HistoryEntry historyEntry; @Before - public void initAllocateTest() throws Exception { + public void initAllocateTest() { setEppInput( "domain_allocate.xml", ImmutableMap.of("APPLICATIONID", "2-TLD", "DOMAIN", "example-one.tld")); diff --git a/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java index b431feb0b..e8be1e9df 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java @@ -150,7 +150,7 @@ public class DomainApplicationCreateFlowTest } @Before - public void setUp() throws Exception { + public void setUp() { setEppInput("domain_create_sunrise_encoded_signed_mark.xml"); createTld("tld", TldState.SUNRISE); persistResource(Registry.get("tld").asBuilder().setReservedLists(createReservedList()).build()); @@ -250,7 +250,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMarkCorrupt() throws Exception { + public void testFailure_signedMarkCorrupt() { createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_encoded_signed_mark_corrupt.xml"); persistContactsAndHosts(); @@ -260,7 +260,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMarkCertificateRevoked() throws Exception { + public void testFailure_signedMarkCertificateRevoked() { createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_encoded_signed_mark_revoked_cert.xml"); persistContactsAndHosts(); @@ -270,7 +270,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMarkCertificateExpired() throws Exception { + public void testFailure_signedMarkCertificateExpired() { createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_encoded_signed_mark.xml"); persistContactsAndHosts(); @@ -282,7 +282,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMarkCertificateNotYetValid() throws Exception { + public void testFailure_signedMarkCertificateNotYetValid() { createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_encoded_signed_mark.xml"); persistContactsAndHosts(); @@ -294,7 +294,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMarkCertificateCorrupt() throws Exception { + public void testFailure_signedMarkCertificateCorrupt() { useTmchProdCert(); createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_encoded_signed_mark_certificate_corrupt.xml"); @@ -314,7 +314,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMarkCertificateSignature() throws Exception { + public void testFailure_signedMarkCertificateSignature() { useTmchProdCert(); createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_encoded_signed_mark.xml"); @@ -326,7 +326,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMarkSignature() throws Exception { + public void testFailure_signedMarkSignature() { createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_encoded_signed_mark_signature_corrupt.xml"); persistContactsAndHosts(); @@ -408,7 +408,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationReservedAllowedInSunrise() throws Exception { + public void testFailure_landrushApplicationReservedAllowedInSunrise() { createTld("tld", TldState.SUNRUSH); persistResource( Registry.get("tld") @@ -423,7 +423,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationPremiumBlocked() throws Exception { + public void testFailure_landrushApplicationPremiumBlocked() { createTld("example", TldState.SUNRUSH); setEppInput("domain_create_landrush_premium.xml"); persistContactsAndHosts(); @@ -435,8 +435,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushFeeNotProvidedOnPremiumName_whenRegistryRequiresFeeAcking() - throws Exception { + public void testFailure_landrushFeeNotProvidedOnPremiumName_whenRegistryRequiresFeeAcking() { createTld("example", TldState.SUNRUSH); setEppInput("domain_create_landrush_premium.xml"); persistContactsAndHosts(); @@ -446,8 +445,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushFeeNotProvidedOnPremiumName_whenRegistrarRequiresFeeAcking() - throws Exception { + public void testFailure_landrushFeeNotProvidedOnPremiumName_whenRegistrarRequiresFeeAcking() { createTld("example", TldState.SUNRUSH); persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(false).build()); persistResource( @@ -561,7 +559,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithRefundableFee_v06() throws Exception { + public void testFailure_landrushApplicationWithRefundableFee_v06() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -571,7 +569,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithRefundableFee_v11() throws Exception { + public void testFailure_landrushApplicationWithRefundableFee_v11() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -582,7 +580,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithRefundableFee_v12() throws Exception { + public void testFailure_landrushApplicationWithRefundableFee_v12() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -593,7 +591,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithGracePeriodFee_v06() throws Exception { + public void testFailure_landrushApplicationWithGracePeriodFee_v06() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -604,7 +602,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithGracePeriodFee_v11() throws Exception { + public void testFailure_landrushApplicationWithGracePeriodFee_v11() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -615,7 +613,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithGracePeriodFee_v12() throws Exception { + public void testFailure_landrushApplicationWithGracePeriodFee_v12() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -626,7 +624,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithAppliedFee_v06() throws Exception { + public void testFailure_landrushApplicationWithAppliedFee_v06() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -636,7 +634,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithAppliedFee_v11() throws Exception { + public void testFailure_landrushApplicationWithAppliedFee_v11() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -646,7 +644,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushApplicationWithAppliedFee_v12() throws Exception { + public void testFailure_landrushApplicationWithAppliedFee_v12() { createTld("tld", TldState.LANDRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -757,7 +755,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_missingMarks() throws Exception { + public void testFailure_missingMarks() { setEppInput("domain_create_sunrise_without_marks.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -767,7 +765,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_suspendedRegistrarCantCreateDomainApplication() throws Exception { + public void testFailure_suspendedRegistrarCantCreateDomainApplication() { setEppInput("domain_create_sunrise_encoded_signed_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -784,7 +782,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_sunriseApplicationInLandrush() throws Exception { + public void testFailure_sunriseApplicationInLandrush() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_signed_mark.xml"); persistContactsAndHosts(); @@ -795,7 +793,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_smdRevoked() throws Exception { + public void testFailure_smdRevoked() { SignedMarkRevocationList.create(clock.nowUtc(), ImmutableMap.of(SMD_ID, clock.nowUtc())).save(); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -804,7 +802,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_tooManyNameservers() throws Exception { + public void testFailure_tooManyNameservers() { createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_14_nameservers.xml"); persistContactsAndHosts(); @@ -814,7 +812,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_secDnsMaxSigLife() throws Exception { + public void testFailure_secDnsMaxSigLife() { setEppInput("domain_create_sunrise_with_secdns_maxsiglife.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -823,7 +821,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_secDnsTooManyDsRecords() throws Exception { + public void testFailure_secDnsTooManyDsRecords() { setEppInput("domain_create_sunrise_signed_mark_with_secdns_9_records.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -832,7 +830,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongExtension() throws Exception { + public void testFailure_wrongExtension() { setEppInput("domain_create_sunrise_wrong_extension.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -841,7 +839,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_reserved() throws Exception { + public void testFailure_reserved() { setEppInput("domain_create_sunrise_signed_mark_reserved.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -981,7 +979,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushLrpApplication_badToken() throws Exception { + public void testFailure_landrushLrpApplication_badToken() { createTld("tld", TldState.LANDRUSH); persistResource( Registry.get("tld") @@ -1002,7 +1000,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushLrpApplication_tokenForWrongTld() throws Exception { + public void testFailure_landrushLrpApplication_tokenForWrongTld() { createTld("tld", TldState.LANDRUSH); persistResource( Registry.get("tld") @@ -1026,7 +1024,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushLrpApplication_usedToken() throws Exception { + public void testFailure_landrushLrpApplication_usedToken() { createTld("tld", TldState.LANDRUSH); persistResource( Registry.get("tld") @@ -1095,7 +1093,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrush_duringLrpWithMissingToken() throws Exception { + public void testFailure_landrush_duringLrpWithMissingToken() { createTld("tld", TldState.LANDRUSH); persistResource( Registry.get("tld") @@ -1110,7 +1108,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_landrushWithPeriodInMonths() throws Exception { + public void testFailure_landrushWithPeriodInMonths() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_months.xml"); persistContactsAndHosts(); @@ -1120,7 +1118,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_missingHost() throws Exception { + public void testFailure_missingHost() { persistActiveHost("ns1.example.net"); persistActiveContact("jd1234"); persistActiveContact("sh8013"); @@ -1130,7 +1128,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_missingContact() throws Exception { + public void testFailure_missingContact() { persistActiveHost("ns1.example.net"); persistActiveHost("ns2.example.net"); persistActiveContact("jd1234"); @@ -1140,7 +1138,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongTld() throws Exception { + public void testFailure_wrongTld() { deleteTld("tld"); createTld("foo", TldState.SUNRISE); persistContactsAndHosts(); @@ -1150,7 +1148,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_predelegation() throws Exception { + public void testFailure_predelegation() { createTld("tld", TldState.PREDELEGATION); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1159,7 +1157,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_notAuthorizedForTld() throws Exception { + public void testFailure_notAuthorizedForTld() { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); persistContactsAndHosts(); @@ -1168,7 +1166,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_sunrush() throws Exception { + public void testFailure_sunrush() { createTld("tld", TldState.SUNRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1177,7 +1175,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_quietPeriod() throws Exception { + public void testFailure_quietPeriod() { createTld("tld", TldState.QUIET_PERIOD); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1186,7 +1184,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_generalAvailability() throws Exception { + public void testFailure_generalAvailability() { createTld("tld", TldState.GENERAL_AVAILABILITY); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1195,7 +1193,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_startDateSunrise() throws Exception { + public void testFailure_startDateSunrise() { createTld("tld", TldState.START_DATE_SUNRISE); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1204,7 +1202,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongDeclaredPhase() throws Exception { + public void testFailure_wrongDeclaredPhase() { setEppInput("domain_create_landrush_signed_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1270,7 +1268,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_duplicateContact() throws Exception { + public void testFailure_duplicateContact() { setEppInput("domain_create_sunrise_duplicate_contact.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1279,7 +1277,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_missingContactType() throws Exception { + public void testFailure_missingContactType() { setEppInput("domain_create_sunrise_missing_contact_type.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1289,7 +1287,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_noMatchingMarks() throws Exception { + public void testFailure_noMatchingMarks() { setEppInput("domain_create_sunrise_no_matching_marks.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1298,7 +1296,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_beforeMarkCreationTime() throws Exception { + public void testFailure_beforeMarkCreationTime() { // If we move now back in time a bit, the mark will not have gone into effect yet. clock.setTo(DateTime.parse("2013-08-09T10:05:59Z").minusSeconds(1)); persistContactsAndHosts(); @@ -1308,7 +1306,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_atMarkExpirationTime() throws Exception { + public void testFailure_atMarkExpirationTime() { // Move time forward to the mark expiration time. clock.setTo(DateTime.parse("2017-07-23T22:00:00.000Z")); persistContactsAndHosts(); @@ -1318,7 +1316,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_hexEncoding() throws Exception { + public void testFailure_hexEncoding() { setEppInput("domain_create_sunrise_hex_encoding.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1328,7 +1326,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_badEncoding() throws Exception { + public void testFailure_badEncoding() { setEppInput("domain_create_sunrise_bad_encoding.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1337,7 +1335,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_badEncodedXml() throws Exception { + public void testFailure_badEncodedXml() { setEppInput("domain_create_sunrise_bad_encoded_xml.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1346,7 +1344,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_badIdn() throws Exception { + public void testFailure_badIdn() { createTld("xn--q9jyb4c", TldState.SUNRUSH); setEppInput("domain_create_sunrush_bad_idn_minna.xml"); persistContactsAndHosts(); @@ -1356,7 +1354,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_badValidatorId() throws Exception { + public void testFailure_badValidatorId() { createTld("tld", TldState.SUNRUSH); setEppInput("domain_create_sunrush_bad_validator_id.xml"); persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY)); @@ -1367,7 +1365,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMark() throws Exception { + public void testFailure_signedMark() { setEppInput("domain_create_sunrise_signed_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1376,7 +1374,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_codeMark() throws Exception { + public void testFailure_codeMark() { setEppInput("domain_create_sunrise_code_with_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1385,7 +1383,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_emptyEncodedMarkData() throws Exception { + public void testFailure_emptyEncodedMarkData() { setEppInput("domain_create_sunrise_empty_encoded_signed_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1394,7 +1392,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_signedMarkAndNotice() throws Exception { + public void testFailure_signedMarkAndNotice() { setEppInput("domain_create_sunrise_signed_mark_and_notice.xml"); persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY)); persistContactsAndHosts(); @@ -1405,7 +1403,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_twoSignedMarks() throws Exception { + public void testFailure_twoSignedMarks() { setEppInput("domain_create_sunrise_two_signed_marks.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); @@ -1414,7 +1412,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_missingClaimsNotice() throws Exception { + public void testFailure_missingClaimsNotice() { createTld("tld", TldState.SUNRUSH); persistClaimsList(ImmutableMap.of("test-validate", CLAIMS_KEY)); setEppInput("domain_create_sunrush.xml"); @@ -1425,7 +1423,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_claimsNoticeProvided_nameNotOnClaimsList() throws Exception { + public void testFailure_claimsNoticeProvided_nameNotOnClaimsList() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_claim_notice.xml"); persistContactsAndHosts(); @@ -1435,7 +1433,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_claimsNoticeProvided_claimsPeriodEnded() throws Exception { + public void testFailure_claimsNoticeProvided_claimsPeriodEnded() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_claim_notice.xml"); persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); @@ -1446,7 +1444,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_expiredClaim() throws Exception { + public void testFailure_expiredClaim() { createTld("tld", TldState.SUNRUSH); clock.setTo(DateTime.parse("2010-08-17T09:00:00.0Z")); setEppInput("domain_create_sunrush_claim_notice.xml"); @@ -1458,7 +1456,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_expiredAcceptance() throws Exception { + public void testFailure_expiredAcceptance() { createTld("tld", TldState.SUNRUSH); clock.setTo(DateTime.parse("2009-09-16T09:00:00.0Z")); setEppInput("domain_create_sunrush_claim_notice.xml"); @@ -1470,7 +1468,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_malformedTcnIdWrongLength() throws Exception { + public void testFailure_malformedTcnIdWrongLength() { createTld("tld", TldState.SUNRUSH); persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); @@ -1482,7 +1480,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_malformedTcnIdBadChar() throws Exception { + public void testFailure_malformedTcnIdBadChar() { createTld("tld", TldState.SUNRUSH); persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); @@ -1494,7 +1492,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_badTcnIdChecksum() throws Exception { + public void testFailure_badTcnIdChecksum() { createTld("tld", TldState.SUNRUSH); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); setEppInput("domain_create_sunrush_bad_checksum_claim_notice.xml"); @@ -1506,7 +1504,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongFeeLandrushApplication_v06() throws Exception { + public void testFailure_wrongFeeLandrushApplication_v06() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6")); persistResource( @@ -1518,7 +1516,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongFeeLandrushApplication_v11() throws Exception { + public void testFailure_wrongFeeLandrushApplication_v11() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11")); persistResource( @@ -1530,7 +1528,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongFeeLandrushApplication_v12() throws Exception { + public void testFailure_wrongFeeLandrushApplication_v12() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12")); persistResource( @@ -1542,7 +1540,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongCurrency_v06() throws Exception { + public void testFailure_wrongCurrency_v06() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6")); persistResource( @@ -1562,7 +1560,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongCurrency_v11() throws Exception { + public void testFailure_wrongCurrency_v11() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11")); persistResource( @@ -1582,7 +1580,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_wrongCurrency_v12() throws Exception { + public void testFailure_wrongCurrency_v12() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12")); persistResource( @@ -1602,7 +1600,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_feeGivenInWrongScale_v06() throws Exception { + public void testFailure_feeGivenInWrongScale_v06() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.6")); persistContactsAndHosts(); @@ -1612,7 +1610,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_feeGivenInWrongScale_v11() throws Exception { + public void testFailure_feeGivenInWrongScale_v11() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.11")); persistContactsAndHosts(); @@ -1622,7 +1620,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_feeGivenInWrongScale_v12() throws Exception { + public void testFailure_feeGivenInWrongScale_v12() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.12")); persistContactsAndHosts(); @@ -1647,7 +1645,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_registrantNotWhitelisted() throws Exception { + public void testFailure_registrantNotWhitelisted() { persistActiveContact("someone"); persistContactsAndHosts(); persistResource( @@ -1661,7 +1659,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_nameserverNotWhitelisted() throws Exception { + public void testFailure_nameserverNotWhitelisted() { persistContactsAndHosts(); persistResource( Registry.get("tld") @@ -1695,7 +1693,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_emptyNameserverFailsWhitelist() throws Exception { + public void testFailure_emptyNameserverFailsWhitelist() { setEppInput("domain_create_sunrise_encoded_signed_mark_no_hosts.xml"); persistResource( Registry.get("tld") @@ -1731,7 +1729,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_domainNameserverRestricted_someNameserversDisallowed() throws Exception { + public void testFailure_domainNameserverRestricted_someNameserversDisallowed() { persistResource( Registry.get("tld") .asBuilder() @@ -1748,7 +1746,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_domainNameserverRestricted_noNameserversAllowed() throws Exception { + public void testFailure_domainNameserverRestricted_noNameserversAllowed() { setEppInput("domain_create_sunrise_encoded_signed_mark_no_hosts.xml"); persistResource( Registry.get("tld") @@ -1789,7 +1787,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_domainNameserversDisallowed_tldNameserversAllowed() throws Exception { + public void testFailure_domainNameserversDisallowed_tldNameserversAllowed() { persistResource( Registry.get("tld") .asBuilder() @@ -1809,7 +1807,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_domainNameserversAllowed_tldNameserversDisallowed() throws Exception { + public void testFailure_domainNameserversAllowed_tldNameserversDisallowed() { persistResource( Registry.get("tld") .asBuilder() @@ -1829,7 +1827,7 @@ public class DomainApplicationCreateFlowTest } @Test - public void testFailure_max10Years() throws Exception { + public void testFailure_max10Years() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_create_landrush_11_years.xml"); persistContactsAndHosts(); @@ -1838,8 +1836,7 @@ public class DomainApplicationCreateFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - private void doFailingDomainNameTest(String domainName, Class exception) - throws Exception { + private void doFailingDomainNameTest(String domainName, Class exception) { setEppInput("domain_create_sunrise_signed_mark_uppercase.xml"); eppLoader.replaceAll("TEST-VALIDATE.tld", domainName); persistContactsAndHosts(); diff --git a/javatests/google/registry/flows/domain/DomainApplicationDeleteFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationDeleteFlowTest.java index 86dd2186f..7fbab88d0 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationDeleteFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationDeleteFlowTest.java @@ -151,7 +151,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_unauthorizedClient() throws Exception { + public void testFailure_unauthorizedClient() { sessionMetadata.setClientId("NewRegistrar"); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); @@ -168,7 +168,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_notAuthorizedForTld() throws Exception { + public void testFailure_notAuthorizedForTld() { persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); @@ -187,7 +187,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_sunriseDuringLandrush() throws Exception { + public void testFailure_sunriseDuringLandrush() { createTld("tld", TldState.LANDRUSH); setEppInput("domain_delete_application_landrush.xml", ImmutableMap.of("DOMAIN", "example.tld")); persistResource( @@ -243,7 +243,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_mismatchedPhase() throws Exception { + public void testFailure_mismatchedPhase() { setEppInput("domain_delete_application_landrush.xml", ImmutableMap.of("DOMAIN", "example.tld")); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); EppException thrown = assertThrows(LaunchPhaseMismatchException.class, this::runFlow); @@ -251,7 +251,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_wrongExtension() throws Exception { + public void testFailure_wrongExtension() { setEppInput("domain_delete_application_wrong_extension.xml"); persistActiveDomainApplication("example.tld"); EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow); @@ -259,7 +259,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_predelegation() throws Exception { + public void testFailure_predelegation() { createTld("tld", TldState.PREDELEGATION); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); @@ -267,7 +267,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_quietPeriod() throws Exception { + public void testFailure_quietPeriod() { createTld("tld", TldState.QUIET_PERIOD); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); @@ -275,7 +275,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_generalAvailability() throws Exception { + public void testFailure_generalAvailability() { createTld("tld", TldState.GENERAL_AVAILABILITY); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); @@ -283,7 +283,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_startDateSunrise() throws Exception { + public void testFailure_startDateSunrise() { createTld("tld", TldState.START_DATE_SUNRISE); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); @@ -327,7 +327,7 @@ public class DomainApplicationDeleteFlowTest } @Test - public void testFailure_applicationIdForDifferentDomain() throws Exception { + public void testFailure_applicationIdForDifferentDomain() { persistResource(newDomainApplication("invalid.tld").asBuilder().setRepoId("1-TLD").build()); EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); diff --git a/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java index 9465b97a5..744cf0fc5 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java @@ -315,7 +315,7 @@ public class DomainApplicationInfoFlowTest } @Test - public void testFailure_applicationIdForDifferentDomain() throws Exception { + public void testFailure_applicationIdForDifferentDomain() { persistResource( new DomainApplication.Builder() .setRepoId("123-TLD") diff --git a/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java index c00735de2..08ce37c8d 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java @@ -125,7 +125,7 @@ public class DomainApplicationUpdateFlowTest .build()); } - private Builder newApplicationBuilder() throws Exception { + private Builder newApplicationBuilder() { return newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD"); } @@ -430,7 +430,7 @@ public class DomainApplicationUpdateFlowTest } @Test - public void testFailure_wrongExtension() throws Exception { + public void testFailure_wrongExtension() { setEppInput("domain_update_sunrise_wrong_extension.xml"); EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -908,7 +908,7 @@ public class DomainApplicationUpdateFlowTest } @Test - public void testFailure_customPricingLogic_feeMismatch() throws Exception { + public void testFailure_customPricingLogic_feeMismatch() { persistReferencedEntities(); persistResource( newDomainApplication("non-free-update.tld").asBuilder().setRepoId("1-ROID").build()); diff --git a/javatests/google/registry/flows/domain/DomainCheckFlowTest.java b/javatests/google/registry/flows/domain/DomainCheckFlowTest.java index 01bcb53a4..a83888a21 100644 --- a/javatests/google/registry/flows/domain/DomainCheckFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCheckFlowTest.java @@ -81,7 +81,7 @@ public class DomainCheckFlowTest setEppInput("domain_check_one_tld.xml"); } - private ReservedList createReservedList() throws Exception { + private ReservedList createReservedList() { return persistReservedList( "tld-reserved", "reserved,FULLY_BLOCKED", @@ -328,21 +328,21 @@ public class DomainCheckFlowTest } @Test - public void testFailure_tooManyIds() throws Exception { + public void testFailure_tooManyIds() { setEppInput("domain_check_51.xml"); EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFailure_wrongTld() throws Exception { + public void testFailure_wrongTld() { setEppInput("domain_check.xml"); EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFailure_notAuthorizedForTld() throws Exception { + public void testFailure_notAuthorizedForTld() { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); @@ -358,8 +358,8 @@ public class DomainCheckFlowTest CommitMode.LIVE, UserPrivileges.SUPERUSER, loadFile("domain_check_one_tld_response.xml")); } - private void doFailingBadLabelTest(String label, Class expectedException) - throws Exception { + private void doFailingBadLabelTest( + String label, Class expectedException) { setEppInput("domain_check_template.xml", ImmutableMap.of("LABEL", label)); EppException thrown = assertThrows(expectedException, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -444,7 +444,7 @@ public class DomainCheckFlowTest } @Test - public void testFailure_predelegation() throws Exception { + public void testFailure_predelegation() { createTld("tld", TldState.PREDELEGATION); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -761,84 +761,84 @@ public class DomainCheckFlowTest } @Test - public void testFeeExtension_wrongCurrency_v06() throws Exception { + public void testFeeExtension_wrongCurrency_v06() { setEppInput("domain_check_fee_euro_v06.xml"); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_wrongCurrency_v11() throws Exception { + public void testFeeExtension_wrongCurrency_v11() { setEppInput("domain_check_fee_euro_v11.xml"); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_wrongCurrency_v12() throws Exception { + public void testFeeExtension_wrongCurrency_v12() { setEppInput("domain_check_fee_euro_v12.xml"); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_periodNotInYears_v06() throws Exception { + public void testFeeExtension_periodNotInYears_v06() { setEppInput("domain_check_fee_bad_period_v06.xml"); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_periodNotInYears_v11() throws Exception { + public void testFeeExtension_periodNotInYears_v11() { setEppInput("domain_check_fee_bad_period_v11.xml"); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_periodNotInYears_v12() throws Exception { + public void testFeeExtension_periodNotInYears_v12() { setEppInput("domain_check_fee_bad_period_v12.xml"); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_commandWithPhase_v06() throws Exception { + public void testFeeExtension_commandWithPhase_v06() { setEppInput("domain_check_fee_command_phase_v06.xml"); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_commandWithPhase_v11() throws Exception { + public void testFeeExtension_commandWithPhase_v11() { setEppInput("domain_check_fee_command_phase_v11.xml"); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_commandWithPhase_v12() throws Exception { + public void testFeeExtension_commandWithPhase_v12() { setEppInput("domain_check_fee_command_phase_v12.xml"); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_commandSubphase_v06() throws Exception { + public void testFeeExtension_commandSubphase_v06() { setEppInput("domain_check_fee_command_subphase_v06.xml"); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_commandSubphase_v11() throws Exception { + public void testFeeExtension_commandSubphase_v11() { setEppInput("domain_check_fee_command_subphase_v11.xml"); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_commandSubphase_v12() throws Exception { + public void testFeeExtension_commandSubphase_v12() { setEppInput("domain_check_fee_command_subphase_v12.xml"); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -846,7 +846,7 @@ public class DomainCheckFlowTest // This test is only relevant for v06, since domain names are not specified in v11 or v12. @Test - public void testFeeExtension_feeCheckNotInAvailabilityCheck() throws Exception { + public void testFeeExtension_feeCheckNotInAvailabilityCheck() { setEppInput("domain_check_fee_not_in_avail.xml"); EppException thrown = assertThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow); @@ -854,84 +854,84 @@ public class DomainCheckFlowTest } @Test - public void testFeeExtension_multiyearRestore_v06() throws Exception { + public void testFeeExtension_multiyearRestore_v06() { setEppInput("domain_check_fee_multiyear_restore_v06.xml"); EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_multiyearRestore_v11() throws Exception { + public void testFeeExtension_multiyearRestore_v11() { setEppInput("domain_check_fee_multiyear_restore_v11.xml"); EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_multiyearRestore_v12() throws Exception { + public void testFeeExtension_multiyearRestore_v12() { setEppInput("domain_check_fee_multiyear_restore_v12.xml"); EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_multiyearTransfer_v06() throws Exception { + public void testFeeExtension_multiyearTransfer_v06() { setEppInput("domain_check_fee_multiyear_transfer_v06.xml"); EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_multiyearTransfer_v11() throws Exception { + public void testFeeExtension_multiyearTransfer_v11() { setEppInput("domain_check_fee_multiyear_transfer_v11.xml"); EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_multiyearTransfer_v12() throws Exception { + public void testFeeExtension_multiyearTransfer_v12() { setEppInput("domain_check_fee_multiyear_transfer_v12.xml"); EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_unknownCommand_v06() throws Exception { + public void testFeeExtension_unknownCommand_v06() { setEppInput("domain_check_fee_unknown_command_v06.xml"); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_unknownCommand_v11() throws Exception { + public void testFeeExtension_unknownCommand_v11() { setEppInput("domain_check_fee_unknown_command_v11.xml"); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_unknownCommand_v12() throws Exception { + public void testFeeExtension_unknownCommand_v12() { setEppInput("domain_check_fee_unknown_command_v12.xml"); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_invalidCommand_v06() throws Exception { + public void testFeeExtension_invalidCommand_v06() { setEppInput("domain_check_fee_invalid_command_v06.xml"); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_invalidCommand_v11() throws Exception { + public void testFeeExtension_invalidCommand_v11() { setEppInput("domain_check_fee_invalid_command_v11.xml"); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFeeExtension_invalidCommand_v12() throws Exception { + public void testFeeExtension_invalidCommand_v12() { setEppInput("domain_check_fee_invalid_command_v12.xml"); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -978,7 +978,7 @@ public class DomainCheckFlowTest @Ignore @Test - public void testSuccess_feeCheck_multipleRanges() throws Exception { + public void testSuccess_feeCheck_multipleRanges() { // TODO: If at some point we have more than one type of fees that are time dependent, populate // this test to test if the notAfter date is the earliest of the end points of the ranges. } diff --git a/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java b/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java index 25f125071..5d5bfe7f1 100644 --- a/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java @@ -101,21 +101,21 @@ public class DomainClaimsCheckFlowTest } @Test - public void testFailure_TooManyIds() throws Exception { + public void testFailure_TooManyIds() { setEppInput("domain_check_claims_51.xml"); EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFailure_tldDoesntExist() throws Exception { + public void testFailure_tldDoesntExist() { setEppInput("domain_check_claims_bad_tld.xml"); EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFailure_notAuthorizedForTld() throws Exception { + public void testFailure_notAuthorizedForTld() { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); @@ -136,7 +136,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testFailure_predelgation() throws Exception { + public void testFailure_predelgation() { createTld("tld", TldState.PREDELEGATION); setEppInput("domain_check_claims.xml"); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); @@ -144,7 +144,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testFailure_sunrise() throws Exception { + public void testFailure_sunrise() { createTld("tld", TldState.SUNRISE); setEppInput("domain_check_claims.xml"); EppException thrown = assertThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow); @@ -152,7 +152,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testFailure_allocationToken() throws Exception { + public void testFailure_allocationToken() { createTld("tld", TldState.SUNRISE); setEppInput("domain_check_claims_allocationtoken.xml"); EppException thrown = @@ -161,7 +161,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testFailure_multipleTlds_oneHasEndedClaims() throws Exception { + public void testFailure_multipleTlds_oneHasEndedClaims() { createTlds("tld1", "tld2"); persistResource( Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build()); diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index a0ce16274..4954bedbb 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -171,7 +171,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase exception) - throws Exception { + private void doFailingDomainNameTest(String domainName, Class exception) { setEppInput("domain_create_uppercase.xml"); eppLoader.replaceAll("Example.tld", domainName); persistContactsAndHosts(); @@ -1703,7 +1701,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase() @@ -2324,7 +2321,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase() @@ -2413,7 +2410,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase } /** Adds a domain with no pending transfer on it. */ - protected void setupDomain(String label, String tld) throws Exception { + protected void setupDomain(String label, String tld) { createTld(tld); contact = persistActiveContact("jd1234"); domain = new DomainResource.Builder() diff --git a/javatests/google/registry/flows/domain/DomainTransferQueryFlowTest.java b/javatests/google/registry/flows/domain/DomainTransferQueryFlowTest.java index 6a4d1c35f..ba4fac8d5 100644 --- a/javatests/google/registry/flows/domain/DomainTransferQueryFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainTransferQueryFlowTest.java @@ -161,7 +161,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_badContactPassword() throws Exception { + public void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -177,7 +177,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_badDomainPassword() throws Exception { + public void testFailure_badDomainPassword() { // Change the domain's password so it does not match the password in the file. domain = persistResource( @@ -193,7 +193,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_neverBeenTransferred() throws Exception { + public void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -203,7 +203,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_unrelatedClient() throws Exception { + public void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( diff --git a/javatests/google/registry/flows/domain/DomainTransferRejectFlowTest.java b/javatests/google/registry/flows/domain/DomainTransferRejectFlowTest.java index c97e3b2f0..17fa3f656 100644 --- a/javatests/google/registry/flows/domain/DomainTransferRejectFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainTransferRejectFlowTest.java @@ -172,7 +172,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_notAuthorizedForTld() throws Exception { + public void testFailure_notAuthorizedForTld() { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = @@ -193,7 +193,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_badContactPassword() throws Exception { + public void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -209,7 +209,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_badDomainPassword() throws Exception { + public void testFailure_badDomainPassword() { // Change the domain's password so it does not match the password in the file. domain = persistResource( @@ -225,7 +225,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_neverBeenTransferred() throws Exception { + public void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -234,7 +234,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_clientApproved() throws Exception { + public void testFailure_clientApproved() { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = assertThrows( @@ -243,7 +243,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_clientRejected() throws Exception { + public void testFailure_clientRejected() { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = assertThrows( @@ -252,7 +252,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_clientCancelled() throws Exception { + public void testFailure_clientCancelled() { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = assertThrows( @@ -261,7 +261,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_serverApproved() throws Exception { + public void testFailure_serverApproved() { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = assertThrows( @@ -270,7 +270,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_serverCancelled() throws Exception { + public void testFailure_serverCancelled() { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = assertThrows( @@ -279,7 +279,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_gainingClient() throws Exception { + public void testFailure_gainingClient() { setClientIdForFlow("NewRegistrar"); EppException thrown = assertThrows( @@ -288,7 +288,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_unrelatedClient() throws Exception { + public void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( diff --git a/javatests/google/registry/flows/domain/DomainTransferRequestFlowTest.java b/javatests/google/registry/flows/domain/DomainTransferRequestFlowTest.java index c458ff291..96046ad86 100644 --- a/javatests/google/registry/flows/domain/DomainTransferRequestFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainTransferRequestFlowTest.java @@ -128,7 +128,7 @@ public class DomainTransferRequestFlowTest .build(); @Before - public void setUp() throws Exception { + public void setUp() { setEppInput("domain_transfer_request.xml"); setClientIdForFlow("NewRegistrar"); } @@ -1158,7 +1158,7 @@ public class DomainTransferRequestFlowTest assertAboutEppExceptions().that(thrown).marshalsToXml(); } - private void runWrongFeeAmountTest(Map substitutions) throws Exception { + private void runWrongFeeAmountTest(Map substitutions) { persistResource( Registry.get("tld") .asBuilder() @@ -1378,7 +1378,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_nonexistentDomain() throws Exception { + public void testFailure_nonexistentDomain() { createTld("tld"); contact = persistActiveContact("jd1234"); ResourceDoesNotExistException thrown = diff --git a/javatests/google/registry/flows/domain/token/AllocationTokenFlowUtilsTest.java b/javatests/google/registry/flows/domain/token/AllocationTokenFlowUtilsTest.java index 76aaa7c68..19532d567 100644 --- a/javatests/google/registry/flows/domain/token/AllocationTokenFlowUtilsTest.java +++ b/javatests/google/registry/flows/domain/token/AllocationTokenFlowUtilsTest.java @@ -71,7 +71,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { } @Test - public void test_verifyToken_failsOnNonexistentToken() throws Exception { + public void test_verifyToken_failsOnNonexistentToken() { AllocationTokenFlowUtils flowUtils = new AllocationTokenFlowUtils(new AllocationTokenCustomLogic()); EppException thrown = @@ -88,7 +88,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { } @Test - public void test_verifyToken_callsCustomLogic() throws Exception { + public void test_verifyToken_callsCustomLogic() { persistResource(new AllocationToken.Builder().setToken("tokeN").build()); AllocationTokenFlowUtils flowUtils = new AllocationTokenFlowUtils(new FailingAllocationTokenCustomLogic()); @@ -106,7 +106,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { } @Test - public void test_checkDomainsWithToken_successfullyVerifiesValidToken() throws Exception { + public void test_checkDomainsWithToken_successfullyVerifiesValidToken() { persistResource(new AllocationToken.Builder().setToken("tokeN").build()); AllocationTokenFlowUtils flowUtils = new AllocationTokenFlowUtils(new AllocationTokenCustomLogic()); @@ -124,7 +124,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { } @Test - public void test_checkDomainsWithToken_showsFailureMessageForRedeemedToken() throws Exception { + public void test_checkDomainsWithToken_showsFailureMessageForRedeemedToken() { persistResource( new AllocationToken.Builder() .setToken("tokeN") @@ -149,7 +149,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { } @Test - public void test_checkDomainsWithToken_callsCustomLogic() throws Exception { + public void test_checkDomainsWithToken_callsCustomLogic() { persistResource(new AllocationToken.Builder().setToken("tokeN").build()); AllocationTokenFlowUtils flowUtils = new AllocationTokenFlowUtils(new FailingAllocationTokenCustomLogic()); @@ -167,7 +167,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { } @Test - public void test_checkDomainsWithToken_resultsFromCustomLogicAreIntegrated() throws Exception { + public void test_checkDomainsWithToken_resultsFromCustomLogicAreIntegrated() { persistResource(new AllocationToken.Builder().setToken("tokeN").build()); AllocationTokenFlowUtils flowUtils = new AllocationTokenFlowUtils(new CustomResultAllocationTokenCustomLogic()); @@ -202,8 +202,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { AllocationToken token, Registry registry, String clientId, - DateTime now) - throws EppException { + DateTime now) { throw new IllegalStateException("failed for tests"); } diff --git a/javatests/google/registry/flows/host/HostCheckFlowTest.java b/javatests/google/registry/flows/host/HostCheckFlowTest.java index e785715af..918dda788 100644 --- a/javatests/google/registry/flows/host/HostCheckFlowTest.java +++ b/javatests/google/registry/flows/host/HostCheckFlowTest.java @@ -76,7 +76,7 @@ public class HostCheckFlowTest extends ResourceCheckFlowTestCase192.0.2.2\n" @@ -248,8 +248,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase exception) - throws Exception { + private void doFailingHostNameTest(String hostName, Class exception) { setEppHostCreateInputWithIps(hostName); EppException thrown = assertThrows(exception, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -286,7 +285,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase exception) - throws Exception { + private void doFailingStatusTest(StatusValue statusValue, Class exception) { persistResource( newHostResource("ns1.example.tld") .asBuilder() @@ -148,7 +147,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase validateHostName("host.co.uk").toString()); } @Test - public void test_validateHostName_hostNameTooLong() throws Exception { + public void test_validateHostName_hostNameTooLong() { assertThrows( HostNameTooLongException.class, () -> validateHostName(Strings.repeat("na", 200) + ".wat.man")); } @Test - public void test_validateHostName_hostNameNotLowerCase() throws Exception { + public void test_validateHostName_hostNameNotLowerCase() { assertThrows(HostNameNotLowerCaseException.class, () -> validateHostName("NA.CAPS.TLD")); } @Test - public void test_validateHostName_hostNameNotPunyCoded() throws Exception { + public void test_validateHostName_hostNameNotPunyCoded() { assertThrows( HostNameNotPunyCodedException.class, () -> validateHostName("motörhead.death.metal")); } @Test - public void test_validateHostName_hostNameNotNormalized() throws Exception { + public void test_validateHostName_hostNameNotNormalized() { assertThrows(HostNameNotNormalizedException.class, () -> validateHostName("root.node.yeah.")); } @Test - public void test_validateHostName_hostNameHasLeadingHyphen() throws Exception { + public void test_validateHostName_hostNameHasLeadingHyphen() { assertThrows(InvalidHostNameException.class, () -> validateHostName("-giga.mega.tld")); } @Test - public void test_validateHostName_hostNameTooShallow() throws Exception { + public void test_validateHostName_hostNameTooShallow() { assertThrows(HostNameTooShallowException.class, () -> validateHostName("domain.tld")); } } diff --git a/javatests/google/registry/flows/host/HostInfoFlowTest.java b/javatests/google/registry/flows/host/HostInfoFlowTest.java index 70501307c..4387b4bf4 100644 --- a/javatests/google/registry/flows/host/HostInfoFlowTest.java +++ b/javatests/google/registry/flows/host/HostInfoFlowTest.java @@ -164,14 +164,14 @@ public class HostInfoFlowTest extends ResourceFlowTestCase { } // Also called in subclasses. - void doFailingTest(String xmlFilename, Class exception) throws Exception { + void doFailingTest(String xmlFilename, Class exception) { setEppInput(xmlFilename); EppException thrown = assertThrows(exception, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); diff --git a/javatests/google/registry/flows/session/LogoutFlowTest.java b/javatests/google/registry/flows/session/LogoutFlowTest.java index b8cc3f789..b44f7eedf 100644 --- a/javatests/google/registry/flows/session/LogoutFlowTest.java +++ b/javatests/google/registry/flows/session/LogoutFlowTest.java @@ -44,7 +44,7 @@ public class LogoutFlowTest extends FlowTestCase { } @Test - public void testFailure() throws Exception { + public void testFailure() { sessionMetadata.setClientId(null); // Turn off the implicit login EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); diff --git a/javatests/google/registry/groups/DirectoryGroupsConnectionTest.java b/javatests/google/registry/groups/DirectoryGroupsConnectionTest.java index b9ddbea5e..f557f88a8 100644 --- a/javatests/google/registry/groups/DirectoryGroupsConnectionTest.java +++ b/javatests/google/registry/groups/DirectoryGroupsConnectionTest.java @@ -48,7 +48,6 @@ import com.google.api.services.groupssettings.model.Groups; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import google.registry.groups.GroupsConnection.Role; -import java.io.IOException; import java.util.Set; import org.junit.Before; import org.junit.Test; @@ -248,10 +247,10 @@ public class DirectoryGroupsConnectionTest { final String message) throws Exception { HttpTransport transport = new MockHttpTransport() { @Override - public LowLevelHttpRequest buildRequest(String method, String url) throws IOException { + public LowLevelHttpRequest buildRequest(String method, String url) { return new MockLowLevelHttpRequest() { @Override - public LowLevelHttpResponse execute() throws IOException { + public LowLevelHttpResponse execute() { MockLowLevelHttpResponse response = new MockLowLevelHttpResponse(); response.setStatusCode(statusCode); response.setContentType(Json.MEDIA_TYPE); diff --git a/javatests/google/registry/keyring/api/KeySerializerTest.java b/javatests/google/registry/keyring/api/KeySerializerTest.java index 71e47c067..2c3629277 100644 --- a/javatests/google/registry/keyring/api/KeySerializerTest.java +++ b/javatests/google/registry/keyring/api/KeySerializerTest.java @@ -139,7 +139,7 @@ public class KeySerializerTest { } } - @Test public void serializeString() throws Exception { + @Test public void serializeString() { String result = KeySerializer.deserializeString(KeySerializer.serializeString("value\n")); assertThat(result).isEqualTo("value\n"); } diff --git a/javatests/google/registry/keyring/kms/GoogleJsonResponseExceptionHelper.java b/javatests/google/registry/keyring/kms/GoogleJsonResponseExceptionHelper.java index 045d606f3..2899ad68e 100644 --- a/javatests/google/registry/keyring/kms/GoogleJsonResponseExceptionHelper.java +++ b/javatests/google/registry/keyring/kms/GoogleJsonResponseExceptionHelper.java @@ -62,7 +62,7 @@ public class GoogleJsonResponseExceptionHelper { } @Override - protected LowLevelHttpRequest buildRequest(String method, String url) throws IOException { + protected LowLevelHttpRequest buildRequest(String method, String url) { return new FakeLowLevelHttpRequest(statusCode, content); } } @@ -77,12 +77,12 @@ public class GoogleJsonResponseExceptionHelper { } @Override - public void addHeader(String name, String value) throws IOException { + public void addHeader(String name, String value) { // Nothing! } @Override - public LowLevelHttpResponse execute() throws IOException { + public LowLevelHttpResponse execute() { return new FakeLowLevelHttpResponse(statusCode, content); } } @@ -97,59 +97,59 @@ public class GoogleJsonResponseExceptionHelper { } @Override - public InputStream getContent() throws IOException { + public InputStream getContent() { return content; } @Override - public String getContentEncoding() throws IOException { + public String getContentEncoding() { return null; } @Override - public long getContentLength() throws IOException { + public long getContentLength() { return 0; } @Override - public String getContentType() throws IOException { + public String getContentType() { return "text/json"; } @Override - public String getStatusLine() throws IOException { + public String getStatusLine() { return null; } @Override - public int getStatusCode() throws IOException { + public int getStatusCode() { return statusCode; } @Override - public String getReasonPhrase() throws IOException { + public String getReasonPhrase() { return null; } @Override - public int getHeaderCount() throws IOException { + public int getHeaderCount() { return 0; } @Override - public String getHeaderName(int index) throws IOException { + public String getHeaderName(int index) { return null; } @Override - public String getHeaderValue(int index) throws IOException { + public String getHeaderValue(int index) { return null; } } private static class EmptyHttpContent implements HttpContent { @Override - public long getLength() throws IOException { + public long getLength() { return 0; } @@ -164,7 +164,7 @@ public class GoogleJsonResponseExceptionHelper { } @Override - public void writeTo(OutputStream out) throws IOException { + public void writeTo(OutputStream out) { // Nothing! } } diff --git a/javatests/google/registry/mapreduce/inputs/ChildEntityInputTest.java b/javatests/google/registry/mapreduce/inputs/ChildEntityInputTest.java index a5e4752ce..c32199eb1 100644 --- a/javatests/google/registry/mapreduce/inputs/ChildEntityInputTest.java +++ b/javatests/google/registry/mapreduce/inputs/ChildEntityInputTest.java @@ -187,7 +187,7 @@ public class ChildEntityInputTest { } @Test - public void testSuccess_childEntityInput_polymorphicBaseType() throws Exception { + public void testSuccess_childEntityInput_polymorphicBaseType() { createChildEntityInput(ImmutableSet.of(EppResource.class), ImmutableSet.of(BillingEvent.class)); } diff --git a/javatests/google/registry/mapreduce/inputs/EppResourceInputsTest.java b/javatests/google/registry/mapreduce/inputs/EppResourceInputsTest.java index be7d3a369..4ed971f92 100644 --- a/javatests/google/registry/mapreduce/inputs/EppResourceInputsTest.java +++ b/javatests/google/registry/mapreduce/inputs/EppResourceInputsTest.java @@ -73,19 +73,19 @@ public class EppResourceInputsTest { } @Test - public void testSuccess_keyInputType_polymorphicBaseType() throws Exception { + public void testSuccess_keyInputType_polymorphicBaseType() { createKeyInput(DomainBase.class); } @Test - public void testFailure_keyInputType_polymorphicSubclass() throws Exception { + public void testFailure_keyInputType_polymorphicSubclass() { IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> createKeyInput(DomainResource.class)); assertThat(thrown).hasMessageThat().contains("non-polymorphic"); } @Test - public void testFailure_keyInputType_noInheritanceBetweenTypes_eppResource() throws Exception { + public void testFailure_keyInputType_noInheritanceBetweenTypes_eppResource() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -94,14 +94,14 @@ public class EppResourceInputsTest { } @Test - public void testSuccess_entityInputTypesMayBePolymorphic() throws Exception { + public void testSuccess_entityInputTypesMayBePolymorphic() { // Both polymorphic and not should work. createEntityInput(DomainBase.class); createEntityInput(DomainResource.class); } @Test - public void testFailure_entityInputType_noInheritanceBetweenTypes_eppResource() throws Exception { + public void testFailure_entityInputType_noInheritanceBetweenTypes_eppResource() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -110,7 +110,7 @@ public class EppResourceInputsTest { } @Test - public void testFailure_entityInputType_noInheritanceBetweenTypes_subclasses() throws Exception { + public void testFailure_entityInputType_noInheritanceBetweenTypes_subclasses() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, diff --git a/javatests/google/registry/model/CreateAutoTimestampTest.java b/javatests/google/registry/model/CreateAutoTimestampTest.java index 61f1bacb1..59e198dbd 100644 --- a/javatests/google/registry/model/CreateAutoTimestampTest.java +++ b/javatests/google/registry/model/CreateAutoTimestampTest.java @@ -45,7 +45,7 @@ public class CreateAutoTimestampTest { } @Before - public void before() throws Exception { + public void before() { ObjectifyService.register(TestObject.class); } @@ -54,7 +54,7 @@ public class CreateAutoTimestampTest { } @Test - public void testSaveSetsTime() throws Exception { + public void testSaveSetsTime() { DateTime transactionTime = ofy() .transact( @@ -69,7 +69,7 @@ public class CreateAutoTimestampTest { } @Test - public void testResavingRespectsOriginalTime() throws Exception { + public void testResavingRespectsOriginalTime() { final DateTime oldCreateTime = DateTime.now(UTC).minusDays(1); ofy() .transact( diff --git a/javatests/google/registry/model/EntityClassesTest.java b/javatests/google/registry/model/EntityClassesTest.java index 7eb1e0282..423170946 100644 --- a/javatests/google/registry/model/EntityClassesTest.java +++ b/javatests/google/registry/model/EntityClassesTest.java @@ -40,19 +40,19 @@ public class EntityClassesTest { clazz -> clazz.getCanonicalName().substring(clazz.getPackage().getName().length())); @Test - public void testEntityClasses_inAlphabeticalOrder() throws Exception { + public void testEntityClasses_inAlphabeticalOrder() { assertThat(ALL_CLASSES).isStrictlyOrdered(QUALIFIED_CLASS_NAME_ORDERING); } @Test - public void testEntityClasses_baseEntitiesHaveUniqueKinds() throws Exception { + public void testEntityClasses_baseEntitiesHaveUniqueKinds() { assertThat(ALL_CLASSES.stream().filter(hasAnnotation(Entity.class)).map(Key::getKind)) .named("base entity kinds") .containsNoDuplicates(); } @Test - public void testEntityClasses_entitySubclassesHaveKindsMatchingBaseEntities() throws Exception { + public void testEntityClasses_entitySubclassesHaveKindsMatchingBaseEntities() { Set baseEntityKinds = ALL_CLASSES .stream() @@ -69,7 +69,7 @@ public class EntityClassesTest { } @Test - public void testEntityClasses_eitherBaseEntityOrEntitySubclass() throws Exception { + public void testEntityClasses_eitherBaseEntityOrEntitySubclass() { for (Class clazz : ALL_CLASSES) { boolean isEntityXorEntitySubclass = clazz.isAnnotationPresent(Entity.class) ^ clazz.isAnnotationPresent(EntitySubclass.class); diff --git a/javatests/google/registry/model/EntityTestCase.java b/javatests/google/registry/model/EntityTestCase.java index 494e97e2a..cf234ff87 100644 --- a/javatests/google/registry/model/EntityTestCase.java +++ b/javatests/google/registry/model/EntityTestCase.java @@ -60,7 +60,7 @@ public class EntityTestCase { protected FakeClock clock = new FakeClock(DateTime.now(UTC)); @Before - public void injectClock() throws Exception { + public void injectClock() { inject.setStaticField(Ofy.class, "clock", clock); } diff --git a/javatests/google/registry/model/EppResourceUtilsTest.java b/javatests/google/registry/model/EppResourceUtilsTest.java index 102069b1d..c7dc3495c 100644 --- a/javatests/google/registry/model/EppResourceUtilsTest.java +++ b/javatests/google/registry/model/EppResourceUtilsTest.java @@ -52,13 +52,13 @@ public class EppResourceUtilsTest { private final FakeClock clock = new FakeClock(DateTime.now(UTC)); @Before - public void init() throws Exception { + public void init() { createTld("tld"); inject.setStaticField(Ofy.class, "clock", clock); } @Test - public void testLoadAtPointInTime_beforeCreated_returnsNull() throws Exception { + public void testLoadAtPointInTime_beforeCreated_returnsNull() { clock.advanceOneMilli(); // Don't save a commit log, we shouldn't need one. HostResource host = persistResource( @@ -69,7 +69,7 @@ public class EppResourceUtilsTest { } @Test - public void testLoadAtPointInTime_atOrAfterLastAutoUpdateTime_returnsResource() throws Exception { + public void testLoadAtPointInTime_atOrAfterLastAutoUpdateTime_returnsResource() { clock.advanceOneMilli(); // Don't save a commit log, we shouldn't need one. HostResource host = persistResource( @@ -80,8 +80,7 @@ public class EppResourceUtilsTest { } @Test - public void testLoadAtPointInTime_usingIntactRevisionHistory_returnsMutationValue() - throws Exception { + public void testLoadAtPointInTime_usingIntactRevisionHistory_returnsMutationValue() { clock.advanceOneMilli(); // Save resource with a commit log that we can read in later as a revisions map value. HostResource oldHost = persistResourceWithCommitLog( @@ -102,8 +101,7 @@ public class EppResourceUtilsTest { } @Test - public void testLoadAtPointInTime_brokenRevisionHistory_returnsResourceAsIs() - throws Exception { + public void testLoadAtPointInTime_brokenRevisionHistory_returnsResourceAsIs() { // Don't save a commit log since we want to test the handling of a broken revisions key. HostResource oldHost = persistResource( newHostResource("ns1.cat.tld").asBuilder() @@ -123,8 +121,7 @@ public class EppResourceUtilsTest { } @Test - public void testLoadAtPointInTime_fallback_returnsMutationValueForOldestRevision() - throws Exception { + public void testLoadAtPointInTime_fallback_returnsMutationValueForOldestRevision() { clock.advanceOneMilli(); // Save a commit log that we can fall back to. HostResource oldHost = persistResourceWithCommitLog( @@ -146,8 +143,7 @@ public class EppResourceUtilsTest { } @Test - public void testLoadAtPointInTime_ultimateFallback_onlyOneRevision_returnsCurrentResource() - throws Exception { + public void testLoadAtPointInTime_ultimateFallback_onlyOneRevision_returnsCurrentResource() { clock.advanceOneMilli(); // Don't save a commit log; we want to test that we load from the current resource. HostResource host = persistResource( @@ -162,7 +158,7 @@ public class EppResourceUtilsTest { } @Test - public void testLoadAtPointInTime_moreThanThirtyDaysInPast_historyIsPurged() throws Exception { + public void testLoadAtPointInTime_moreThanThirtyDaysInPast_historyIsPurged() { clock.advanceOneMilli(); HostResource host = persistResourceWithCommitLog(newHostResource("ns1.example.net")); diff --git a/javatests/google/registry/model/ImmutableObjectTest.java b/javatests/google/registry/model/ImmutableObjectTest.java index bee23f3a2..2cfaf3373 100644 --- a/javatests/google/registry/model/ImmutableObjectTest.java +++ b/javatests/google/registry/model/ImmutableObjectTest.java @@ -71,7 +71,7 @@ public class ImmutableObjectTest { } @Test - public void testToString_simpleClass() throws Exception { + public void testToString_simpleClass() { SimpleObject object = new SimpleObject("foo", null); assertThat(object.toString()).isEqualTo("" + "SimpleObject (@" + System.identityHashCode(object) + "): {\n" @@ -81,7 +81,7 @@ public class ImmutableObjectTest { } @Test - public void testToDiffableFieldMap_simpleClass() throws Exception { + public void testToDiffableFieldMap_simpleClass() { SimpleObject object = new SimpleObject("foo", null); assertThat(object.toDiffableFieldMap()).containsEntry("a", "foo"); assertThat(object.toDiffableFieldMap()).containsEntry("b", null); @@ -97,7 +97,7 @@ public class ImmutableObjectTest { } @Test - public void testToDiffableFieldMap_typesClass() throws Exception { + public void testToDiffableFieldMap_typesClass() { TypesObject object = new TypesObject(); object.bool = true; object.boolObject = true; @@ -121,7 +121,7 @@ public class ImmutableObjectTest { } @Test - public void testToDiffableFieldMap_nestedObjectClass() throws Exception { + public void testToDiffableFieldMap_nestedObjectClass() { SimpleObject innermostObject = new SimpleObject("foo", "bar"); NestedObject innerObject = new NestedObject(innermostObject); NestedObject object = new NestedObject(innerObject); @@ -140,7 +140,7 @@ public class ImmutableObjectTest { } @Test - public void testToDiffableFieldMap_nestedObjectCollectionsClass() throws Exception { + public void testToDiffableFieldMap_nestedObjectCollectionsClass() { SimpleObject obj1 = new SimpleObject("foo", "bar"); SimpleObject obj2 = new SimpleObject("bax", "bar"); Map obj1map = obj1.toDiffableFieldMap(); @@ -169,13 +169,13 @@ public class ImmutableObjectTest { } @Test - public void testToDiffableFieldMap_iterableField_notExpanded() throws Exception { + public void testToDiffableFieldMap_iterableField_notExpanded() { IterableObject iterableObject = new IterableObject(new CidrAddressBlock("127.0.0.1/32")); assertThat(iterableObject.toDiffableFieldMap()).containsEntry("iterable", "127.0.0.1/32"); } @Test - public void testToDiffableFieldMap_infiniteIterableField_notExpanded() throws Exception { + public void testToDiffableFieldMap_infiniteIterableField_notExpanded() { IterableObject iterableObject = new IterableObject(Iterables.cycle("na")); assertThat(iterableObject.toDiffableFieldMap()).containsEntry("iterable", "[na] (cycled)"); } diff --git a/javatests/google/registry/model/SchemaVersionTest.java b/javatests/google/registry/model/SchemaVersionTest.java index cfe420477..66f0bcf6d 100644 --- a/javatests/google/registry/model/SchemaVersionTest.java +++ b/javatests/google/registry/model/SchemaVersionTest.java @@ -33,7 +33,7 @@ public class SchemaVersionTest { public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Test - public void testGoldenSchemaFile() throws Exception { + public void testGoldenSchemaFile() { GoldenFileTestHelper.assertThat(SchemaVersion.getSchema()) .describedAs("Datastore schema") .createdByNomulusCommand("get_schema") diff --git a/javatests/google/registry/model/UpdateAutoTimestampTest.java b/javatests/google/registry/model/UpdateAutoTimestampTest.java index 4c585eee2..00be0f9c2 100644 --- a/javatests/google/registry/model/UpdateAutoTimestampTest.java +++ b/javatests/google/registry/model/UpdateAutoTimestampTest.java @@ -45,7 +45,7 @@ public class UpdateAutoTimestampTest { } @Before - public void before() throws Exception { + public void before() { ObjectifyService.register(TestObject.class); } @@ -54,7 +54,7 @@ public class UpdateAutoTimestampTest { } @Test - public void testSaveSetsTime() throws Exception { + public void testSaveSetsTime() { DateTime transactionTime = ofy() .transact( @@ -69,7 +69,7 @@ public class UpdateAutoTimestampTest { } @Test - public void testResavingOverwritesOriginalTime() throws Exception { + public void testResavingOverwritesOriginalTime() { DateTime transactionTime = ofy() .transact( diff --git a/javatests/google/registry/model/billing/BillingEventTest.java b/javatests/google/registry/model/billing/BillingEventTest.java index 0e02addfd..b2ff19426 100644 --- a/javatests/google/registry/model/billing/BillingEventTest.java +++ b/javatests/google/registry/model/billing/BillingEventTest.java @@ -53,7 +53,7 @@ public class BillingEventTest extends EntityTestCase { BillingEvent.Modification modification; @Before - public void setUp() throws Exception { + public void setUp() { createTld("tld"); domain = persistActiveDomain("foo.tld"); historyEntry = persistResource( @@ -126,7 +126,7 @@ public class BillingEventTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(ofy().load().entity(oneTime).now()).isEqualTo(oneTime); assertThat(ofy().load().entity(oneTimeSynthetic).now()).isEqualTo(oneTimeSynthetic); assertThat(ofy().load().entity(recurring).now()).isEqualTo(recurring); @@ -136,7 +136,7 @@ public class BillingEventTest extends EntityTestCase { } @Test - public void testParenting() throws Exception { + public void testParenting() { // Note that these are all tested separately because BillingEvent is an abstract base class that // lacks the @Entity annotation, and thus we cannot call .type(BillingEvent.class) assertThat(ofy().load().type(BillingEvent.OneTime.class).ancestor(domain).list()) @@ -158,7 +158,7 @@ public class BillingEventTest extends EntityTestCase { } @Test - public void testCancellationMatching() throws Exception { + public void testCancellationMatching() { Key recurringKey = ofy().load().entity(oneTimeSynthetic).now() .getCancellationMatchingBillingEvent(); assertThat(ofy().load().key(recurringKey).now()).isEqualTo(recurring); @@ -306,7 +306,7 @@ public class BillingEventTest extends EntityTestCase { } @Test - public void testDeadCodeThatDeletedScrapCommandsReference() throws Exception { + public void testDeadCodeThatDeletedScrapCommandsReference() { assertThat(recurring.getParentKey()).isEqualTo(Key.create(historyEntry)); new BillingEvent.OneTime.Builder().setParent(Key.create(historyEntry)); } diff --git a/javatests/google/registry/model/billing/RegistrarBillingEntryTest.java b/javatests/google/registry/model/billing/RegistrarBillingEntryTest.java index 611d55390..c2ac7a03d 100644 --- a/javatests/google/registry/model/billing/RegistrarBillingEntryTest.java +++ b/javatests/google/registry/model/billing/RegistrarBillingEntryTest.java @@ -51,7 +51,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { } @Test - public void testGetters() throws Exception { + public void testGetters() { RegistrarBillingEntry entry = new RegistrarBillingEntry.Builder() .setPrevious(null) @@ -71,7 +71,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { } @Test - public void testToJsonMap() throws Exception { + public void testToJsonMap() { assertThat( new RegistrarBillingEntry.Builder() .setPrevious(null) @@ -95,7 +95,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { } @Test - public void testBadTimeOrdering_causesError() throws Exception { + public void testBadTimeOrdering_causesError() { IllegalStateException thrown = assertThrows( IllegalStateException.class, @@ -119,7 +119,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { } @Test - public void testRegistrarMismatch_causesError() throws Exception { + public void testRegistrarMismatch_causesError() { IllegalStateException thrown = assertThrows( IllegalStateException.class, @@ -143,7 +143,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { } @Test - public void testCurrencyMismatch_causesError() throws Exception { + public void testCurrencyMismatch_causesError() { assertThrows( CurrencyMismatchException.class, () -> @@ -165,7 +165,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { } @Test - public void testZeroAmount_causesError() throws Exception { + public void testZeroAmount_causesError() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, diff --git a/javatests/google/registry/model/billing/RegistrarBillingUtilsTest.java b/javatests/google/registry/model/billing/RegistrarBillingUtilsTest.java index 554c82da4..a65976fc0 100644 --- a/javatests/google/registry/model/billing/RegistrarBillingUtilsTest.java +++ b/javatests/google/registry/model/billing/RegistrarBillingUtilsTest.java @@ -56,7 +56,7 @@ public final class RegistrarBillingUtilsTest { private Registrar registrar; @Before - public void before() throws Exception { + public void before() { inject.setStaticField(Ofy.class, "clock", clock); registrar = loadRegistrar("NewRegistrar"); createTlds("xn--q9jyb4c", "com", "net"); diff --git a/javatests/google/registry/model/billing/RegistrarCreditBalanceTest.java b/javatests/google/registry/model/billing/RegistrarCreditBalanceTest.java index 3ffc04362..faad25cf4 100644 --- a/javatests/google/registry/model/billing/RegistrarCreditBalanceTest.java +++ b/javatests/google/registry/model/billing/RegistrarCreditBalanceTest.java @@ -48,7 +48,7 @@ public class RegistrarCreditBalanceTest extends EntityTestCase { Map> rawBalanceMap; @Before - public void setUp() throws Exception { + public void setUp() { createTld("tld"); theRegistrar = loadRegistrar("TheRegistrar"); unpersistedCredit = makeCredit(theRegistrar, clock.nowUtc()); @@ -79,7 +79,7 @@ public class RegistrarCreditBalanceTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(ofy().load().entity(balance).now()).isEqualTo(balance); } @@ -89,19 +89,19 @@ public class RegistrarCreditBalanceTest extends EntityTestCase { verifyIndexing(balance); } @Test - public void testSuccess_balanceWithUnpersistedCredit() throws Exception { + public void testSuccess_balanceWithUnpersistedCredit() { balance.asBuilder().setParent(unpersistedCredit).build(); } @Test - public void testFailure_balanceNotInCreditCurrency() throws Exception { + public void testFailure_balanceNotInCreditCurrency() { assertThrows( IllegalStateException.class, () -> balance.asBuilder().setAmount(Money.parse("JPY 1")).build()); } @Test - public void testFailure_balanceNotInCreditCurrencyWithUnpersistedCredit() throws Exception { + public void testFailure_balanceNotInCreditCurrencyWithUnpersistedCredit() { assertThrows( IllegalStateException.class, () -> @@ -113,17 +113,17 @@ public class RegistrarCreditBalanceTest extends EntityTestCase { } @Test - public void testSuccess_balanceMap_createForCredit() throws Exception { + public void testSuccess_balanceMap_createForCredit() { assertThat(BalanceMap.createForCredit(credit)).isEqualTo(rawBalanceMap); } @Test - public void testSuccess_balanceMap_createForEmptyCredit() throws Exception { + public void testSuccess_balanceMap_createForEmptyCredit() { assertThat(BalanceMap.createForCredit(makeCredit(theRegistrar, clock.nowUtc()))).isEmpty(); } @Test - public void testSuccess_balanceMap_getActiveBalance_emptyMap() throws Exception { + public void testSuccess_balanceMap_getActiveBalance_emptyMap() { BalanceMap map = new BalanceMap(ImmutableMap.of()); assertThat(map.getActiveBalanceAtTime(START_OF_TIME)).isEmpty(); assertThat(map.getActiveBalanceAtTime(clock.nowUtc())).isEmpty(); @@ -134,7 +134,7 @@ public class RegistrarCreditBalanceTest extends EntityTestCase { } @Test - public void testSuccess_balanceMap_getActiveBalanceAtTime() throws Exception { + public void testSuccess_balanceMap_getActiveBalanceAtTime() { BalanceMap map = new BalanceMap(rawBalanceMap); assertThat(map.getActiveBalanceAtTime(START_OF_TIME)).isEmpty(); assertThat(map.getActiveBalanceAtTime(clock.nowUtc().minusMillis(1))).isEmpty(); @@ -150,7 +150,7 @@ public class RegistrarCreditBalanceTest extends EntityTestCase { } @Test - public void testSuccess_balanceMap_getActiveBalanceBeforeTime() throws Exception { + public void testSuccess_balanceMap_getActiveBalanceBeforeTime() { BalanceMap map = new BalanceMap(rawBalanceMap); assertThat(map.getActiveBalanceBeforeTime(START_OF_TIME)).isEmpty(); assertThat(map.getActiveBalanceBeforeTime(clock.nowUtc().minusMillis(1))).isEmpty(); diff --git a/javatests/google/registry/model/billing/RegistrarCreditTest.java b/javatests/google/registry/model/billing/RegistrarCreditTest.java index c3b542c46..1928ae7a6 100644 --- a/javatests/google/registry/model/billing/RegistrarCreditTest.java +++ b/javatests/google/registry/model/billing/RegistrarCreditTest.java @@ -37,7 +37,7 @@ public class RegistrarCreditTest extends EntityTestCase { private RegistrarCredit promoCredit; @Before - public void setUp() throws Exception { + public void setUp() { createTld("tld"); Registrar theRegistrar = ofy().load() .type(Registrar.class) @@ -62,7 +62,7 @@ public class RegistrarCreditTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(ofy().load().entity(auctionCredit).now()).isEqualTo(auctionCredit); assertThat(ofy().load().entity(promoCredit).now()).isEqualTo(promoCredit); } @@ -75,7 +75,7 @@ public class RegistrarCreditTest extends EntityTestCase { } @Test - public void testFailure_missingTld() throws Exception { + public void testFailure_missingTld() { NullPointerException thrown = assertThrows( NullPointerException.class, () -> promoCredit.asBuilder().setTld(null).build()); @@ -83,7 +83,7 @@ public class RegistrarCreditTest extends EntityTestCase { } @Test - public void testFailure_NonexistentTld() throws Exception { + public void testFailure_NonexistentTld() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -92,7 +92,7 @@ public class RegistrarCreditTest extends EntityTestCase { } @Test - public void testFailure_CurrencyDoesNotMatchTldCurrency() throws Exception { + public void testFailure_CurrencyDoesNotMatchTldCurrency() { assertThat(Registry.get("tld").getCurrency()).isEqualTo(USD); IllegalArgumentException thrown = assertThrows( diff --git a/javatests/google/registry/model/common/CursorTest.java b/javatests/google/registry/model/common/CursorTest.java index 92fe6f3a1..9ab51d767 100644 --- a/javatests/google/registry/model/common/CursorTest.java +++ b/javatests/google/registry/model/common/CursorTest.java @@ -65,7 +65,7 @@ public class CursorTest extends EntityTestCase { } @Test - public void testFailure_invalidScopeOnCreate() throws Exception { + public void testFailure_invalidScopeOnCreate() { createTld("tld"); clock.advanceOneMilli(); final DateTime time = DateTime.parse("2012-07-12T03:30:00.000Z"); @@ -81,7 +81,7 @@ public class CursorTest extends EntityTestCase { } @Test - public void testFailure_invalidScopeOnKeyCreate() throws Exception { + public void testFailure_invalidScopeOnKeyCreate() { createTld("tld"); IllegalArgumentException thrown = assertThrows( @@ -93,14 +93,14 @@ public class CursorTest extends EntityTestCase { } @Test - public void testFailure_createGlobalKeyForScopedCursorType() throws Exception { + public void testFailure_createGlobalKeyForScopedCursorType() { IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> Cursor.createGlobalKey(RDE_UPLOAD)); assertThat(thrown).hasMessageThat().contains("Cursor type is not a global cursor"); } @Test - public void testFailure_invalidScopeOnGlobalKeyCreate() throws Exception { + public void testFailure_invalidScopeOnGlobalKeyCreate() { createTld("tld"); IllegalArgumentException thrown = assertThrows( @@ -112,7 +112,7 @@ public class CursorTest extends EntityTestCase { } @Test - public void testFailure_nullScope() throws Exception { + public void testFailure_nullScope() { NullPointerException thrown = assertThrows( NullPointerException.class, @@ -121,7 +121,7 @@ public class CursorTest extends EntityTestCase { } @Test - public void testFailure_nullCursorType() throws Exception { + public void testFailure_nullCursorType() { createTld("tld"); NullPointerException thrown = assertThrows( @@ -131,7 +131,7 @@ public class CursorTest extends EntityTestCase { } @Test - public void testFailure_nullTime() throws Exception { + public void testFailure_nullTime() { createTld("tld"); NullPointerException thrown = assertThrows( diff --git a/javatests/google/registry/model/common/TimeOfYearTest.java b/javatests/google/registry/model/common/TimeOfYearTest.java index 88f3f7b38..a66774b07 100644 --- a/javatests/google/registry/model/common/TimeOfYearTest.java +++ b/javatests/google/registry/model/common/TimeOfYearTest.java @@ -34,14 +34,14 @@ public class TimeOfYearTest { private static final DateTime march1 = DateTime.parse("2012-03-01T01:02:03.0Z"); @Test - public void testSuccess_fromDateTime() throws Exception { + public void testSuccess_fromDateTime() { // We intentionally don't allow leap years in TimeOfYear, so February 29 should be February 28. assertThat(TimeOfYear.fromDateTime(february28)).isEqualTo(TimeOfYear.fromDateTime(february29)); assertThat(TimeOfYear.fromDateTime(february29)).isNotEqualTo(TimeOfYear.fromDateTime(march1)); } @Test - public void testSuccess_nextAfter() throws Exception { + public void testSuccess_nextAfter() { // This should be lossless because atOrAfter includes an exact match. assertThat(TimeOfYear.fromDateTime(march1).getNextInstanceAtOrAfter(march1)).isEqualTo(march1); // This should be a year later because we stepped forward a millisecond @@ -50,7 +50,7 @@ public class TimeOfYearTest { } @Test - public void testSuccess_nextBefore() throws Exception { + public void testSuccess_nextBefore() { // This should be lossless because beforeOrAt includes an exact match. assertThat(TimeOfYear.fromDateTime(march1).getLastInstanceBeforeOrAt(march1)).isEqualTo(march1); // This should be a year earlier because we stepped backward a millisecond diff --git a/javatests/google/registry/model/common/TimedTransitionPropertyTest.java b/javatests/google/registry/model/common/TimedTransitionPropertyTest.java index b5e995ed3..bc7de3d13 100644 --- a/javatests/google/registry/model/common/TimedTransitionPropertyTest.java +++ b/javatests/google/registry/model/common/TimedTransitionPropertyTest.java @@ -72,12 +72,12 @@ public class TimedTransitionPropertyTest { } @Test - public void testSuccess_toValueMap() throws Exception { + public void testSuccess_toValueMap() { assertThat(timedString.toValueMap()).isEqualTo(values); } private static void testGetValueAtTime( - TimedTransitionProperty timedString) throws Exception { + TimedTransitionProperty timedString) { assertThat(timedString.getValueAtTime(A_LONG_TIME_AGO)).isEqualTo("0"); assertThat(timedString.getValueAtTime(START_OF_TIME.minusMillis(1))).isEqualTo("0"); assertThat(timedString.getValueAtTime(START_OF_TIME)).isEqualTo("0"); @@ -99,7 +99,7 @@ public class TimedTransitionPropertyTest { } @Test - public void testSuccess_getNextTransitionAfter() throws Exception { + public void testSuccess_getNextTransitionAfter() { assertThat(timedString.getNextTransitionAfter(A_LONG_TIME_AGO)).isEqualTo(DATE_1); assertThat(timedString.getNextTransitionAfter(START_OF_TIME.plusMillis(1))).isEqualTo(DATE_1); assertThat(timedString.getNextTransitionAfter(DATE_1.minusMillis(1))).isEqualTo(DATE_1); @@ -124,7 +124,7 @@ public class TimedTransitionPropertyTest { } @Test - public void testFailure_valueMapNotChronologicallyOrdered() throws Exception { + public void testFailure_valueMapNotChronologicallyOrdered() { assertThrows( IllegalArgumentException.class, () -> @@ -134,7 +134,7 @@ public class TimedTransitionPropertyTest { } @Test - public void testFailure_transitionTimeBeforeStartOfTime() throws Exception { + public void testFailure_transitionTimeBeforeStartOfTime() { assertThrows( IllegalArgumentException.class, () -> @@ -143,7 +143,7 @@ public class TimedTransitionPropertyTest { } @Test - public void testFailure_noValues() throws Exception { + public void testFailure_noValues() { assertThrows( IllegalArgumentException.class, () -> @@ -152,7 +152,7 @@ public class TimedTransitionPropertyTest { } @Test - public void testFailure_noValueAtStartOfTime() throws Exception { + public void testFailure_noValueAtStartOfTime() { assertThrows( IllegalArgumentException.class, () -> @@ -161,7 +161,7 @@ public class TimedTransitionPropertyTest { } @Test - public void testFailure_noValuesAfterSimulatedEmptyLoad() throws Exception { + public void testFailure_noValuesAfterSimulatedEmptyLoad() { timedString = forMapify("0", StringTimedTransition.class); // Simulate a load from Datastore by clearing, but don't insert any transitions. timedString.clear(); @@ -169,7 +169,7 @@ public class TimedTransitionPropertyTest { } @Test - public void testFailure_noValueAtStartOfTimeAfterSimulatedLoad() throws Exception { + public void testFailure_noValueAtStartOfTimeAfterSimulatedLoad() { // Just for testing, don't extract transitions from a TimedTransitionProperty in real code. StringTimedTransition transition1 = timedString.get(DATE_1); timedString = forMapify("0", StringTimedTransition.class); diff --git a/javatests/google/registry/model/contact/ContactResourceTest.java b/javatests/google/registry/model/contact/ContactResourceTest.java index 9382d0d46..f48c3251c 100644 --- a/javatests/google/registry/model/contact/ContactResourceTest.java +++ b/javatests/google/registry/model/contact/ContactResourceTest.java @@ -44,7 +44,7 @@ public class ContactResourceTest extends EntityTestCase { ContactResource contactResource; @Before - public void setUp() throws Exception { + public void setUp() { createTld("foobar"); // Set up a new persisted ContactResource entity. contactResource = persistResource(cloneAndSetAutoTimestamps( @@ -109,7 +109,7 @@ public class ContactResourceTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat( loadByForeignKey(ContactResource.class, contactResource.getForeignKey(), clock.nowUtc())) .isEqualTo(contactResource); @@ -154,7 +154,7 @@ public class ContactResourceTest extends EntityTestCase { } @Test - public void testEmptyTransferDataBecomesNull() throws Exception { + public void testEmptyTransferDataBecomesNull() { ContactResource withNull = new ContactResource.Builder().setTransferData(null).build(); ContactResource withEmpty = withNull.asBuilder().setTransferData(TransferData.EMPTY).build(); assertThat(withNull).isEqualTo(withEmpty); diff --git a/javatests/google/registry/model/domain/AllocationTokenTest.java b/javatests/google/registry/model/domain/AllocationTokenTest.java index 83a063490..9e065eb9a 100644 --- a/javatests/google/registry/model/domain/AllocationTokenTest.java +++ b/javatests/google/registry/model/domain/AllocationTokenTest.java @@ -30,7 +30,7 @@ import org.junit.Test; public class AllocationTokenTest extends EntityTestCase { @Test - public void testPersistence() throws Exception { + public void testPersistence() { AllocationToken token = persistResource( new AllocationToken.Builder() @@ -52,7 +52,7 @@ public class AllocationTokenTest extends EntityTestCase { } @Test - public void testCreationTime_autoPopulates() throws Exception { + public void testCreationTime_autoPopulates() { AllocationToken tokenBeforePersisting = new AllocationToken.Builder().setToken("abc123").build(); assertThat(tokenBeforePersisting.getCreationTime()).isEmpty(); @@ -61,7 +61,7 @@ public class AllocationTokenTest extends EntityTestCase { } @Test - public void testSetCreationTime_cantCallMoreThanOnce() throws Exception { + public void testSetCreationTime_cantCallMoreThanOnce() { AllocationToken.Builder builder = new AllocationToken.Builder() .setToken("foobar") @@ -74,7 +74,7 @@ public class AllocationTokenTest extends EntityTestCase { } @Test - public void testSetToken_cantCallMoreThanOnce() throws Exception { + public void testSetToken_cantCallMoreThanOnce() { AllocationToken.Builder builder = new AllocationToken.Builder().setToken("foobar"); IllegalStateException thrown = assertThrows(IllegalStateException.class, () -> builder.setToken("barfoo")); diff --git a/javatests/google/registry/model/domain/DomainApplicationTest.java b/javatests/google/registry/model/domain/DomainApplicationTest.java index 12abfa6ce..a3da2b7f6 100644 --- a/javatests/google/registry/model/domain/DomainApplicationTest.java +++ b/javatests/google/registry/model/domain/DomainApplicationTest.java @@ -48,7 +48,7 @@ public class DomainApplicationTest extends EntityTestCase { DomainApplication domainApplication; @Before - public void setUp() throws Exception { + public void setUp() { createTld("com"); // Set up a new persisted domain application entity. domainApplication = persistResource(cloneAndSetAutoTimestamps( @@ -86,7 +86,7 @@ public class DomainApplicationTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(loadDomainApplication(domainApplication.getForeignKey(), clock.nowUtc())) .isEqualTo(domainApplication); } diff --git a/javatests/google/registry/model/domain/DomainResourceTest.java b/javatests/google/registry/model/domain/DomainResourceTest.java index 2e9896007..6ea37ea22 100644 --- a/javatests/google/registry/model/domain/DomainResourceTest.java +++ b/javatests/google/registry/model/domain/DomainResourceTest.java @@ -62,7 +62,7 @@ public class DomainResourceTest extends EntityTestCase { DomainResource domain; @Before - public void setUp() throws Exception { + public void setUp() { createTld("com"); Key domainKey = Key.create(null, DomainResource.class, "4-COM"); Key hostKey = Key.create(persistResource( @@ -144,7 +144,7 @@ public class DomainResourceTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(loadByForeignKey(DomainResource.class, domain.getForeignKey(), clock.nowUtc())) .isEqualTo(domain); } @@ -211,7 +211,7 @@ public class DomainResourceTest extends EntityTestCase { } @Test - public void testEmptyTransferDataBecomesNull() throws Exception { + public void testEmptyTransferDataBecomesNull() { DomainResource withNull = newDomainResource("example.com").asBuilder().setTransferData(null).build(); DomainResource withEmpty = withNull.asBuilder().setTransferData(TransferData.EMPTY).build(); diff --git a/javatests/google/registry/model/domain/LrpTokenEntityTest.java b/javatests/google/registry/model/domain/LrpTokenEntityTest.java index ccdaf8432..ab4c7fcf4 100644 --- a/javatests/google/registry/model/domain/LrpTokenEntityTest.java +++ b/javatests/google/registry/model/domain/LrpTokenEntityTest.java @@ -35,7 +35,7 @@ public class LrpTokenEntityTest extends EntityTestCase { LrpTokenEntity redeemedToken; @Before - public void setUp() throws Exception { + public void setUp() { createTld("tld"); DomainApplication lrpApplication = persistActiveDomainApplication("domain.tld"); HistoryEntry applicationCreateHistoryEntry = persistResource(new HistoryEntry.Builder() @@ -60,24 +60,24 @@ public class LrpTokenEntityTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(ofy().load().entity(redeemedToken).now()).isEqualTo(redeemedToken); } @Test - public void testSuccess_loadByToken() throws Exception { + public void testSuccess_loadByToken() { assertThat(ofy().load().key(Key.create(LrpTokenEntity.class, "a0b1c2d3e4f5g6")).now()) .isEqualTo(unredeemedToken); } @Test - public void testSuccess_loadByAssignee() throws Exception { + public void testSuccess_loadByAssignee() { assertThat( ofy().load().type(LrpTokenEntity.class).filter("assignee", "1:1020304").first().now()) .isEqualTo(unredeemedToken); } @Test - public void testSuccess_isRedeemed() throws Exception { + public void testSuccess_isRedeemed() { assertThat(redeemedToken.isRedeemed()).isTrue(); assertThat(unredeemedToken.isRedeemed()).isFalse(); } diff --git a/javatests/google/registry/model/eppoutput/ResultTest.java b/javatests/google/registry/model/eppoutput/ResultTest.java index 1960c8ca4..017bf0d65 100644 --- a/javatests/google/registry/model/eppoutput/ResultTest.java +++ b/javatests/google/registry/model/eppoutput/ResultTest.java @@ -25,7 +25,7 @@ import org.junit.runners.JUnit4; public final class ResultTest { @Test - public void testDeadCodeWeDontWantToDelete() throws Exception { + public void testDeadCodeWeDontWantToDelete() { Result result = new Result(); result.msg = "hello"; assertThat(result.getMsg()).isEqualTo("hello"); diff --git a/javatests/google/registry/model/host/HostResourceTest.java b/javatests/google/registry/model/host/HostResourceTest.java index ebe113957..188a5519f 100644 --- a/javatests/google/registry/model/host/HostResourceTest.java +++ b/javatests/google/registry/model/host/HostResourceTest.java @@ -48,7 +48,7 @@ public class HostResourceTest extends EntityTestCase { HostResource host; @Before - public void setUp() throws Exception { + public void setUp() { createTld("com"); // Set up a new persisted registrar entity. domain = @@ -85,7 +85,7 @@ public class HostResourceTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(loadByForeignKey( HostResource.class, host.getForeignKey(), clock.nowUtc())) .isEqualTo(host); @@ -118,7 +118,7 @@ public class HostResourceTest extends EntityTestCase { } @Test - public void testEmptySetsBecomeNull() throws Exception { + public void testEmptySetsBecomeNull() { assertThat(new HostResource.Builder().setInetAddresses(null).build().inetAddresses).isNull(); assertThat(new HostResource.Builder().setInetAddresses(ImmutableSet.of()).build().inetAddresses) .isNull(); diff --git a/javatests/google/registry/model/index/DomainApplicationIndexTest.java b/javatests/google/registry/model/index/DomainApplicationIndexTest.java index 1fc93ac03..64671bf8b 100644 --- a/javatests/google/registry/model/index/DomainApplicationIndexTest.java +++ b/javatests/google/registry/model/index/DomainApplicationIndexTest.java @@ -38,7 +38,7 @@ import org.junit.Test; /** Unit tests for {@link DomainApplicationIndex}. */ public class DomainApplicationIndexTest extends EntityTestCase { @Before - public void init() throws Exception { + public void init() { createTld("com"); } diff --git a/javatests/google/registry/model/index/EppResourceIndexTest.java b/javatests/google/registry/model/index/EppResourceIndexTest.java index b3b3085fd..9da824515 100644 --- a/javatests/google/registry/model/index/EppResourceIndexTest.java +++ b/javatests/google/registry/model/index/EppResourceIndexTest.java @@ -35,14 +35,14 @@ public class EppResourceIndexTest extends EntityTestCase { ContactResource contact; @Before - public void setUp() throws Exception { + public void setUp() { createTld("tld"); // The DatastoreHelper here creates the EppResourceIndex for us. contact = persistActiveContact("abcd1357"); } @Test - public void testPersistence() throws Exception { + public void testPersistence() { EppResourceIndex loadedIndex = Iterables.getOnlyElement(getEppResourceIndexObjects()); assertThat(ofy().load().key(loadedIndex.reference).now()).isEqualTo(contact); } @@ -53,7 +53,7 @@ public class EppResourceIndexTest extends EntityTestCase { } @Test - public void testIdempotentOnUpdate() throws Exception { + public void testIdempotentOnUpdate() { contact = persistResource(contact.asBuilder().setEmailAddress("abc@def.fake").build()); EppResourceIndex loadedIndex = Iterables.getOnlyElement(getEppResourceIndexObjects()); assertThat(ofy().load().key(loadedIndex.reference).now()).isEqualTo(contact); diff --git a/javatests/google/registry/model/index/ForeignKeyIndexTest.java b/javatests/google/registry/model/index/ForeignKeyIndexTest.java index 6cf51af98..10117d851 100644 --- a/javatests/google/registry/model/index/ForeignKeyIndexTest.java +++ b/javatests/google/registry/model/index/ForeignKeyIndexTest.java @@ -40,12 +40,12 @@ import org.junit.Test; public class ForeignKeyIndexTest extends EntityTestCase { @Before - public void setUp() throws Exception { + public void setUp() { createTld("com"); } @Test - public void testPersistence() throws Exception { + public void testPersistence() { // Persist a host and implicitly persist a ForeignKeyIndex for it. HostResource host = persistActiveHost("ns1.example.com"); ForeignKeyIndex fki = @@ -78,7 +78,7 @@ public class ForeignKeyIndexTest extends EntityTestCase { } @Test - public void testLoad_newerKeyHasBeenSoftDeleted() throws Exception { + public void testLoad_newerKeyHasBeenSoftDeleted() { HostResource host1 = persistActiveHost("ns1.example.com"); clock.advanceOneMilli(); ForeignKeyHostIndex fki = new ForeignKeyHostIndex(); @@ -103,7 +103,7 @@ public class ForeignKeyIndexTest extends EntityTestCase { } @Test - public void testDeadCodeThatDeletedScrapCommandsReference() throws Exception { + public void testDeadCodeThatDeletedScrapCommandsReference() { persistActiveHost("omg"); assertThat(ForeignKeyIndex.load(HostResource.class, "omg", clock.nowUtc()).getForeignKey()) .isEqualTo("omg"); @@ -118,7 +118,7 @@ public class ForeignKeyIndexTest extends EntityTestCase { } @Test - public void test_loadCached_cachesNonexistenceOfHosts() throws Exception { + public void test_loadCached_cachesNonexistenceOfHosts() { setNonZeroCachingInterval(); assertThat( ForeignKeyIndex.loadCached( @@ -139,7 +139,7 @@ public class ForeignKeyIndexTest extends EntityTestCase { } @Test - public void test_loadCached_cachesExistenceOfHosts() throws Exception { + public void test_loadCached_cachesExistenceOfHosts() { setNonZeroCachingInterval(); HostResource host1 = persistActiveHost("ns1.example.com"); HostResource host2 = persistActiveHost("ns2.example.com"); @@ -165,7 +165,7 @@ public class ForeignKeyIndexTest extends EntityTestCase { } @Test - public void test_loadCached_doesntSeeHostChangesWhileCacheIsValid() throws Exception { + public void test_loadCached_doesntSeeHostChangesWhileCacheIsValid() { setNonZeroCachingInterval(); HostResource originalHost = persistActiveHost("ns1.example.com"); ForeignKeyIndex originalFki = loadHostFki("ns1.example.com"); @@ -191,7 +191,7 @@ public class ForeignKeyIndexTest extends EntityTestCase { } @Test - public void test_loadCached_filtersOutSoftDeletedHosts() throws Exception { + public void test_loadCached_filtersOutSoftDeletedHosts() { setNonZeroCachingInterval(); persistActiveHost("ns1.example.com"); persistDeletedHost("ns2.example.com", clock.nowUtc().minusDays(1)); @@ -204,7 +204,7 @@ public class ForeignKeyIndexTest extends EntityTestCase { } @Test - public void test_loadCached_cachesContactFkis() throws Exception { + public void test_loadCached_cachesContactFkis() { setNonZeroCachingInterval(); persistActiveContact("contactid1"); ForeignKeyIndex fki1 = loadContactFki("contactid1"); diff --git a/javatests/google/registry/model/mark/MarkContactTest.java b/javatests/google/registry/model/mark/MarkContactTest.java index 7f7f99e42..4db060de2 100644 --- a/javatests/google/registry/model/mark/MarkContactTest.java +++ b/javatests/google/registry/model/mark/MarkContactTest.java @@ -25,7 +25,7 @@ import org.junit.runners.JUnit4; public final class MarkContactTest { @Test - public void testDeadCodeWeDontWantToDelete() throws Exception { + public void testDeadCodeWeDontWantToDelete() { MarkContact mc = new MarkContact(); mc.type = MarkContact.ContactType.OWNER; assertThat(mc.getType()).isEqualTo(MarkContact.ContactType.OWNER); diff --git a/javatests/google/registry/model/mark/MarkHolderTest.java b/javatests/google/registry/model/mark/MarkHolderTest.java index 9836801b2..5a511a5a9 100644 --- a/javatests/google/registry/model/mark/MarkHolderTest.java +++ b/javatests/google/registry/model/mark/MarkHolderTest.java @@ -25,7 +25,7 @@ import org.junit.runners.JUnit4; public final class MarkHolderTest { @Test - public void testDeadCodeWeDontWantToDelete() throws Exception { + public void testDeadCodeWeDontWantToDelete() { MarkHolder mc = new MarkHolder(); mc.entitlement = MarkHolder.EntitlementType.OWNER; assertThat(mc.getEntitlementType()).isEqualTo(MarkHolder.EntitlementType.OWNER); diff --git a/javatests/google/registry/model/mark/MarkProtectionTest.java b/javatests/google/registry/model/mark/MarkProtectionTest.java index 844cbd6c6..e39c488b3 100644 --- a/javatests/google/registry/model/mark/MarkProtectionTest.java +++ b/javatests/google/registry/model/mark/MarkProtectionTest.java @@ -26,7 +26,7 @@ import org.junit.runners.JUnit4; public final class MarkProtectionTest { @Test - public void testDeadCodeWeDontWantToDelete() throws Exception { + public void testDeadCodeWeDontWantToDelete() { MarkProtection mp = new MarkProtection(); mp.countryCode = "US"; assertThat(mp.getCountryCode()).isEqualTo("US"); diff --git a/javatests/google/registry/model/ofy/OfyCommitLogTest.java b/javatests/google/registry/model/ofy/OfyCommitLogTest.java index e39347f88..b92653f2b 100644 --- a/javatests/google/registry/model/ofy/OfyCommitLogTest.java +++ b/javatests/google/registry/model/ofy/OfyCommitLogTest.java @@ -56,20 +56,20 @@ public class OfyCommitLogTest { private final FakeClock clock = new FakeClock(DateTime.parse("2000-01-01TZ")); @Before - public void before() throws Exception { + public void before() { register(Root.class); register(Child.class); inject.setStaticField(Ofy.class, "clock", clock); } @Test - public void testTransact_doesNothing_noCommitLogIsSaved() throws Exception { + public void testTransact_doesNothing_noCommitLogIsSaved() { ofy().transact(() -> {}); assertThat(ofy().load().type(CommitLogManifest.class)).isEmpty(); } @Test - public void testTransact_savesDataAndCommitLog() throws Exception { + public void testTransact_savesDataAndCommitLog() { ofy().transact(() -> ofy().save().entity(Root.create(1, getCrossTldKey())).now()); assertThat(ofy().load().key(Key.create(getCrossTldKey(), Root.class, 1)).now().value) .isEqualTo("value"); @@ -78,7 +78,7 @@ public class OfyCommitLogTest { } @Test - public void testTransact_saveWithoutBackup_noCommitLogIsSaved() throws Exception { + public void testTransact_saveWithoutBackup_noCommitLogIsSaved() { ofy().transact(() -> ofy().saveWithoutBackup().entity(Root.create(1, getCrossTldKey())).now()); assertThat(ofy().load().key(Key.create(getCrossTldKey(), Root.class, 1)).now().value) .isEqualTo("value"); @@ -87,7 +87,7 @@ public class OfyCommitLogTest { } @Test - public void testTransact_deleteWithoutBackup_noCommitLogIsSaved() throws Exception { + public void testTransact_deleteWithoutBackup_noCommitLogIsSaved() { ofy().transact(() -> ofy().saveWithoutBackup().entity(Root.create(1, getCrossTldKey())).now()); ofy().transact(() -> ofy().deleteWithoutBackup().key(Key.create(Root.class, 1))); assertThat(ofy().load().key(Key.create(Root.class, 1)).now()).isNull(); @@ -96,7 +96,7 @@ public class OfyCommitLogTest { } @Test - public void testTransact_savesEntity_itsProtobufFormIsStoredInCommitLog() throws Exception { + public void testTransact_savesEntity_itsProtobufFormIsStoredInCommitLog() { ofy().transact(() -> ofy().save().entity(Root.create(1, getCrossTldKey())).now()); final byte[] entityProtoBytes = ofy().load().type(CommitLogMutation.class).first().now().entityProtoBytes; @@ -112,7 +112,7 @@ public class OfyCommitLogTest { } @Test - public void testTransact_savesEntity_mutationIsChildOfManifest() throws Exception { + public void testTransact_savesEntity_mutationIsChildOfManifest() { ofy().transact(() -> ofy().save().entity(Root.create(1, getCrossTldKey())).now()); assertThat( ofy() @@ -123,7 +123,7 @@ public class OfyCommitLogTest { } @Test - public void testTransactNew_savesDataAndCommitLog() throws Exception { + public void testTransactNew_savesDataAndCommitLog() { ofy().transactNew(() -> ofy().save().entity(Root.create(1, getCrossTldKey())).now()); assertThat(ofy().load().key(Key.create(getCrossTldKey(), Root.class, 1)).now().value) .isEqualTo("value"); @@ -132,7 +132,7 @@ public class OfyCommitLogTest { } @Test - public void testTransact_multipleSaves_logsMultipleMutations() throws Exception { + public void testTransact_multipleSaves_logsMultipleMutations() { ofy() .transact( () -> { @@ -144,7 +144,7 @@ public class OfyCommitLogTest { } @Test - public void testTransact_deletion_deletesAndLogsWithoutMutation() throws Exception { + public void testTransact_deletion_deletesAndLogsWithoutMutation() { ofy().transact(() -> ofy().saveWithoutBackup().entity(Root.create(1, getCrossTldKey())).now()); clock.advanceOneMilli(); final Key otherTldKey = Key.create(getCrossTldKey(), Root.class, 1); @@ -157,7 +157,7 @@ public class OfyCommitLogTest { } @Test - public void testTransactNew_deleteNotBackedUpKind_throws() throws Exception { + public void testTransactNew_deleteNotBackedUpKind_throws() { final CommitLogManifest backupsArentAllowedOnMe = CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of()); IllegalArgumentException thrown = @@ -168,7 +168,7 @@ public class OfyCommitLogTest { } @Test - public void testTransactNew_saveNotBackedUpKind_throws() throws Exception { + public void testTransactNew_saveNotBackedUpKind_throws() { final CommitLogManifest backupsArentAllowedOnMe = CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of()); IllegalArgumentException thrown = @@ -179,7 +179,7 @@ public class OfyCommitLogTest { } @Test - public void testTransactNew_deleteVirtualEntityKey_throws() throws Exception { + public void testTransactNew_deleteVirtualEntityKey_throws() { final Key virtualEntityKey = TestVirtualObject.createKey("virtual"); IllegalArgumentException thrown = assertThrows( @@ -189,7 +189,7 @@ public class OfyCommitLogTest { } @Test - public void testTransactNew_saveVirtualEntity_throws() throws Exception { + public void testTransactNew_saveVirtualEntity_throws() { final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual"); IllegalArgumentException thrown = assertThrows( @@ -199,7 +199,7 @@ public class OfyCommitLogTest { } @Test - public void test_deleteWithoutBackup_withVirtualEntityKey_throws() throws Exception { + public void test_deleteWithoutBackup_withVirtualEntityKey_throws() { final Key virtualEntityKey = TestVirtualObject.createKey("virtual"); IllegalArgumentException thrown = assertThrows( @@ -209,7 +209,7 @@ public class OfyCommitLogTest { } @Test - public void test_saveWithoutBackup_withVirtualEntity_throws() throws Exception { + public void test_saveWithoutBackup_withVirtualEntity_throws() { final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual"); IllegalArgumentException thrown = assertThrows( @@ -218,7 +218,7 @@ public class OfyCommitLogTest { } @Test - public void testTransact_twoSavesOnSameKey_throws() throws Exception { + public void testTransact_twoSavesOnSameKey_throws() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -233,7 +233,7 @@ public class OfyCommitLogTest { } @Test - public void testTransact_saveAndDeleteSameKey_throws() throws Exception { + public void testTransact_saveAndDeleteSameKey_throws() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -248,7 +248,7 @@ public class OfyCommitLogTest { } @Test - public void testSavingRootAndChild_updatesTimestampOnBackupGroupRoot() throws Exception { + public void testSavingRootAndChild_updatesTimestampOnBackupGroupRoot() { ofy().transact(() -> ofy().save().entity(Root.create(1, getCrossTldKey()))); ofy().clearSessionCache(); assertThat(ofy().load().key(Key.create(getCrossTldKey(), Root.class, 1)).now() @@ -266,7 +266,7 @@ public class OfyCommitLogTest { } @Test - public void testSavingOnlyChild_updatesTimestampOnBackupGroupRoot() throws Exception { + public void testSavingOnlyChild_updatesTimestampOnBackupGroupRoot() { ofy().transact(() -> ofy().save().entity(Root.create(1, getCrossTldKey()))); ofy().clearSessionCache(); assertThat(ofy().load().key(Key.create(getCrossTldKey(), Root.class, 1)).now() @@ -279,7 +279,7 @@ public class OfyCommitLogTest { } @Test - public void testDeletingChild_updatesTimestampOnBackupGroupRoot() throws Exception { + public void testDeletingChild_updatesTimestampOnBackupGroupRoot() { ofy().transact(() -> ofy().save().entity(Root.create(1, getCrossTldKey()))); ofy().clearSessionCache(); assertThat(ofy().load().key(Key.create(getCrossTldKey(), Root.class, 1)).now() @@ -293,7 +293,7 @@ public class OfyCommitLogTest { } @Test - public void testReadingRoot_doesntUpdateTimestamp() throws Exception { + public void testReadingRoot_doesntUpdateTimestamp() { ofy().transact(() -> ofy().save().entity(Root.create(1, getCrossTldKey()))); ofy().clearSessionCache(); assertThat(ofy().load().key(Key.create(getCrossTldKey(), Root.class, 1)).now() @@ -313,7 +313,7 @@ public class OfyCommitLogTest { } @Test - public void testReadingChild_doesntUpdateTimestampOnBackupGroupRoot() throws Exception { + public void testReadingChild_doesntUpdateTimestampOnBackupGroupRoot() { ofy().transact(() -> ofy().save().entity(Root.create(1, getCrossTldKey()))); ofy().clearSessionCache(); assertThat(ofy().load().key(Key.create(getCrossTldKey(), Root.class, 1)).now() @@ -333,7 +333,7 @@ public class OfyCommitLogTest { } @Test - public void testSavingAcrossBackupGroupRoots_updatesCorrectTimestamps() throws Exception { + public void testSavingAcrossBackupGroupRoots_updatesCorrectTimestamps() { // Create three roots. ofy() .transact( diff --git a/javatests/google/registry/model/ofy/OfyFilterTest.java b/javatests/google/registry/model/ofy/OfyFilterTest.java index 8bdd0d76b..ec2cf6e2b 100644 --- a/javatests/google/registry/model/ofy/OfyFilterTest.java +++ b/javatests/google/registry/model/ofy/OfyFilterTest.java @@ -70,7 +70,7 @@ public class OfyFilterTest { * the bug occurs, were it not for OfyFilter. */ @Test - public void testFilterRegistersTypes() throws Exception { + public void testFilterRegistersTypes() { UnregisteredEntity entity = new UnregisteredEntity(5L); IllegalStateException e = assertThrows(IllegalStateException.class, () -> Key.create(entity)); assertThat(e) diff --git a/javatests/google/registry/model/poll/PollMessageExternalKeyConverterTest.java b/javatests/google/registry/model/poll/PollMessageExternalKeyConverterTest.java index 6d254ad2d..4aa89d176 100644 --- a/javatests/google/registry/model/poll/PollMessageExternalKeyConverterTest.java +++ b/javatests/google/registry/model/poll/PollMessageExternalKeyConverterTest.java @@ -57,7 +57,7 @@ public class PollMessageExternalKeyConverterTest { FakeClock clock = new FakeClock(DateTime.parse("2007-07-07T01:01:01Z")); @Before - public void setUp() throws Exception { + public void setUp() { inject.setStaticField(Ofy.class, "clock", clock); createTld("foobar"); historyEntry = persistResource(new HistoryEntry.Builder() @@ -129,7 +129,7 @@ public class PollMessageExternalKeyConverterTest { } @Test - public void testFailure_invalidEppResourceTypeId() throws Exception { + public void testFailure_invalidEppResourceTypeId() { // Populate the testdata correctly as for 1-2-FOOBAR-4-5 so we know that the only thing that // is wrong here is the EppResourceTypeId. testSuccess_domain(); @@ -139,14 +139,14 @@ public class PollMessageExternalKeyConverterTest { } @Test - public void testFailure_tooFewComponentParts() throws Exception { + public void testFailure_tooFewComponentParts() { assertThrows( PollMessageExternalKeyParseException.class, () -> parsePollMessageExternalId("1-3-EXAMPLE")); } @Test - public void testFailure_tooManyComponentParts() throws Exception { + public void testFailure_tooManyComponentParts() { assertThrows( PollMessageExternalKeyParseException.class, () -> parsePollMessageExternalId("1-3-EXAMPLE-4-5-2007-2009")); @@ -154,7 +154,7 @@ public class PollMessageExternalKeyConverterTest { @Test - public void testFailure_nonNumericIds() throws Exception { + public void testFailure_nonNumericIds() { assertThrows( PollMessageExternalKeyParseException.class, () -> parsePollMessageExternalId("A-B-FOOBAR-D-E-F")); diff --git a/javatests/google/registry/model/poll/PollMessageTest.java b/javatests/google/registry/model/poll/PollMessageTest.java index 90c2b41d9..78fbba146 100644 --- a/javatests/google/registry/model/poll/PollMessageTest.java +++ b/javatests/google/registry/model/poll/PollMessageTest.java @@ -34,7 +34,7 @@ public class PollMessageTest extends EntityTestCase { HistoryEntry historyEntry; @Before - public void setUp() throws Exception { + public void setUp() { createTld("foobar"); historyEntry = persistResource(new HistoryEntry.Builder() .setParent(persistActiveDomain("foo.foobar")) @@ -51,7 +51,7 @@ public class PollMessageTest extends EntityTestCase { } @Test - public void testPersistenceOneTime() throws Exception { + public void testPersistenceOneTime() { PollMessage.OneTime pollMessage = persistResource( new PollMessage.OneTime.Builder() .setClientId("TheRegistrar") @@ -63,7 +63,7 @@ public class PollMessageTest extends EntityTestCase { } @Test - public void testPersistenceAutorenew() throws Exception { + public void testPersistenceAutorenew() { PollMessage.Autorenew pollMessage = persistResource( new PollMessage.Autorenew.Builder() .setClientId("TheRegistrar") diff --git a/javatests/google/registry/model/rde/RdeNamingUtilsTest.java b/javatests/google/registry/model/rde/RdeNamingUtilsTest.java index 84c749a85..01ca20ed4 100644 --- a/javatests/google/registry/model/rde/RdeNamingUtilsTest.java +++ b/javatests/google/registry/model/rde/RdeNamingUtilsTest.java @@ -30,32 +30,32 @@ import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class RdeNamingUtilsTest { @Test - public void testMakeRydeFilename_rdeDeposit() throws Exception { + public void testMakeRydeFilename_rdeDeposit() { assertThat(makeRydeFilename("numbness", DateTime.parse("1984-12-18TZ"), FULL, 1, 0)) .isEqualTo("numbness_1984-12-18_full_S1_R0"); } @Test - public void testMakeRydeFilename_brdaDeposit() throws Exception { + public void testMakeRydeFilename_brdaDeposit() { assertThat(makeRydeFilename("dreary", DateTime.parse("2000-12-18TZ"), THIN, 1, 0)) .isEqualTo("dreary_2000-12-18_thin_S1_R0"); } @Test - public void testMakeRydeFilename_revisionNumber() throws Exception { + public void testMakeRydeFilename_revisionNumber() { assertThat(makeRydeFilename("wretched", DateTime.parse("2000-12-18TZ"), THIN, 1, 123)) .isEqualTo("wretched_2000-12-18_thin_S1_R123"); } @Test - public void testMakeRydeFilename_timestampNotAtTheWitchingHour_throwsIae() throws Exception { + public void testMakeRydeFilename_timestampNotAtTheWitchingHour_throwsIae() { assertThrows( IllegalArgumentException.class, () -> makeRydeFilename("wretched", DateTime.parse("2000-12-18T04:20Z"), THIN, 1, 0)); } @Test - public void testMakePartialName() throws Exception { + public void testMakePartialName() { assertThat(makePartialName("unholy", DateTime.parse("2000-12-18TZ"), THIN)) .isEqualTo("unholy_2000-12-18_thin"); } diff --git a/javatests/google/registry/model/rde/RdeRevisionTest.java b/javatests/google/registry/model/rde/RdeRevisionTest.java index 3c7ca1bfe..f11b4e995 100644 --- a/javatests/google/registry/model/rde/RdeRevisionTest.java +++ b/javatests/google/registry/model/rde/RdeRevisionTest.java @@ -37,20 +37,20 @@ public class RdeRevisionTest { @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Test - public void testGetNextRevision_objectDoesntExist_returnsZero() throws Exception { + public void testGetNextRevision_objectDoesntExist_returnsZero() { assertThat(getNextRevision("torment", DateTime.parse("1984-12-18TZ"), FULL)) .isEqualTo(0); } @Test - public void testGetNextRevision_objectExistsAtZero_returnsOne() throws Exception { + public void testGetNextRevision_objectExistsAtZero_returnsOne() { save("sorrow", DateTime.parse("1984-12-18TZ"), FULL, 0); assertThat(getNextRevision("sorrow", DateTime.parse("1984-12-18TZ"), FULL)) .isEqualTo(1); } @Test - public void testSaveRevision_objectDoesntExist_newRevisionIsZero_nextRevIsOne() throws Exception { + public void testSaveRevision_objectDoesntExist_newRevisionIsZero_nextRevIsOne() { ofy().transact(new VoidWork() { @Override public void vrun() { @@ -65,7 +65,7 @@ public class RdeRevisionTest { } @Test - public void testSaveRevision_objectDoesntExist_newRevisionIsOne_throwsVe() throws Exception { + public void testSaveRevision_objectDoesntExist_newRevisionIsOne_throwsVe() { VerifyException thrown = assertThrows( VerifyException.class, @@ -82,7 +82,7 @@ public class RdeRevisionTest { } @Test - public void testSaveRevision_objectExistsAtZero_newRevisionIsZero_throwsVe() throws Exception { + public void testSaveRevision_objectExistsAtZero_newRevisionIsZero_throwsVe() { save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0); VerifyException thrown = assertThrows( @@ -100,7 +100,7 @@ public class RdeRevisionTest { } @Test - public void testSaveRevision_objectExistsAtZero_newRevisionIsOne_nextRevIsTwo() throws Exception { + public void testSaveRevision_objectExistsAtZero_newRevisionIsOne_nextRevIsTwo() { save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0); ofy().transact(new VoidWork() { @Override @@ -116,7 +116,7 @@ public class RdeRevisionTest { } @Test - public void testSaveRevision_objectExistsAtZero_newRevisionIsTwo_throwsVe() throws Exception { + public void testSaveRevision_objectExistsAtZero_newRevisionIsTwo_throwsVe() { save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0); VerifyException thrown = assertThrows( @@ -134,7 +134,7 @@ public class RdeRevisionTest { } @Test - public void testSaveRevision_negativeRevision_throwsIae() throws Exception { + public void testSaveRevision_negativeRevision_throwsIae() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -151,7 +151,7 @@ public class RdeRevisionTest { } @Test - public void testSaveRevision_callerNotInTransaction_throwsIse() throws Exception { + public void testSaveRevision_callerNotInTransaction_throwsIse() { IllegalStateException thrown = assertThrows( IllegalStateException.class, diff --git a/javatests/google/registry/model/registrar/RegistrarTest.java b/javatests/google/registry/model/registrar/RegistrarTest.java index 902394c29..64652fa8b 100644 --- a/javatests/google/registry/model/registrar/RegistrarTest.java +++ b/javatests/google/registry/model/registrar/RegistrarTest.java @@ -49,7 +49,7 @@ public class RegistrarTest extends EntityTestCase { private RegistrarContact abuseAdminContact; @Before - public void setUp() throws Exception { + public void setUp() { createTld("xn--q9jyb4c"); // Set up a new persisted registrar entity. registrar = @@ -124,7 +124,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(registrar).isEqualTo(ofy().load().type(Registrar.class) .parent(EntityGroupRoot.getCrossTldKey()) .id(registrar.getClientId()) @@ -137,7 +137,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_passwordNull() throws Exception { + public void testFailure_passwordNull() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setPassword(null)); @@ -145,7 +145,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_passwordTooShort() throws Exception { + public void testFailure_passwordTooShort() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setPassword("abcde")); @@ -153,7 +153,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_passwordTooLong() throws Exception { + public void testFailure_passwordTooLong() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -162,7 +162,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testSuccess_clientId_bounds() throws Exception { + public void testSuccess_clientId_bounds() { registrar = registrar.asBuilder().setClientId("abc").build(); assertThat(registrar.getClientId()).isEqualTo("abc"); registrar = registrar.asBuilder().setClientId("abcdefghijklmnop").build(); @@ -170,19 +170,19 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_clientId_tooShort() throws Exception { + public void testFailure_clientId_tooShort() { assertThrows(IllegalArgumentException.class, () -> new Registrar.Builder().setClientId("ab")); } @Test - public void testFailure_clientId_tooLong() throws Exception { + public void testFailure_clientId_tooLong() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setClientId("abcdefghijklmnopq")); } @Test - public void testSetCertificateHash_alsoSetsHash() throws Exception { + public void testSetCertificateHash_alsoSetsHash() { registrar = registrar.asBuilder().setClientCertificate(null, clock.nowUtc()).build(); clock.advanceOneMilli(); registrar = registrar.asBuilder() @@ -194,7 +194,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testDeleteCertificateHash_alsoDeletesHash() throws Exception { + public void testDeleteCertificateHash_alsoDeletesHash() { assertThat(registrar.getClientCertificateHash()).isNotNull(); clock.advanceOneMilli(); registrar = registrar.asBuilder() @@ -206,7 +206,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testSetFailoverCertificateHash_alsoSetsHash() throws Exception { + public void testSetFailoverCertificateHash_alsoSetsHash() { clock.advanceOneMilli(); registrar = registrar.asBuilder() .setFailoverClientCertificate(SAMPLE_CERT2, clock.nowUtc()) @@ -217,7 +217,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testDeleteFailoverCertificateHash_alsoDeletesHash() throws Exception { + public void testDeleteFailoverCertificateHash_alsoDeletesHash() { registrar = registrar.asBuilder() .setFailoverClientCertificate(SAMPLE_CERT, clock.nowUtc()) .build(); @@ -232,7 +232,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testSuccess_clearingIanaAndBillingIds() throws Exception { + public void testSuccess_clearingIanaAndBillingIds() { registrar.asBuilder() .setType(Type.TEST) .setIanaIdentifier(null) @@ -241,7 +241,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testSuccess_clearingBillingAccountMap() throws Exception { + public void testSuccess_clearingBillingAccountMap() { registrar = registrar.asBuilder() .setBillingAccountMap(null) .build(); @@ -249,24 +249,24 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testSuccess_ianaIdForInternal() throws Exception { + public void testSuccess_ianaIdForInternal() { registrar.asBuilder().setType(Type.INTERNAL).setIanaIdentifier(9998L).build(); registrar.asBuilder().setType(Type.INTERNAL).setIanaIdentifier(9999L).build(); } @Test - public void testSuccess_ianaIdForPdt() throws Exception { + public void testSuccess_ianaIdForPdt() { registrar.asBuilder().setType(Type.PDT).setIanaIdentifier(9995L).build(); registrar.asBuilder().setType(Type.PDT).setIanaIdentifier(9996L).build(); } @Test - public void testSuccess_ianaIdForExternalMonitoring() throws Exception { + public void testSuccess_ianaIdForExternalMonitoring() { registrar.asBuilder().setType(Type.EXTERNAL_MONITORING).setIanaIdentifier(9997L).build(); } @Test - public void testSuccess_emptyContactTypesAllowed() throws Exception { + public void testSuccess_emptyContactTypesAllowed() { persistSimpleResource( new RegistrarContact.Builder() .setParent(registrar) @@ -282,7 +282,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testSuccess_getContactsByType() throws Exception { + public void testSuccess_getContactsByType() { RegistrarContact newTechContact = persistSimpleResource( new RegistrarContact.Builder() @@ -316,7 +316,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_missingRegistrarType() throws Exception { + public void testFailure_missingRegistrarType() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -325,7 +325,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_missingRegistrarName() throws Exception { + public void testFailure_missingRegistrarName() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -335,7 +335,7 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_missingAddress() throws Exception { + public void testFailure_missingAddress() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -351,21 +351,21 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_badIanaIdForInternal() throws Exception { + public void testFailure_badIanaIdForInternal() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setType(Type.INTERNAL).setIanaIdentifier(8L).build()); } @Test - public void testFailure_badIanaIdForPdt() throws Exception { + public void testFailure_badIanaIdForPdt() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setType(Type.PDT).setIanaIdentifier(8L).build()); } @Test - public void testFailure_badIanaIdForExternalMonitoring() throws Exception { + public void testFailure_badIanaIdForExternalMonitoring() { assertThrows( IllegalArgumentException.class, () -> @@ -373,45 +373,45 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_missingIanaIdForReal() throws Exception { + public void testFailure_missingIanaIdForReal() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setType(Type.REAL).build()); } @Test - public void testFailure_missingIanaIdForInternal() throws Exception { + public void testFailure_missingIanaIdForInternal() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setType(Type.INTERNAL).build()); } @Test - public void testFailure_missingIanaIdForPdt() throws Exception { + public void testFailure_missingIanaIdForPdt() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setType(Type.PDT).build()); } @Test - public void testFailure_missingIanaIdForExternalMonitoring() throws Exception { + public void testFailure_missingIanaIdForExternalMonitoring() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setType(Type.EXTERNAL_MONITORING).build()); } @Test - public void testFailure_phonePasscodeTooShort() throws Exception { + public void testFailure_phonePasscodeTooShort() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setPhonePasscode("0123")); } @Test - public void testFailure_phonePasscodeTooLong() throws Exception { + public void testFailure_phonePasscodeTooLong() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setPhonePasscode("012345")); } @Test - public void testFailure_phonePasscodeInvalidCharacters() throws Exception { + public void testFailure_phonePasscodeInvalidCharacters() { assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setPhonePasscode("code1")); } @@ -434,28 +434,28 @@ public class RegistrarTest extends EntityTestCase { } @Test - public void testFailure_loadByClientId_clientIdIsNull() throws Exception { + public void testFailure_loadByClientId_clientIdIsNull() { IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(null)); assertThat(thrown).hasMessageThat().contains("clientId must be specified"); } @Test - public void testFailure_loadByClientId_clientIdIsEmpty() throws Exception { + public void testFailure_loadByClientId_clientIdIsEmpty() { IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId("")); assertThat(thrown).hasMessageThat().contains("clientId must be specified"); } @Test - public void testFailure_loadByClientIdCached_clientIdIsNull() throws Exception { + public void testFailure_loadByClientIdCached_clientIdIsNull() { IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(null)); assertThat(thrown).hasMessageThat().contains("clientId must be specified"); } @Test - public void testFailure_loadByClientIdCached_clientIdIsEmpty() throws Exception { + public void testFailure_loadByClientIdCached_clientIdIsEmpty() { IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached("")); assertThat(thrown).hasMessageThat().contains("clientId must be specified"); diff --git a/javatests/google/registry/model/registry/RegistryTest.java b/javatests/google/registry/model/registry/RegistryTest.java index 8eeba7847..7145b3717 100644 --- a/javatests/google/registry/model/registry/RegistryTest.java +++ b/javatests/google/registry/model/registry/RegistryTest.java @@ -49,20 +49,20 @@ public class RegistryTest extends EntityTestCase { Registry registry; @Before - public void setup() throws Exception { + public void setup() { createTld("tld"); registry = Registry.get("tld"); } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertWithMessage("Registry not found").that(Registry.get("tld")).isNotNull(); assertThat(ofy().load().type(Registry.class).parent(getCrossTldKey()).id("tld").now()) .isEqualTo(Registry.get("tld")); } @Test - public void testFailure_registryNotFound() throws Exception { + public void testFailure_registryNotFound() { createTld("foo"); assertThrows(RegistryNotFoundException.class, () -> Registry.get("baz")); } @@ -135,7 +135,7 @@ public class RegistryTest extends EntityTestCase { } @Test - public void testGetReservedLists_doesntReturnNullWhenUninitialized() throws Exception { + public void testGetReservedLists_doesntReturnNullWhenUninitialized() { Registry registry = newRegistry("foo", "FOO"); assertThat(registry.getReservedLists()).isNotNull(); assertThat(registry.getReservedLists()).isEmpty(); @@ -305,7 +305,7 @@ public class RegistryTest extends EntityTestCase { } @Test - public void testQuietPeriodCanAppearMultipleTimesAnywhere() throws Exception { + public void testQuietPeriodCanAppearMultipleTimesAnywhere() { Registry.get("tld").asBuilder() .setTldStateTransitions(ImmutableSortedMap.naturalOrder() .put(START_OF_TIME, TldState.PREDELEGATION) diff --git a/javatests/google/registry/model/registry/label/PremiumListTest.java b/javatests/google/registry/model/registry/label/PremiumListTest.java index e3bbcffa4..dcf5c1bdd 100644 --- a/javatests/google/registry/model/registry/label/PremiumListTest.java +++ b/javatests/google/registry/model/registry/label/PremiumListTest.java @@ -42,7 +42,7 @@ public class PremiumListTest { @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Before - public void before() throws Exception { + public void before() { // createTld() overwrites the premium list, so call it first. createTld("tld"); PremiumList pl = @@ -56,20 +56,20 @@ public class PremiumListTest { } @Test - public void testSave_badSyntax() throws Exception { + public void testSave_badSyntax() { assertThrows( IllegalArgumentException.class, () -> persistPremiumList("gtld1", "lol,nonsense USD,e,e # yup")); } @Test - public void testSave_invalidCurrencySymbol() throws Exception { + public void testSave_invalidCurrencySymbol() { assertThrows( IllegalArgumentException.class, () -> persistReservedList("gtld1", "lol,XBTC 200")); } @Test - public void testProbablePremiumLabels() throws Exception { + public void testProbablePremiumLabels() { PremiumList pl = PremiumList.getUncached("tld").get(); PremiumListRevision revision = ofy().load().key(pl.getRevisionKey()).now(); assertThat(revision.getProbablePremiumLabels().mightContain("notpremium")).isFalse(); diff --git a/javatests/google/registry/model/registry/label/PremiumListUtilsTest.java b/javatests/google/registry/model/registry/label/PremiumListUtilsTest.java index aa9aa6b44..c093ba87b 100644 --- a/javatests/google/registry/model/registry/label/PremiumListUtilsTest.java +++ b/javatests/google/registry/model/registry/label/PremiumListUtilsTest.java @@ -63,7 +63,7 @@ public class PremiumListUtilsTest { @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Before - public void before() throws Exception { + public void before() { // createTld() overwrites the premium list, so call it first. PremiumList.cachePremiumListEntries = PremiumList.createCachePremiumListEntries(standardMinutes(1)); @@ -80,8 +80,8 @@ public class PremiumListUtilsTest { premiumListProcessingTime.reset(); } - void assertMetricOutcomeCount(int checkCount, DomainLabelMetrics.PremiumListCheckOutcome outcome) - throws Exception { + void assertMetricOutcomeCount( + int checkCount, DomainLabelMetrics.PremiumListCheckOutcome outcome) { assertThat(premiumListChecks) .hasValueForLabels(checkCount, "tld", "tld", outcome.toString()) .and() @@ -93,7 +93,7 @@ public class PremiumListUtilsTest { } @Test - public void testGetPremiumPrice_returnsNoPriceWhenNoPremiumListConfigured() throws Exception { + public void testGetPremiumPrice_returnsNoPriceWhenNoPremiumListConfigured() { createTld("ghost"); persistResource( new Registry.Builder() @@ -108,8 +108,7 @@ public class PremiumListUtilsTest { } @Test - public void testGetPremiumPrice_throwsExceptionWhenNonExistentPremiumListConfigured() - throws Exception { + public void testGetPremiumPrice_throwsExceptionWhenNonExistentPremiumListConfigured() { deletePremiumList(PremiumList.getUncached("tld").get()); IllegalStateException thrown = assertThrows( @@ -126,7 +125,7 @@ public class PremiumListUtilsTest { } @Test - public void testSave_updateTime_isUpdatedOnEverySave() throws Exception { + public void testSave_updateTime_isUpdatedOnEverySave() { PremiumList pl = savePremiumListAndEntries( new PremiumList.Builder().setName("tld3").build(), ImmutableList.of("slime,USD 10")); @@ -138,14 +137,14 @@ public class PremiumListUtilsTest { } @Test - public void testSave_creationTime_onlyUpdatedOnFirstCreation() throws Exception { + public void testSave_creationTime_onlyUpdatedOnFirstCreation() { PremiumList pl = persistPremiumList("tld3", "sludge,JPY 1000"); PremiumList newPl = savePremiumListAndEntries(pl, ImmutableList.of("sleighbells,CHF 2000")); assertThat(newPl.creationTime).isEqualTo(pl.creationTime); } @Test - public void testExists() throws Exception { + public void testExists() { assertThat(doesPremiumListExist("tld")).isTrue(); assertThat(doesPremiumListExist("nonExistentPremiumList")).isFalse(); } @@ -172,7 +171,7 @@ public class PremiumListUtilsTest { } @Test - public void testGetPremiumPrice_cachedSecondTime() throws Exception { + public void testGetPremiumPrice_cachedSecondTime() { assertThat(getPremiumPrice("rich", Registry.get("tld"))).hasValue(Money.parse("USD 1999")); assertThat(getPremiumPrice("rich", Registry.get("tld"))).hasValue(Money.parse("USD 1999")); assertThat(premiumListChecks) @@ -190,7 +189,7 @@ public class PremiumListUtilsTest { } @Test - public void testGetPremiumPrice_bloomFilterFalsePositive() throws Exception { + public void testGetPremiumPrice_bloomFilterFalsePositive() { // Remove one of the premium list entries from behind the Bloom filter's back. ofy() .transactNew( @@ -226,7 +225,7 @@ public class PremiumListUtilsTest { } @Test - public void testSave_removedPremiumListEntries_areNoLongerInDatastore() throws Exception { + public void testSave_removedPremiumListEntries_areNoLongerInDatastore() { Registry registry = Registry.get("tld"); PremiumList pl = persistPremiumList("tld", "genius,USD 10", "dolt,JPY 1000"); assertThat(getPremiumPrice("genius", registry)).hasValue(Money.parse("USD 10")); @@ -266,7 +265,7 @@ public class PremiumListUtilsTest { } @Test - public void testSave_simple() throws Exception { + public void testSave_simple() { PremiumList pl = savePremiumListAndEntries( new PremiumList.Builder().setName("tld2").build(), @@ -298,7 +297,7 @@ public class PremiumListUtilsTest { } @Test - public void test_saveAndUpdateEntriesTwice() throws Exception { + public void test_saveAndUpdateEntriesTwice() { PremiumList pl = savePremiumListAndEntries( new PremiumList.Builder().setName("pl").build(), ImmutableList.of("test,USD 1")); @@ -316,7 +315,7 @@ public class PremiumListUtilsTest { } @Test - public void testDelete() throws Exception { + public void testDelete() { persistPremiumList("gtld1", "trombone,USD 10"); assertThat(PremiumList.getUncached("gtld1")).isPresent(); Key parent = PremiumList.getUncached("gtld1").get().getRevisionKey(); diff --git a/javatests/google/registry/model/registry/label/ReservedListTest.java b/javatests/google/registry/model/registry/label/ReservedListTest.java index 5c0c37d68..7effb87d6 100644 --- a/javatests/google/registry/model/registry/label/ReservedListTest.java +++ b/javatests/google/registry/model/registry/label/ReservedListTest.java @@ -66,7 +66,7 @@ public class ReservedListTest { FakeClock clock = new FakeClock(DateTime.parse("2010-01-01T10:00:00Z")); @Before - public void before() throws Exception { + public void before() { inject.setStaticField(Ofy.class, "clock", clock); createTld("tld"); reservedListChecks.reset(); @@ -87,8 +87,7 @@ public class ReservedListTest { } @Test - public void testGetReservationTypes_allLabelsAreUnreserved_withNoReservedLists() - throws Exception { + public void testGetReservationTypes_allLabelsAreUnreserved_withNoReservedLists() { assertThat(Registry.get("tld").getReservedLists()).isEmpty(); assertThat(getReservationTypes("doodle", "tld")).isEmpty(); assertThat(getReservationTypes("access", "tld")).isEmpty(); @@ -97,7 +96,7 @@ public class ReservedListTest { } @Test - public void testZeroReservedLists_doesNotCauseError() throws Exception { + public void testZeroReservedLists_doesNotCauseError() { assertThat(getReservationTypes("doodle", "tld")).isEmpty(); verifyUnreservedCheckCount(1); } @@ -120,7 +119,7 @@ public class ReservedListTest { } @Test - public void testMatchesAnchorTenantReservation() throws Exception { + public void testMatchesAnchorTenantReservation() { persistResource( Registry.get("tld") .asBuilder() @@ -161,7 +160,7 @@ public class ReservedListTest { } @Test - public void testGetAllowedNameservers() throws Exception { + public void testGetAllowedNameservers() { ReservedList rl1 = persistReservedList( "reserved1", @@ -193,7 +192,7 @@ public class ReservedListTest { } @Test - public void testMatchesAnchorTenantReservation_falseOnOtherReservationTypes() throws Exception { + public void testMatchesAnchorTenantReservation_falseOnOtherReservationTypes() { persistResource( Registry.get("tld") .asBuilder() @@ -256,7 +255,7 @@ public class ReservedListTest { } @Test - public void testMatchesAnchorTenantReservation_duplicatingAuthCodes() throws Exception { + public void testMatchesAnchorTenantReservation_duplicatingAuthCodes() { ReservedList rl1 = persistReservedList("reserved1", "lol,RESERVED_FOR_ANCHOR_TENANT,foo"); ReservedList rl2 = persistReservedList("reserved2", "lol,RESERVED_FOR_ANCHOR_TENANT,foo"); createTld("tld"); @@ -274,7 +273,7 @@ public class ReservedListTest { } @Test - public void testGetReservationTypes_concatsMultipleListsCorrectly() throws Exception { + public void testGetReservationTypes_concatsMultipleListsCorrectly() { ReservedList rl1 = persistReservedList( "reserved1", "lol,FULLY_BLOCKED # yup", @@ -316,8 +315,7 @@ public class ReservedListTest { } @Test - public void testGetReservationTypes_returnsAllReservationTypesFromMultipleListsForTheSameLabel() - throws Exception { + public void testGetReservationTypes_returnsAllReservationTypesFromMultipleListsForTheSameLabel() { ReservedList rl1 = persistReservedList("reserved1", "lol,NAME_COLLISION # yup", "cat,FULLY_BLOCKED"); ReservedList rl2 = @@ -333,7 +331,7 @@ public class ReservedListTest { @Test - public void testGetReservationTypes_worksAfterReservedListRemovedUsingSet() throws Exception { + public void testGetReservationTypes_worksAfterReservedListRemovedUsingSet() { ReservedList rl1 = persistReservedList( "reserved1", "lol,FULLY_BLOCKED", "cat,FULLY_BLOCKED"); ReservedList rl2 = persistReservedList( @@ -366,7 +364,7 @@ public class ReservedListTest { } @Test - public void testGetReservationTypes_combinesMultipleLists() throws Exception { + public void testGetReservationTypes_combinesMultipleLists() { ReservedList rl1 = persistReservedList( "reserved1", "lol,NAME_COLLISION", "roflcopter,ALLOWED_IN_SUNRISE"); ReservedList rl2 = persistReservedList("reserved2", "lol,FULLY_BLOCKED"); @@ -397,7 +395,7 @@ public class ReservedListTest { } @Test - public void testSave() throws Exception { + public void testSave() { ReservedList rl = persistReservedList("tld-reserved", "lol,FULLY_BLOCKED # yup"); createTld("tld"); persistResource(Registry.get("tld").asBuilder().setReservedLists(rl).build()); @@ -405,7 +403,7 @@ public class ReservedListTest { } @Test - public void testSave_commentsArePersistedCorrectly() throws Exception { + public void testSave_commentsArePersistedCorrectly() { ReservedList reservedList = persistReservedList( "reserved", "trombone,FULLY_BLOCKED # yup", @@ -430,20 +428,20 @@ public class ReservedListTest { } @Test - public void testIsInUse_returnsTrueWhenInUse() throws Exception { + public void testIsInUse_returnsTrueWhenInUse() { ReservedList rl = persistReservedList("reserved", "trombone,FULLY_BLOCKED"); persistResource(Registry.get("tld").asBuilder().setReservedLists(ImmutableSet.of(rl)).build()); assertThat(rl.isInUse()).isTrue(); } @Test - public void testIsInUse_returnsFalseWhenNotInUse() throws Exception { + public void testIsInUse_returnsFalseWhenNotInUse() { ReservedList rl = persistReservedList("reserved", "trombone,FULLY_BLOCKED"); assertThat(rl.isInUse()).isFalse(); } @Test - public void testSetFromInputLines() throws Exception { + public void testSetFromInputLines() { ReservedList reservedList = persistReservedList("reserved", "trombone,FULLY_BLOCKED"); assertThat(ReservedList.get("reserved").get().getReservedListEntries()).hasSize(1); reservedList = reservedList.asBuilder() @@ -454,7 +452,7 @@ public class ReservedListTest { } @Test - public void testAsBuilderReturnsIdenticalReservedList() throws Exception { + public void testAsBuilderReturnsIdenticalReservedList() { ReservedList original = persistReservedList("tld-reserved-cloning", "trombone,FULLY_BLOCKED"); ReservedList clone = original.asBuilder().build(); assertThat(clone.getName()).isEqualTo("tld-reserved-cloning"); @@ -466,7 +464,7 @@ public class ReservedListTest { } @Test - public void testSave_badSyntax() throws Exception { + public void testSave_badSyntax() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -475,13 +473,13 @@ public class ReservedListTest { } @Test - public void testSave_badReservationType() throws Exception { + public void testSave_badReservationType() { assertThrows( IllegalArgumentException.class, () -> persistReservedList("tld", "lol,FULLY_BLOCKZ # yup")); } @Test - public void testSave_additionalRestrictionWithIncompatibleReservationType() throws Exception { + public void testSave_additionalRestrictionWithIncompatibleReservationType() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -501,7 +499,7 @@ public class ReservedListTest { } @Test - public void testSave_badNameservers_invalidSyntax() throws Exception { + public void testSave_badNameservers_invalidSyntax() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -514,7 +512,7 @@ public class ReservedListTest { } @Test - public void testSave_badNameservers_tooFewPartsForHostname() throws Exception { + public void testSave_badNameservers_tooFewPartsForHostname() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -527,7 +525,7 @@ public class ReservedListTest { } @Test - public void testSave_noPasswordWithAnchorTenantReservation() throws Exception { + public void testSave_noPasswordWithAnchorTenantReservation() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, @@ -545,7 +543,7 @@ public class ReservedListTest { } @Test - public void testSave_noNameserversWithNameserverRestrictedReservation() throws Exception { + public void testSave_noNameserversWithNameserverRestrictedReservation() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, diff --git a/javatests/google/registry/model/reporting/HistoryEntryTest.java b/javatests/google/registry/model/reporting/HistoryEntryTest.java index 7e3309596..5b04f3dbf 100644 --- a/javatests/google/registry/model/reporting/HistoryEntryTest.java +++ b/javatests/google/registry/model/reporting/HistoryEntryTest.java @@ -35,7 +35,7 @@ public class HistoryEntryTest extends EntityTestCase { HistoryEntry historyEntry; @Before - public void setUp() throws Exception { + public void setUp() { createTld("foobar"); DomainTransactionRecord transactionRecord = new DomainTransactionRecord.Builder() @@ -64,7 +64,7 @@ public class HistoryEntryTest extends EntityTestCase { } @Test - public void testPersistence() throws Exception { + public void testPersistence() { assertThat(ofy().load().entity(historyEntry).now()).isEqualTo(historyEntry); } diff --git a/javatests/google/registry/model/server/LockTest.java b/javatests/google/registry/model/server/LockTest.java index c59a9d7db..ced8a37cf 100644 --- a/javatests/google/registry/model/server/LockTest.java +++ b/javatests/google/registry/model/server/LockTest.java @@ -84,7 +84,7 @@ public class LockTest { } @Test - public void testReleasedExplicitly() throws Exception { + public void testReleasedExplicitly() { Optional lock = acquire("", ONE_DAY, FREE); assertThat(lock).isPresent(); // We can't get it again at the same time. @@ -96,7 +96,7 @@ public class LockTest { } @Test - public void testReleasedAfterTimeout() throws Exception { + public void testReleasedAfterTimeout() { assertThat(acquire("", TWO_MILLIS, FREE)).isPresent(); // We can't get it again at the same time. assertThat(acquire("", TWO_MILLIS, IN_USE)).isEmpty(); @@ -109,7 +109,7 @@ public class LockTest { } @Test - public void testReleasedAfterRequestFinish() throws Exception { + public void testReleasedAfterRequestFinish() { assertThat(acquire("", ONE_DAY, FREE)).isPresent(); // We can't get it again while request is active assertThat(acquire("", ONE_DAY, IN_USE)).isEmpty(); @@ -119,7 +119,7 @@ public class LockTest { } @Test - public void testTldsAreIndependent() throws Exception { + public void testTldsAreIndependent() { Optional lockA = acquire("a", ONE_DAY, FREE); assertThat(lockA).isPresent(); // For a different tld we can still get a lock with the same name. @@ -134,7 +134,7 @@ public class LockTest { } @Test - public void testFailure_emptyResourceName() throws Exception { + public void testFailure_emptyResourceName() { IllegalArgumentException thrown = assertThrows( IllegalArgumentException.class, diff --git a/javatests/google/registry/model/server/ServerSecretTest.java b/javatests/google/registry/model/server/ServerSecretTest.java index 8e701a679..1e7354cec 100644 --- a/javatests/google/registry/model/server/ServerSecretTest.java +++ b/javatests/google/registry/model/server/ServerSecretTest.java @@ -40,14 +40,14 @@ public class ServerSecretTest { } @Test - public void testGet_bootstrapping_savesSecretToDatastore() throws Exception { + public void testGet_bootstrapping_savesSecretToDatastore() { ServerSecret secret = ServerSecret.get(); assertThat(secret).isNotNull(); assertThat(ofy().load().entity(new ServerSecret()).now()).isEqualTo(secret); } @Test - public void testGet_existingSecret_returned() throws Exception { + public void testGet_existingSecret_returned() { ServerSecret secret = ServerSecret.create(123, 456); ofy().saveWithoutBackup().entity(secret).now(); assertThat(ServerSecret.get()).isEqualTo(secret); @@ -55,7 +55,7 @@ public class ServerSecretTest { } @Test - public void testGet_cachedSecret_returnedWithoutDatastoreRead() throws Exception { + public void testGet_cachedSecret_returnedWithoutDatastoreRead() { int numInitialReads = RequestCapturingAsyncDatastoreService.getReads().size(); ServerSecret secret = ServerSecret.get(); int numReads = RequestCapturingAsyncDatastoreService.getReads().size(); @@ -65,14 +65,14 @@ public class ServerSecretTest { } @Test - public void testAsUuid() throws Exception { + public void testAsUuid() { UUID uuid = ServerSecret.create(123, 456).asUuid(); assertThat(uuid.getMostSignificantBits()).isEqualTo(123); assertThat(uuid.getLeastSignificantBits()).isEqualTo(456); } @Test - public void testAsBytes() throws Exception { + public void testAsBytes() { byte[] bytes = ServerSecret.create(123, 0x456).asBytes(); assertThat(bytes) .isEqualTo(new byte[] {0, 0, 0, 0, 0, 0, 0, 123, 0, 0, 0, 0, 0, 0, 0x4, 0x56}); diff --git a/javatests/google/registry/model/smd/IssuerInfoTest.java b/javatests/google/registry/model/smd/IssuerInfoTest.java index 9bc997b14..7760f0588 100644 --- a/javatests/google/registry/model/smd/IssuerInfoTest.java +++ b/javatests/google/registry/model/smd/IssuerInfoTest.java @@ -25,7 +25,7 @@ import org.junit.runners.JUnit4; public final class IssuerInfoTest { @Test - public void testDeadCodeWeDontWantToDelete() throws Exception { + public void testDeadCodeWeDontWantToDelete() { IssuerInfo mp = new IssuerInfo(); mp.issuerId = "sloth"; assertThat(mp.getIssuerId()).isEqualTo("sloth"); diff --git a/javatests/google/registry/model/smd/SignedMarkRevocationListTest.java b/javatests/google/registry/model/smd/SignedMarkRevocationListTest.java index d00751155..565221aca 100644 --- a/javatests/google/registry/model/smd/SignedMarkRevocationListTest.java +++ b/javatests/google/registry/model/smd/SignedMarkRevocationListTest.java @@ -41,7 +41,7 @@ public class SignedMarkRevocationListTest { private final FakeClock clock = new FakeClock(DateTime.parse("2013-01-01T00:00:00Z")); @Test - public void testUnshardedSaveFails() throws Exception { + public void testUnshardedSaveFails() { // Our @Entity's @OnSave method will notice that this shouldn't be saved. assertThrows( SignedMarkRevocationList.UnshardedSaveException.class, @@ -59,14 +59,14 @@ public class SignedMarkRevocationListTest { } @Test - public void testEmpty() throws Exception { + public void testEmpty() { // When Datastore is empty, it should give us an empty thing. assertThat(SignedMarkRevocationList.get()) .isEqualTo(SignedMarkRevocationList.create(START_OF_TIME, ImmutableMap.of())); } @Test - public void testSharding2() throws Exception { + public void testSharding2() { final int rows = SHARD_SIZE + 1; // Create a SignedMarkRevocationList that will need 2 shards to save. ImmutableMap.Builder revokes = new ImmutableMap.Builder<>(); @@ -82,7 +82,7 @@ public class SignedMarkRevocationListTest { } @Test - public void testSharding4() throws Exception { + public void testSharding4() { final int rows = SHARD_SIZE * 3 + 1; // Create a SignedMarkRevocationList that will need 4 shards to save. ImmutableMap.Builder revokes = new ImmutableMap.Builder<>(); @@ -109,7 +109,7 @@ public class SignedMarkRevocationListTest { } @Test - public void test_isSmdRevoked_null() throws Exception { + public void test_isSmdRevoked_null() { assertThrows( NullPointerException.class, () -> @@ -118,7 +118,7 @@ public class SignedMarkRevocationListTest { } @Test - public void test_isSmdRevoked_garbage() throws Exception { + public void test_isSmdRevoked_garbage() { SignedMarkRevocationList smdrl = createSaveGetHelper(SHARD_SIZE + 1); assertThat(smdrl.getCreationTime()).isEqualTo(clock.nowUtc()); assertThat(smdrl.isSmdRevoked("rofl", clock.nowUtc())).isFalse(); @@ -126,7 +126,7 @@ public class SignedMarkRevocationListTest { } @Test - public void test_getCreationTime() throws Exception { + public void test_getCreationTime() { clock.setTo(DateTime.parse("2000-01-01T00:00:00Z")); createSaveGetHelper(5); assertThat(SignedMarkRevocationList.get().getCreationTime()) @@ -137,7 +137,7 @@ public class SignedMarkRevocationListTest { } @Test - public void test_isSmdRevoked_present() throws Exception { + public void test_isSmdRevoked_present() { final int rows = SHARD_SIZE + 1; SignedMarkRevocationList smdrl = createSaveGetHelper(rows); assertThat(smdrl.isSmdRevoked("0", clock.nowUtc())).isTrue(); @@ -146,7 +146,7 @@ public class SignedMarkRevocationListTest { } @Test - public void test_isSmdRevoked_future() throws Exception { + public void test_isSmdRevoked_future() { final int rows = SHARD_SIZE; SignedMarkRevocationList smdrl = createSaveGetHelper(rows); clock.advanceOneMilli(); @@ -156,7 +156,7 @@ public class SignedMarkRevocationListTest { } @Test - public void test_isSmdRevoked_past() throws Exception { + public void test_isSmdRevoked_past() { final int rows = SHARD_SIZE; SignedMarkRevocationList smdrl = createSaveGetHelper(rows); clock.setTo(clock.nowUtc().minusMillis(1)); diff --git a/javatests/google/registry/model/tmch/ClaimsListShardTest.java b/javatests/google/registry/model/tmch/ClaimsListShardTest.java index fd70ca855..6f7902b0a 100644 --- a/javatests/google/registry/model/tmch/ClaimsListShardTest.java +++ b/javatests/google/registry/model/tmch/ClaimsListShardTest.java @@ -50,12 +50,12 @@ public class ClaimsListShardTest { public final InjectRule inject = new InjectRule(); @Before - public void before() throws Exception { + public void before() { inject.setStaticField(ClaimsListShard.class, "shardSize", 10); } @Test - public void test_unshardedSaveFails() throws Exception { + public void test_unshardedSaveFails() { assertThrows( UnshardedSaveException.class, () -> @@ -72,13 +72,13 @@ public class ClaimsListShardTest { } @Test - public void testGet_safelyLoadsEmptyClaimsList_whenNoShardsExist() throws Exception { + public void testGet_safelyLoadsEmptyClaimsList_whenNoShardsExist() { assertThat(ClaimsListShard.get().labelsToKeys).isEmpty(); assertThat(ClaimsListShard.get().creationTime).isEqualTo(START_OF_TIME); } @Test - public void test_savesAndGets_withSharding() throws Exception { + public void test_savesAndGets_withSharding() { // Create a ClaimsList that will need 4 shards to save. Map labelsToKeys = new HashMap<>(); for (int i = 0; i <= ClaimsListShard.shardSize * 3; i++) { diff --git a/javatests/google/registry/model/tmch/TmchCrlTest.java b/javatests/google/registry/model/tmch/TmchCrlTest.java index 42860a688..4da345f3d 100644 --- a/javatests/google/registry/model/tmch/TmchCrlTest.java +++ b/javatests/google/registry/model/tmch/TmchCrlTest.java @@ -29,7 +29,7 @@ public class TmchCrlTest { @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Test - public void testSuccess() throws Exception { + public void testSuccess() { assertThat(TmchCrl.get()).isNull(); TmchCrl.set("lolcat", "http://lol.cat"); assertThat(TmchCrl.get().getCrl()).isEqualTo("lolcat"); diff --git a/javatests/google/registry/model/transfer/TransferDataTest.java b/javatests/google/registry/model/transfer/TransferDataTest.java index b3eb27ae8..d96053a87 100644 --- a/javatests/google/registry/model/transfer/TransferDataTest.java +++ b/javatests/google/registry/model/transfer/TransferDataTest.java @@ -58,7 +58,7 @@ public class TransferDataTest { } @Test - public void test_copyConstantFieldsToBuilder() throws Exception { + public void test_copyConstantFieldsToBuilder() { TransferData constantTransferData = new TransferData.Builder() .setTransferRequestTrid(Trid.create("server-trid", "client-trid")) diff --git a/javatests/google/registry/model/translators/CommitLogRevisionsTranslatorFactoryTest.java b/javatests/google/registry/model/translators/CommitLogRevisionsTranslatorFactoryTest.java index 1e11ad24b..b7e8bf120 100644 --- a/javatests/google/registry/model/translators/CommitLogRevisionsTranslatorFactoryTest.java +++ b/javatests/google/registry/model/translators/CommitLogRevisionsTranslatorFactoryTest.java @@ -60,7 +60,7 @@ public class CommitLogRevisionsTranslatorFactoryTest { private final FakeClock clock = new FakeClock(START_TIME); @Before - public void before() throws Exception { + public void before() { ObjectifyService.register(TestObject.class); inject.setStaticField(Ofy.class, "clock", clock); } @@ -75,7 +75,7 @@ public class CommitLogRevisionsTranslatorFactoryTest { } @Test - public void testSave_doesNotMutateOriginalResource() throws Exception { + public void testSave_doesNotMutateOriginalResource() { TestObject object = new TestObject(); save(object); assertThat(object.revisions).isEmpty(); @@ -83,7 +83,7 @@ public class CommitLogRevisionsTranslatorFactoryTest { } @Test - public void testSave_translatorAddsKeyToCommitLogToField() throws Exception { + public void testSave_translatorAddsKeyToCommitLogToField() { save(new TestObject()); TestObject object = reload(); assertThat(object.revisions).hasSize(1); @@ -93,7 +93,7 @@ public class CommitLogRevisionsTranslatorFactoryTest { } @Test - public void testSave_twoVersionsOnOneDay_keyToLastCommitLogsGetsStored() throws Exception { + public void testSave_twoVersionsOnOneDay_keyToLastCommitLogsGetsStored() { save(new TestObject()); clock.advanceBy(standardHours(1)); save(reload()); @@ -103,7 +103,7 @@ public class CommitLogRevisionsTranslatorFactoryTest { } @Test - public void testSave_twoVersionsOnTwoDays_keyToBothCommitLogsGetsStored() throws Exception { + public void testSave_twoVersionsOnTwoDays_keyToBothCommitLogsGetsStored() { save(new TestObject()); clock.advanceBy(standardDays(1)); save(reload()); @@ -114,7 +114,7 @@ public class CommitLogRevisionsTranslatorFactoryTest { } @Test - public void testSave_moreThanThirtyDays_truncatedAtThirtyPlusOne() throws Exception { + public void testSave_moreThanThirtyDays_truncatedAtThirtyPlusOne() { save(new TestObject()); for (int i = 0; i < 35; i++) { clock.advanceBy(standardDays(1)); @@ -126,7 +126,7 @@ public class CommitLogRevisionsTranslatorFactoryTest { } @Test - public void testSave_moreThanThirtySparse_keepsOneEntryPrecedingThirtyDays() throws Exception { + public void testSave_moreThanThirtySparse_keepsOneEntryPrecedingThirtyDays() { save(new TestObject()); assertThat(reload().revisions).hasSize(1); assertThat(reload().revisions.firstKey()).isEqualTo(clock.nowUtc().minusDays(0)); @@ -146,7 +146,7 @@ public class CommitLogRevisionsTranslatorFactoryTest { @Test @SuppressWarnings("unchecked") - public void testRawEntityLayout() throws Exception { + public void testRawEntityLayout() { save(new TestObject()); clock.advanceBy(standardDays(1)); com.google.appengine.api.datastore.Entity entity = @@ -160,12 +160,12 @@ public class CommitLogRevisionsTranslatorFactoryTest { } @Test - public void testLoad_neverSaved_returnsNull() throws Exception { + public void testLoad_neverSaved_returnsNull() { assertThat(ofy().load().entity(new TestObject()).now()).isNull(); } @Test - public void testLoad_missingRevisionRawProperties_createsEmptyObject() throws Exception { + public void testLoad_missingRevisionRawProperties_createsEmptyObject() { com.google.appengine.api.datastore.Entity entity = ofy().transactNewReadOnly(() -> ofy().save().toEntity(new TestObject())); entity.removeProperty("revisions.key"); diff --git a/javatests/google/registry/module/backend/BackendRequestComponentTest.java b/javatests/google/registry/module/backend/BackendRequestComponentTest.java index 5958a90aa..6768570d6 100644 --- a/javatests/google/registry/module/backend/BackendRequestComponentTest.java +++ b/javatests/google/registry/module/backend/BackendRequestComponentTest.java @@ -24,7 +24,7 @@ import org.junit.runners.JUnit4; public class BackendRequestComponentTest { @Test - public void testRoutingMap() throws Exception { + public void testRoutingMap() { GoldenFileTestHelper.assertThatRoutesFromComponent(BackendRequestComponent.class) .describedAs("backend routing map") .isEqualToGolden(BackendRequestComponentTest.class, "backend_routing.txt"); diff --git a/javatests/google/registry/module/frontend/FrontendRequestComponentTest.java b/javatests/google/registry/module/frontend/FrontendRequestComponentTest.java index 2850f345c..b1e1b1b8b 100644 --- a/javatests/google/registry/module/frontend/FrontendRequestComponentTest.java +++ b/javatests/google/registry/module/frontend/FrontendRequestComponentTest.java @@ -25,7 +25,7 @@ import org.junit.runners.JUnit4; public class FrontendRequestComponentTest { @Test - public void testRoutingMap() throws Exception { + public void testRoutingMap() { GoldenFileTestHelper.assertThatRoutesFromComponent(FrontendRequestComponent.class) .describedAs("frontend routing map") .isEqualToGolden(FrontendRequestComponentTest.class, "frontend_routing.txt"); diff --git a/javatests/google/registry/module/pubapi/PubApiRequestComponentTest.java b/javatests/google/registry/module/pubapi/PubApiRequestComponentTest.java index f85549a72..f27f172d3 100644 --- a/javatests/google/registry/module/pubapi/PubApiRequestComponentTest.java +++ b/javatests/google/registry/module/pubapi/PubApiRequestComponentTest.java @@ -25,7 +25,7 @@ import org.junit.runners.JUnit4; public class PubApiRequestComponentTest { @Test - public void testRoutingMap() throws Exception { + public void testRoutingMap() { GoldenFileTestHelper.assertThatRoutesFromComponent(PubApiRequestComponent.class) .describedAs("pubapi routing map") .isEqualToGolden(PubApiRequestComponentTest.class, "pubapi_routing.txt"); diff --git a/javatests/google/registry/module/tools/ToolsRequestComponentTest.java b/javatests/google/registry/module/tools/ToolsRequestComponentTest.java index 1ebd9806a..e049b44f3 100644 --- a/javatests/google/registry/module/tools/ToolsRequestComponentTest.java +++ b/javatests/google/registry/module/tools/ToolsRequestComponentTest.java @@ -24,7 +24,7 @@ import org.junit.runners.JUnit4; public class ToolsRequestComponentTest { @Test - public void testRoutingMap() throws Exception { + public void testRoutingMap() { GoldenFileTestHelper.assertThatRoutesFromComponent(ToolsRequestComponent.class) .describedAs("tools routing map") .isEqualToGolden(ToolsRequestComponentTest.class, "tools_routing.txt"); diff --git a/javatests/google/registry/monitoring/whitebox/EppMetricTest.java b/javatests/google/registry/monitoring/whitebox/EppMetricTest.java index 34778d286..6c21ee1ac 100644 --- a/javatests/google/registry/monitoring/whitebox/EppMetricTest.java +++ b/javatests/google/registry/monitoring/whitebox/EppMetricTest.java @@ -38,7 +38,7 @@ public class EppMetricTest { @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Test - public void test_invalidTld_isRecordedAsInvalid() throws Exception { + public void test_invalidTld_isRecordedAsInvalid() { EppMetric metric = EppMetric.builderForRequest("request-id-1", new FakeClock()) .setTlds(ImmutableSet.of("notarealtld")) @@ -47,7 +47,7 @@ public class EppMetricTest { } @Test - public void test_validTld_isRecorded() throws Exception { + public void test_validTld_isRecorded() { createTld("example"); EppMetric metric = EppMetric.builderForRequest("request-id-1", new FakeClock()) @@ -57,7 +57,7 @@ public class EppMetricTest { } @Test - public void test_multipleTlds_areRecordedAsVarious() throws Exception { + public void test_multipleTlds_areRecordedAsVarious() { createTlds("foo", "bar"); EppMetric metric = EppMetric.builderForRequest("request-id-1", new FakeClock()) @@ -67,7 +67,7 @@ public class EppMetricTest { } @Test - public void test_zeroTlds_areRecordedAsAbsent() throws Exception { + public void test_zeroTlds_areRecordedAsAbsent() { EppMetric metric = EppMetric.builderForRequest("request-id-1", new FakeClock()) .setTlds(ImmutableSet.of()) @@ -76,7 +76,7 @@ public class EppMetricTest { } @Test - public void testGetBigQueryRowEncoding_encodesCorrectly() throws Exception { + public void testGetBigQueryRowEncoding_encodesCorrectly() { EppMetric metric = EppMetric.builder() .setRequestId("request-id-1") @@ -108,7 +108,7 @@ public class EppMetricTest { } @Test - public void testGetBigQueryRowEncoding_hasAllSchemaFields() throws Exception { + public void testGetBigQueryRowEncoding_hasAllSchemaFields() { EppMetric metric = EppMetric.builder() .setRequestId("request-id-1") diff --git a/javatests/google/registry/pricing/PricingEngineProxyTest.java b/javatests/google/registry/pricing/PricingEngineProxyTest.java index bf78d043d..0959b3149 100644 --- a/javatests/google/registry/pricing/PricingEngineProxyTest.java +++ b/javatests/google/registry/pricing/PricingEngineProxyTest.java @@ -50,7 +50,7 @@ public class PricingEngineProxyTest { private Clock clock; @Before - public void before() throws Exception { + public void before() { PremiumList premiumList = persistPremiumList( "rich,USD 100", "richer,USD 999", @@ -85,7 +85,7 @@ public class PricingEngineProxyTest { } @Test - public void testIsPremiumDomain() throws Exception { + public void testIsPremiumDomain() { createTld("example"); assertThat(isDomainPremium("poor.example", clock.nowUtc())).isFalse(); assertThat(isDomainPremium("rich.example", clock.nowUtc())).isTrue(); @@ -93,7 +93,7 @@ public class PricingEngineProxyTest { } @Test - public void testGetDomainCreateCost() throws Exception { + public void testGetDomainCreateCost() { // The example tld has a premium price for "rich". createTld("example"); // The default value of 17 is set in createTld(). @@ -108,7 +108,7 @@ public class PricingEngineProxyTest { } @Test - public void testGetDomainRenewCost() throws Exception { + public void testGetDomainRenewCost() { // The example tld has a premium price for "rich". createTld("example"); persistResource( @@ -137,7 +137,7 @@ public class PricingEngineProxyTest { } @Test - public void testFailure_cantLoadPricingEngine() throws Exception { + public void testFailure_cantLoadPricingEngine() { createTld("example"); persistResource( Registry.get("example") diff --git a/javatests/google/registry/rdap/RdapActionBaseTest.java b/javatests/google/registry/rdap/RdapActionBaseTest.java index bea2730b2..e2143861d 100644 --- a/javatests/google/registry/rdap/RdapActionBaseTest.java +++ b/javatests/google/registry/rdap/RdapActionBaseTest.java @@ -115,7 +115,7 @@ public class RdapActionBaseTest { private RdapTestAction action; @Before - public void setUp() throws Exception { + public void setUp() { createTld("thing"); inject.setStaticField(Ofy.class, "clock", clock); action = new RdapTestAction(); @@ -146,7 +146,7 @@ public class RdapActionBaseTest { } @Test - public void testIllegalValue_showsReadableTypeName() throws Exception { + public void testIllegalValue_showsReadableTypeName() { assertThat(generateActualJson("IllegalArgumentException")).isEqualTo(JSONValue.parse( "{\"lang\":\"en\", \"errorCode\":400, \"title\":\"Bad Request\"," + "\"rdapConformance\":[\"rdap_level_0\"]," @@ -155,7 +155,7 @@ public class RdapActionBaseTest { } @Test - public void testRuntimeException_returns500Error() throws Exception { + public void testRuntimeException_returns500Error() { assertThat(generateActualJson("RuntimeException")).isEqualTo(JSONValue.parse( "{\"lang\":\"en\", \"errorCode\":500, \"title\":\"Internal Server Error\"," + "\"rdapConformance\":[\"rdap_level_0\"]," @@ -164,39 +164,39 @@ public class RdapActionBaseTest { } @Test - public void testValidName_works() throws Exception { + public void testValidName_works() { assertThat(generateActualJson("no.thing")).isEqualTo(JSONValue.parse( loadFile(this.getClass(), "rdapjson_toplevel.json"))); assertThat(response.getStatus()).isEqualTo(200); } @Test - public void testContentType_rdapjson_utf8() throws Exception { + public void testContentType_rdapjson_utf8() { generateActualJson("no.thing"); assertThat(response.getContentType().toString()) .isEqualTo("application/rdap+json; charset=utf-8"); } @Test - public void testHeadRequest_returnsNoContent() throws Exception { + public void testHeadRequest_returnsNoContent() { assertThat(generateHeadPayload("no.thing")).isEmpty(); assertThat(response.getStatus()).isEqualTo(200); } @Test - public void testHeadRequestIllegalValue_returnsNoContent() throws Exception { + public void testHeadRequestIllegalValue_returnsNoContent() { assertThat(generateHeadPayload("IllegalArgumentException")).isEmpty(); assertThat(response.getStatus()).isEqualTo(400); } @Test - public void testRdapServer_allowsAllCrossOriginRequests() throws Exception { + public void testRdapServer_allowsAllCrossOriginRequests() { generateActualJson("no.thing"); assertThat(response.getHeaders().get(ACCESS_CONTROL_ALLOW_ORIGIN)).isEqualTo("*"); } @Test - public void testMetrics_onSuccess() throws Exception { + public void testMetrics_onSuccess() { generateActualJson("no.thing"); verify(rdapMetrics) .updateMetrics( @@ -215,7 +215,7 @@ public class RdapActionBaseTest { } @Test - public void testMetrics_onError() throws Exception { + public void testMetrics_onError() { generateActualJson("IllegalArgumentException"); verify(rdapMetrics) .updateMetrics( @@ -239,7 +239,7 @@ public class RdapActionBaseTest { } @Test - public void testUnformatted() throws Exception { + public void testUnformatted() { action.requestPath = RdapTestAction.PATH + "no.thing"; action.fullServletPath = "http://myserver.example.com" + RdapTestAction.PATH; action.requestMethod = GET; @@ -249,7 +249,7 @@ public class RdapActionBaseTest { } @Test - public void testFormatted() throws Exception { + public void testFormatted() { action.requestPath = RdapTestAction.PATH + "no.thing?formatOutput=true"; action.fullServletPath = "http://myserver.example.com" + RdapTestAction.PATH; action.requestMethod = GET; diff --git a/javatests/google/registry/rdap/RdapDomainActionTest.java b/javatests/google/registry/rdap/RdapDomainActionTest.java index fc28ba569..af19848e9 100644 --- a/javatests/google/registry/rdap/RdapDomainActionTest.java +++ b/javatests/google/registry/rdap/RdapDomainActionTest.java @@ -93,7 +93,7 @@ public class RdapDomainActionTest { private RdapDomainAction action; @Before - public void setUp() throws Exception { + public void setUp() { inject.setStaticField(Ofy.class, "clock", clock); // lol createTld("lol"); @@ -434,7 +434,7 @@ public class RdapDomainActionTest { } @Test - public void testInvalidDomain_returns400() throws Exception { + public void testInvalidDomain_returns400() { assertJsonEqual( generateActualJson("invalid/domain/name"), generateExpectedJson( @@ -447,7 +447,7 @@ public class RdapDomainActionTest { } @Test - public void testUnknownDomain_returns400() throws Exception { + public void testUnknownDomain_returns400() { assertJsonEqual( generateActualJson("missingdomain.com"), generateExpectedJson( @@ -460,59 +460,59 @@ public class RdapDomainActionTest { } @Test - public void testValidDomain_works() throws Exception { + public void testValidDomain_works() { login("evilregistrar"); assertProperResponseForCatLol("cat.lol", "rdap_domain.json"); } @Test - public void testValidDomain_works_sameRegistrarRequested() throws Exception { + public void testValidDomain_works_sameRegistrarRequested() { action.registrarParam = Optional.of("evilregistrar"); login("evilregistrar"); assertProperResponseForCatLol("cat.lol", "rdap_domain.json"); } @Test - public void testValidDomain_notFound_differentRegistrarRequested() throws Exception { + public void testValidDomain_notFound_differentRegistrarRequested() { action.registrarParam = Optional.of("idnregistrar"); generateActualJson("cat.lol"); assertThat(response.getStatus()).isEqualTo(404); } @Test - public void testValidDomain_asAdministrator_works() throws Exception { + public void testValidDomain_asAdministrator_works() { loginAsAdmin(); assertProperResponseForCatLol("cat.lol", "rdap_domain.json"); } @Test - public void testValidDomain_notLoggedIn_noContacts() throws Exception { + public void testValidDomain_notLoggedIn_noContacts() { assertProperResponseForCatLol("cat.lol", "rdap_domain_no_contacts.json"); } @Test - public void testValidDomain_loggedInAsOtherRegistrar_noContacts() throws Exception { + public void testValidDomain_loggedInAsOtherRegistrar_noContacts() { login("idnregistrar"); assertProperResponseForCatLol("cat.lol", "rdap_domain_no_contacts.json"); } @Test - public void testUpperCase_ignored() throws Exception { + public void testUpperCase_ignored() { assertProperResponseForCatLol("CaT.lOl", "rdap_domain_no_contacts.json"); } @Test - public void testTrailingDot_ignored() throws Exception { + public void testTrailingDot_ignored() { assertProperResponseForCatLol("cat.lol.", "rdap_domain_no_contacts.json"); } @Test - public void testQueryParameter_ignored() throws Exception { + public void testQueryParameter_ignored() { assertProperResponseForCatLol("cat.lol?key=value", "rdap_domain_no_contacts.json"); } @Test - public void testIdnDomain_works() throws Exception { + public void testIdnDomain_works() { login("idnregistrar"); assertJsonEqual( generateActualJson("cat.みんな"), @@ -528,7 +528,7 @@ public class RdapDomainActionTest { } @Test - public void testIdnDomainWithPercentEncoding_works() throws Exception { + public void testIdnDomainWithPercentEncoding_works() { login("idnregistrar"); assertJsonEqual( generateActualJson("cat.%E3%81%BF%E3%82%93%E3%81%AA"), @@ -544,7 +544,7 @@ public class RdapDomainActionTest { } @Test - public void testPunycodeDomain_works() throws Exception { + public void testPunycodeDomain_works() { login("idnregistrar"); assertJsonEqual( generateActualJson("cat.xn--q9jyb4c"), @@ -560,7 +560,7 @@ public class RdapDomainActionTest { } @Test - public void testMultilevelDomain_works() throws Exception { + public void testMultilevelDomain_works() { login("1tldregistrar"); assertJsonEqual( generateActualJson("cat.1.tld"), @@ -578,14 +578,14 @@ public class RdapDomainActionTest { // todo (b/27378695): reenable or delete this test @Ignore @Test - public void testDomainInTestTld_notFound() throws Exception { + public void testDomainInTestTld_notFound() { persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build()); generateActualJson("cat.lol"); assertThat(response.getStatus()).isEqualTo(404); } @Test - public void testDeletedDomain_notFound() throws Exception { + public void testDeletedDomain_notFound() { assertJsonEqual( generateActualJson("dodo.lol"), generateExpectedJson("dodo.lol not found", null, "1", "rdap_error_404.json")); @@ -593,21 +593,21 @@ public class RdapDomainActionTest { } @Test - public void testDeletedDomain_notFound_includeDeletedSetFalse() throws Exception { + public void testDeletedDomain_notFound_includeDeletedSetFalse() { action.includeDeletedParam = Optional.of(true); generateActualJson("dodo.lol"); assertThat(response.getStatus()).isEqualTo(404); } @Test - public void testDeletedDomain_notFound_notLoggedIn() throws Exception { + public void testDeletedDomain_notFound_notLoggedIn() { action.includeDeletedParam = Optional.of(true); generateActualJson("dodo.lol"); assertThat(response.getStatus()).isEqualTo(404); } @Test - public void testDeletedDomain_notFound_loggedInAsDifferentRegistrar() throws Exception { + public void testDeletedDomain_notFound_loggedInAsDifferentRegistrar() { login("1tldregistrar"); action.includeDeletedParam = Optional.of(true); generateActualJson("dodo.lol"); @@ -615,7 +615,7 @@ public class RdapDomainActionTest { } @Test - public void testDeletedDomain_works_loggedInAsCorrectRegistrar() throws Exception { + public void testDeletedDomain_works_loggedInAsCorrectRegistrar() { login("evilregistrar"); action.includeDeletedParam = Optional.of(true); assertJsonEqual( @@ -633,7 +633,7 @@ public class RdapDomainActionTest { } @Test - public void testDeletedDomain_works_loggedInAsAdmin() throws Exception { + public void testDeletedDomain_works_loggedInAsAdmin() { loginAsAdmin(); action.includeDeletedParam = Optional.of(true); assertJsonEqual( @@ -651,7 +651,7 @@ public class RdapDomainActionTest { } @Test - public void testMetrics() throws Exception { + public void testMetrics() { generateActualJson("cat.lol"); verify(rdapMetrics) .updateMetrics( diff --git a/javatests/google/registry/rdap/RdapDomainSearchActionTest.java b/javatests/google/registry/rdap/RdapDomainSearchActionTest.java index df2adfc59..641306270 100644 --- a/javatests/google/registry/rdap/RdapDomainSearchActionTest.java +++ b/javatests/google/registry/rdap/RdapDomainSearchActionTest.java @@ -175,7 +175,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Before - public void setUp() throws Exception { + public void setUp() { inject.setStaticField(Ofy.class, "clock", clock); // cat.lol and cat2.lol @@ -888,7 +888,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testInvalidPath_rejected() throws Exception { + public void testInvalidPath_rejected() { action.requestPath = RdapDomainSearchAction.PATH + "/path"; action.run(); assertThat(response.getStatus()).isEqualTo(400); @@ -896,7 +896,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testInvalidRequest_rejected() throws Exception { + public void testInvalidRequest_rejected() { assertThat(generateActualJson(RequestType.NONE, null)) .isEqualTo(generateExpectedJson( "You must specify either name=XXXX, nsLdhName=YYYY or nsIp=ZZZZ", @@ -906,7 +906,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testInvalidWildcard_rejected() throws Exception { + public void testInvalidWildcard_rejected() { assertThat(generateActualJson(RequestType.NAME, "exam*ple")) .isEqualTo(generateExpectedJson( "Suffix after wildcard must be one or more domain" @@ -917,7 +917,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testMultipleWildcards_rejected() throws Exception { + public void testMultipleWildcards_rejected() { assertThat(generateActualJson(RequestType.NAME, "*.*")) .isEqualTo(generateExpectedJson("Only one wildcard allowed", "rdap_error_422.json")); assertThat(response.getStatus()).isEqualTo(422); @@ -925,7 +925,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNoCharactersToMatch_rejected() throws Exception { + public void testNoCharactersToMatch_rejected() { rememberWildcardType("*"); assertThat(generateActualJson(RequestType.NAME, "*")) .isEqualTo( @@ -938,7 +938,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testFewerThanTwoCharactersToMatch_rejected() throws Exception { + public void testFewerThanTwoCharactersToMatch_rejected() { rememberWildcardType("a*"); assertThat(generateActualJson(RequestType.NAME, "a*")) .isEqualTo( @@ -951,21 +951,21 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_found() throws Exception { + public void testDomainMatch_found() { login("evilregistrar"); runSuccessfulTestWithCatLol(RequestType.NAME, "cat.lol", "rdap_domain.json"); verifyMetrics(SearchType.BY_DOMAIN_NAME, Optional.of(1L)); } @Test - public void testDomainMatch_foundWithUpperCase() throws Exception { + public void testDomainMatch_foundWithUpperCase() { login("evilregistrar"); runSuccessfulTestWithCatLol(RequestType.NAME, "CaT.lOl", "rdap_domain.json"); verifyMetrics(SearchType.BY_DOMAIN_NAME, Optional.of(1L)); } @Test - public void testDomainMatch_found_sameRegistrarRequested() throws Exception { + public void testDomainMatch_found_sameRegistrarRequested() { login("evilregistrar"); action.registrarParam = Optional.of("evilregistrar"); runSuccessfulTestWithCatLol(RequestType.NAME, "cat.lol", "rdap_domain.json"); @@ -973,21 +973,21 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_notFound_differentRegistrarRequested() throws Exception { + public void testDomainMatch_notFound_differentRegistrarRequested() { action.registrarParam = Optional.of("otherregistrar"); runNotFoundTest(RequestType.NAME, "cat.lol", "No domains found"); verifyErrorMetrics(SearchType.BY_DOMAIN_NAME); } @Test - public void testDomainMatch_found_asAdministrator() throws Exception { + public void testDomainMatch_found_asAdministrator() { loginAsAdmin(); runSuccessfulTestWithCatLol(RequestType.NAME, "cat.lol", "rdap_domain.json"); verifyMetrics(SearchType.BY_DOMAIN_NAME, Optional.of(1L)); } @Test - public void testDomainMatch_found_loggedInAsOtherRegistrar() throws Exception { + public void testDomainMatch_found_loggedInAsOtherRegistrar() { login("otherregistrar"); runSuccessfulTestWithCatLol( RequestType.NAME, "cat.lol", "rdap_domain_no_contacts_with_remark.json"); @@ -1000,19 +1000,19 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { */ @Ignore @Test - public void testDomainMatchWithTrailingDot_notFound() throws Exception { + public void testDomainMatchWithTrailingDot_notFound() { runNotFoundTest(RequestType.NAME, "cat.lol.", "No domains found"); } @Test - public void testDomainMatch_cat2_lol_found() throws Exception { + public void testDomainMatch_cat2_lol_found() { login("evilregistrar"); runSuccessfulTestWithCat2Lol(RequestType.NAME, "cat2.lol", "rdap_domain_cat2.json"); verifyMetrics(SearchType.BY_DOMAIN_NAME, Optional.of(1L)); } @Test - public void testDomainMatch_cat_example_found() throws Exception { + public void testDomainMatch_cat_example_found() { login("evilregistrar"); runSuccessfulTest( RequestType.NAME, @@ -1028,7 +1028,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_cat_idn_unicode_found() throws Exception { + public void testDomainMatch_cat_idn_unicode_found() { runSuccessfulTest( RequestType.NAME, "cat.みんな", @@ -1045,7 +1045,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_cat_idn_punycode_found() throws Exception { + public void testDomainMatch_cat_idn_punycode_found() { runSuccessfulTest( RequestType.NAME, "cat.xn--q9jyb4c", @@ -1060,7 +1060,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_cat_1_test_found() throws Exception { + public void testDomainMatch_cat_1_test_found() { runSuccessfulTest( RequestType.NAME, "cat.1.test", @@ -1075,7 +1075,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_castar_1_test_found() throws Exception { + public void testDomainMatch_castar_1_test_found() { runSuccessfulTest( RequestType.NAME, "ca*.1.test", @@ -1090,13 +1090,13 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_castar_test_notFound() throws Exception { + public void testDomainMatch_castar_test_notFound() { runNotFoundTest(RequestType.NAME, "ca*.test", "No domains found"); verifyErrorMetrics(SearchType.BY_DOMAIN_NAME); } @Test - public void testDomainMatch_catstar_lol_found() throws Exception { + public void testDomainMatch_catstar_lol_found() { rememberWildcardType("cat*.lol"); assertThat(generateActualJson(RequestType.NAME, "cat*.lol")) .isEqualTo(generateExpectedJsonForTwoDomains("cat.lol", "C-LOL", "cat2.lol", "17-LOL")); @@ -1105,7 +1105,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_cstar_lol_found() throws Exception { + public void testDomainMatch_cstar_lol_found() { rememberWildcardType("c*.lol"); assertThat(generateActualJson(RequestType.NAME, "c*.lol")) .isEqualTo(generateExpectedJsonForTwoDomains("cat.lol", "C-LOL", "cat2.lol", "17-LOL")); @@ -1114,13 +1114,13 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_qstar_lol_notFound() throws Exception { + public void testDomainMatch_qstar_lol_notFound() { runNotFoundTest(RequestType.NAME, "q*.lol", "No domains found"); verifyErrorMetrics(SearchType.BY_DOMAIN_NAME); } @Test - public void testDomainMatch_star_lol_found() throws Exception { + public void testDomainMatch_star_lol_found() { rememberWildcardType("*.lol"); assertThat(generateActualJson(RequestType.NAME, "*.lol")) .isEqualTo(generateExpectedJsonForTwoDomains("cat.lol", "C-LOL", "cat2.lol", "17-LOL")); @@ -1129,7 +1129,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_star_lol_found_sameRegistrarRequested() throws Exception { + public void testDomainMatch_star_lol_found_sameRegistrarRequested() { action.registrarParam = Optional.of("evilregistrar"); rememberWildcardType("*.lol"); assertThat(generateActualJson(RequestType.NAME, "*.lol")) @@ -1139,7 +1139,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_star_lol_notFound_differentRegistrarRequested() throws Exception { + public void testDomainMatch_star_lol_notFound_differentRegistrarRequested() { action.registrarParam = Optional.of("otherregistrar"); rememberWildcardType("*.lol"); runNotFoundTest(RequestType.NAME, "*.lol", "No domains found"); @@ -1147,7 +1147,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_cat_star_found() throws Exception { + public void testDomainMatch_cat_star_found() { rememberWildcardType("cat.*"); assertThat(generateActualJson(RequestType.NAME, "cat.*")) .isEqualTo( @@ -1162,7 +1162,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_cat_star_foundOne_sameRegistrarRequested() throws Exception { + public void testDomainMatch_cat_star_foundOne_sameRegistrarRequested() { login("evilregistrar"); action.registrarParam = Optional.of("evilregistrar"); runSuccessfulTestWithCatLol(RequestType.NAME, "cat.*", "rdap_domain.json"); @@ -1170,21 +1170,21 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_cat_star_notFound_differentRegistrarRequested() throws Exception { + public void testDomainMatch_cat_star_notFound_differentRegistrarRequested() { action.registrarParam = Optional.of("otherregistrar"); runNotFoundTest(RequestType.NAME, "cat.*", "No domains found"); verifyErrorMetrics(SearchType.BY_DOMAIN_NAME); } @Test - public void testDomainMatch_cat_lstar_found() throws Exception { + public void testDomainMatch_cat_lstar_found() { login("evilregistrar"); runSuccessfulTestWithCatLol(RequestType.NAME, "cat.l*", "rdap_domain.json"); verifyMetrics(SearchType.BY_DOMAIN_NAME, Optional.of(1L)); } @Test - public void testDomainMatch_catstar_found() throws Exception { + public void testDomainMatch_catstar_found() { rememberWildcardType("cat*"); assertThat(generateActualJson(RequestType.NAME, "cat*")) .isEqualTo( @@ -1200,7 +1200,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatchWithWildcardAndEmptySuffix_fails() throws Exception { + public void testDomainMatchWithWildcardAndEmptySuffix_fails() { // Unfortunately, we can't be sure which error is going to be returned. The version of // IDN.toASCII used in Eclipse drops a trailing dot, if any. But the version linked in by // Blaze throws an error in that situation. So just check that it returns an error. @@ -1210,20 +1210,20 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_dog_notFound() throws Exception { + public void testDomainMatch_dog_notFound() { runNotFoundTest(RequestType.NAME, "dog*", "No domains found"); verifyErrorMetrics(SearchType.BY_DOMAIN_NAME); } @Test - public void testDomainMatchDeletedDomain_notFound() throws Exception { + public void testDomainMatchDeletedDomain_notFound() { persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); runNotFoundTest(RequestType.NAME, "cat.lol", "No domains found"); verifyErrorMetrics(SearchType.BY_DOMAIN_NAME); } @Test - public void testDomainMatchDeletedDomain_notFound_deletedNotRequested() throws Exception { + public void testDomainMatchDeletedDomain_notFound_deletedNotRequested() { login("evilregistrar"); persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); runNotFoundTest(RequestType.NAME, "cat.lol", "No domains found"); @@ -1231,7 +1231,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatchDeletedDomain_found_loggedInAsSameRegistrar() throws Exception { + public void testDomainMatchDeletedDomain_found_loggedInAsSameRegistrar() { login("evilregistrar"); action.includeDeletedParam = Optional.of(true); deleteCatLol(); @@ -1240,7 +1240,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatchDeletedDomain_notFound_loggedInAsOtherRegistrar() throws Exception { + public void testDomainMatchDeletedDomain_notFound_loggedInAsOtherRegistrar() { login("otherregistrar"); action.includeDeletedParam = Optional.of(true); persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); @@ -1249,7 +1249,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatchDeletedDomain_found_loggedInAsAdmin() throws Exception { + public void testDomainMatchDeletedDomain_found_loggedInAsAdmin() { loginAsAdmin(); action.includeDeletedParam = Optional.of(true); deleteCatLol(); @@ -1258,14 +1258,14 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatchDeletedDomainWithWildcard_notFound() throws Exception { + public void testDomainMatchDeletedDomainWithWildcard_notFound() { persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); runNotFoundTest(RequestType.NAME, "cat.lo*", "No domains found"); verifyErrorMetrics(SearchType.BY_DOMAIN_NAME, Optional.of(1L), 404); } @Test - public void testDomainMatchDeletedDomainsWithWildcardAndTld_notFound() throws Exception { + public void testDomainMatchDeletedDomainsWithWildcardAndTld_notFound() { persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); persistDomainAsDeleted(domainCatLol2, clock.nowUtc().minusDays(1)); runNotFoundTest(RequestType.NAME, "cat*.lol", "No domains found"); @@ -1275,14 +1275,14 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { // TODO(b/27378695): reenable or delete this test @Ignore @Test - public void testDomainMatchDomainInTestTld_notFound() throws Exception { + public void testDomainMatchDomainInTestTld_notFound() { persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build()); runNotFoundTest(RequestType.NAME, "cat.lol", "No domains found"); verifyErrorMetrics(SearchType.BY_DOMAIN_NAME); } @Test - public void testDomainMatch_manyDeletedDomains_fullResultSet() throws Exception { + public void testDomainMatch_manyDeletedDomains_fullResultSet() { // There are enough domains to fill a full result set; deleted domains are ignored. createManyDomainsAndHosts(4, 4, 2); rememberWildcardType("domain*.lol"); @@ -1293,8 +1293,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_manyDeletedDomains_partialResultSetDueToInsufficientDomains() - throws Exception { + public void testDomainMatch_manyDeletedDomains_partialResultSetDueToInsufficientDomains() { // There are not enough domains to fill a full result set. createManyDomainsAndHosts(3, 20, 2); rememberWildcardType("domain*.lol"); @@ -1305,8 +1304,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_manyDeletedDomains_partialResultSetDueToFetchingLimit() - throws Exception { + public void testDomainMatch_manyDeletedDomains_partialResultSetDueToFetchingLimit() { // This is not exactly desired behavior, but expected: There are enough domains to fill a full // result set, but there are so many deleted domains that we run out of patience before we work // our way through all of them. @@ -1331,7 +1329,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_nontruncatedResultsSet() throws Exception { + public void testDomainMatch_nontruncatedResultsSet() { createManyDomainsAndHosts(4, 1, 2); runSuccessfulTestWithFourDomains( RequestType.NAME, @@ -1345,7 +1343,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_truncatedResultsSet() throws Exception { + public void testDomainMatch_truncatedResultsSet() { createManyDomainsAndHosts(5, 1, 2); runSuccessfulTestWithFourDomains( RequestType.NAME, @@ -1360,7 +1358,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_tldSearchOrderedProperly() throws Exception { + public void testDomainMatch_tldSearchOrderedProperly() { createManyDomainsAndHosts(4, 1, 2); rememberWildcardType("*.lol"); assertThat(generateActualJson(RequestType.NAME, "*.lol")) @@ -1379,7 +1377,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_reallyTruncatedResultsSet() throws Exception { + public void testDomainMatch_reallyTruncatedResultsSet() { // Don't use 10 or more domains for this test, because domain10.lol will come before // domain2.lol, and you'll get the wrong domains in the result set. createManyDomainsAndHosts(9, 1, 2); @@ -1396,7 +1394,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testDomainMatch_truncatedResultsAfterMultipleChunks() throws Exception { + public void testDomainMatch_truncatedResultsAfterMultipleChunks() { createManyDomainsAndHosts(5, 6, 2); rememberWildcardType("domain*.lol"); assertThat(generateActualJson(RequestType.NAME, "domain*.lol")) @@ -1458,7 +1456,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_foundMultiple() throws Exception { + public void testNameserverMatch_foundMultiple() { rememberWildcardType("ns1.cat.lol"); assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.lol")) .isEqualTo(generateExpectedJsonForTwoDomains()); @@ -1467,7 +1465,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_foundMultiple_sameRegistrarRequested() throws Exception { + public void testNameserverMatch_foundMultiple_sameRegistrarRequested() { action.registrarParam = Optional.of("TheRegistrar"); rememberWildcardType("ns1.cat.lol"); assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns1.cat.lol")) @@ -1477,21 +1475,21 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_notFound_differentRegistrarRequested() throws Exception { + public void testNameserverMatch_notFound_differentRegistrarRequested() { action.registrarParam = Optional.of("otherregistrar"); runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.cat.lol", "No matching nameservers found"); verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404); } @Test - public void testNameserverMatchWithWildcard_found() throws Exception { + public void testNameserverMatchWithWildcard_found() { login("evilregistrar"); runSuccessfulTestWithCatLol(RequestType.NS_LDH_NAME, "ns2.cat.l*", "rdap_domain.json"); verifyMetrics(SearchType.BY_NAMESERVER_NAME, 1, 1); } @Test - public void testNameserverMatchWithWildcard_found_sameRegistrarRequested() throws Exception { + public void testNameserverMatchWithWildcard_found_sameRegistrarRequested() { login("evilregistrar"); action.registrarParam = Optional.of("TheRegistrar"); runSuccessfulTestWithCatLol(RequestType.NS_LDH_NAME, "ns2.cat.l*", "rdap_domain.json"); @@ -1499,21 +1497,20 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchWithWildcard_notFound_differentRegistrarRequested() - throws Exception { + public void testNameserverMatchWithWildcard_notFound_differentRegistrarRequested() { action.registrarParam = Optional.of("otherregistrar"); runNotFoundTest(RequestType.NS_LDH_NAME, "ns2.cat.l*", "No matching nameservers found"); verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404); } @Test - public void testNameserverMatchWithWildcardAndDomainSuffix_notFound() throws Exception { + public void testNameserverMatchWithWildcardAndDomainSuffix_notFound() { runNotFoundTest(RequestType.NS_LDH_NAME, "ns5*.cat.lol", "No matching nameservers found"); verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404); } @Test - public void testNameserverMatchWithNoPrefixAndDomainSuffix_found() throws Exception { + public void testNameserverMatchWithNoPrefixAndDomainSuffix_found() { rememberWildcardType("*.cat.lol"); assertThat(generateActualJson(RequestType.NS_LDH_NAME, "*.cat.lol")) .isEqualTo(generateExpectedJsonForTwoDomains()); @@ -1522,8 +1519,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchWithOneCharacterPrefixAndDomainSuffix_found() - throws Exception { + public void testNameserverMatchWithOneCharacterPrefixAndDomainSuffix_found() { rememberWildcardType("n*.cat.lol"); assertThat(generateActualJson(RequestType.NS_LDH_NAME, "n*.cat.lol")) .isEqualTo(generateExpectedJsonForTwoDomains()); @@ -1533,8 +1529,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { @Test public void - testNameserverMatchWithOneCharacterPrefixAndDomainSuffix_found_sameRegistrarRequested() - throws Exception { + testNameserverMatchWithOneCharacterPrefixAndDomainSuffix_found_sameRegistrarRequested() { action.registrarParam = Optional.of("TheRegistrar"); rememberWildcardType("n*.cat.lol"); assertThat(generateActualJson(RequestType.NS_LDH_NAME, "n*.cat.lol")) @@ -1544,16 +1539,14 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchWithPrefixAndDomainSuffix_notFound_differentRegistrarRequested() - throws Exception { + public void testNameserverMatchWithPrefixAndDomainSuffix_notFound_differentRegistrarRequested() { action.registrarParam = Optional.of("otherregistrar"); runNotFoundTest(RequestType.NS_LDH_NAME, "n*.cat.lol", "No matching nameservers found"); verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404); } @Test - public void testNameserverMatchWithTwoCharacterPrefixAndDomainSuffix_found() - throws Exception { + public void testNameserverMatchWithTwoCharacterPrefixAndDomainSuffix_found() { rememberWildcardType("ns*.cat.lol"); assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns*.cat.lol")) .isEqualTo(generateExpectedJsonForTwoDomains()); @@ -1562,7 +1555,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchWithWildcardAndEmptySuffix_unprocessable() throws Exception { + public void testNameserverMatchWithWildcardAndEmptySuffix_unprocessable() { rememberWildcardType("ns*."); generateActualJson(RequestType.NS_LDH_NAME, "ns*."); assertThat(response.getStatus()).isEqualTo(422); @@ -1570,7 +1563,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchWithWildcardAndInvalidSuffix_unprocessable() throws Exception { + public void testNameserverMatchWithWildcardAndInvalidSuffix_unprocessable() { rememberWildcardType("ns*.google.com"); generateActualJson(RequestType.NS_LDH_NAME, "ns*.google.com"); assertThat(response.getStatus()).isEqualTo(422); @@ -1578,21 +1571,21 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_ns2_cat_lol_found() throws Exception { + public void testNameserverMatch_ns2_cat_lol_found() { login("evilregistrar"); runSuccessfulTestWithCatLol(RequestType.NS_LDH_NAME, "ns2.cat.lol", "rdap_domain.json"); verifyMetrics(SearchType.BY_NAMESERVER_NAME, 1, 1); } @Test - public void testNameserverMatch_ns2_dog_lol_found() throws Exception { + public void testNameserverMatch_ns2_dog_lol_found() { login("evilregistrar"); runSuccessfulTestWithCat2Lol(RequestType.NS_LDH_NAME, "ns2.dog.lol", "rdap_domain_cat2.json"); verifyMetrics(SearchType.BY_NAMESERVER_NAME, 1, 1); } @Test - public void testNameserverMatch_ns1_cat_idn_unicode_badRequest() throws Exception { + public void testNameserverMatch_ns1_cat_idn_unicode_badRequest() { // nsLdhName must use punycode. metricWildcardType = WildcardType.INVALID; metricPrefixLength = 0; @@ -1602,7 +1595,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_ns1_cat_idn_punycode_found() throws Exception { + public void testNameserverMatch_ns1_cat_idn_punycode_found() { runSuccessfulTest( RequestType.NS_LDH_NAME, "ns1.cat.xn--q9jyb4c", @@ -1617,7 +1610,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_ns1_cat_1_test_found() throws Exception { + public void testNameserverMatch_ns1_cat_1_test_found() { runSuccessfulTest( RequestType.NS_LDH_NAME, "ns1.cat.1.test", @@ -1632,7 +1625,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_nsstar_cat_1_test_found() throws Exception { + public void testNameserverMatch_nsstar_cat_1_test_found() { runSuccessfulTest( RequestType.NS_LDH_NAME, "ns*.cat.1.test", @@ -1647,7 +1640,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_nsstar_test_unprocessable() throws Exception { + public void testNameserverMatch_nsstar_test_unprocessable() { rememberWildcardType("ns*.1.test"); generateActualJson(RequestType.NS_LDH_NAME, "ns*.1.test"); assertThat(response.getStatus()).isEqualTo(422); @@ -1655,7 +1648,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchMissing_notFound() throws Exception { + public void testNameserverMatchMissing_notFound() { runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.missing.com", "No matching nameservers found"); verifyErrorMetrics(SearchType.BY_NAMESERVER_NAME, Optional.empty(), Optional.of(0L), 404); } @@ -1663,13 +1656,13 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { // TODO(b/27378695): reenable or delete this test @Ignore @Test - public void testNameserverMatchDomainsInTestTld_notFound() throws Exception { + public void testNameserverMatchDomainsInTestTld_notFound() { persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build()); runNotFoundTest(RequestType.NS_LDH_NAME, "ns2.cat.lol", "No matching nameservers found"); } @Test - public void testNameserverMatchDeletedDomain_notFound() throws Exception { + public void testNameserverMatchDeletedDomain_notFound() { action.includeDeletedParam = Optional.of(true); deleteCatLol(); runNotFoundTest(RequestType.NS_LDH_NAME, "ns2.cat.lol", "No domains found"); @@ -1677,7 +1670,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchDeletedDomain_found_loggedInAsSameRegistrar() throws Exception { + public void testNameserverMatchDeletedDomain_found_loggedInAsSameRegistrar() { login("evilregistrar"); action.includeDeletedParam = Optional.of(true); deleteCatLol(); @@ -1686,8 +1679,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchDeletedDomain_notFound_loggedInAsOtherRegistrar() - throws Exception { + public void testNameserverMatchDeletedDomain_notFound_loggedInAsOtherRegistrar() { login("otherregistrar"); action.includeDeletedParam = Optional.of(true); persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); @@ -1696,7 +1688,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchDeletedDomain_found_loggedInAsAdmin() throws Exception { + public void testNameserverMatchDeletedDomain_found_loggedInAsAdmin() { loginAsAdmin(); action.includeDeletedParam = Optional.of(true); deleteCatLol(); @@ -1705,7 +1697,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchOneDeletedDomain_foundTheOther() throws Exception { + public void testNameserverMatchOneDeletedDomain_foundTheOther() { login("evilregistrar"); persistDomainAsDeleted(domainCatExample, clock.nowUtc().minusDays(1)); runSuccessfulTestWithCatLol(RequestType.NS_LDH_NAME, "ns1.cat.lol", "rdap_domain.json"); @@ -1713,7 +1705,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchTwoDeletedDomains_notFound() throws Exception { + public void testNameserverMatchTwoDeletedDomains_notFound() { persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); persistDomainAsDeleted(domainCatExample, clock.nowUtc().minusDays(1)); runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.cat.lol", "No domains found"); @@ -1721,7 +1713,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchDeletedNameserver_notFound() throws Exception { + public void testNameserverMatchDeletedNameserver_notFound() { persistResource( hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.cat.lol", "No matching nameservers found"); @@ -1729,7 +1721,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchDeletedNameserverWithWildcard_notFound() throws Exception { + public void testNameserverMatchDeletedNameserverWithWildcard_notFound() { persistResource( hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); runNotFoundTest(RequestType.NS_LDH_NAME, "ns1.cat.l*", "No matching nameservers found"); @@ -1737,8 +1729,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchDeletedNameserverWithWildcardAndSuffix_notFound() - throws Exception { + public void testNameserverMatchDeletedNameserverWithWildcardAndSuffix_notFound() { persistResource( hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); runNotFoundTest(RequestType.NS_LDH_NAME, "ns1*.cat.lol", "No matching nameservers found"); @@ -1746,7 +1737,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchManyNameserversForTheSameDomains() throws Exception { + public void testNameserverMatchManyNameserversForTheSameDomains() { // 40 nameservers for each of 3 domains; we should get back all three undeleted domains, because // each one references the nameserver. createManyDomainsAndHosts(3, 1, 40); @@ -1758,7 +1749,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchManyNameserversForTheSameDomainsWithWildcard() throws Exception { + public void testNameserverMatchManyNameserversForTheSameDomainsWithWildcard() { // Same as above, except with a wildcard (that still only finds one nameserver). createManyDomainsAndHosts(3, 1, 40); rememberWildcardType("ns1.domain1.l*"); @@ -1769,7 +1760,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatchManyNameserversForTheSameDomainsWithSuffix() throws Exception { + public void testNameserverMatchManyNameserversForTheSameDomainsWithSuffix() { // Same as above, except that we find all 40 nameservers because of the wildcard. But we // should still only return 3 domains, because we merge duplicate domains together in a set. // Since we fetch domains by nameserver in batches of 30 nameservers, we need to make sure to @@ -1783,7 +1774,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_nontruncatedResultsSet() throws Exception { + public void testNameserverMatch_nontruncatedResultsSet() { createManyDomainsAndHosts(4, 1, 2); runSuccessfulTestWithFourDomains( RequestType.NS_LDH_NAME, @@ -1797,7 +1788,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_truncatedResultsSet() throws Exception { + public void testNameserverMatch_truncatedResultsSet() { createManyDomainsAndHosts(5, 1, 2); runSuccessfulTestWithFourDomains( RequestType.NS_LDH_NAME, @@ -1816,7 +1807,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_reallyTruncatedResultsSet() throws Exception { + public void testNameserverMatch_reallyTruncatedResultsSet() { createManyDomainsAndHosts(9, 1, 2); runSuccessfulTestWithFourDomains( RequestType.NS_LDH_NAME, @@ -1835,7 +1826,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_duplicatesNotTruncated() throws Exception { + public void testNameserverMatch_duplicatesNotTruncated() { // 60 nameservers for each of 4 domains; these should translate into 2 30-nameserver domain // fetches, which should _not_ trigger the truncation warning because all the domains will be // duplicates. @@ -1857,7 +1848,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testNameserverMatch_incompleteResultsSet() throws Exception { + public void testNameserverMatch_incompleteResultsSet() { createManyDomainsAndHosts(2, 1, 2500); rememberWildcardType("ns*.domain1.lol"); assertThat(generateActualJson(RequestType.NS_LDH_NAME, "ns*.domain1.lol")) @@ -1897,7 +1888,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchV4Address_invalidAddress() throws Exception { + public void testAddressMatchV4Address_invalidAddress() { rememberWildcardType("1.2.3.4.5.6.7.8.9"); generateActualJson(RequestType.NS_IP, "1.2.3.4.5.6.7.8.9"); assertThat(response.getStatus()).isEqualTo(400); @@ -1905,7 +1896,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchV4Address_foundMultiple() throws Exception { + public void testAddressMatchV4Address_foundMultiple() { rememberWildcardType("1.2.3.4"); assertThat(generateActualJson(RequestType.NS_IP, "1.2.3.4")) .isEqualTo(generateExpectedJsonForTwoDomains()); @@ -1914,7 +1905,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchV4Address_foundMultiple_sameRegistrarRequested() throws Exception { + public void testAddressMatchV4Address_foundMultiple_sameRegistrarRequested() { action.registrarParam = Optional.of("TheRegistrar"); rememberWildcardType("1.2.3.4"); assertThat(generateActualJson(RequestType.NS_IP, "1.2.3.4")) @@ -1924,14 +1915,14 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchV4Address_notFound_differentRegistrarRequested() throws Exception { + public void testAddressMatchV4Address_notFound_differentRegistrarRequested() { action.registrarParam = Optional.of("otherregistrar"); runNotFoundTest(RequestType.NS_IP, "1.2.3.4", "No domains found"); verifyErrorMetrics(SearchType.BY_NAMESERVER_ADDRESS, Optional.empty(), Optional.of(0L), 404); } @Test - public void testAddressMatchV6Address_foundOne() throws Exception { + public void testAddressMatchV6Address_foundOne() { runSuccessfulTestWithCatLol( RequestType.NS_IP, "bad:f00d:cafe:0:0:0:15:beef", @@ -1940,7 +1931,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchLocalhost_notFound() throws Exception { + public void testAddressMatchLocalhost_notFound() { runNotFoundTest(RequestType.NS_IP, "127.0.0.1", "No domains found"); verifyErrorMetrics(SearchType.BY_NAMESERVER_ADDRESS, Optional.empty(), Optional.of(0L), 404); } @@ -1948,7 +1939,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { // TODO(b/27378695): reenable or delete this test @Ignore @Test - public void testAddressMatchDomainsInTestTld_notFound() throws Exception { + public void testAddressMatchDomainsInTestTld_notFound() { persistResource(Registry.get("lol").asBuilder().setTldType(Registry.TldType.TEST).build()); persistResource(Registry.get("example").asBuilder().setTldType(Registry.TldType.TEST).build()); runNotFoundTest(RequestType.NS_IP, "127.0.0.1", "No matching nameservers found"); @@ -1956,7 +1947,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchDeletedDomain_notFound() throws Exception { + public void testAddressMatchDeletedDomain_notFound() { action.includeDeletedParam = Optional.of(true); deleteCatLol(); runNotFoundTest(RequestType.NS_IP, "bad:f00d:cafe:0:0:0:15:beef", "No domains found"); @@ -1964,7 +1955,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchDeletedDomain_found_loggedInAsSameRegistrar() throws Exception { + public void testAddressMatchDeletedDomain_found_loggedInAsSameRegistrar() { login("evilregistrar"); action.includeDeletedParam = Optional.of(true); deleteCatLol(); @@ -1974,7 +1965,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchDeletedDomain_notFound_loggedInAsOtherRegistrar() throws Exception { + public void testAddressMatchDeletedDomain_notFound_loggedInAsOtherRegistrar() { login("otherregistrar"); action.includeDeletedParam = Optional.of(true); persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); @@ -1983,7 +1974,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchDeletedDomain_found_loggedInAsAdmin() throws Exception { + public void testAddressMatchDeletedDomain_found_loggedInAsAdmin() { loginAsAdmin(); action.includeDeletedParam = Optional.of(true); deleteCatLol(); @@ -1993,7 +1984,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchOneDeletedDomain_foundTheOther() throws Exception { + public void testAddressMatchOneDeletedDomain_foundTheOther() { login("evilregistrar"); persistDomainAsDeleted(domainCatExample, clock.nowUtc().minusDays(1)); rememberWildcardType("1.2.3.4"); @@ -2012,7 +2003,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchTwoDeletedDomains_notFound() throws Exception { + public void testAddressMatchTwoDeletedDomains_notFound() { persistDomainAsDeleted(domainCatLol, clock.nowUtc().minusDays(1)); persistDomainAsDeleted(domainCatExample, clock.nowUtc().minusDays(1)); runNotFoundTest(RequestType.NS_IP, "1.2.3.4", "No domains found"); @@ -2020,14 +2011,14 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatchDeletedNameserver_notFound() throws Exception { + public void testAddressMatchDeletedNameserver_notFound() { persistResource(hostNs1CatLol.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); runNotFoundTest(RequestType.NS_IP, "1.2.3.4", "No domains found"); verifyErrorMetrics(SearchType.BY_NAMESERVER_ADDRESS, Optional.empty(), Optional.of(0L), 404); } @Test - public void testAddressMatch_nontruncatedResultsSet() throws Exception { + public void testAddressMatch_nontruncatedResultsSet() { createManyDomainsAndHosts(4, 1, 2); runSuccessfulTestWithFourDomains( RequestType.NS_IP, @@ -2041,7 +2032,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatch_truncatedResultsSet() throws Exception { + public void testAddressMatch_truncatedResultsSet() { createManyDomainsAndHosts(5, 1, 2); runSuccessfulTestWithFourDomains( RequestType.NS_IP, @@ -2060,7 +2051,7 @@ public class RdapDomainSearchActionTest extends RdapSearchActionTestCase { } @Test - public void testAddressMatch_reallyTruncatedResultsSet() throws Exception { + public void testAddressMatch_reallyTruncatedResultsSet() { createManyDomainsAndHosts(9, 1, 2); runSuccessfulTestWithFourDomains( RequestType.NS_IP, diff --git a/javatests/google/registry/rdap/RdapEntityActionTest.java b/javatests/google/registry/rdap/RdapEntityActionTest.java index 9178b9154..ae5ef267d 100644 --- a/javatests/google/registry/rdap/RdapEntityActionTest.java +++ b/javatests/google/registry/rdap/RdapEntityActionTest.java @@ -93,7 +93,7 @@ public class RdapEntityActionTest { private ContactResource deletedContact; @Before - public void setUp() throws Exception { + public void setUp() { inject.setStaticField(Ofy.class, "clock", clock); // lol createTld("lol"); @@ -298,7 +298,7 @@ public class RdapEntityActionTest { } @Test - public void testInvalidEntity_returns400() throws Exception { + public void testInvalidEntity_returns400() { assertThat(generateActualJson("invalid/entity/handle")).isEqualTo( generateExpectedJson( "invalid/entity/handle is not a valid entity handle", @@ -307,38 +307,38 @@ public class RdapEntityActionTest { } @Test - public void testUnknownEntity_notFound() throws Exception { + public void testUnknownEntity_notFound() { runNotFoundTest("_MISSING-ENTITY_"); } @Test - public void testValidRegistrantContact_works() throws Exception { + public void testValidRegistrantContact_works() { login("evilregistrar"); runSuccessfulTest(registrant.getRepoId(), "rdap_associated_contact.json"); } @Test - public void testValidRegistrantContact_found_sameRegistrarRequested() throws Exception { + public void testValidRegistrantContact_found_sameRegistrarRequested() { login("evilregistrar"); action.registrarParam = Optional.of("evilregistrar"); runSuccessfulTest(registrant.getRepoId(), "rdap_associated_contact.json"); } @Test - public void testValidRegistrantContact_notFound_differentRegistrarRequested() throws Exception { + public void testValidRegistrantContact_notFound_differentRegistrarRequested() { login("evilregistrar"); action.registrarParam = Optional.of("idnregistrar"); runNotFoundTest(registrant.getRepoId()); } @Test - public void testValidRegistrantContact_found_asAdministrator() throws Exception { + public void testValidRegistrantContact_found_asAdministrator() { loginAsAdmin(); runSuccessfulTest(registrant.getRepoId(), "rdap_associated_contact.json"); } @Test - public void testValidRegistrantContact_found_notLoggedIn() throws Exception { + public void testValidRegistrantContact_found_notLoggedIn() { runSuccessfulTest( registrant.getRepoId(), "(◕‿◕)", @@ -349,7 +349,7 @@ public class RdapEntityActionTest { } @Test - public void testValidRegistrantContact_found_loggedInAsOtherRegistrar() throws Exception { + public void testValidRegistrantContact_found_loggedInAsOtherRegistrar() { login("otherregistrar"); runSuccessfulTest( registrant.getRepoId(), @@ -361,49 +361,49 @@ public class RdapEntityActionTest { } @Test - public void testValidAdminContact_works() throws Exception { + public void testValidAdminContact_works() { login("evilregistrar"); runSuccessfulTest(adminContact.getRepoId(), "rdap_associated_contact.json"); } @Test - public void testValidTechContact_works() throws Exception { + public void testValidTechContact_works() { login("evilregistrar"); runSuccessfulTest(techContact.getRepoId(), "rdap_associated_contact.json"); } @Test - public void testValidDisconnectedContact_works() throws Exception { + public void testValidDisconnectedContact_works() { login("evilregistrar"); runSuccessfulTest(disconnectedContact.getRepoId(), "rdap_contact.json"); } @Test - public void testDeletedContact_notFound() throws Exception { + public void testDeletedContact_notFound() { runNotFoundTest(deletedContact.getRepoId()); } @Test - public void testDeletedContact_notFound_includeDeletedSetFalse() throws Exception { + public void testDeletedContact_notFound_includeDeletedSetFalse() { action.includeDeletedParam = Optional.of(false); runNotFoundTest(deletedContact.getRepoId()); } @Test - public void testDeletedContact_notFound_notLoggedIn() throws Exception { + public void testDeletedContact_notFound_notLoggedIn() { action.includeDeletedParam = Optional.of(true); runNotFoundTest(deletedContact.getRepoId()); } @Test - public void testDeletedContact_notFound_loggedInAsDifferentRegistrar() throws Exception { + public void testDeletedContact_notFound_loggedInAsDifferentRegistrar() { login("idnregistrar"); action.includeDeletedParam = Optional.of(true); runNotFoundTest(deletedContact.getRepoId()); } @Test - public void testDeletedContact_found_loggedInAsCorrectRegistrar() throws Exception { + public void testDeletedContact_found_loggedInAsCorrectRegistrar() { login("evilregistrar"); action.includeDeletedParam = Optional.of(true); runSuccessfulTest( @@ -416,7 +416,7 @@ public class RdapEntityActionTest { } @Test - public void testDeletedContact_found_loggedInAsAdmin() throws Exception { + public void testDeletedContact_found_loggedInAsAdmin() { loginAsAdmin(); action.includeDeletedParam = Optional.of(true); runSuccessfulTest( @@ -429,45 +429,45 @@ public class RdapEntityActionTest { } @Test - public void testRegistrar_found() throws Exception { + public void testRegistrar_found() { runSuccessfulTest("101", "Yes Virginia