Unify two exceptions that mean the same thing

These were historically separate due to the old flow
structure, but now they should be one exception.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133984858
This commit is contained in:
cgoldfeder 2016-09-22 12:24:54 -07:00 committed by Ben McIlwain
parent 21a98b899c
commit 096877f03e
55 changed files with 163 additions and 211 deletions

View file

@ -31,7 +31,7 @@ import google.registry.flows.EppException.UnimplementedExtensionException;
import google.registry.flows.ResourceFlow.BadCommandForRegistryPhaseException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
import google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException;
import google.registry.flows.domain.DomainApplicationDeleteFlow.SunriseApplicationCannotBeDeletedInLandrushException;
import google.registry.flows.domain.DomainFlowUtils.ApplicationDomainNameMismatchException;
import google.registry.flows.domain.DomainFlowUtils.LaunchPhaseMismatchException;
@ -120,7 +120,7 @@ public class DomainApplicationDeleteFlowTest
@Test
public void testFailure_neverExisted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
runFlow();
}
@ -128,7 +128,7 @@ public class DomainApplicationDeleteFlowTest
@Test
public void testFailure_existedButWasDeleted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistResource(newDomainApplication("example.tld").asBuilder()
.setRepoId("1-TLD")

View file

@ -27,11 +27,11 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.domain.DomainApplicationInfoFlow.ApplicationLaunchPhaseMismatchException;
import google.registry.flows.domain.DomainApplicationInfoFlow.MissingApplicationIdException;
import google.registry.flows.domain.DomainFlowUtils.ApplicationDomainNameMismatchException;
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.domain.DesignatedContact.Type;
@ -261,7 +261,7 @@ public class DomainApplicationInfoFlowTest
@Test
public void testFailure_neverExisted() throws Exception {
thrown.expect(
ResourceToQueryDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
runFlow();
}
@ -269,7 +269,7 @@ public class DomainApplicationInfoFlowTest
@Test
public void testFailure_existedButWasDeleted() throws Exception {
thrown.expect(
ResourceToQueryDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistResource(new DomainApplication.Builder()
.setRepoId("123-COM")

View file

@ -33,7 +33,7 @@ import com.googlecode.objectify.Key;
import google.registry.flows.EppException.UnimplementedExtensionException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
import google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException;
import google.registry.flows.ResourceUpdateFlow.AddRemoveSameValueEppException;
import google.registry.flows.ResourceUpdateFlow.ResourceHasClientUpdateProhibitedException;
import google.registry.flows.ResourceUpdateFlow.StatusNotClientSettableException;
@ -402,7 +402,7 @@ public class DomainApplicationUpdateFlowTest
@Test
public void testFailure_neverExisted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistReferencedEntities();
runFlow();
@ -411,7 +411,7 @@ public class DomainApplicationUpdateFlowTest
@Test
public void testFailure_existedButWasDeleted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistReferencedEntities();
persistResource(newApplicationBuilder().setDeletionTime(START_OF_TIME).build());

View file

@ -46,7 +46,7 @@ import google.registry.flows.EppRequestSource;
import google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
import google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException;
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
import google.registry.flows.domain.DomainDeleteFlow.DomainToDeleteHasHostsException;
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
@ -593,7 +593,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testFailure_neverExisted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
runFlow();
}
@ -601,7 +601,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testFailure_existedButWasDeleted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc());
runFlow();

View file

@ -29,11 +29,11 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.flows.domain.DomainFlowUtils.BadPeriodUnitException;
import google.registry.flows.domain.DomainFlowUtils.CurrencyUnitMismatchException;
import google.registry.flows.domain.DomainFlowUtils.FeeChecksDontSupportPhasesException;
import google.registry.flows.domain.DomainFlowUtils.RestoresAreAlwaysForOneYearException;
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
import google.registry.model.billing.BillingEvent.Recurring;
import google.registry.model.contact.ContactAuthInfo;
import google.registry.model.contact.ContactResource;
@ -375,7 +375,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
@Test
public void testFailure_neverExisted() throws Exception {
thrown.expect(
ResourceToQueryDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
runFlow();
}
@ -383,7 +383,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
@Test
public void testFailure_existedButWasDeleted() throws Exception {
thrown.expect(
ResourceToQueryDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistResource(newDomainResource("example.tld").asBuilder()
.setDeletionTime(clock.nowUtc().minusDays(1))

View file

@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableSortedMap;
import com.googlecode.objectify.Key;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
import google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException;
import google.registry.flows.SingleResourceFlow.ResourceStatusProhibitsOperationException;
import google.registry.flows.domain.DomainFlowUtils.BadPeriodUnitException;
import google.registry.flows.domain.DomainFlowUtils.CurrencyUnitMismatchException;
@ -380,7 +380,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
@Test
public void testFailure_neverExisted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
runFlow();
}
@ -388,7 +388,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
@Test
public void testFailure_existedButWasDeleted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc());
runFlow();

View file

@ -40,7 +40,7 @@ import com.googlecode.objectify.Key;
import google.registry.flows.EppException.UnimplementedExtensionException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
import google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException;
import google.registry.flows.domain.DomainFlowUtils.CurrencyUnitMismatchException;
import google.registry.flows.domain.DomainFlowUtils.CurrencyValueScaleException;
import google.registry.flows.domain.DomainFlowUtils.DomainReservedException;
@ -343,7 +343,7 @@ public class DomainRestoreRequestFlowTest extends
@Test
public void testFailure_doesNotExist() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
runFlow();
}
@ -453,7 +453,7 @@ public class DomainRestoreRequestFlowTest extends
@Test
public void testFailure_fullyDeleted() throws Exception {
thrown.expect(ResourceToMutateDoesNotExistException.class);
thrown.expect(ResourceDoesNotExistException.class);
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc());
runFlow();
}

View file

@ -39,10 +39,10 @@ import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Ordering;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
import google.registry.flows.exceptions.NotPendingTransferException;
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
import google.registry.model.EppResource;
import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Cancellation;
@ -456,7 +456,7 @@ public class DomainTransferApproveFlowTest
@Test
public void testFailure_deletedDomain() throws Exception {
thrown.expect(ResourceToMutateDoesNotExistException.class,
thrown.expect(ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
domain = persistResource(
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
@ -465,7 +465,7 @@ public class DomainTransferApproveFlowTest
@Test
public void testFailure_nonexistentDomain() throws Exception {
thrown.expect(ResourceToMutateDoesNotExistException.class,
thrown.expect(ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
deleteResource(domain);
doFailingTest("domain_transfer_approve.xml");

View file

@ -27,10 +27,10 @@ import static google.registry.util.DateTimeUtils.END_OF_TIME;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
import google.registry.flows.exceptions.NotPendingTransferException;
import google.registry.flows.exceptions.NotTransferInitiatorException;
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
import google.registry.model.contact.ContactAuthInfo;
import google.registry.model.domain.DomainAuthInfo;
import google.registry.model.domain.DomainResource;
@ -270,7 +270,7 @@ public class DomainTransferCancelFlowTest
@Test
public void testFailure_deletedDomain() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
domain = persistResource(
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
@ -280,7 +280,7 @@ public class DomainTransferCancelFlowTest
@Test
public void testFailure_nonexistentDomain() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
deleteResource(domain);
doFailingTest("domain_transfer_cancel.xml");

View file

@ -23,9 +23,9 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
import google.registry.flows.exceptions.NotAuthorizedToViewTransferException;
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
import google.registry.model.contact.ContactAuthInfo;
import google.registry.model.domain.DomainAuthInfo;
import google.registry.model.domain.DomainResource;
@ -225,7 +225,7 @@ public class DomainTransferQueryFlowTest
@Test
public void testFailure_deletedDomain() throws Exception {
thrown.expect(
ResourceToQueryDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
domain = persistResource(
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
@ -235,7 +235,7 @@ public class DomainTransferQueryFlowTest
@Test
public void testFailure_nonexistentDomain() throws Exception {
thrown.expect(
ResourceToQueryDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
deleteResource(domain);
doFailingTest("domain_transfer_query.xml");

View file

@ -27,10 +27,10 @@ import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.domain.DomainFlowUtils.NotAuthorizedForTldException;
import google.registry.flows.exceptions.NotPendingTransferException;
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
import google.registry.model.contact.ContactAuthInfo;
import google.registry.model.domain.DomainAuthInfo;
import google.registry.model.domain.DomainResource;
@ -243,7 +243,7 @@ public class DomainTransferRejectFlowTest
@Test
public void testFailure_deletedDomain() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
domain = persistResource(
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
@ -253,7 +253,7 @@ public class DomainTransferRejectFlowTest
@Test
public void testFailure_nonexistentDomain() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
deleteResource(domain);
doFailingTest("domain_transfer_reject.xml");

View file

@ -40,6 +40,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Iterables;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
import google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException;
import google.registry.flows.domain.DomainFlowUtils.BadPeriodUnitException;
import google.registry.flows.domain.DomainFlowUtils.CurrencyUnitMismatchException;
import google.registry.flows.domain.DomainFlowUtils.CurrencyValueScaleException;
@ -52,7 +53,6 @@ import google.registry.flows.exceptions.AlreadyPendingTransferException;
import google.registry.flows.exceptions.MissingTransferRequestAuthInfoException;
import google.registry.flows.exceptions.ObjectAlreadySponsoredException;
import google.registry.flows.exceptions.ResourceStatusProhibitsOperationException;
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
import google.registry.model.EppResource;
import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Cancellation.Builder;
@ -725,7 +725,7 @@ public class DomainTransferRequestFlowTest
@Test
public void testFailure_deletedDomain() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
domain = persistResource(
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
@ -737,14 +737,14 @@ public class DomainTransferRequestFlowTest
setEppInput("domain_transfer_request_wildcard.xml", ImmutableMap.of("DOMAIN", "--invalid"));
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
assertTransactionalFlow(true);
thrown.expect(ResourceToMutateDoesNotExistException.class, "(--invalid)");
thrown.expect(ResourceDoesNotExistException.class, "(--invalid)");
runFlow(CommitMode.LIVE, UserPrivileges.NORMAL);
}
@Test
public void testFailure_nonexistentDomain() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
deleteResource(domain);
doFailingTest("domain_transfer_request.xml");

View file

@ -45,7 +45,7 @@ import google.registry.flows.EppRequestSource;
import google.registry.flows.ResourceCreateOrMutateFlow.OnlyToolCanPassMetadataException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.ResourceFlowUtils.ResourceNotOwnedException;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
import google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException;
import google.registry.flows.ResourceUpdateFlow.AddRemoveSameValueEppException;
import google.registry.flows.ResourceUpdateFlow.ResourceHasClientUpdateProhibitedException;
import google.registry.flows.ResourceUpdateFlow.StatusNotClientSettableException;
@ -818,7 +818,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
@Test
public void testFailure_neverExisted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistReferencedEntities();
runFlow();
@ -827,7 +827,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
@Test
public void testFailure_existedButWasDeleted() throws Exception {
thrown.expect(
ResourceToMutateDoesNotExistException.class,
ResourceDoesNotExistException.class,
String.format("(%s)", getUniqueIdFromCommand()));
persistReferencedEntities();
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc());

View file

@ -26,7 +26,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Range;
import com.googlecode.objectify.Key;
import google.registry.flows.ResourceMutateFlow.ResourceToMutateDoesNotExistException;
import google.registry.flows.ResourceMutateFlow.ResourceDoesNotExistException;
import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.TestExtraLogicManager;
@ -152,7 +152,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase {
@Test
public void test_extraLogic_renewPrice_noDomain() throws Exception {
thrown.expect(ResourceToMutateDoesNotExistException.class);
thrown.expect(ResourceDoesNotExistException.class);
TldSpecificLogicProxy.getRenewPrice(
Registry.get("test"), "renew--13.test", "clientId", clock.nowUtc(), 1, null);
}
@ -202,7 +202,7 @@ public class TldSpecificLogicProxyTest extends ShardableTestCase {
@Test
public void test_extraLogic_restorePrice_noDomain() throws Exception {
thrown.expect(ResourceToMutateDoesNotExistException.class);
thrown.expect(ResourceDoesNotExistException.class);
TldSpecificLogicProxy.getRestorePrice(
Registry.get("test"), "renew-13.test", "clientId", clock.nowUtc(), null);
}