Remove more unnecessary "throws" declarations

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201243722
This commit is contained in:
mcilwain 2018-06-19 14:40:42 -07:00 committed by Ben McIlwain
parent 47322b7fcd
commit ad73f3d167
61 changed files with 318 additions and 331 deletions

View file

@ -73,7 +73,7 @@ public final class DnsInjectionTest {
}
@Test
public void testReadDnsQueueAction_injectsAndWorks() throws Exception {
public void testReadDnsQueueAction_injectsAndWorks() {
persistActiveSubordinateHost("ns1.example.lol", persistActiveDomain("example.lol"));
clock.advanceOneMilli();
dnsQueue.addDomainRefreshTask("example.lol");
@ -83,7 +83,7 @@ public final class DnsInjectionTest {
}
@Test
public void testRefreshDns_domain_injectsAndWorks() throws Exception {
public void testRefreshDns_domain_injectsAndWorks() {
persistActiveDomain("example.lol");
when(req.getParameter("type")).thenReturn("domain");
when(req.getParameter("name")).thenReturn("example.lol");
@ -101,7 +101,7 @@ public final class DnsInjectionTest {
}
@Test
public void testRefreshDns_host_injectsAndWorks() throws Exception {
public void testRefreshDns_host_injectsAndWorks() {
persistActiveSubordinateHost("ns1.example.lol", persistActiveDomain("example.lol"));
when(req.getParameter("type")).thenReturn("host");
when(req.getParameter("name")).thenReturn("ns1.example.lol");

View file

@ -49,7 +49,7 @@ public class DnsQueueTest {
}
@Test
public void test_addHostRefreshTask_success() throws Exception {
public void test_addHostRefreshTask_success() {
createTld("tld");
dnsQueue.addHostRefreshTask("octopus.tld");
assertTasksEnqueued(
@ -79,7 +79,7 @@ public class DnsQueueTest {
}
@Test
public void test_addDomainRefreshTask_success() throws Exception {
public void test_addDomainRefreshTask_success() {
createTld("tld");
dnsQueue.addDomainRefreshTask("octopus.tld");
assertTasksEnqueued(

View file

@ -106,7 +106,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testHost_published() throws Exception {
public void testHost_published() {
action = createAction("xn--q9jyb4c");
action.hosts = ImmutableSet.of("ns1.example.xn--q9jyb4c");
@ -132,7 +132,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testDomain_published() throws Exception {
public void testDomain_published() {
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.xn--q9jyb4c");
@ -158,7 +158,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testAction_acquiresCorrectLock() throws Exception {
public void testAction_acquiresCorrectLock() {
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
action = createAction("xn--q9jyb4c");
action.lockIndex = 2;
@ -176,7 +176,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testPublish_commitFails() throws Exception {
public void testPublish_commitFails() {
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.xn--q9jyb4c", "example2.xn--q9jyb4c");
action.hosts =
@ -203,7 +203,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testHostAndDomain_published() throws Exception {
public void testHostAndDomain_published() {
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.xn--q9jyb4c", "example2.xn--q9jyb4c");
action.hosts = ImmutableSet.of(
@ -235,7 +235,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testWrongTld_notPublished() throws Exception {
public void testWrongTld_notPublished() {
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.com", "example2.com");
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
@ -261,7 +261,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testLockIsntAvailable() throws Exception {
public void testLockIsntAvailable() {
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.com", "example2.com");
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
@ -284,7 +284,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testParam_invalidLockIndex() throws Exception {
public void testParam_invalidLockIndex() {
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.com");
@ -309,7 +309,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testRegistryParam_mismatchedMaxLocks() throws Exception {
public void testRegistryParam_mismatchedMaxLocks() {
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setNumDnsPublishLocks(4).build());
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.com");
@ -334,7 +334,7 @@ public class PublishDnsUpdatesActionTest {
}
@Test
public void testWrongDnsWriter() throws Exception {
public void testWrongDnsWriter() {
action = createAction("xn--q9jyb4c");
action.domains = ImmutableSet.of("example.com", "example2.com");
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");

View file

@ -147,8 +147,7 @@ public class ReadDnsQueueActionTest {
.param(DNS_TARGET_TYPE_PARAM, TargetType.DOMAIN.toString());
}
private void assertTldsEnqueuedInPushQueue(ImmutableMultimap<String, String> tldsToDnsWriters)
throws Exception {
private void assertTldsEnqueuedInPushQueue(ImmutableMultimap<String, String> tldsToDnsWriters) {
// By default, the publishDnsUpdates tasks will be enqueued one hour after the update items were
// created in the pull queue. This is because of the clock.advanceBy in run()
assertTasksEnqueued(
@ -169,7 +168,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_methodPostIsDefault() throws Exception {
public void testSuccess_methodPostIsDefault() {
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.net");
dnsQueue.addDomainRefreshTask("domain.example");
@ -185,7 +184,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_allSingleLockTlds() throws Exception {
public void testSuccess_allSingleLockTlds() {
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.net");
dnsQueue.addDomainRefreshTask("domain.example");
@ -198,7 +197,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_moreUpdatesThanQueueBatchSize() throws Exception {
public void testSuccess_moreUpdatesThanQueueBatchSize() {
// The task queue has a batch size of 1000 (that's the maximum number of items you can lease at
// once).
ImmutableList<String> domains =
@ -225,7 +224,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_twoDnsWriters() throws Exception {
public void testSuccess_twoDnsWriters() {
persistResource(
Registry.get("com")
.asBuilder()
@ -240,7 +239,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_differentUpdateTimes_usesMinimum() throws Exception {
public void testSuccess_differentUpdateTimes_usesMinimum() {
clock.setTo(DateTime.parse("3000-02-03TZ"));
dnsQueue.addDomainRefreshTask("domain1.com");
clock.setTo(DateTime.parse("3000-02-04TZ"));
@ -265,7 +264,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_oneTldPaused_returnedToQueue() throws Exception {
public void testSuccess_oneTldPaused_returnedToQueue() {
persistResource(Registry.get("net").asBuilder().setDnsPaused(true).build());
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.net");
@ -279,7 +278,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_oneTldUnknown_returnedToQueue() throws Exception {
public void testSuccess_oneTldUnknown_returnedToQueue() {
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.example");
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
@ -299,7 +298,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_corruptTaskTldMismatch_published() throws Exception {
public void testSuccess_corruptTaskTldMismatch_published() {
// TODO(mcilwain): what's the correct action to take in this case?
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.example");
@ -320,7 +319,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_corruptTaskNoTld_discarded() throws Exception {
public void testSuccess_corruptTaskNoTld_discarded() {
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.example");
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
@ -339,7 +338,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_corruptTaskNoName_discarded() throws Exception {
public void testSuccess_corruptTaskNoName_discarded() {
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.example");
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
@ -358,7 +357,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_corruptTaskNoType_discarded() throws Exception {
public void testSuccess_corruptTaskNoType_discarded() {
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.example");
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
@ -377,7 +376,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_corruptTaskWrongType_discarded() throws Exception {
public void testSuccess_corruptTaskWrongType_discarded() {
dnsQueue.addDomainRefreshTask("domain.com");
dnsQueue.addDomainRefreshTask("domain.example");
QueueFactory.getQueue(DNS_PULL_QUEUE_NAME)
@ -397,7 +396,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_zone_getsIgnored() throws Exception {
public void testSuccess_zone_getsIgnored() {
dnsQueue.addHostRefreshTask("ns1.domain.com");
dnsQueue.addDomainRefreshTask("domain.net");
dnsQueue.addZoneRefreshTask("example");
@ -418,7 +417,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_manyDomainsAndHosts() throws Exception {
public void testSuccess_manyDomainsAndHosts() {
for (int i = 0; i < 150; i++) {
// 0: domain; 1: host 1; 2: host 2
for (int thingType = 0; thingType < 3; thingType++) {
@ -489,7 +488,7 @@ public class ReadDnsQueueActionTest {
}
@Test
public void testSuccess_lockGroupsHostBySuperordinateDomain() throws Exception {
public void testSuccess_lockGroupsHostBySuperordinateDomain() {
dnsQueue.addDomainRefreshTask("hello.multilock.uk");
dnsQueue.addHostRefreshTask("ns1.abc.hello.multilock.uk");
dnsQueue.addHostRefreshTask("ns2.hello.multilock.uk");

View file

@ -310,14 +310,14 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_nonExistentDomain() throws Exception {
public void testLoadDomain_nonExistentDomain() {
writer.publishDomain("example.tld");
verifyZone(ImmutableSet.of());
}
@Test
public void testLoadDomain_noDsDataOrNameservers() throws Exception {
public void testLoadDomain_noDsDataOrNameservers() {
persistResource(fakeDomain("example.tld", ImmutableSet.of(), 0));
writer.publishDomain("example.tld");
@ -325,7 +325,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_deleteOldData() throws Exception {
public void testLoadDomain_deleteOldData() {
stubZone = fakeDomainRecords("example.tld", 2, 2, 2, 2);
persistResource(fakeDomain("example.tld", ImmutableSet.of(), 0));
writer.publishDomain("example.tld");
@ -334,7 +334,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_withExternalNs() throws Exception {
public void testLoadDomain_withExternalNs() {
persistResource(
fakeDomain("example.tld", ImmutableSet.of(persistResource(fakeHost("0.external"))), 0));
writer.publishDomain("example.tld");
@ -343,7 +343,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_withDsData() throws Exception {
public void testLoadDomain_withDsData() {
persistResource(
fakeDomain("example.tld", ImmutableSet.of(persistResource(fakeHost("0.external"))), 1));
writer.publishDomain("example.tld");
@ -352,7 +352,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_withInBailiwickNs_IPv4() throws Exception {
public void testLoadDomain_withInBailiwickNs_IPv4() {
persistResource(
fakeDomain(
"example.tld",
@ -367,7 +367,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_withInBailiwickNs_IPv6() throws Exception {
public void testLoadDomain_withInBailiwickNs_IPv6() {
persistResource(
fakeDomain(
"example.tld",
@ -382,7 +382,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_withNameserveThatEndsWithDomainName() throws Exception {
public void testLoadDomain_withNameserveThatEndsWithDomainName() {
persistResource(
fakeDomain(
"example.tld",
@ -394,7 +394,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadHost_externalHost() throws Exception {
public void testLoadHost_externalHost() {
writer.publishHost("ns1.example.com");
// external hosts should not be published in our zone
@ -402,7 +402,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadHost_removeStaleNsRecords() throws Exception {
public void testLoadHost_removeStaleNsRecords() {
// Initialize the zone with both NS records
stubZone = fakeDomainRecords("example.tld", 2, 0, 0, 0);
@ -435,7 +435,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_withClientHold() throws Exception {
public void testLoadDomain_withClientHold() {
persistResource(
fakeDomain(
"example.tld",
@ -450,7 +450,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_withServerHold() throws Exception {
public void testLoadDomain_withServerHold() {
persistResource(
fakeDomain(
"example.tld",
@ -466,7 +466,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testLoadDomain_withPendingDelete() throws Exception {
public void testLoadDomain_withPendingDelete() {
persistResource(
fakeDomain(
"example.tld",
@ -481,7 +481,7 @@ public class CloudDnsWriterTest {
}
@Test
public void testDuplicateRecords() throws Exception {
public void testDuplicateRecords() {
// In publishing DNS records, we can end up publishing information on the same host twice
// (through a domain change and a host change), so this scenario needs to work.
persistResource(