Remove unnecessary "throws" declarations

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

View file

@ -396,7 +396,7 @@ public class BigqueryConnection implements AutoCloseable {
public ListenableFuture<DestinationTable> load(
DestinationTable dest,
SourceFormat sourceFormat,
Iterable<String> sourceUris) throws Exception {
Iterable<String> sourceUris) {
Job job = new Job()
.setConfiguration(new JobConfiguration()
.setLoad(new JobConfigurationLoad()
@ -441,7 +441,7 @@ public class BigqueryConnection implements AutoCloseable {
* <p>Returns a ListenableFuture that holds the ImmutableTable on success.
*/
public ListenableFuture<ImmutableTable<Integer, TableFieldSchema, Object>>
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 {
*
* <p>Returns the results of the query in an ImmutableTable on success.
*/
public ImmutableTable<Integer, TableFieldSchema, Object> queryToLocalTableSync(String querySql)
throws Exception {
public ImmutableTable<Integer, TableFieldSchema, Object> queryToLocalTableSync(String querySql) {
Job job = new Job()
.setConfiguration(new JobConfiguration()
.setQuery(new JobConfigurationQuery()

View file

@ -193,7 +193,7 @@ class ChildEntityReader<R extends EppResource, I extends ImmutableObject> extend
}
@Override
public void beginShard() throws IOException {
public void beginShard() {
eppResourceEntityReader.beginShard();
}

View file

@ -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();
}
}

View file

@ -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();
}

View file

@ -43,12 +43,12 @@ public class EnumToAttributeAdapter<E extends Enum<E> & 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;

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -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<JaxbFragment<XjcRdeContactElement>> {
}
@Override
public List<? extends InputReader<JaxbFragment<XjcRdeContactElement>>> createReaders()
throws IOException {
public List<? extends InputReader<JaxbFragment<XjcRdeContactElement>>> createReaders() {
int numReaders = this.numReaders;
RdeHeader header = newParser().getHeader();
int numberOfContacts = header.getContactCount().intValue();

View file

@ -82,7 +82,7 @@ public class RdeContactReader extends InputReader<JaxbFragment<XjcRdeContactElem
}
@Override
public JaxbFragment<XjcRdeContactElement> next() throws IOException {
public JaxbFragment<XjcRdeContactElement> next() {
if (count < maxResults) {
if (parser == null) {
parser = newParser();

View file

@ -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<JaxbFragment<XjcRdeDomainElement>> {
}
@Override
public List<? extends InputReader<JaxbFragment<XjcRdeDomainElement>>> createReaders()
throws IOException {
public List<? extends InputReader<JaxbFragment<XjcRdeDomainElement>>> createReaders() {
int numReaders = this.numReaders;
RdeHeader header = newParser().getHeader();
int numberOfDomains = header.getDomainCount().intValue();

View file

@ -79,7 +79,7 @@ public class RdeDomainReader extends InputReader<JaxbFragment<XjcRdeDomainElemen
}
@Override
public JaxbFragment<XjcRdeDomainElement> next() throws IOException {
public JaxbFragment<XjcRdeDomainElement> next() {
if (count < maxResults) {
if (parser == null) {
parser = newParser();

View file

@ -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<JaxbFragment<XjcRdeHostElement>> {
}
@Override
public List<? extends InputReader<JaxbFragment<XjcRdeHostElement>>> createReaders()
throws IOException {
public List<? extends InputReader<JaxbFragment<XjcRdeHostElement>>> createReaders() {
int numReaders = this.numReaders;
RdeHeader header = createParser().getHeader();
int numberOfHosts = header.getHostCount().intValue();

View file

@ -82,7 +82,7 @@ public class RdeHostReader extends InputReader<JaxbFragment<XjcRdeHostElement>>
}
@Override
public JaxbFragment<XjcRdeHostElement> next() throws IOException {
public JaxbFragment<XjcRdeHostElement> next() {
if (count < maxResults) {
if (parser == null) {
parser = newParser();

View file

@ -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<String, String> getViewQueryMap() throws IOException {
public ImmutableMap<String, String> 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<String, String> createQueryMap(
LocalDate firstDayOfMonth, LocalDate lastDayOfMonth) throws IOException {
LocalDate firstDayOfMonth, LocalDate lastDayOfMonth) {
ImmutableMap.Builder<String, String> 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));
}

View file

@ -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));

View file

@ -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<String, String> getViewQueryMap() throws IOException;
ImmutableMap<String, String> getViewQueryMap();
/** Returns a query that retrieves the overall report from the previously generated view. */
String getReportQuery() throws IOException;
String getReportQuery();
}

View file

@ -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<String, String> getViewQueryMap() throws IOException {
public ImmutableMap<String, String> 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<String, String> createQueryMap(
DateTime earliestReportTime, DateTime latestReportTime) throws IOException {
DateTime earliestReportTime, DateTime latestReportTime) {
ImmutableMap.Builder<String, String> 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));
}

View file

@ -63,7 +63,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
private final List<Key<DomainApplication>> applicationKeys = new ArrayList<>();
@Override
protected String postExecute() throws Exception {
protected String postExecute() {
return ofy()
.transactNewReadOnly(
() -> {

View file

@ -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();
}

View file

@ -34,7 +34,7 @@ public class CheckSnapshotCommand implements RemoteApiCommand {
private String snapshotName;
@Override
public void run() throws Exception {
public void run() {
Iterable<DatastoreBackupInfo> backups =
DatastoreBackupService.get().findAllByNamePrefix(snapshotName);
if (Iterables.isEmpty(backups)) {

View file

@ -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 <directory1> <directory2>");
return;

View file

@ -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 "";
}

View file

@ -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<String> 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)));

View file

@ -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)

View file

@ -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);

View file

@ -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(

View file

@ -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);
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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 "";
}

View file

@ -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(

View file

@ -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(),

View file

@ -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);

View file

@ -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());
}

View file

@ -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.",

View file

@ -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() {

View file

@ -25,7 +25,7 @@ public class DeployInvoicingPipelineCommand implements Command {
@Inject InvoicingPipeline invoicingPipeline;
@Override
public void run() throws Exception {
public void run() {
invoicingPipeline.deploy();
}
}

View file

@ -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<AllocationToken> tokens =

View file

@ -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");

View file

@ -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.");

View file

@ -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());
}
}

View file

@ -51,7 +51,7 @@ final class GetSchemaTreeCommand implements Command {
private Multimap<Class<?>, Class<?>> superclassToSubclasses;
@Override
public void run() throws Exception {
public void run() {
// Get the @Parent type for each class.
Map<Class<?>, Class<?>> entityToParentType = new HashMap<>();
for (Class<?> clazz : ALL_CLASSES) {

View file

@ -36,7 +36,7 @@ final class HelpCommand implements Command {
private List<String> mainParameters = new ArrayList<>();
@Override
public void run() throws Exception {
public void run() {
String target = getOnlyElement(mainParameters, null);
if (target == null) {
jcommander.usage();

View file

@ -49,7 +49,7 @@ final class ListCursorsCommand implements RemoteApiCommand {
private boolean filterEscrowEnabled;
@Override
public void run() throws Exception {
public void run() {
List<String> lines = new ArrayList<>();
for (String tld : Registries.getTlds()) {
Registry registry = Registry.get(tld);

View file

@ -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;

View file

@ -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()) {

View file

@ -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;
}

View file

@ -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())

View file

@ -41,7 +41,7 @@ public final class ResaveEntitiesCommand extends MutatingCommand {
List<String> mainParameters;
@Override
protected void init() throws Exception {
protected void init() {
for (List<String> batch : partition(mainParameters, BATCH_SIZE)) {
for (String websafeKey : batch) {
ImmutableObject entity = ofy().load().key(Key.<ImmutableObject>create(websafeKey)).now();

View file

@ -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);

View file

@ -47,7 +47,7 @@ public final class ResaveEppResourceCommand extends MutatingCommand {
protected String uniqueId;
@Override
protected void init() throws Exception {
protected void init() {
Key<? extends EppResource> resourceKey = checkArgumentNotNull(
type.getKey(uniqueId, DateTime.now(UTC)),
"Could not find active resource of type %s: %s", type, uniqueId);

View file

@ -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<String, ?> params, MediaType contentType, byte[] payload)
throws IOException;

View file

@ -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) {

View file

@ -248,7 +248,7 @@ public class ShellCommand implements Command {
*
* <p>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 {
*
* <p>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()

View file

@ -100,7 +100,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand {
ImmutableSortedSet<String> existingDsData;
@Override
protected void initMutatingEppToolCommand() throws ParseException {
protected void initMutatingEppToolCommand() {
superuser = true;
DateTime now = DateTime.now(UTC);
ImmutableSet<String> 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 "";
}

View file

@ -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()) {

View file

@ -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) {

View file

@ -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));

View file

@ -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));

View file

@ -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(

View file

@ -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);
}

View file

@ -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(

View file

@ -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));

View file

@ -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);

View file

@ -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();

View file

@ -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<ListItem> call() throws Exception {
public Iterator<ListItem> 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),

View file

@ -133,7 +133,7 @@ public class DeleteContactsAndHostsActionTest
}
@Before
public void setup() throws Exception {
public void setup() {
enqueuer =
new AsyncFlowEnqueuer(
getQueue(QUEUE_ASYNC_DELETE),

View file

@ -129,7 +129,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
}
@Test
public void testFail_givenNonTestTld() throws Exception {
public void testFail_givenNonTestTld() {
action.tlds = ImmutableSet.of("not-test.test");
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, this::runMapreduce);
@ -139,7 +139,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
}
@Test
public void testFail_givenNonExistentTld() throws Exception {
public void testFail_givenNonExistentTld() {
action.tlds = ImmutableSet.of("non-existent.test");
IllegalArgumentException thrown =
assertThrows(IllegalArgumentException.class, this::runMapreduce);
@ -149,7 +149,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
}
@Test
public void testFail_givenNonDotTestTldOnProd() throws Exception {
public void testFail_givenNonDotTestTldOnProd() {
action.tlds = ImmutableSet.of("example");
action.registryEnvironment = RegistryEnvironment.PRODUCTION;
IllegalArgumentException thrown =
@ -256,7 +256,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
}
@Test
public void testFailure_registryAdminClientId_isRequiredForSoftDeletion() throws Exception {
public void testFailure_registryAdminClientId_isRequiredForSoftDeletion() {
persistResource(
newDomainResource("blah.ib-any.test")
.asBuilder()

View file

@ -100,7 +100,7 @@ public class ExpandRecurringBillingEventsActionTest
.build();
}
void saveCursor(final DateTime cursorTime) throws Exception {
void saveCursor(final DateTime cursorTime) {
ofy().transact(() -> 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 =

View file

@ -98,7 +98,7 @@ public class MapreduceEntityCleanupActionTest
}
}
private static String createMapreduce(String jobName) throws Exception {
private static String createMapreduce(String jobName) {
MapReduceJob<String, String, String, String, List<List<String>>> mapReduceJob =
new MapReduceJob<>(
new MapReduceSpecification.Builder<String, String, String, String, List<List<String>>>()
@ -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

View file

@ -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(

View file

@ -61,7 +61,7 @@ public class BigqueryTemplatePipelineTest {
}
@Test
public void testEndToEndPipeline() throws Exception {
public void testEndToEndPipeline() {
ImmutableList<TableRow> inputRows =
ImmutableList.of(
new TableRow(),

View file

@ -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.

View file

@ -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));
}
}

View file

@ -23,7 +23,7 @@ import org.junit.runners.JUnit4;
public class RegistryEnvironmentTest {
@Test
public void testGet() throws Exception {
public void testGet() {
RegistryEnvironment.get();
}
}

View file

@ -76,7 +76,7 @@ public class TldFanoutActionTest {
return params.build();
}
private void run(ImmutableListMultimap<String, String> params) throws Exception {
private void run(ImmutableListMultimap<String, String> 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,
() ->

View file

@ -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 =

View file

@ -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,

View file

@ -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;

View file

@ -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);

View file

@ -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"));
}
}

View file

@ -159,7 +159,7 @@ public class CloudDnsWriterTest {
});
}
private void verifyZone(ImmutableSet<ResourceRecordSet> expectedRecords) throws Exception {
private void verifyZone(ImmutableSet<ResourceRecordSet> 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());

View file

@ -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")

View file

@ -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)

View file

@ -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"));

View file

@ -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)));

View file

@ -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"));
}
}

View file

@ -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());
}

View file

@ -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)

View file

@ -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;

View file

@ -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)

View file

@ -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(

View file

@ -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");

View file

@ -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();

View file

@ -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")

View file

@ -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,

View file

@ -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);
}

View file

@ -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,

View file

@ -45,7 +45,7 @@ public class EppLoginTlsTest extends EppTestCase {
}
@Before
public void initTest() throws Exception {
public void initTest() {
persistResource(
loadRegistrar("NewRegistrar")
.asBuilder()

View file

@ -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()

Some files were not shown because too many files have changed in this diff Show more