Merge JUnitBackport's expectThrows into assertThrows

More information: https://github.com/junit-team/junit5/issues/531

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187034408
This commit is contained in:
cushon 2018-02-26 09:38:17 -08:00 committed by jianglai
parent f96a0b7da9
commit 606b470cd0
180 changed files with 1325 additions and 1381 deletions

View file

@ -16,7 +16,7 @@ package google.registry.flows;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -63,7 +63,7 @@ public class ExtensionManagerTest {
.build();
manager.register(MetadataExtension.class, LaunchCreateExtension.class);
EppException thrown =
expectThrows(UnsupportedRepeatedExtensionException.class, manager::validate);
assertThrows(UnsupportedRepeatedExtensionException.class, manager::validate);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -99,7 +99,7 @@ public class ExtensionManagerTest {
.build();
manager.register(FeeInfoCommandExtensionV06.class);
EppException thrown =
expectThrows(UndeclaredServiceExtensionException.class, manager::validate);
assertThrows(UndeclaredServiceExtensionException.class, manager::validate);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -136,7 +136,7 @@ public class ExtensionManagerTest {
.setSuppliedExtensions(MetadataExtension.class)
.build();
manager.register(MetadataExtension.class);
EppException thrown = expectThrows(OnlyToolCanPassMetadataException.class, manager::validate);
EppException thrown = assertThrows(OnlyToolCanPassMetadataException.class, manager::validate);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -164,7 +164,7 @@ public class ExtensionManagerTest {
.build();
manager.register(DomainTransferRequestSuperuserExtension.class);
EppException thrown =
expectThrows(UnauthorizedForSuperuserExtensionException.class, manager::validate);
assertThrows(UnauthorizedForSuperuserExtensionException.class, manager::validate);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -179,7 +179,7 @@ public class ExtensionManagerTest {
.build();
manager.register(DomainTransferRequestSuperuserExtension.class);
EppException thrown =
expectThrows(UnauthorizedForSuperuserExtensionException.class, manager::validate);
assertThrows(UnauthorizedForSuperuserExtensionException.class, manager::validate);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -191,7 +191,7 @@ public class ExtensionManagerTest {
.setDeclaredUris()
.setSuppliedExtensions(LaunchCreateExtension.class)
.build();
EppException thrown = expectThrows(UnimplementedExtensionException.class, manager::validate);
EppException thrown = assertThrows(UnimplementedExtensionException.class, manager::validate);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -20,7 +20,7 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.tmch.ClaimsListShardTest.createTestClaimsListShard;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.LogsSubject.assertAboutLogs;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
@ -136,7 +136,7 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
@Test
public void testRequiresLogin() throws Exception {
sessionMetadata.setClientId(null);
EppException thrown = expectThrows(NotLoggedInException.class, this::runFlow);
EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -15,7 +15,7 @@
package google.registry.flows;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -39,7 +39,7 @@ public final class TlsCredentialsTest {
public void testProvideClientCertificateHash_missing() {
HttpServletRequest req = mock(HttpServletRequest.class);
BadRequestException thrown =
expectThrows(
assertThrows(
BadRequestException.class,
() -> TlsCredentials.EppTlsModule.provideClientCertificateHash(req));
assertThat(thrown).hasMessageThat().contains("Missing header: X-SSL-Certificate");
@ -57,7 +57,7 @@ public final class TlsCredentialsTest {
public void testProvideRequestedServername_missing() {
HttpServletRequest req = mock(HttpServletRequest.class);
BadRequestException thrown =
expectThrows(
assertThrows(
BadRequestException.class,
() -> TlsCredentials.EppTlsModule.provideRequestedServername(req));
assertThat(thrown).hasMessageThat().contains("Missing header: X-Requested-Servername-SNI");

View file

@ -18,7 +18,7 @@ import static google.registry.model.eppoutput.CheckData.ContactCheck.create;
import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceCheckFlowTestCase;
@ -79,7 +79,7 @@ public class ContactCheckFlowTest
@Test
public void testTooManyIds() throws Exception {
setEppInput("contact_check_51.xml");
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow);
EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceFlowTestCase;
@ -71,7 +71,7 @@ public class ContactCreateFlowTest
public void testFailure_alreadyExists() throws Exception {
persistActiveContact(getUniqueIdFromCommand());
ResourceAlreadyExistsException thrown =
expectThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThat(thrown)
.hasMessageThat()
.contains(
@ -89,7 +89,7 @@ public class ContactCreateFlowTest
public void testFailure_nonAsciiInIntAddress() throws Exception {
setEppInput("contact_create_hebrew_int.xml");
EppException thrown =
expectThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -97,7 +97,7 @@ public class ContactCreateFlowTest
public void testFailure_declineDisclosure() throws Exception {
setEppInput("contact_create_decline_disclosure.xml");
EppException thrown =
expectThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableSet;
import google.registry.flows.EppException;
@ -74,7 +74,7 @@ public class ContactDeleteFlowTest
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -83,7 +83,7 @@ public class ContactDeleteFlowTest
public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -112,7 +112,7 @@ public class ContactDeleteFlowTest
newContactResource(getUniqueIdFromCommand()).asBuilder()
.setStatusValues(ImmutableSet.of(statusValue))
.build());
EppException thrown = expectThrows(exception, this::runFlow);
EppException thrown = assertThrows(exception, this::runFlow);
assertThat(thrown).hasMessageThat().contains(statusValue.getXmlName());
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -121,7 +121,7 @@ public class ContactDeleteFlowTest
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistActiveContact(getUniqueIdFromCommand());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -148,7 +148,7 @@ public class ContactDeleteFlowTest
createTld("tld");
persistResource(
newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand())));
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -157,7 +157,7 @@ public class ContactDeleteFlowTest
createTld("tld");
persistResource(
newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand())));
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -166,7 +166,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -175,7 +175,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
public void testFailure_existedButWasDeleted() throws Exception {
persistContactResource(false);
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage;
import static google.registry.testing.DatastoreHelper.getPollMessages;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
@ -145,9 +145,10 @@ public class ContactTransferApproveFlowTest
contact.asBuilder()
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown = expectThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("contact_transfer_approve_with_authinfo.xml"));
EppException thrown =
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("contact_transfer_approve_with_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -155,7 +156,7 @@ public class ContactTransferApproveFlowTest
public void testFailure_neverBeenTransferred() throws Exception {
changeTransferStatus(null);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -164,7 +165,7 @@ public class ContactTransferApproveFlowTest
public void testFailure_clientApproved() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -173,7 +174,7 @@ public class ContactTransferApproveFlowTest
public void testFailure_clientRejected() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -182,7 +183,7 @@ public class ContactTransferApproveFlowTest
public void testFailure_clientCancelled() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -191,7 +192,7 @@ public class ContactTransferApproveFlowTest
public void testFailure_serverApproved() throws Exception {
changeTransferStatus(TransferStatus.SERVER_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -200,7 +201,7 @@ public class ContactTransferApproveFlowTest
public void testFailure_serverCancelled() throws Exception {
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -209,7 +210,7 @@ public class ContactTransferApproveFlowTest
public void testFailure_gainingClient() throws Exception {
setClientIdForFlow("NewRegistrar");
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -218,7 +219,7 @@ public class ContactTransferApproveFlowTest
public void testFailure_unrelatedClient() throws Exception {
setClientIdForFlow("ClientZ");
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -228,7 +229,7 @@ public class ContactTransferApproveFlowTest
contact = persistResource(
contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("contact_transfer_approve.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
@ -241,7 +242,7 @@ public class ContactTransferApproveFlowTest
contact = persistResource(
contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("contact_transfer_approve.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));

View file

@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage;
import static google.registry.testing.DatastoreHelper.getPollMessages;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
@ -132,7 +132,7 @@ public class ContactTransferCancelFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("contact_transfer_cancel_with_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -142,7 +142,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_neverBeenTransferred() throws Exception {
changeTransferStatus(null);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -151,7 +151,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_clientApproved() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -160,7 +160,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_clientRejected() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -169,7 +169,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_clientCancelled() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -178,7 +178,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_serverApproved() throws Exception {
changeTransferStatus(TransferStatus.SERVER_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -187,7 +187,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_serverCancelled() throws Exception {
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -196,7 +196,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_sponsoringClient() throws Exception {
setClientIdForFlow("TheRegistrar");
EppException thrown =
expectThrows(
assertThrows(
NotTransferInitiatorException.class,
() -> doFailingTest("contact_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -206,7 +206,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_unrelatedClient() throws Exception {
setClientIdForFlow("ClientZ");
EppException thrown =
expectThrows(
assertThrows(
NotTransferInitiatorException.class,
() -> doFailingTest("contact_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -217,7 +217,7 @@ public class ContactTransferCancelFlowTest
contact =
persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("contact_transfer_cancel.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
@ -228,7 +228,7 @@ public class ContactTransferCancelFlowTest
public void testFailure_nonexistentContact() throws Exception {
deleteResource(contact);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("contact_transfer_cancel.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));

View file

@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
import static google.registry.testing.DatastoreHelper.deleteResource;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
@ -145,7 +145,7 @@ public class ContactTransferQueryFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("contact_transfer_query_with_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -157,7 +157,7 @@ public class ContactTransferQueryFlowTest
// code above will write the wrong ROID into the file.
contact = contact.asBuilder().setRepoId("DEADBEEF_TLD-ROID").build();
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("contact_transfer_query_with_roid.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -167,7 +167,7 @@ public class ContactTransferQueryFlowTest
public void testFailure_neverBeenTransferred() throws Exception {
changeTransferStatus(null);
EppException thrown =
expectThrows(
assertThrows(
NoTransferHistoryToQueryException.class,
() -> doFailingTest("contact_transfer_query.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -177,7 +177,7 @@ public class ContactTransferQueryFlowTest
public void testFailure_unrelatedClient() throws Exception {
setClientIdForFlow("ClientZ");
EppException thrown =
expectThrows(
assertThrows(
NotAuthorizedToViewTransferException.class,
() -> doFailingTest("contact_transfer_query.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -188,7 +188,7 @@ public class ContactTransferQueryFlowTest
contact =
persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_query.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -198,7 +198,7 @@ public class ContactTransferQueryFlowTest
public void testFailure_nonexistentContact() throws Exception {
deleteResource(contact);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_query.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();

View file

@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage;
import static google.registry.testing.DatastoreHelper.getPollMessages;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
@ -147,7 +147,7 @@ public class ContactTransferRejectFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("contact_transfer_reject_with_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -157,7 +157,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_neverBeenTransferred() throws Exception {
changeTransferStatus(null);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -166,7 +166,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_clientApproved() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -175,7 +175,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_clientRejected() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -184,7 +184,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_clientCancelled() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -193,7 +193,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_serverApproved() throws Exception {
changeTransferStatus(TransferStatus.SERVER_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -202,7 +202,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_serverCancelled() throws Exception {
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -211,7 +211,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_gainingClient() throws Exception {
setClientIdForFlow("NewRegistrar");
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -220,7 +220,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_unrelatedClient() throws Exception {
setClientIdForFlow("ClientZ");
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -230,7 +230,7 @@ public class ContactTransferRejectFlowTest
contact =
persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("contact_transfer_reject.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
@ -241,7 +241,7 @@ public class ContactTransferRejectFlowTest
public void testFailure_nonexistentContact() throws Exception {
deleteResource(contact);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("contact_transfer_reject.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));

View file

@ -29,7 +29,7 @@ import static google.registry.testing.DatastoreHelper.getPollMessages;
import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@ -158,7 +158,7 @@ public class ContactTransferRequestFlowTest
@Test
public void testFailure_noAuthInfo() throws Exception {
EppException thrown =
expectThrows(
assertThrows(
MissingTransferRequestAuthInfoException.class,
() -> doFailingTest("contact_transfer_request_no_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -174,7 +174,7 @@ public class ContactTransferRequestFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("contact_transfer_request.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -225,7 +225,7 @@ public class ContactTransferRequestFlowTest
.build())
.build());
EppException thrown =
expectThrows(
assertThrows(
AlreadyPendingTransferException.class,
() -> doFailingTest("contact_transfer_request.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -235,7 +235,7 @@ public class ContactTransferRequestFlowTest
public void testFailure_sponsoringClient() throws Exception {
setClientIdForFlow("TheRegistrar");
EppException thrown =
expectThrows(
assertThrows(
ObjectAlreadySponsoredException.class,
() -> doFailingTest("contact_transfer_request.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -246,7 +246,7 @@ public class ContactTransferRequestFlowTest
contact =
persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("contact_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
@ -257,7 +257,7 @@ public class ContactTransferRequestFlowTest
public void testFailure_nonexistentContact() throws Exception {
deleteResource(contact);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("contact_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
@ -270,7 +270,7 @@ public class ContactTransferRequestFlowTest
persistResource(
contact.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(
assertThrows(
ResourceStatusProhibitsOperationException.class,
() -> doFailingTest("contact_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains("clientTransferProhibited");
@ -283,7 +283,7 @@ public class ContactTransferRequestFlowTest
persistResource(
contact.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(
assertThrows(
ResourceStatusProhibitsOperationException.class,
() -> doFailingTest("contact_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains("serverTransferProhibited");
@ -295,7 +295,7 @@ public class ContactTransferRequestFlowTest
contact =
persistResource(contact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(
assertThrows(
ResourceStatusProhibitsOperationException.class,
() -> doFailingTest("contact_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains("pendingDelete");

View file

@ -22,7 +22,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -258,7 +258,7 @@ public class ContactUpdateFlowTest
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -267,7 +267,7 @@ public class ContactUpdateFlowTest
public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -276,7 +276,7 @@ public class ContactUpdateFlowTest
public void testFailure_statusValueNotClientSettable() throws Exception {
setEppInput("contact_update_prohibited_status.xml");
persistActiveContact(getUniqueIdFromCommand());
EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow);
EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -293,7 +293,7 @@ public class ContactUpdateFlowTest
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistActiveContact(getUniqueIdFromCommand());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -346,7 +346,7 @@ public class ContactUpdateFlowTest
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.build());
EppException thrown =
expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -358,7 +358,7 @@ public class ContactUpdateFlowTest
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -371,7 +371,7 @@ public class ContactUpdateFlowTest
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -387,7 +387,7 @@ public class ContactUpdateFlowTest
setEppInput("contact_update_hebrew_int.xml");
persistActiveContact(getUniqueIdFromCommand());
EppException thrown =
expectThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -396,7 +396,7 @@ public class ContactUpdateFlowTest
setEppInput("contact_update_decline_disclosure.xml");
persistActiveContact(getUniqueIdFromCommand());
EppException thrown =
expectThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -404,7 +404,7 @@ public class ContactUpdateFlowTest
public void testFailure_addRemoveSameValue() throws Exception {
setEppInput("contact_update_add_remove_same.xml");
persistActiveContact(getUniqueIdFromCommand());
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -31,7 +31,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
@ -257,7 +257,7 @@ public class DomainAllocateFlowTest
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
.build());
NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser);
assertThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -273,7 +273,7 @@ public class DomainAllocateFlowTest
ImmutableSet.of("ns1.example.net", "ns2.example.net"))
.build());
RegistrantNotAllowedException thrown =
expectThrows(RegistrantNotAllowedException.class, this::runFlowAsSuperuser);
assertThrows(RegistrantNotAllowedException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("jd1234");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -289,7 +289,7 @@ public class DomainAllocateFlowTest
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.net, ns2.example.net"))
.build());
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class,
this::runFlowAsSuperuser);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -322,7 +322,7 @@ public class DomainAllocateFlowTest
"example-one,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net"))
.build());
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -340,7 +340,7 @@ public class DomainAllocateFlowTest
"example-one,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net"))
.build());
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class,
this::runFlowAsSuperuser);
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -379,7 +379,7 @@ public class DomainAllocateFlowTest
ImmutableSet.of("ns1.example.net", "ns2.example.net", "ns3.example.net"))
.build());
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -399,7 +399,7 @@ public class DomainAllocateFlowTest
ImmutableSet.of("ns4.example.net", "ns2.example.net", "ns3.example.net"))
.build());
NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser);
assertThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -594,7 +594,7 @@ public class DomainAllocateFlowTest
setupDomainApplication("tld", TldState.QUIET_PERIOD);
persistActiveDomain(getUniqueIdFromCommand());
EppException thrown =
expectThrows(ResourceAlreadyExistsException.class, this::runFlowAsSuperuser);
assertThrows(ResourceAlreadyExistsException.class, this::runFlowAsSuperuser);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -630,7 +630,7 @@ public class DomainAllocateFlowTest
public void testFailure_applicationDeleted() throws Exception {
setupDomainApplication("tld", TldState.QUIET_PERIOD);
persistResource(application.asBuilder().setDeletionTime(clock.nowUtc()).build());
EppException thrown = expectThrows(MissingApplicationException.class, this::runFlowAsSuperuser);
EppException thrown = assertThrows(MissingApplicationException.class, this::runFlowAsSuperuser);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -639,7 +639,7 @@ public class DomainAllocateFlowTest
setupDomainApplication("tld", TldState.QUIET_PERIOD);
persistResource(
application.asBuilder().setApplicationStatus(ApplicationStatus.REJECTED).build());
EppException thrown = expectThrows(HasFinalStatusException.class, this::runFlowAsSuperuser);
EppException thrown = assertThrows(HasFinalStatusException.class, this::runFlowAsSuperuser);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -648,7 +648,7 @@ public class DomainAllocateFlowTest
setupDomainApplication("tld", TldState.QUIET_PERIOD);
persistResource(
application.asBuilder().setApplicationStatus(ApplicationStatus.ALLOCATED).build());
EppException thrown = expectThrows(HasFinalStatusException.class, this::runFlowAsSuperuser);
EppException thrown = assertThrows(HasFinalStatusException.class, this::runFlowAsSuperuser);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -656,7 +656,7 @@ public class DomainAllocateFlowTest
public void testFailure_applicationDoesNotExist() throws Exception {
setupDomainApplication("tld", TldState.QUIET_PERIOD);
setEppInput("domain_allocate_bad_application_roid.xml");
EppException thrown = expectThrows(MissingApplicationException.class, this::runFlowAsSuperuser);
EppException thrown = assertThrows(MissingApplicationException.class, this::runFlowAsSuperuser);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -667,7 +667,7 @@ public class DomainAllocateFlowTest
setEppInput("domain_allocate_no_nameservers.xml");
assertTransactionalFlow(true);
EppException thrown =
expectThrows(
assertThrows(
OnlySuperuserCanAllocateException.class,
() -> runFlow(CommitMode.LIVE, UserPrivileges.NORMAL));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -678,7 +678,7 @@ public class DomainAllocateFlowTest
setupDomainApplication("tld", TldState.QUIET_PERIOD);
setEppInput("domain_allocate_11_years.xml");
EppException thrown =
expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlowAsSuperuser);
assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlowAsSuperuser);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -32,7 +32,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static java.util.Comparator.comparing;
import static org.joda.money.CurrencyUnit.EUR;
@ -253,7 +253,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_encoded_signed_mark_corrupt.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(SignedMarkParsingErrorException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkParsingErrorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -263,7 +263,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_encoded_signed_mark_revoked_cert.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(SignedMarkCertificateRevokedException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkCertificateRevokedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -275,7 +275,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
clock.setTo(DateTime.parse("2022-01-01"));
clock.setTo(DateTime.parse("2022-01-01"));
EppException thrown = expectThrows(SignedMarkCertificateExpiredException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkCertificateExpiredException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -287,7 +287,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
clock.setTo(DateTime.parse("2012-07-22T00:01:00Z"));
EppException thrown =
expectThrows(SignedMarkCertificateNotYetValidException.class, this::runFlow);
assertThrows(SignedMarkCertificateNotYetValidException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -307,7 +307,7 @@ public class DomainApplicationCreateFlowTest
throw new GeneralSecurityException();
}
};
EppException thrown = expectThrows(SignedMarkCertificateInvalidException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkCertificateInvalidException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -319,7 +319,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown =
expectThrows(SignedMarkCertificateSignatureException.class, this::runFlow);
assertThrows(SignedMarkCertificateSignatureException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -329,7 +329,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_encoded_signed_mark_signature_corrupt.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(SignedMarkSignatureException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkSignatureException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -416,7 +416,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_allowedinsunrise.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow);
EppException thrown = assertThrows(DomainReservedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -428,7 +428,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
// Modify the Registrar to block premium names.
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
EppException thrown = expectThrows(PremiumNameBlockedException.class, this::runFlow);
EppException thrown = assertThrows(PremiumNameBlockedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -439,7 +439,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_premium.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -453,7 +453,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_premium.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -564,7 +564,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
setEppInput("domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -575,7 +575,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
setEppInput(
"domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -586,7 +586,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
setEppInput(
"domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -597,7 +597,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
setEppInput(
"domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -608,7 +608,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
setEppInput(
"domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -619,7 +619,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
setEppInput(
"domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -629,7 +629,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -639,7 +639,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -649,7 +649,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -760,7 +760,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown =
expectThrows(LandrushApplicationDisallowedDuringSunriseException.class, this::runFlow);
assertThrows(LandrushApplicationDisallowedDuringSunriseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -777,7 +777,7 @@ public class DomainApplicationCreateFlowTest
.build());
clock.advanceOneMilli();
EppException thrown =
expectThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow);
assertThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -788,7 +788,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown =
expectThrows(SunriseApplicationDisallowedDuringLandrushException.class, this::runFlow);
assertThrows(SunriseApplicationDisallowedDuringLandrushException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -797,7 +797,7 @@ public class DomainApplicationCreateFlowTest
SignedMarkRevocationList.create(clock.nowUtc(), ImmutableMap.of(SMD_ID, clock.nowUtc())).save();
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(SignedMarkRevokedErrorException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkRevokedErrorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -807,7 +807,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_14_nameservers.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(TooManyNameserversException.class, this::runFlow);
EppException thrown = assertThrows(TooManyNameserversException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -816,7 +816,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_with_secdns_maxsiglife.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(MaxSigLifeNotSupportedException.class, this::runFlow);
EppException thrown = assertThrows(MaxSigLifeNotSupportedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -825,7 +825,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_signed_mark_with_secdns_9_records.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(TooManyDsRecordsException.class, this::runFlow);
EppException thrown = assertThrows(TooManyDsRecordsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -834,7 +834,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_wrong_extension.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -843,7 +843,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_signed_mark_reserved.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow);
EppException thrown = assertThrows(DomainReservedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -898,7 +898,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown =
expectThrows(UncontestedSunriseApplicationBlockedInLandrushException.class, this::runFlow);
assertThrows(UncontestedSunriseApplicationBlockedInLandrushException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -995,7 +995,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow);
EppException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1019,7 +1019,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow);
EppException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1042,7 +1042,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow);
EppException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1103,7 +1103,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow);
EppException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1113,7 +1113,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_months.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1123,7 +1123,7 @@ public class DomainApplicationCreateFlowTest
persistActiveContact("jd1234");
persistActiveContact("sh8013");
LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.net)");
}
@ -1133,7 +1133,7 @@ public class DomainApplicationCreateFlowTest
persistActiveHost("ns2.example.net");
persistActiveContact("jd1234");
LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)");
}
@ -1143,7 +1143,7 @@ public class DomainApplicationCreateFlowTest
createTld("foo", TldState.SUNRISE);
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow);
EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1152,7 +1152,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.PREDELEGATION);
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1161,7 +1161,7 @@ public class DomainApplicationCreateFlowTest
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistContactsAndHosts();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1170,7 +1170,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.SUNRUSH);
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(LaunchPhaseMismatchException.class, this::runFlow);
EppException thrown = assertThrows(LaunchPhaseMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1179,7 +1179,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.QUIET_PERIOD);
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1188,7 +1188,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.GENERAL_AVAILABILITY);
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1197,7 +1197,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1206,7 +1206,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_signed_mark.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(LaunchPhaseMismatchException.class, this::runFlow);
EppException thrown = assertThrows(LaunchPhaseMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1272,7 +1272,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_duplicate_contact.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow);
EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1282,7 +1282,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
// We need to test for missing type, but not for invalid - the schema enforces that for us.
EppException thrown = expectThrows(MissingContactTypeException.class, this::runFlow);
EppException thrown = assertThrows(MissingContactTypeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1291,7 +1291,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_no_matching_marks.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
EppException thrown = assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1301,7 +1301,7 @@ public class DomainApplicationCreateFlowTest
clock.setTo(DateTime.parse("2013-08-09T10:05:59Z").minusSeconds(1));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
EppException thrown = assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1311,7 +1311,7 @@ public class DomainApplicationCreateFlowTest
clock.setTo(DateTime.parse("2017-07-23T22:00:00.000Z"));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
EppException thrown = assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1321,7 +1321,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown =
expectThrows(Base64RequiredForEncodedSignedMarksException.class, this::runFlow);
assertThrows(Base64RequiredForEncodedSignedMarksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1330,7 +1330,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_bad_encoding.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(SignedMarkEncodingErrorException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkEncodingErrorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1339,7 +1339,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_bad_encoded_xml.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(SignedMarkParsingErrorException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkParsingErrorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1349,7 +1349,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_bad_idn_minna.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(InvalidIdnDomainLabelException.class, this::runFlow);
EppException thrown = assertThrows(InvalidIdnDomainLabelException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1360,7 +1360,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(InvalidTrademarkValidatorException.class, this::runFlow);
EppException thrown = assertThrows(InvalidTrademarkValidatorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1369,7 +1369,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_signed_mark.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(SignedMarksMustBeEncodedException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarksMustBeEncodedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1378,7 +1378,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_code_with_mark.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(UnsupportedMarkTypeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedMarkTypeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1387,7 +1387,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_empty_encoded_signed_mark.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(SignedMarkParsingErrorException.class, this::runFlow);
EppException thrown = assertThrows(SignedMarkParsingErrorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1398,7 +1398,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown =
expectThrows(NoticeCannotBeUsedWithSignedMarkException.class, this::runFlow);
assertThrows(NoticeCannotBeUsedWithSignedMarkException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1407,7 +1407,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_two_signed_marks.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(TooManySignedMarksException.class, this::runFlow);
EppException thrown = assertThrows(TooManySignedMarksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1418,7 +1418,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(MissingClaimsNoticeException.class, this::runFlow);
EppException thrown = assertThrows(MissingClaimsNoticeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1428,7 +1428,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_claim_notice.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(UnexpectedClaimsNoticeException.class, this::runFlow);
EppException thrown = assertThrows(UnexpectedClaimsNoticeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1439,7 +1439,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts();
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow);
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1451,7 +1451,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(ExpiredClaimException.class, this::runFlow);
EppException thrown = assertThrows(ExpiredClaimException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1463,7 +1463,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(AcceptedTooLongAgoException.class, this::runFlow);
EppException thrown = assertThrows(AcceptedTooLongAgoException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1475,7 +1475,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_malformed_claim_notice1.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(MalformedTcnIdException.class, this::runFlow);
EppException thrown = assertThrows(MalformedTcnIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1487,7 +1487,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_malformed_claim_notice2.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(MalformedTcnIdException.class, this::runFlow);
EppException thrown = assertThrows(MalformedTcnIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1499,7 +1499,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(InvalidTcnIdChecksumException.class, this::runFlow);
EppException thrown = assertThrows(InvalidTcnIdChecksumException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1511,7 +1511,7 @@ public class DomainApplicationCreateFlowTest
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1523,7 +1523,7 @@ public class DomainApplicationCreateFlowTest
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1535,7 +1535,7 @@ public class DomainApplicationCreateFlowTest
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1555,7 +1555,7 @@ public class DomainApplicationCreateFlowTest
.build());
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1575,7 +1575,7 @@ public class DomainApplicationCreateFlowTest
.build());
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1595,7 +1595,7 @@ public class DomainApplicationCreateFlowTest
.build());
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1605,7 +1605,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1615,7 +1615,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1625,7 +1625,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1635,7 +1635,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli();
persistActiveDomain(getUniqueIdFromCommand());
ResourceAlreadyExistsException thrown =
expectThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertAboutEppExceptions()
.that(thrown)
.marshalsToXml()
@ -1654,7 +1654,7 @@ public class DomainApplicationCreateFlowTest
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
.build());
RegistrantNotAllowedException thrown =
expectThrows(RegistrantNotAllowedException.class, this::runFlow);
assertThrows(RegistrantNotAllowedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml().and().hasMessageThatContains("jd1234");
}
@ -1667,7 +1667,7 @@ public class DomainApplicationCreateFlowTest
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
.build());
NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertAboutEppExceptions()
.that(thrown)
.marshalsToXml()
@ -1704,7 +1704,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1741,7 +1741,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
}
@ -1759,7 +1759,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1802,7 +1802,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
}
@ -1822,7 +1822,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts();
clock.advanceOneMilli();
NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
}
@ -1832,7 +1832,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_11_years.xml");
persistContactsAndHosts();
clock.advanceOneMilli();
EppException thrown = expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
EppException thrown = assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1841,7 +1841,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_signed_mark_uppercase.xml");
eppLoader.replaceAll("TEST-VALIDATE.tld", domainName);
persistContactsAndHosts();
EppException thrown = expectThrows(exception, this::runFlow);
EppException thrown = assertThrows(exception, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -27,7 +27,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveDomainApplication;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@ -133,7 +133,7 @@ public class DomainApplicationDeleteFlowTest
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -146,7 +146,7 @@ public class DomainApplicationDeleteFlowTest
.setDeletionTime(clock.nowUtc().minusSeconds(1))
.build());
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -154,7 +154,7 @@ public class DomainApplicationDeleteFlowTest
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -172,7 +172,7 @@ public class DomainApplicationDeleteFlowTest
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -197,7 +197,7 @@ public class DomainApplicationDeleteFlowTest
.setPhase(LaunchPhase.SUNRISE)
.build());
EppException thrown =
expectThrows(SunriseApplicationCannotBeDeletedInLandrushException.class, this::runFlow);
assertThrows(SunriseApplicationCannotBeDeletedInLandrushException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -246,7 +246,7 @@ public class DomainApplicationDeleteFlowTest
public void testFailure_mismatchedPhase() throws Exception {
setEppInput("domain_delete_application_landrush.xml", ImmutableMap.of("DOMAIN", "example.tld"));
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
EppException thrown = expectThrows(LaunchPhaseMismatchException.class, this::runFlow);
EppException thrown = assertThrows(LaunchPhaseMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -254,7 +254,7 @@ public class DomainApplicationDeleteFlowTest
public void testFailure_wrongExtension() throws Exception {
setEppInput("domain_delete_application_wrong_extension.xml");
persistActiveDomainApplication("example.tld");
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -262,7 +262,7 @@ public class DomainApplicationDeleteFlowTest
public void testFailure_predelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION);
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -270,7 +270,7 @@ public class DomainApplicationDeleteFlowTest
public void testFailure_quietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD);
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -278,7 +278,7 @@ public class DomainApplicationDeleteFlowTest
public void testFailure_generalAvailability() throws Exception {
createTld("tld", TldState.GENERAL_AVAILABILITY);
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -286,7 +286,7 @@ public class DomainApplicationDeleteFlowTest
public void testFailure_startDateSunrise() throws Exception {
createTld("tld", TldState.START_DATE_SUNRISE);
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -329,7 +329,7 @@ public class DomainApplicationDeleteFlowTest
@Test
public void testFailure_applicationIdForDifferentDomain() throws Exception {
persistResource(newDomainApplication("invalid.tld").asBuilder().setRepoId("1-TLD").build());
EppException thrown = expectThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
@ -287,7 +287,7 @@ public class DomainApplicationInfoFlowTest
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -301,7 +301,7 @@ public class DomainApplicationInfoFlowTest
.setRegistrant(Key.create(persistActiveContact("jd1234")))
.build());
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -310,7 +310,7 @@ public class DomainApplicationInfoFlowTest
persistResource(AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
sessionMetadata.setClientId("ClientZ");
persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST);
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -323,7 +323,7 @@ public class DomainApplicationInfoFlowTest
.setRegistrant(Key.create(persistActiveContact("jd1234")))
.setPhase(LaunchPhase.SUNRUSH)
.build());
EppException thrown = expectThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -331,7 +331,7 @@ public class DomainApplicationInfoFlowTest
public void testFailure_noApplicationId() throws Exception {
setEppInput("domain_info_sunrise_no_application_id.xml");
persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST);
EppException thrown = expectThrows(MissingApplicationIdException.class, this::runFlow);
EppException thrown = assertThrows(MissingApplicationIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -340,7 +340,7 @@ public class DomainApplicationInfoFlowTest
persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST);
application = persistResource(application.asBuilder().setPhase(LaunchPhase.SUNRISE).build());
EppException thrown =
expectThrows(ApplicationLaunchPhaseMismatchException.class, this::runFlow);
assertThrows(ApplicationLaunchPhaseMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -29,7 +29,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainApplicationSubject.assertAboutApplications;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import com.google.common.collect.ImmutableMap;
@ -364,7 +364,7 @@ public class DomainApplicationUpdateFlowTest
setEppInput(xmlFilename);
persistReferencedEntities();
persistNewApplication();
EppException thrown = expectThrows(expectedException, this::runFlow);
EppException thrown = assertThrows(expectedException, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -400,7 +400,7 @@ public class DomainApplicationUpdateFlowTest
setEppInput("domain_update_sunrise_dsdata_add.xml");
persistResource(newApplicationBuilder().setDsData(builder.build()).build());
EppException thrown = expectThrows(TooManyDsRecordsException.class, this::runFlow);
EppException thrown = assertThrows(TooManyDsRecordsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -425,14 +425,14 @@ public class DomainApplicationUpdateFlowTest
// Modify application to have 13 nameservers. We will then remove one and add one in the test.
modifyApplicationToHave13Nameservers();
setEppInput("domain_update_sunrise_add_nameserver.xml");
EppException thrown = expectThrows(TooManyNameserversException.class, this::runFlow);
EppException thrown = assertThrows(TooManyNameserversException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_wrongExtension() throws Exception {
setEppInput("domain_update_sunrise_wrong_extension.xml");
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -440,7 +440,7 @@ public class DomainApplicationUpdateFlowTest
public void testFailure_applicationDomainNameMismatch() throws Exception {
persistReferencedEntities();
persistResource(newApplicationBuilder().setFullyQualifiedDomainName("something.tld").build());
EppException thrown = expectThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -448,7 +448,7 @@ public class DomainApplicationUpdateFlowTest
public void testFailure_neverExisted() throws Exception {
persistReferencedEntities();
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -457,7 +457,7 @@ public class DomainApplicationUpdateFlowTest
persistReferencedEntities();
persistResource(newApplicationBuilder().setDeletionTime(START_OF_TIME).build());
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -470,7 +470,7 @@ public class DomainApplicationUpdateFlowTest
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.build());
EppException thrown =
expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -482,7 +482,7 @@ public class DomainApplicationUpdateFlowTest
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
}
@ -490,7 +490,7 @@ public class DomainApplicationUpdateFlowTest
persistReferencedEntities();
persistResource(newApplicationBuilder().setApplicationStatus(status).build());
EppException thrown =
expectThrows(ApplicationStatusProhibitsUpdateException.class, this::runFlow);
assertThrows(ApplicationStatusProhibitsUpdateException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -516,7 +516,7 @@ public class DomainApplicationUpdateFlowTest
persistActiveContact("mak21");
persistNewApplication();
LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.tld)");
}
@ -527,7 +527,7 @@ public class DomainApplicationUpdateFlowTest
persistActiveContact("mak21");
persistNewApplication();
LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)");
}
@ -548,7 +548,7 @@ public class DomainApplicationUpdateFlowTest
Key.create(
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc())))))
.build());
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow);
EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -557,7 +557,7 @@ public class DomainApplicationUpdateFlowTest
setEppInput("domain_update_sunrise_prohibited_status.xml");
persistReferencedEntities();
persistNewApplication();
EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow);
EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -576,7 +576,7 @@ public class DomainApplicationUpdateFlowTest
setEppInput("domain_update_sunrise_duplicate_contact.xml");
persistReferencedEntities();
persistNewApplication();
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow);
EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -586,7 +586,7 @@ public class DomainApplicationUpdateFlowTest
persistReferencedEntities();
persistNewApplication();
// We need to test for missing type, but not for invalid - the schema enforces that for us.
EppException thrown = expectThrows(MissingContactTypeException.class, this::runFlow);
EppException thrown = assertThrows(MissingContactTypeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -595,7 +595,7 @@ public class DomainApplicationUpdateFlowTest
sessionMetadata.setClientId("NewRegistrar");
persistReferencedEntities();
persistApplication();
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -615,7 +615,7 @@ public class DomainApplicationUpdateFlowTest
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistReferencedEntities();
persistApplication();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -641,7 +641,7 @@ public class DomainApplicationUpdateFlowTest
Key.create(
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
.build());
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -658,7 +658,7 @@ public class DomainApplicationUpdateFlowTest
Key.create(
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))))
.build());
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -673,7 +673,7 @@ public class DomainApplicationUpdateFlowTest
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
.build());
EppException thrown = expectThrows(MissingAdminContactException.class, this::runFlow);
EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -688,7 +688,7 @@ public class DomainApplicationUpdateFlowTest
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
.build());
EppException thrown = expectThrows(MissingTechnicalContactException.class, this::runFlow);
EppException thrown = assertThrows(MissingTechnicalContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -702,7 +702,7 @@ public class DomainApplicationUpdateFlowTest
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
.build());
clock.advanceOneMilli();
EppException thrown = expectThrows(RegistrantNotAllowedException.class, this::runFlow);
EppException thrown = assertThrows(RegistrantNotAllowedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -716,7 +716,7 @@ public class DomainApplicationUpdateFlowTest
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
.build());
clock.advanceOneMilli();
EppException thrown = expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -746,7 +746,7 @@ public class DomainApplicationUpdateFlowTest
.build());
clock.advanceOneMilli();
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -802,7 +802,7 @@ public class DomainApplicationUpdateFlowTest
.build());
clock.advanceOneMilli();
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.tld");
}
@ -820,7 +820,7 @@ public class DomainApplicationUpdateFlowTest
.build());
clock.advanceOneMilli();
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -883,7 +883,7 @@ public class DomainApplicationUpdateFlowTest
.build());
clock.advanceOneMilli();
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.tld");
}
@ -903,7 +903,7 @@ public class DomainApplicationUpdateFlowTest
.build());
clock.advanceOneMilli();
NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.tld");
}
@ -916,7 +916,7 @@ public class DomainApplicationUpdateFlowTest
"domain_update_sunrise_fee.xml",
ImmutableMap.of("DOMAIN", "non-free-update.tld", "AMOUNT", "12.00"));
clock.advanceOneMilli();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -25,7 +25,7 @@ import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD;
@ -330,14 +330,14 @@ public class DomainCheckFlowTest
@Test
public void testFailure_tooManyIds() throws Exception {
setEppInput("domain_check_51.xml");
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow);
EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_wrongTld() throws Exception {
setEppInput("domain_check.xml");
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow);
EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -345,7 +345,7 @@ public class DomainCheckFlowTest
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -361,7 +361,7 @@ public class DomainCheckFlowTest
private void doFailingBadLabelTest(String label, Class<? extends EppException> expectedException)
throws Exception {
setEppInput("domain_check_template.xml", ImmutableMap.of("LABEL", label));
EppException thrown = expectThrows(expectedException, this::runFlow);
EppException thrown = assertThrows(expectedException, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -446,7 +446,7 @@ public class DomainCheckFlowTest
@Test
public void testFailure_predelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION);
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -780,84 +780,84 @@ public class DomainCheckFlowTest
@Test
public void testFeeExtension_wrongCurrency_v06() throws Exception {
setEppInput("domain_check_fee_euro_v06.xml");
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_wrongCurrency_v11() throws Exception {
setEppInput("domain_check_fee_euro_v11.xml");
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_wrongCurrency_v12() throws Exception {
setEppInput("domain_check_fee_euro_v12.xml");
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_periodNotInYears_v06() throws Exception {
setEppInput("domain_check_fee_bad_period_v06.xml");
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_periodNotInYears_v11() throws Exception {
setEppInput("domain_check_fee_bad_period_v11.xml");
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_periodNotInYears_v12() throws Exception {
setEppInput("domain_check_fee_bad_period_v12.xml");
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_commandWithPhase_v06() throws Exception {
setEppInput("domain_check_fee_command_phase_v06.xml");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_commandWithPhase_v11() throws Exception {
setEppInput("domain_check_fee_command_phase_v11.xml");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_commandWithPhase_v12() throws Exception {
setEppInput("domain_check_fee_command_phase_v12.xml");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_commandSubphase_v06() throws Exception {
setEppInput("domain_check_fee_command_subphase_v06.xml");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_commandSubphase_v11() throws Exception {
setEppInput("domain_check_fee_command_subphase_v11.xml");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_commandSubphase_v12() throws Exception {
setEppInput("domain_check_fee_command_subphase_v12.xml");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -866,91 +866,91 @@ public class DomainCheckFlowTest
public void testFeeExtension_feeCheckNotInAvailabilityCheck() throws Exception {
setEppInput("domain_check_fee_not_in_avail.xml");
EppException thrown =
expectThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow);
assertThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_multiyearRestore_v06() throws Exception {
setEppInput("domain_check_fee_multiyear_restore_v06.xml");
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_multiyearRestore_v11() throws Exception {
setEppInput("domain_check_fee_multiyear_restore_v11.xml");
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_multiyearRestore_v12() throws Exception {
setEppInput("domain_check_fee_multiyear_restore_v12.xml");
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_multiyearTransfer_v06() throws Exception {
setEppInput("domain_check_fee_multiyear_transfer_v06.xml");
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_multiyearTransfer_v11() throws Exception {
setEppInput("domain_check_fee_multiyear_transfer_v11.xml");
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_multiyearTransfer_v12() throws Exception {
setEppInput("domain_check_fee_multiyear_transfer_v12.xml");
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_unknownCommand_v06() throws Exception {
setEppInput("domain_check_fee_unknown_command_v06.xml");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_unknownCommand_v11() throws Exception {
setEppInput("domain_check_fee_unknown_command_v11.xml");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_unknownCommand_v12() throws Exception {
setEppInput("domain_check_fee_unknown_command_v12.xml");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_invalidCommand_v06() throws Exception {
setEppInput("domain_check_fee_invalid_command_v06.xml");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_invalidCommand_v11() throws Exception {
setEppInput("domain_check_fee_invalid_command_v11.xml");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFeeExtension_invalidCommand_v12() throws Exception {
setEppInput("domain_check_fee_invalid_command_v12.xml");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow);
EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTlds;
import static google.registry.testing.DatastoreHelper.loadRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@ -103,14 +103,14 @@ public class DomainClaimsCheckFlowTest
@Test
public void testFailure_TooManyIds() throws Exception {
setEppInput("domain_check_claims_51.xml");
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow);
EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_tldDoesntExist() throws Exception {
setEppInput("domain_check_claims_bad_tld.xml");
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow);
EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -118,7 +118,7 @@ public class DomainClaimsCheckFlowTest
public void testFailure_notAuthorizedForTld() throws Exception {
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -139,7 +139,7 @@ public class DomainClaimsCheckFlowTest
public void testFailure_predelgation() throws Exception {
createTld("tld", TldState.PREDELEGATION);
setEppInput("domain_check_claims.xml");
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -147,7 +147,7 @@ public class DomainClaimsCheckFlowTest
public void testFailure_sunrise() throws Exception {
createTld("tld", TldState.SUNRISE);
setEppInput("domain_check_claims.xml");
EppException thrown = expectThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow);
EppException thrown = assertThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -156,7 +156,7 @@ public class DomainClaimsCheckFlowTest
createTld("tld", TldState.SUNRISE);
setEppInput("domain_check_claims_allocationtoken.xml");
EppException thrown =
expectThrows(DomainClaimsCheckNotAllowedWithAllocationTokens.class, this::runFlow);
assertThrows(DomainClaimsCheckNotAllowedWithAllocationTokens.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -166,7 +166,7 @@ public class DomainClaimsCheckFlowTest
persistResource(
Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
setEppInput("domain_check_claims_multiple_tlds.xml");
EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow);
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -42,7 +42,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
@ -391,7 +391,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_invalidAllocationToken() throws Exception {
setEppInput("domain_create_allocationtoken.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(InvalidAllocationTokenException.class, this::runFlow);
EppException thrown = assertThrows(InvalidAllocationTokenException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -406,7 +406,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build());
clock.advanceOneMilli();
EppException thrown =
expectThrows(AlreadyRedeemedAllocationTokenException.class, this::runFlow);
assertThrows(AlreadyRedeemedAllocationTokenException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -443,7 +443,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTlds("foo.tld", "tld");
setEppInput("domain_create_wildcard.xml", ImmutableMap.of("DOMAIN", "foo.tld"));
persistContactsAndHosts();
EppException thrown = expectThrows(DomainNameExistsAsTldException.class, this::runFlow);
EppException thrown = assertThrows(DomainNameExistsAsTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -452,7 +452,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTlds("foo.tld", "tld");
setEppInput("domain_create_wildcard.xml", ImmutableMap.of("DOMAIN", "FOO.TLD"));
persistContactsAndHosts();
EppException thrown = expectThrows(BadDomainNameCharacterException.class, this::runFlow);
EppException thrown = assertThrows(BadDomainNameCharacterException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -600,7 +600,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_refundableFee_v06() throws Exception {
setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -608,7 +608,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_refundableFee_v11() throws Exception {
setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -616,7 +616,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_refundableFee_v12() throws Exception {
setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -624,7 +624,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_gracePeriodFee_v06() throws Exception {
setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -632,7 +632,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_gracePeriodFee_v11() throws Exception {
setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -640,7 +640,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_gracePeriodFee_v12() throws Exception {
setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -648,7 +648,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_appliedFee_v06() throws Exception {
setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -656,7 +656,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_appliedFee_v11() throws Exception {
setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -664,7 +664,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_appliedFee_v12() throws Exception {
setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -688,7 +688,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_metadataNotFromTool() throws Exception {
setEppInput("domain_create_metadata.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
EppException thrown = assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -708,7 +708,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build());
setEppInput("domain_create_lrp.xml");
persistContactsAndHosts();
Exception e = expectThrows(InvalidLrpTokenException.class, this::runFlow);
Exception e = assertThrows(InvalidLrpTokenException.class, this::runFlow);
assertThat(e).hasMessageThat().isEqualTo("Invalid limited registration period token");
assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull();
}
@ -721,7 +721,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setLrpPeriod(new Interval(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1)))
.build());
persistContactsAndHosts();
InvalidLrpTokenException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow);
InvalidLrpTokenException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("Invalid limited registration period token");
}
@ -848,7 +848,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_periodInMonths() throws Exception {
setEppInput("domain_create_months.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -879,7 +879,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
setEppInput("domain_create.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MissingClaimsNoticeException.class, this::runFlow);
EppException thrown = assertThrows(MissingClaimsNoticeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -888,7 +888,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_claim_notice.xml");
persistClaimsList(ImmutableMap.of());
persistContactsAndHosts();
EppException thrown = expectThrows(UnexpectedClaimsNoticeException.class, this::runFlow);
EppException thrown = assertThrows(UnexpectedClaimsNoticeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -898,7 +898,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts();
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow);
EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -906,7 +906,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_tooManyNameservers() throws Exception {
setEppInput("domain_create_14_nameservers.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(TooManyNameserversException.class, this::runFlow);
EppException thrown = assertThrows(TooManyNameserversException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -914,7 +914,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_secDnsMaxSigLife() throws Exception {
setEppInput("domain_create_dsdata.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MaxSigLifeNotSupportedException.class, this::runFlow);
EppException thrown = assertThrows(MaxSigLifeNotSupportedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -922,7 +922,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_secDnsTooManyDsRecords() throws Exception {
setEppInput("domain_create_dsdata_9_records.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(TooManyDsRecordsException.class, this::runFlow);
EppException thrown = assertThrows(TooManyDsRecordsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -930,7 +930,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_wrongExtension() throws Exception {
setEppInput("domain_create_wrong_extension.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -940,7 +940,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -950,7 +950,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -960,7 +960,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -978,7 +978,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -996,7 +996,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1014,7 +1014,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1023,7 +1023,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistContactsAndHosts();
persistActiveDomain(getUniqueIdFromCommand());
ResourceAlreadyExistsException thrown =
expectThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertAboutEppExceptions()
.that(thrown)
.marshalsToXml()
@ -1036,7 +1036,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_reserved() throws Exception {
setEppInput("domain_create_reserved.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow);
EppException thrown = assertThrows(DomainReservedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1044,7 +1044,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_anchorTenantViaAuthCode_wrongAuthCode() throws Exception {
setEppInput("domain_create_anchor_wrong_authcode.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow);
EppException thrown = assertThrows(DomainReservedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1144,7 +1144,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistActiveContact("jd1234");
persistActiveContact("sh8013");
LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.net)");
}
@ -1160,7 +1160,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build());
clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.net");
}
@ -1169,7 +1169,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistContactsAndHosts();
persistActiveDomainApplication(getUniqueIdFromCommand());
clock.advanceOneMilli();
EppException thrown = expectThrows(DomainHasOpenApplicationsException.class, this::runFlow);
EppException thrown = assertThrows(DomainHasOpenApplicationsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1198,7 +1198,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistActiveHost("ns2.example.net");
persistActiveContact("jd1234");
LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)");
}
@ -1214,7 +1214,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build());
clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("jd1234");
}
@ -1222,7 +1222,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_wrongTld() throws Exception {
persistContactsAndHosts("net");
deleteTld("tld");
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow);
EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1231,7 +1231,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.PREDELEGATION);
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1240,7 +1240,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRISE);
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1249,7 +1249,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRUSH);
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1258,7 +1258,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.LANDRUSH);
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1267,7 +1267,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1276,7 +1276,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.QUIET_PERIOD);
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1355,7 +1355,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_duplicateContact() throws Exception {
setEppInput("domain_create_duplicate_contact.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow);
EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1364,7 +1364,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
// We need to test for missing type, but not for invalid - the schema enforces that for us.
setEppInput("domain_create_missing_contact_type.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MissingContactTypeException.class, this::runFlow);
EppException thrown = assertThrows(MissingContactTypeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1372,7 +1372,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_missingRegistrant() throws Exception {
setEppInput("domain_create_missing_registrant.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MissingRegistrantException.class, this::runFlow);
EppException thrown = assertThrows(MissingRegistrantException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1380,7 +1380,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_missingAdmin() throws Exception {
setEppInput("domain_create_missing_admin.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MissingAdminContactException.class, this::runFlow);
EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1388,7 +1388,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_missingTech() throws Exception {
setEppInput("domain_create_missing_tech.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MissingTechnicalContactException.class, this::runFlow);
EppException thrown = assertThrows(MissingTechnicalContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1396,7 +1396,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_missingNonRegistrantContacts() throws Exception {
setEppInput("domain_create_missing_non_registrant_contacts.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MissingAdminContactException.class, this::runFlow);
EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1405,7 +1405,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("xn--q9jyb4c");
setEppInput("domain_create_bad_idn_minna.xml");
persistContactsAndHosts("net");
EppException thrown = expectThrows(InvalidIdnDomainLabelException.class, this::runFlow);
EppException thrown = assertThrows(InvalidIdnDomainLabelException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1414,7 +1414,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_bad_validator_id.xml");
persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY));
persistContactsAndHosts();
EppException thrown = expectThrows(InvalidTrademarkValidatorException.class, this::runFlow);
EppException thrown = assertThrows(InvalidTrademarkValidatorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1422,7 +1422,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_codeMark() throws Exception {
setEppInput("domain_create_code_with_mark.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(UnsupportedMarkTypeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedMarkTypeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1432,7 +1432,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_signed_mark.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1441,7 +1441,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2010-08-17T09:00:00.0Z"));
setEppInput("domain_create_claim_notice.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(ExpiredClaimException.class, this::runFlow);
EppException thrown = assertThrows(ExpiredClaimException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1450,7 +1450,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-09-16T09:00:00.0Z"));
setEppInput("domain_create_claim_notice.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(AcceptedTooLongAgoException.class, this::runFlow);
EppException thrown = assertThrows(AcceptedTooLongAgoException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1459,7 +1459,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_malformed_claim_notice1.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MalformedTcnIdException.class, this::runFlow);
EppException thrown = assertThrows(MalformedTcnIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1468,7 +1468,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_malformed_claim_notice2.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(MalformedTcnIdException.class, this::runFlow);
EppException thrown = assertThrows(MalformedTcnIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1477,7 +1477,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_bad_checksum_claim_notice.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(InvalidTcnIdChecksumException.class, this::runFlow);
EppException thrown = assertThrows(InvalidTcnIdChecksumException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1489,7 +1489,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistContactsAndHosts("net");
// Modify the Registrar to block premium names.
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
EppException thrown = expectThrows(PremiumNameBlockedException.class, this::runFlow);
EppException thrown = assertThrows(PremiumNameBlockedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1499,7 +1499,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertThat(Registry.get("example").getPremiumPriceAckRequired()).isTrue();
setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net");
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1511,7 +1511,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net");
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1523,7 +1523,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net");
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1535,7 +1535,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("net");
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts();
EppException thrown = expectThrows(UndeclaredServiceExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1547,7 +1547,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("net");
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts();
EppException thrown = expectThrows(UndeclaredServiceExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1559,7 +1559,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("net");
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts();
EppException thrown = expectThrows(UndeclaredServiceExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1567,7 +1567,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1575,7 +1575,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1583,7 +1583,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1598,7 +1598,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setState(State.SUSPENDED)
.build());
EppException thrown =
expectThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow);
assertThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1607,7 +1607,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_uppercase.xml");
eppLoader.replaceAll("Example.tld", domainName);
persistContactsAndHosts();
EppException thrown = expectThrows(exception, this::runFlow);
EppException thrown = assertThrows(exception, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1683,7 +1683,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_sunrise.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1736,7 +1736,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_start_date_sunrise.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1776,7 +1776,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput("domain_create_registration_start_date_sunrise_wrong_encoded_signed_mark.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
EppException thrown = assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1787,7 +1787,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_start_date_sunrise_claims_notice.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1797,7 +1797,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_sunrush.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1810,7 +1810,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setAllowedTlds(ImmutableSet.of("irrelevant"))
.build());
persistContactsAndHosts();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1863,7 +1863,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_landrush.xml");
persistContactsAndHosts();
EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1920,7 +1920,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
.build());
RegistrantNotAllowedException thrown =
expectThrows(RegistrantNotAllowedException.class, this::runFlow);
assertThrows(RegistrantNotAllowedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("jd1234");
}
@ -1933,7 +1933,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
.build());
NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
}
@ -1947,7 +1947,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build());
persistContactsAndHosts();
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1994,7 +1994,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns1.example.net:ns2.example.net:ns3.example.net"))
.build());
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -2010,7 +2010,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns2.example.net:ns3.example.net"))
.build());
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
}
@ -2026,7 +2026,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.net:ns2.example.net"))
.build());
DomainNotAllowedForTldWithCreateRestrictionException thrown =
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("example.tld");
}
@ -2076,7 +2076,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns1.example.net:ns2.example.net:ns3.example.net"))
.build());
NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
}
@ -2095,7 +2095,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns2.example.net:ns3.example.net:ns4.example.net"))
.build());
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net");
}
@ -2116,7 +2116,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns1.example.net:ns2.example.net:ns3.example.net"))
.build());
DomainNotAllowedForTldWithCreateRestrictionException thrown =
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("example.tld");
}
@ -2170,7 +2170,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1),
Money.of(USD, 0)))
.build());
EppException thrown = expectThrows(FeeDescriptionParseException.class, this::runFlow);
EppException thrown = assertThrows(FeeDescriptionParseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -2198,7 +2198,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1),
Money.of(USD, 0)))
.build());
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("CREATE");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -2222,7 +2222,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1),
Money.of(USD, 0)))
.build());
EppException thrown = expectThrows(FeeDescriptionMultipleMatchesException.class, this::runFlow);
EppException thrown = assertThrows(FeeDescriptionMultipleMatchesException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ea");
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -2326,7 +2326,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1),
Money.of(USD, 0)))
.build());
Exception e = expectThrows(FeesRequiredDuringEarlyAccessProgramException.class, this::runFlow);
Exception e = assertThrows(FeesRequiredDuringEarlyAccessProgramException.class, this::runFlow);
assertThat(e)
.hasMessageThat()
.isEqualTo(
@ -2374,7 +2374,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_max10Years() throws Exception {
setEppInput("domain_create_11_years.xml");
persistContactsAndHosts();
EppException thrown = expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
EppException thrown = assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -43,7 +43,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
@ -674,7 +674,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testFailure_predelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION);
setUpSuccessfulTest();
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -690,7 +690,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -698,7 +698,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -717,7 +717,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.asBuilder()
.addSubordinateHost(subordinateHost.getFullyQualifiedHostName())
.build());
EppException thrown = expectThrows(DomainToDeleteHasHostsException.class, this::runFlow);
EppException thrown = assertThrows(DomainToDeleteHasHostsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -725,7 +725,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistActiveDomain(getUniqueIdFromCommand());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -743,7 +743,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest();
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -765,7 +765,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.addStatusValue(StatusValue.CLIENT_DELETE_PROHIBITED)
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("clientDeleteProhibited");
}
@ -777,7 +777,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED)
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverDeleteProhibited");
}
@ -789,7 +789,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.addStatusValue(StatusValue.PENDING_DELETE)
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete");
}
@ -816,7 +816,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testFailure_metadataNotFromTool() throws Exception {
setEppInput("domain_delete_metadata.xml");
persistResource(newDomainResource(getUniqueIdFromCommand()));
EppException thrown = expectThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
EppException thrown = assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1082,7 +1082,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test
public void testFailure_allocationTokenNotSupportedOnDelete() throws Exception {
setEppInput("domain_delete_allocationtoken.xml");
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
}

View file

@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;
@ -411,7 +411,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -423,7 +423,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
.setDeletionTime(clock.nowUtc().minusDays(1))
.build());
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -438,7 +438,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
.build());
sessionMetadata.setClientId("ClientZ");
setEppInput("domain_info_with_auth.xml");
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -452,7 +452,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("diffpw")))
.build());
setEppInput("domain_info_with_auth.xml");
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -470,7 +470,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our registrant.
eppLoader.replaceAll("JD1234-REP", registrant.getRepoId());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -487,7 +487,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our registrant.
eppLoader.replaceAll("JD1234-REP", registrant.getRepoId());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -505,7 +505,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our contact.
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -522,7 +522,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our contact.
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -534,7 +534,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our unrelated contact.
eppLoader.replaceAll("JD1234-REP", unrelatedContact.getRepoId());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -545,7 +545,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our unrelated contact.
eppLoader.replaceAll("JD1234-REP", unrelatedContact.getRepoId());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow);
EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -625,7 +625,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_wrongCurrency() throws Exception {
setEppInput("domain_info_fee_create_euro.xml");
persistTestEntities(false);
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -634,7 +634,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_periodNotInYears() throws Exception {
setEppInput("domain_info_fee_bad_period.xml");
persistTestEntities(false);
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -643,7 +643,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_commandPhase() throws Exception {
setEppInput("domain_info_fee_command_phase.xml");
persistTestEntities(false);
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -652,7 +652,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_commandSubphase() throws Exception {
setEppInput("domain_info_fee_command_subphase.xml");
persistTestEntities(false);
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -661,7 +661,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_multiyearRestore() throws Exception {
setEppInput("domain_info_fee_multiyear_restore.xml");
persistTestEntities(false);
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -670,7 +670,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_multiyearTransfer() throws Exception {
setEppInput("domain_info_fee_multiyear_transfer.xml");
persistTestEntities(false);
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -28,7 +28,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.EUR;
@ -304,7 +304,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_refundableFee_v06() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_06_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -312,7 +312,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_refundableFee_v11() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_11_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -320,7 +320,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_refundableFee_v12() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_12_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -328,7 +328,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_gracePeriodFee_v06() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_06_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -336,7 +336,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_gracePeriodFee_v11() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_11_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -344,7 +344,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_gracePeriodFee_v12() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_12_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -352,7 +352,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_appliedFee_v06() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_06_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -360,7 +360,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_appliedFee_v11() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_11_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -368,7 +368,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_appliedFee_v12() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_12_MAP);
persistDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -429,7 +429,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -437,7 +437,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -445,7 +445,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_clientRenewProhibited() throws Exception {
persistDomain(StatusValue.CLIENT_RENEW_PROHIBITED);
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("clientRenewProhibited");
}
@ -453,7 +453,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_serverRenewProhibited() throws Exception {
persistDomain(StatusValue.SERVER_RENEW_PROHIBITED);
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverRenewProhibited");
}
@ -467,7 +467,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.addStatusValue(StatusValue.PENDING_DELETE)
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete");
}
@ -480,7 +480,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build());
persistDomain();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -493,7 +493,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build());
persistDomain();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -506,7 +506,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build());
persistDomain();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -524,7 +524,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistDomain();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -542,7 +542,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistDomain();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -560,7 +560,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
persistDomain();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -568,7 +568,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_06_MAP);
persistDomain();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -576,7 +576,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_11_MAP);
persistDomain();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -584,7 +584,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_12_MAP);
persistDomain();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -597,7 +597,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRegistrationExpirationTime(DateTime.parse("2001-09-08T22:00:00.0Z"))
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingTransfer");
}
@ -605,7 +605,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_periodInMonths() throws Exception {
setEppInput("domain_renew_months.xml");
persistDomain();
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow);
EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -613,7 +613,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_max10Years() throws Exception {
setEppInput("domain_renew_11_years.xml");
persistDomain();
EppException thrown = expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
EppException thrown = assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -627,7 +627,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRegistrationExpirationTime(DateTime.parse("2000-04-04T22:00:00.0Z"))
.build());
EppException thrown =
expectThrows(IncorrectCurrentExpirationDateException.class, this::runFlow);
assertThrows(IncorrectCurrentExpirationDateException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -635,7 +635,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistActiveDomain(getUniqueIdFromCommand());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -652,7 +652,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistDomain();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -671,7 +671,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_renew_premium.xml");
persistDomain();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -683,7 +683,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_renew_premium.xml");
persistDomain();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -28,7 +28,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
@ -245,7 +245,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_refundableFee_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_06_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -253,7 +253,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_refundableFee_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_11_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -261,7 +261,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_refundableFee_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_12_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -269,7 +269,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_gracePeriodFee_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_06_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -277,7 +277,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_gracePeriodFee_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_11_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -285,7 +285,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_gracePeriodFee_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_12_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -293,7 +293,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_appliedFee_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_06_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -301,7 +301,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_appliedFee_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_11_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -309,7 +309,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_appliedFee_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_12_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow);
EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -349,7 +349,7 @@ public class DomainRestoreRequestFlowTest
@Test
public void testFailure_doesNotExist() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -359,7 +359,7 @@ public class DomainRestoreRequestFlowTest
persistPendingDeleteDomain();
persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -369,7 +369,7 @@ public class DomainRestoreRequestFlowTest
persistPendingDeleteDomain();
persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -379,7 +379,7 @@ public class DomainRestoreRequestFlowTest
persistPendingDeleteDomain();
persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -396,7 +396,7 @@ public class DomainRestoreRequestFlowTest
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -419,7 +419,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_06_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -427,7 +427,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_11_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -435,7 +435,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_12_MAP);
persistPendingDeleteDomain();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow);
EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -447,21 +447,21 @@ public class DomainRestoreRequestFlowTest
.setDeletionTime(clock.nowUtc().plusDays(4))
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
.build());
EppException thrown = expectThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
EppException thrown = assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_notDeleted() throws Exception {
persistActiveDomain(getUniqueIdFromCommand());
EppException thrown = expectThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
EppException thrown = assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_fullyDeleted() throws Exception {
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
EppException thrown = expectThrows(ResourceDoesNotExistException.class, this::runFlow);
EppException thrown = assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -469,7 +469,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_withChange() throws Exception {
persistPendingDeleteDomain();
setEppInput("domain_update_restore_request_with_change.xml");
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -477,7 +477,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_withAdd() throws Exception {
persistPendingDeleteDomain();
setEppInput("domain_update_restore_request_with_add.xml");
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -485,7 +485,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_withRemove() throws Exception {
persistPendingDeleteDomain();
setEppInput("domain_update_restore_request_with_remove.xml");
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -493,7 +493,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_withSecDnsExtension() throws Exception {
persistPendingDeleteDomain();
setEppInput("domain_update_restore_request_with_secdns.xml");
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -501,7 +501,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistPendingDeleteDomain();
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -510,7 +510,7 @@ public class DomainRestoreRequestFlowTest
sessionMetadata.setClientId("NewRegistrar");
persistPendingDeleteDomain();
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class,
() -> runFlowAssertResponse(loadFile("domain_update_response.xml")));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -521,7 +521,7 @@ public class DomainRestoreRequestFlowTest
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistPendingDeleteDomain();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -541,7 +541,7 @@ public class DomainRestoreRequestFlowTest
persistPendingDeleteDomain();
// Modify the Registrar to block premium names.
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
EppException thrown = expectThrows(PremiumNameBlockedException.class, this::runFlow);
EppException thrown = assertThrows(PremiumNameBlockedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -554,7 +554,7 @@ public class DomainRestoreRequestFlowTest
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
.build());
persistPendingDeleteDomain();
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow);
EppException thrown = assertThrows(DomainReservedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -563,7 +563,7 @@ public class DomainRestoreRequestFlowTest
createTld("example");
setEppInput("domain_update_restore_request_premium.xml");
persistPendingDeleteDomain();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -575,7 +575,7 @@ public class DomainRestoreRequestFlowTest
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_update_restore_request_premium.xml");
persistPendingDeleteDomain();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -33,7 +33,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD;
@ -411,7 +411,7 @@ public class DomainTransferApproveFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_approve_contact_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -426,7 +426,7 @@ public class DomainTransferApproveFlowTest
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_approve_domain_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -436,7 +436,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_neverBeenTransferred() throws Exception {
changeTransferStatus(null);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -445,7 +445,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_clientApproved() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -454,7 +454,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_clientRejected() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -463,7 +463,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_clientCancelled() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -472,7 +472,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_serverApproved() throws Exception {
changeTransferStatus(TransferStatus.SERVER_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -481,7 +481,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_serverCancelled() throws Exception {
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -490,7 +490,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_gainingClient() throws Exception {
setClientIdForFlow("NewRegistrar");
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -499,7 +499,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_unrelatedClient() throws Exception {
setClientIdForFlow("ClientZ");
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -508,7 +508,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_deletedDomain() throws Exception {
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("domain_transfer_approve.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
@ -518,7 +518,7 @@ public class DomainTransferApproveFlowTest
public void testFailure_nonexistentDomain() throws Exception {
deleteResource(domain);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("domain_transfer_approve.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
@ -529,7 +529,7 @@ public class DomainTransferApproveFlowTest
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
EppException thrown =
expectThrows(
assertThrows(
NotAuthorizedForTldException.class,
() ->
doSuccessfulTest(

View file

@ -30,7 +30,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import com.google.common.collect.ImmutableList;
@ -223,7 +223,7 @@ public class DomainTransferCancelFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_cancel_contact_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -239,7 +239,7 @@ public class DomainTransferCancelFlowTest
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_cancel_domain_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -249,7 +249,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_neverBeenTransferred() throws Exception {
changeTransferStatus(null);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -258,7 +258,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_clientApproved() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -267,7 +267,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_clientRejected() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -276,7 +276,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_clientCancelled() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -285,7 +285,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_serverApproved() throws Exception {
changeTransferStatus(TransferStatus.SERVER_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -294,7 +294,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_serverCancelled() throws Exception {
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -303,7 +303,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_sponsoringClient() throws Exception {
setClientIdForFlow("TheRegistrar");
EppException thrown =
expectThrows(
assertThrows(
NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -312,7 +312,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_unrelatedClient() throws Exception {
setClientIdForFlow("ClientZ");
EppException thrown =
expectThrows(
assertThrows(
NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -322,7 +322,7 @@ public class DomainTransferCancelFlowTest
domain =
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -331,7 +331,7 @@ public class DomainTransferCancelFlowTest
public void testFailure_nonexistentDomain() throws Exception {
deleteResource(domain);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -341,7 +341,7 @@ public class DomainTransferCancelFlowTest
persistResource(
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
EppException thrown =
expectThrows(
assertThrows(
NotAuthorizedForTldException.class,
() ->
doSuccessfulTest(

View file

@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.getPollMessages;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
@ -170,7 +170,7 @@ public class DomainTransferQueryFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_query_contact_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -186,7 +186,7 @@ public class DomainTransferQueryFlowTest
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_query_domain_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -196,7 +196,7 @@ public class DomainTransferQueryFlowTest
public void testFailure_neverBeenTransferred() throws Exception {
changeTransferStatus(null);
EppException thrown =
expectThrows(
assertThrows(
NoTransferHistoryToQueryException.class,
() -> doFailingTest("domain_transfer_query.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -206,7 +206,7 @@ public class DomainTransferQueryFlowTest
public void testFailure_unrelatedClient() throws Exception {
setClientIdForFlow("ClientZ");
EppException thrown =
expectThrows(
assertThrows(
NotAuthorizedToViewTransferException.class,
() -> doFailingTest("domain_transfer_query.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -217,7 +217,7 @@ public class DomainTransferQueryFlowTest
domain =
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_query.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -226,7 +226,7 @@ public class DomainTransferQueryFlowTest
public void testFailure_nonexistentDomain() throws Exception {
deleteResource(domain);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_query.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}

View file

@ -32,7 +32,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import com.google.common.collect.ImmutableSet;
@ -176,7 +176,7 @@ public class DomainTransferRejectFlowTest
persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
EppException thrown =
expectThrows(
assertThrows(
NotAuthorizedForTldException.class,
() ->
doSuccessfulTest(
@ -202,7 +202,7 @@ public class DomainTransferRejectFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_reject_contact_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -218,7 +218,7 @@ public class DomainTransferRejectFlowTest
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_reject_domain_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -228,7 +228,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_neverBeenTransferred() throws Exception {
changeTransferStatus(null);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -237,7 +237,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_clientApproved() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -246,7 +246,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_clientRejected() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -255,7 +255,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_clientCancelled() throws Exception {
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -264,7 +264,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_serverApproved() throws Exception {
changeTransferStatus(TransferStatus.SERVER_APPROVED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -273,7 +273,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_serverCancelled() throws Exception {
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
EppException thrown =
expectThrows(
assertThrows(
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -282,7 +282,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_gainingClient() throws Exception {
setClientIdForFlow("NewRegistrar");
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -291,7 +291,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_unrelatedClient() throws Exception {
setClientIdForFlow("ClientZ");
EppException thrown =
expectThrows(
assertThrows(
ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -301,7 +301,7 @@ public class DomainTransferRejectFlowTest
domain =
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -310,7 +310,7 @@ public class DomainTransferRejectFlowTest
public void testFailure_nonexistentDomain() throws Exception {
deleteResource(domain);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_reject.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}

View file

@ -36,7 +36,6 @@ import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptio
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.EUR;
import static org.joda.money.CurrencyUnit.USD;
@ -671,7 +670,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_refundableFee_v06() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_06_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -681,7 +680,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_refundableFee_v11() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_11_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -691,7 +690,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_refundableFee_v12() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_12_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -701,7 +700,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_gracePeriodFee_v06() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_06_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -711,7 +710,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_gracePeriodFee_v11() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_11_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -721,7 +720,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_gracePeriodFee_v12() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_12_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -731,7 +730,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_appliedFee_v06() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_06_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -741,7 +740,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_appliedFee_v11() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_11_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -751,7 +750,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_appliedFee_v12() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
UnsupportedFeeAttributeException.class,
() -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_12_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -792,7 +791,7 @@ public class DomainTransferRequestFlowTest
setupDomain("example", "tld");
clock.advanceOneMilli();
EppException thrown =
expectThrows(
assertThrows(
TransferPeriodMustBeOneYearException.class,
() -> doFailingTest("domain_transfer_request_2_years.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -955,7 +954,7 @@ public class DomainTransferRequestFlowTest
persistResource(
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
EppException thrown =
expectThrows(
assertThrows(
NotAuthorizedForTldException.class,
() ->
doSuccessfulTest(
@ -1104,7 +1103,7 @@ public class DomainTransferRequestFlowTest
.setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build());
EppException thrown =
expectThrows(
assertThrows(
CurrencyUnitMismatchException.class,
() -> doFailingTest("domain_transfer_request_fee.xml", substitutions));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1132,7 +1131,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_feeGivenInWrongScale_v06() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
CurrencyValueScaleException.class,
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_06_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1142,7 +1141,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_feeGivenInWrongScale_v11() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
CurrencyValueScaleException.class,
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_11_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1152,7 +1151,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_feeGivenInWrongScale_v12() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
CurrencyValueScaleException.class,
() -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_12_MAP));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1165,7 +1164,7 @@ public class DomainTransferRequestFlowTest
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build());
EppException thrown =
expectThrows(
assertThrows(
FeesMismatchException.class,
() -> doFailingTest("domain_transfer_request_fee.xml", substitutions));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1195,7 +1194,7 @@ public class DomainTransferRequestFlowTest
// Modify the Registrar to block premium names.
persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build());
EppException thrown =
expectThrows(
assertThrows(
PremiumNameBlockedException.class,
() -> doFailingTest("domain_transfer_request_premium.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1205,7 +1204,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_registryRequiresAcking_feeNotProvidedOnPremiumName() throws Exception {
setupDomain("rich", "example");
EppException thrown =
expectThrows(
assertThrows(
FeesRequiredForPremiumNameException.class,
() -> doFailingTest("domain_transfer_request_premium.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1219,7 +1218,7 @@ public class DomainTransferRequestFlowTest
loadRegistrar("NewRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
clock.advanceOneMilli();
EppException thrown =
expectThrows(
assertThrows(
FeesRequiredForPremiumNameException.class,
() -> doFailingTest("domain_transfer_request_premium.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1229,7 +1228,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_noAuthInfo() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
MissingTransferRequestAuthInfoException.class,
() -> doFailingTest("domain_transfer_request_no_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1246,7 +1245,7 @@ public class DomainTransferRequestFlowTest
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1259,7 +1258,7 @@ public class DomainTransferRequestFlowTest
// code above will write the wrong ROID into the file.
contact = contact.asBuilder().setRepoId("DEADBEEF_TLD-ROID").build();
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1316,7 +1315,7 @@ public class DomainTransferRequestFlowTest
.build())
.build());
EppException thrown =
expectThrows(
assertThrows(
AlreadyPendingTransferException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1333,7 +1332,7 @@ public class DomainTransferRequestFlowTest
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
.build());
EppException thrown =
expectThrows(
assertThrows(
BadAuthInfoForResourceException.class,
() -> doFailingTest("domain_transfer_request_domain_authinfo.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1344,7 +1343,7 @@ public class DomainTransferRequestFlowTest
setupDomain("example", "tld");
setClientIdForFlow("TheRegistrar");
EppException thrown =
expectThrows(
assertThrows(
ObjectAlreadySponsoredException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1356,7 +1355,7 @@ public class DomainTransferRequestFlowTest
domain =
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
@ -1371,7 +1370,7 @@ public class DomainTransferRequestFlowTest
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
assertTransactionalFlow(true);
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> runFlow(CommitMode.LIVE, UserPrivileges.NORMAL));
assertThat(thrown).hasMessageThat().contains("(--invalid)");
@ -1382,7 +1381,7 @@ public class DomainTransferRequestFlowTest
createTld("tld");
contact = persistActiveContact("jd1234");
ResourceDoesNotExistException thrown =
expectThrows(
assertThrows(
ResourceDoesNotExistException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", "example.tld"));
@ -1392,7 +1391,7 @@ public class DomainTransferRequestFlowTest
public void testFailure_periodInMonths() throws Exception {
setupDomain("example", "tld");
EppException thrown =
expectThrows(
assertThrows(
BadPeriodUnitException.class,
() -> doFailingTest("domain_transfer_request_months.xml"));
assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -1405,7 +1404,7 @@ public class DomainTransferRequestFlowTest
persistResource(
domain.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(
assertThrows(
ResourceStatusProhibitsOperationException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains("clientTransferProhibited");
@ -1418,7 +1417,7 @@ public class DomainTransferRequestFlowTest
persistResource(
domain.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(
assertThrows(
ResourceStatusProhibitsOperationException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains("serverTransferProhibited");
@ -1429,7 +1428,7 @@ public class DomainTransferRequestFlowTest
setupDomain("example", "tld");
domain = persistResource(domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(
assertThrows(
ResourceStatusProhibitsOperationException.class,
() -> doFailingTest("domain_transfer_request.xml"));
assertThat(thrown).hasMessageThat().contains("pendingDelete");

View file

@ -36,7 +36,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static org.joda.money.CurrencyUnit.USD;
@ -459,7 +459,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_metadata.xml");
persistReferencedEntities();
persistDomain();
EppException thrown = expectThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
EppException thrown = assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -792,7 +792,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput(xmlFilename);
persistReferencedEntities();
persistActiveDomain(getUniqueIdFromCommand());
EppException thrown = expectThrows(expectedException, this::runFlow);
EppException thrown = assertThrows(expectedException, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -828,7 +828,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_dsdata_add.xml");
persistResource(
newDomainResource(getUniqueIdFromCommand()).asBuilder().setDsData(builder.build()).build());
EppException thrown = expectThrows(TooManyDsRecordsException.class, this::runFlow);
EppException thrown = assertThrows(TooManyDsRecordsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -839,7 +839,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistDomain();
// Modify domain so it has 13 nameservers. We will then try to add one in the test.
modifyDomainToHave13Nameservers();
EppException thrown = expectThrows(TooManyNameserversException.class, this::runFlow);
EppException thrown = assertThrows(TooManyNameserversException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -848,7 +848,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_wrong_extension.xml");
persistReferencedEntities();
persistDomain();
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow);
EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -856,7 +856,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
public void testFailure_neverExisted() throws Exception {
persistReferencedEntities();
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -865,7 +865,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReferencedEntities();
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -876,7 +876,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistActiveContact("mak21");
persistActiveDomain(getUniqueIdFromCommand());
LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.foo)");
}
@ -887,7 +887,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistActiveContact("mak21");
persistActiveDomain(getUniqueIdFromCommand());
LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)");
}
@ -908,7 +908,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
Key.create(
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc())))))
.build());
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow);
EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -917,7 +917,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_prohibited_status.xml");
persistReferencedEntities();
persistDomain();
EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow);
EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -938,7 +938,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.asBuilder()
.addStatusValue(SERVER_UPDATE_PROHIBITED)
.build());
Exception e = expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
Exception e = assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(e).hasMessageThat().containsMatch("serverUpdateProhibited");
}
@ -956,7 +956,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_add_registry_lock.xml");
persistReferencedEntities();
persistDomain();
Exception e = expectThrows(StatusNotClientSettableException.class, this::runFlow);
Exception e = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertThat(e).hasMessageThat().containsMatch("serverUpdateProhibited");
}
@ -980,7 +980,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.build());
EppException thrown =
expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -993,7 +993,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setStatusValues(ImmutableSet.of(SERVER_UPDATE_PROHIBITED))
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
}
@ -1007,7 +1007,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.addStatusValue(StatusValue.PENDING_DELETE)
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete");
}
@ -1016,7 +1016,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_duplicate_contact.xml");
persistReferencedEntities();
persistDomain();
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow);
EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1026,7 +1026,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_missing_contact_type.xml");
persistReferencedEntities();
persistDomain();
EppException thrown = expectThrows(MissingContactTypeException.class, this::runFlow);
EppException thrown = assertThrows(MissingContactTypeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1035,7 +1035,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
sessionMetadata.setClientId("NewRegistrar");
persistReferencedEntities();
persistDomain();
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1055,7 +1055,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistReferencedEntities();
persistDomain();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1082,7 +1082,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
Key.create(
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc()))))
.build());
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1100,7 +1100,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
Key.create(
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))))
.build());
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1116,7 +1116,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
.build());
EppException thrown = expectThrows(MissingAdminContactException.class, this::runFlow);
EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1132,7 +1132,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
.build());
EppException thrown = expectThrows(MissingTechnicalContactException.class, this::runFlow);
EppException thrown = assertThrows(MissingTechnicalContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1150,7 +1150,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.build());
clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("mak21");
}
@ -1168,7 +1168,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.build());
clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
}
@ -1182,7 +1182,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
.build());
clock.advanceOneMilli();
EppException thrown = expectThrows(RegistrantNotAllowedException.class, this::runFlow);
EppException thrown = assertThrows(RegistrantNotAllowedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1196,7 +1196,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
.build());
clock.advanceOneMilli();
EppException thrown = expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
EppException thrown = assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1292,7 +1292,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
.build());
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1323,7 +1323,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns3.example.foo"))
.build());
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
}
@ -1340,7 +1340,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
.build());
EppException thrown =
expectThrows(
assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1387,7 +1387,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns3.example.foo"))
.build());
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
}
@ -1422,7 +1422,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReservedList("reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo"))
.build());
NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
}
@ -1440,7 +1440,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
.build());
NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
}
@ -1460,7 +1460,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
.build());
EppException thrown =
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1477,7 +1477,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
.build());
EppException thrown =
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1532,7 +1532,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistReferencedEntities();
persistDomain();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow);
EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1544,7 +1544,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReferencedEntities();
persistDomain();
EppException thrown =
expectThrows(FeesRequiredForNonFreeOperationException.class, this::runFlow);
assertThrows(FeesRequiredForNonFreeOperationException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static org.joda.time.DateTimeZone.UTC;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -75,7 +75,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
AllocationTokenFlowUtils flowUtils =
new AllocationTokenFlowUtils(new AllocationTokenCustomLogic());
EppException thrown =
expectThrows(
assertThrows(
InvalidAllocationTokenException.class,
() ->
flowUtils.verifyToken(
@ -93,7 +93,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
AllocationTokenFlowUtils flowUtils =
new AllocationTokenFlowUtils(new FailingAllocationTokenCustomLogic());
Exception thrown =
expectThrows(
assertThrows(
IllegalStateException.class,
() ->
flowUtils.verifyToken(
@ -154,7 +154,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase {
AllocationTokenFlowUtils flowUtils =
new AllocationTokenFlowUtils(new FailingAllocationTokenCustomLogic());
Exception thrown =
expectThrows(
assertThrows(
IllegalStateException.class,
() ->
flowUtils.checkDomainsWithToken(

View file

@ -18,7 +18,7 @@ import static google.registry.model.eppoutput.CheckData.HostCheck.create;
import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistDeletedHost;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceCheckFlowTestCase;
@ -78,7 +78,7 @@ public class HostCheckFlowTest extends ResourceCheckFlowTestCase<HostCheckFlow,
@Test
public void testTooManyIds() throws Exception {
setEppInput("host_check_51.xml");
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow);
EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -26,7 +26,7 @@ import static google.registry.testing.DatastoreHelper.persistDeletedHost;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
@ -127,7 +127,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
createTlds("bar.tld", "tld");
setEppHostCreateInputWithIps("ns1.bar.tld");
EppException thrown = expectThrows(HostNameTooShallowException.class, this::runFlow);
EppException thrown = assertThrows(HostNameTooShallowException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -156,7 +156,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
setEppHostCreateInput("ns1.example.tld", null);
createTld("tld");
persistActiveDomain("example.tld");
EppException thrown = expectThrows(SubordinateHostMustHaveIpException.class, this::runFlow);
EppException thrown = assertThrows(SubordinateHostMustHaveIpException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -165,7 +165,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
setEppHostCreateInputWithIps("ns1.example.external");
createTld("tld");
persistActiveDomain("example.tld");
EppException thrown = expectThrows(UnexpectedExternalHostIpException.class, this::runFlow);
EppException thrown = assertThrows(UnexpectedExternalHostIpException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -174,7 +174,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
setEppHostCreateInput("ns1.example.tld", null);
createTld("tld");
SuperordinateDomainDoesNotExistException thrown =
expectThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow);
assertThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(example.tld)");
}
@ -190,7 +190,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
.build());
clock.advanceOneMilli();
SuperordinateDomainInPendingDeleteException thrown =
expectThrows(SuperordinateDomainInPendingDeleteException.class, this::runFlow);
assertThrows(SuperordinateDomainInPendingDeleteException.class, this::runFlow);
assertThat(thrown)
.hasMessageThat()
.contains("Superordinate domain for this hostname is in pending delete");
@ -201,7 +201,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
setEppHostCreateInput("ns1.example.tld", null);
persistActiveHost(getUniqueIdFromCommand());
ResourceAlreadyExistsException thrown =
expectThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThat(thrown)
.hasMessageThat()
.contains(
@ -211,7 +211,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
@Test
public void testFailure_nonLowerCaseHostname() throws Exception {
setEppHostCreateInput("ns1.EXAMPLE.tld", null);
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -219,21 +219,21 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
public void testFailure_nonPunyCodedHostname() throws Exception {
setEppHostCreateInput("ns1.çauçalito.みんな", null);
HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.xn--q9jyb4c");
}
@Test
public void testFailure_nonCanonicalHostname() throws Exception {
setEppHostCreateInput("ns1.example.tld.", null);
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_longHostName() throws Exception {
setEppHostCreateInputWithIps("a" + Strings.repeat(".labelpart", 25) + ".tld");
EppException thrown = expectThrows(HostNameTooLongException.class, this::runFlow);
EppException thrown = assertThrows(HostNameTooLongException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -244,14 +244,14 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
"<host:addr ip=\"v4\">192.0.2.2</host:addr>\n"
+ "<host:addr ip=\"v6\">192.0.2.29</host:addr>\n"
+ "<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>");
EppException thrown = expectThrows(IpAddressVersionMismatchException.class, this::runFlow);
EppException thrown = assertThrows(IpAddressVersionMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
private void doFailingHostNameTest(String hostName, Class<? extends EppException> exception)
throws Exception {
setEppHostCreateInputWithIps(hostName);
EppException thrown = expectThrows(exception, this::runFlow);
EppException thrown = assertThrows(exception, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -289,7 +289,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
public void testFailure_ccTldInBailiwick() throws Exception {
createTld("co.uk");
setEppHostCreateInputWithIps("foo.co.uk");
EppException thrown = expectThrows(HostNameTooShallowException.class, this::runFlow);
EppException thrown = assertThrows(HostNameTooShallowException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -25,7 +25,7 @@ import static google.registry.testing.DatastoreHelper.persistDeletedHost;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import com.google.common.collect.ImmutableMap;
@ -87,7 +87,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)");
}
@ -95,7 +95,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedHost("ns1.example.tld", clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)");
}
@ -106,7 +106,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.asBuilder()
.setStatusValues(ImmutableSet.of(statusValue))
.build());
Exception e = expectThrows(exception, this::runFlow);
Exception e = assertThrows(exception, this::runFlow);
assertThat(e).hasMessageThat().contains(statusValue.getXmlName());
}
@ -132,7 +132,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistActiveHost("ns1.example.tld");
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -191,7 +191,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't help.
.setSuperordinateDomain(Key.create(domain))
.build());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -257,7 +257,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help.
.setSuperordinateDomain(Key.create(domain))
.build());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -269,7 +269,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.asBuilder()
.setNameservers(ImmutableSet.of(Key.create(persistActiveHost("ns1.example.tld"))))
.build());
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -281,14 +281,14 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.asBuilder()
.setNameservers(ImmutableSet.of(Key.create(persistActiveHost("ns1.example.tld"))))
.build());
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_nonLowerCaseHostname() throws Exception {
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET"));
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -296,14 +296,14 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
public void testFailure_nonPunyCodedHostname() throws Exception {
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld"));
HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
}
@Test
public void testFailure_nonCanonicalHostname() throws Exception {
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld."));
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@ -150,7 +150,7 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -159,14 +159,14 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
persistResource(
persistHostResource().asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@Test
public void testFailure_nonLowerCaseHostname() throws Exception {
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET"));
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -174,14 +174,14 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
public void testFailure_nonPunyCodedHostname() throws Exception {
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld"));
HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
}
@Test
public void testFailure_nonCanonicalHostname() throws Exception {
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld."));
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -34,7 +34,7 @@ import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptio
import static google.registry.testing.GenericEppResourceSubject.assertAboutEppResources;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
@ -416,7 +416,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
DomainResource domain = persistActiveDomain("example.tld");
persistActiveHost(oldHostName());
assertThat(domain.getSubordinateHosts()).isEmpty();
expectThrows(CannotRenameExternalHostException.class, this::runFlow);
assertThrows(CannotRenameExternalHostException.class, this::runFlow);
assertNoDnsTasksEnqueued();
}
@ -448,7 +448,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_externalToExternal() throws Exception {
setEppHostUpdateInput("ns1.example.foo", "ns2.example.tld", null, null);
persistActiveHost(oldHostName());
EppException thrown = expectThrows(CannotRenameExternalHostException.class, this::runFlow);
EppException thrown = assertThrows(CannotRenameExternalHostException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -814,7 +814,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
createTld("tld");
persistActiveHost(oldHostName());
SuperordinateDomainDoesNotExistException thrown =
expectThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow);
assertThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(example.tld)");
}
@ -837,7 +837,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveSubordinateHost(oldHostName(), domain);
clock.advanceOneMilli();
SuperordinateDomainInPendingDeleteException thrown =
expectThrows(SuperordinateDomainInPendingDeleteException.class, this::runFlow);
assertThrows(SuperordinateDomainInPendingDeleteException.class, this::runFlow);
assertThat(thrown)
.hasMessageThat()
.contains("Superordinate domain for this hostname is in pending delete");
@ -846,7 +846,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
@Test
public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -854,7 +854,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_neverExisted_updateWithoutNameChange() throws Exception {
setEppInput("host_update_name_unchanged.xml");
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -862,7 +862,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedHost(oldHostName(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
}
@ -873,7 +873,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
clock.advanceOneMilli();
setEppHostUpdateInput("ns1.example.tld", "ns1.example.tld", null, null);
HostAlreadyExistsException thrown =
expectThrows(HostAlreadyExistsException.class, this::runFlow);
assertThrows(HostAlreadyExistsException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.tld");
}
@ -883,14 +883,14 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
persistActiveHost("ns2.example.tld");
HostAlreadyExistsException thrown =
expectThrows(HostAlreadyExistsException.class, this::runFlow);
assertThrows(HostAlreadyExistsException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.tld");
}
@Test
public void testFailure_referToNonLowerCaseHostname() throws Exception {
setEppHostUpdateInput("ns1.EXAMPLE.tld", "ns2.example.tld", null, null);
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -898,7 +898,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_renameToNonLowerCaseHostname() throws Exception {
persistActiveHost("ns1.example.tld");
setEppHostUpdateInput("ns1.example.tld", "ns2.EXAMPLE.tld", null, null);
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -906,7 +906,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_referToNonPunyCodedHostname() throws Exception {
setEppHostUpdateInput("ns1.çauçalito.tld", "ns1.sausalito.tld", null, null);
HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
}
@ -915,7 +915,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveHost("ns1.sausalito.tld");
setEppHostUpdateInput("ns1.sausalito.tld", "ns1.çauçalito.tld", null, null);
HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
}
@ -923,7 +923,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_referToNonCanonicalHostname() throws Exception {
persistActiveHost("ns1.example.tld.");
setEppHostUpdateInput("ns1.example.tld.", "ns2.example.tld", null, null);
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -931,7 +931,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_renameToNonCanonicalHostname() throws Exception {
persistActiveHost("ns1.example.tld");
setEppHostUpdateInput("ns1.example.tld", "ns2.example.tld.", null, null);
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow);
EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -945,7 +945,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
EppException thrown =
expectThrows(CannotRemoveSubordinateHostLastIpException.class, this::runFlow);
assertThrows(CannotRemoveSubordinateHostLastIpException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -954,7 +954,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
setEppHostUpdateInput("ns1.example.tld", "ns2.example.com", null, null);
createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
EppException thrown = expectThrows(RenameHostToExternalRemoveIpException.class, this::runFlow);
EppException thrown = assertThrows(RenameHostToExternalRemoveIpException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -964,7 +964,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
"ns1.example.tld", "ns2.example.com", "<host:addr ip=\"v4\">192.0.2.22</host:addr>", null);
createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
EppException thrown = expectThrows(CannotAddIpToExternalHostException.class, this::runFlow);
EppException thrown = assertThrows(CannotAddIpToExternalHostException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -978,7 +978,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
"<host:status s=\"clientUpdateProhibited\"/>",
"<host:status s=\"clientUpdateProhibited\"/>");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -991,7 +991,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
"ns2.example.tld",
"<host:addr ip=\"v4\">192.0.2.22</host:addr>",
"<host:addr ip=\"v4\">192.0.2.22</host:addr>");
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow);
EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1020,7 +1020,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
.build());
EppException thrown =
expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1034,7 +1034,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
}
@ -1048,7 +1048,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
.build());
ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete");
}
@ -1057,7 +1057,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
setEppInput("host_update_prohibited_status.xml");
EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow);
EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1077,7 +1077,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar");
persistActiveHost("ns1.example.tld");
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1131,7 +1131,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
.build());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1167,7 +1167,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
.build());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1187,7 +1187,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo"));
assertAboutHosts().that(host).hasPersistedCurrentSponsorClientId("TheRegistrar");
EppException thrown = expectThrows(HostDomainNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(HostDomainNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1205,7 +1205,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
assertAboutDomains().that(domain).hasPersistedCurrentSponsorClientId("TheRegistrar");
assertAboutHosts().that(host).hasPersistedCurrentSponsorClientId("TheRegistrar");
EppException thrown = expectThrows(HostDomainNotOwnedException.class, this::runFlow);
EppException thrown = assertThrows(HostDomainNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@ -1244,7 +1244,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
hostName,
"<host:addr ip=\"v4\">192.0.2.22</host:addr>",
"<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>");
EppException thrown = expectThrows(exception, this::runFlow);
EppException thrown = assertThrows(exception, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -21,7 +21,6 @@ import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import com.google.common.collect.ImmutableMap;
@ -174,7 +173,7 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
@Test
public void testFailure_noSuchMessage() throws Exception {
assertTransactionalFlow(true);
Exception e = expectThrows(MessageDoesNotExistException.class, this::runFlow);
Exception e = assertThrows(MessageDoesNotExistException.class, this::runFlow);
assertThat(e)
.hasMessageThat()
.containsMatch(String.format("(1-3-EXAMPLE-4-%d-2011)", MESSAGE_ID));
@ -255,7 +254,7 @@ public class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
.setParent(createHistoryEntryForEppResource(domain))
.build());
assertTransactionalFlow(true);
Exception e = expectThrows(MessageDoesNotExistException.class, this::runFlow);
Exception e = assertThrows(MessageDoesNotExistException.class, this::runFlow);
assertThat(e)
.hasMessageThat()
.containsMatch(String.format("(1-3-EXAMPLE-4-%d-2011)", MESSAGE_ID));

View file

@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList;
import google.registry.flows.EppException;
@ -223,7 +223,7 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
public void testFailure_messageIdProvided() throws Exception {
setEppInput("poll_with_id.xml");
assertTransactionalFlow(false);
EppException thrown = expectThrows(UnexpectedMessageIdException.class, this::runFlow);
EppException thrown = assertThrows(UnexpectedMessageIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
}

View file

@ -18,7 +18,7 @@ import static google.registry.testing.DatastoreHelper.deleteResource;
import static google.registry.testing.DatastoreHelper.loadRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.EppException.UnimplementedExtensionException;
@ -65,7 +65,7 @@ public abstract class LoginFlowTestCase extends FlowTestCase<LoginFlow> {
// Also called in subclasses.
void doFailingTest(String xmlFilename, Class<? extends EppException> exception) throws Exception {
setEppInput(xmlFilename);
EppException thrown = expectThrows(exception, this::runFlow);
EppException thrown = assertThrows(exception, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

View file

@ -16,7 +16,7 @@ package google.registry.flows.session;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException;
import google.registry.flows.FlowTestCase;
@ -46,7 +46,7 @@ public class LogoutFlowTest extends FlowTestCase<LogoutFlow> {
@Test
public void testFailure() throws Exception {
sessionMetadata.setClientId(null); // Turn off the implicit login
EppException thrown = expectThrows(NotLoggedInException.class, this::runFlow);
EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
}