Use method references instead of lambdas when possible

The assertThrows/expectThrows refactoring script does not use method
references, apparently.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179089048
This commit is contained in:
mcilwain 2017-12-14 13:40:15 -08:00 committed by Ben McIlwain
parent e619ea1bff
commit fbe11ff33c
35 changed files with 483 additions and 483 deletions

View file

@ -189,13 +189,13 @@ public class BigqueryPollJobActionTest {
public void testJobPending() throws Exception { public void testJobPending() throws Exception {
when(bigqueryJobsGet.execute()).thenReturn( when(bigqueryJobsGet.execute()).thenReturn(
new Job().setStatus(new JobStatus().setState("PENDING"))); new Job().setStatus(new JobStatus().setState("PENDING")));
assertThrows(NotModifiedException.class, () -> action.run()); assertThrows(NotModifiedException.class, action::run);
} }
@Test @Test
public void testJobStatusUnreadable() throws Exception { public void testJobStatusUnreadable() throws Exception {
when(bigqueryJobsGet.execute()).thenThrow(IOException.class); when(bigqueryJobsGet.execute()).thenThrow(IOException.class);
assertThrows(NotModifiedException.class, () -> action.run()); assertThrows(NotModifiedException.class, action::run);
} }
@Test @Test
@ -203,7 +203,7 @@ public class BigqueryPollJobActionTest {
when(bigqueryJobsGet.execute()).thenReturn( when(bigqueryJobsGet.execute()).thenReturn(
new Job().setStatus(new JobStatus().setState("DONE"))); new Job().setStatus(new JobStatus().setState("DONE")));
action.payload = "payload".getBytes(UTF_8); action.payload = "payload".getBytes(UTF_8);
BadRequestException thrown = expectThrows(BadRequestException.class, () -> action.run()); BadRequestException thrown = expectThrows(BadRequestException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Cannot deserialize task from payload"); assertThat(thrown).hasMessageThat().contains("Cannot deserialize task from payload");
} }
} }

View file

@ -122,7 +122,7 @@ public class CheckSnapshotActionTest {
public void testPost_forPendingBackup_returnsNotModified() throws Exception { public void testPost_forPendingBackup_returnsNotModified() throws Exception {
setPendingBackup(); setPendingBackup();
NotModifiedException thrown = expectThrows(NotModifiedException.class, () -> action.run()); NotModifiedException thrown = expectThrows(NotModifiedException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Datastore backup some_backup still pending"); assertThat(thrown).hasMessageThat().contains("Datastore backup some_backup still pending");
} }
@ -138,7 +138,7 @@ public class CheckSnapshotActionTest {
.plus(Duration.standardMinutes(3)) .plus(Duration.standardMinutes(3))
.plus(Duration.millis(1234))); .plus(Duration.millis(1234)));
NoContentException thrown = expectThrows(NoContentException.class, () -> action.run()); NoContentException thrown = expectThrows(NoContentException.class, action::run);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains( .contains(
@ -186,7 +186,7 @@ public class CheckSnapshotActionTest {
when(backupService.findByName("some_backup")) when(backupService.findByName("some_backup"))
.thenThrow(new IllegalArgumentException("No backup found")); .thenThrow(new IllegalArgumentException("No backup found"));
BadRequestException thrown = expectThrows(BadRequestException.class, () -> action.run()); BadRequestException thrown = expectThrows(BadRequestException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Bad backup name some_backup: No backup found"); assertThat(thrown).hasMessageThat().contains("Bad backup name some_backup: No backup found");
} }
@ -216,7 +216,7 @@ public class CheckSnapshotActionTest {
when(backupService.findByName("some_backup")) when(backupService.findByName("some_backup"))
.thenThrow(new IllegalArgumentException("No backup found")); .thenThrow(new IllegalArgumentException("No backup found"));
BadRequestException thrown = expectThrows(BadRequestException.class, () -> action.run()); BadRequestException thrown = expectThrows(BadRequestException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Bad backup name some_backup: No backup found"); assertThat(thrown).hasMessageThat().contains("Bad backup name some_backup: No backup found");
} }
} }

View file

@ -182,7 +182,7 @@ public class LoadSnapshotActionTest {
@Test @Test
public void testFailure_doPost_badGcsFilename() throws Exception { public void testFailure_doPost_badGcsFilename() throws Exception {
action.snapshotFile = "gs://bucket/snapshot"; action.snapshotFile = "gs://bucket/snapshot";
BadRequestException thrown = expectThrows(BadRequestException.class, () -> action.run()); BadRequestException thrown = expectThrows(BadRequestException.class, action::run);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Error calling load snapshot: backup info file extension missing"); .contains("Error calling load snapshot: backup info file extension missing");
@ -192,7 +192,7 @@ public class LoadSnapshotActionTest {
public void testFailure_doPost_bigqueryThrowsException() throws Exception { public void testFailure_doPost_bigqueryThrowsException() throws Exception {
when(bigqueryJobsInsert.execute()).thenThrow(new IOException("The Internet has gone missing")); when(bigqueryJobsInsert.execute()).thenThrow(new IOException("The Internet has gone missing"));
InternalServerErrorException thrown = InternalServerErrorException thrown =
expectThrows(InternalServerErrorException.class, () -> action.run()); expectThrows(InternalServerErrorException.class, action::run);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Error loading snapshot: The Internet has gone missing"); .contains("Error loading snapshot: The Internet has gone missing");

View file

@ -124,7 +124,7 @@ public class UpdateSnapshotViewActionTest {
when(bigqueryTables.update(anyString(), anyString(), anyString(), any(Table.class))) when(bigqueryTables.update(anyString(), anyString(), anyString(), any(Table.class)))
.thenThrow(new IOException("I'm sorry Dave, I can't let you do that")); .thenThrow(new IOException("I'm sorry Dave, I can't let you do that"));
InternalServerErrorException thrown = InternalServerErrorException thrown =
expectThrows(InternalServerErrorException.class, () -> action.run()); expectThrows(InternalServerErrorException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Error in update snapshot view action"); assertThat(thrown).hasMessageThat().contains("Error in update snapshot view action");
} }
} }

View file

@ -132,7 +132,7 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
@Test @Test
public void testRequiresLogin() throws Exception { public void testRequiresLogin() throws Exception {
sessionMetadata.setClientId(null); sessionMetadata.setClientId(null);
assertThrows(NotLoggedInException.class, () -> runFlow()); assertThrows(NotLoggedInException.class, this::runFlow);
} }
/** /**

View file

@ -77,7 +77,7 @@ public class ContactCheckFlowTest
@Test @Test
public void testTooManyIds() throws Exception { public void testTooManyIds() throws Exception {
setEppInput("contact_check_51.xml"); setEppInput("contact_check_51.xml");
assertThrows(TooManyResourceChecksException.class, () -> runFlow()); assertThrows(TooManyResourceChecksException.class, this::runFlow);
} }
@Test @Test

View file

@ -70,7 +70,7 @@ public class ContactCreateFlowTest
public void testFailure_alreadyExists() throws Exception { public void testFailure_alreadyExists() throws Exception {
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
ResourceAlreadyExistsException thrown = ResourceAlreadyExistsException thrown =
expectThrows(ResourceAlreadyExistsException.class, () -> runFlow()); expectThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains( .contains(
@ -86,13 +86,13 @@ public class ContactCreateFlowTest
@Test @Test
public void testFailure_nonAsciiInIntAddress() throws Exception { public void testFailure_nonAsciiInIntAddress() throws Exception {
setEppInput("contact_create_hebrew_int.xml"); setEppInput("contact_create_hebrew_int.xml");
assertThrows(BadInternationalizedPostalInfoException.class, () -> runFlow()); assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
} }
@Test @Test
public void testFailure_declineDisclosure() throws Exception { public void testFailure_declineDisclosure() throws Exception {
setEppInput("contact_create_decline_disclosure.xml"); setEppInput("contact_create_decline_disclosure.xml");
assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, () -> runFlow()); assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
} }
@Test @Test

View file

@ -73,7 +73,7 @@ public class ContactDeleteFlowTest
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -81,7 +81,7 @@ public class ContactDeleteFlowTest
public void testFailure_existedButWasDeleted() throws Exception { public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -117,7 +117,7 @@ public class ContactDeleteFlowTest
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -142,7 +142,7 @@ public class ContactDeleteFlowTest
createTld("tld"); createTld("tld");
persistResource( persistResource(
newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand()))); newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand())));
assertThrows(ResourceToDeleteIsReferencedException.class, () -> runFlow()); assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
} }
@Test @Test
@ -150,7 +150,7 @@ public class ContactDeleteFlowTest
createTld("tld"); createTld("tld");
persistResource( persistResource(
newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand()))); newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand())));
assertThrows(ResourceToDeleteIsReferencedException.class, () -> runFlow()); assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
} }
@Test @Test

View file

@ -165,7 +165,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -173,7 +173,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
public void testFailure_existedButWasDeleted() throws Exception { public void testFailure_existedButWasDeleted() throws Exception {
persistContactResource(false); persistContactResource(false);
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }

View file

@ -257,7 +257,7 @@ public class ContactUpdateFlowTest
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -265,7 +265,7 @@ public class ContactUpdateFlowTest
public void testFailure_existedButWasDeleted() throws Exception { public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -273,7 +273,7 @@ public class ContactUpdateFlowTest
public void testFailure_statusValueNotClientSettable() throws Exception { public void testFailure_statusValueNotClientSettable() throws Exception {
setEppInput("contact_update_prohibited_status.xml"); setEppInput("contact_update_prohibited_status.xml");
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
assertThrows(StatusNotClientSettableException.class, () -> runFlow()); assertThrows(StatusNotClientSettableException.class, this::runFlow);
} }
@Test @Test
@ -291,7 +291,7 @@ public class ContactUpdateFlowTest
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -338,7 +338,7 @@ public class ContactUpdateFlowTest
newContactResource(getUniqueIdFromCommand()).asBuilder() newContactResource(getUniqueIdFromCommand()).asBuilder()
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)) .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.build()); .build());
assertThrows(ResourceHasClientUpdateProhibitedException.class, () -> runFlow()); assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
} }
@Test @Test
@ -348,7 +348,7 @@ public class ContactUpdateFlowTest
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED)) .setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited"); assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
} }
@ -359,7 +359,7 @@ public class ContactUpdateFlowTest
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE)) .setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertThat(thrown).hasMessageThat().contains("pendingDelete");
} }
@ -373,21 +373,21 @@ public class ContactUpdateFlowTest
public void testFailure_nonAsciiInIntAddress() throws Exception { public void testFailure_nonAsciiInIntAddress() throws Exception {
setEppInput("contact_update_hebrew_int.xml"); setEppInput("contact_update_hebrew_int.xml");
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
assertThrows(BadInternationalizedPostalInfoException.class, () -> runFlow()); assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
} }
@Test @Test
public void testFailure_declineDisclosure() throws Exception { public void testFailure_declineDisclosure() throws Exception {
setEppInput("contact_update_decline_disclosure.xml"); setEppInput("contact_update_decline_disclosure.xml");
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, () -> runFlow()); assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
} }
@Test @Test
public void testFailure_addRemoveSameValue() throws Exception { public void testFailure_addRemoveSameValue() throws Exception {
setEppInput("contact_update_add_remove_same.xml"); setEppInput("contact_update_add_remove_same.xml");
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
assertThrows(AddRemoveSameValueException.class, () -> runFlow()); assertThrows(AddRemoveSameValueException.class, this::runFlow);
} }
@Test @Test

View file

@ -256,7 +256,7 @@ public class DomainAllocateFlowTest
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net")) .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
.build()); .build());
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, () -> runFlowAsSuperuser()); expectThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -271,7 +271,7 @@ public class DomainAllocateFlowTest
ImmutableSet.of("ns1.example.net", "ns2.example.net")) ImmutableSet.of("ns1.example.net", "ns2.example.net"))
.build()); .build());
RegistrantNotAllowedException thrown = RegistrantNotAllowedException thrown =
expectThrows(RegistrantNotAllowedException.class, () -> runFlowAsSuperuser()); expectThrows(RegistrantNotAllowedException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("jd1234"); assertThat(thrown).hasMessageThat().contains("jd1234");
} }
@ -287,7 +287,7 @@ public class DomainAllocateFlowTest
.build()); .build());
assertThrows( assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, NameserversNotSpecifiedForTldWithNameserverWhitelistException.class,
() -> runFlowAsSuperuser()); this::runFlowAsSuperuser);
} }
@Test @Test
@ -317,7 +317,7 @@ public class DomainAllocateFlowTest
"example-one,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net")) "example-one,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net"))
.build()); .build());
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlowAsSuperuser()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -335,7 +335,7 @@ public class DomainAllocateFlowTest
.build()); .build());
assertThrows( assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, NameserversNotSpecifiedForNameserverRestrictedDomainException.class,
() -> runFlowAsSuperuser()); this::runFlowAsSuperuser);
} }
@Test @Test
@ -371,7 +371,7 @@ public class DomainAllocateFlowTest
ImmutableSet.of("ns1.example.net", "ns2.example.net", "ns3.example.net")) ImmutableSet.of("ns1.example.net", "ns2.example.net", "ns3.example.net"))
.build()); .build());
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlowAsSuperuser()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -390,7 +390,7 @@ public class DomainAllocateFlowTest
ImmutableSet.of("ns4.example.net", "ns2.example.net", "ns3.example.net")) ImmutableSet.of("ns4.example.net", "ns2.example.net", "ns3.example.net"))
.build()); .build());
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, () -> runFlowAsSuperuser()); expectThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -575,7 +575,7 @@ public class DomainAllocateFlowTest
public void testFailure_alreadyExists() throws Exception { public void testFailure_alreadyExists() throws Exception {
setupDomainApplication("tld", TldState.QUIET_PERIOD); setupDomainApplication("tld", TldState.QUIET_PERIOD);
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
assertThrows(ResourceAlreadyExistsException.class, () -> runFlowAsSuperuser()); assertThrows(ResourceAlreadyExistsException.class, this::runFlowAsSuperuser);
} }
@Test @Test
@ -610,7 +610,7 @@ public class DomainAllocateFlowTest
public void testFailure_applicationDeleted() throws Exception { public void testFailure_applicationDeleted() throws Exception {
setupDomainApplication("tld", TldState.QUIET_PERIOD); setupDomainApplication("tld", TldState.QUIET_PERIOD);
persistResource(application.asBuilder().setDeletionTime(clock.nowUtc()).build()); persistResource(application.asBuilder().setDeletionTime(clock.nowUtc()).build());
assertThrows(MissingApplicationException.class, () -> runFlowAsSuperuser()); assertThrows(MissingApplicationException.class, this::runFlowAsSuperuser);
} }
@Test @Test
@ -619,7 +619,7 @@ public class DomainAllocateFlowTest
persistResource(application.asBuilder() persistResource(application.asBuilder()
.setApplicationStatus(ApplicationStatus.REJECTED) .setApplicationStatus(ApplicationStatus.REJECTED)
.build()); .build());
assertThrows(HasFinalStatusException.class, () -> runFlowAsSuperuser()); assertThrows(HasFinalStatusException.class, this::runFlowAsSuperuser);
} }
@Test @Test
@ -628,14 +628,14 @@ public class DomainAllocateFlowTest
persistResource(application.asBuilder() persistResource(application.asBuilder()
.setApplicationStatus(ApplicationStatus.ALLOCATED) .setApplicationStatus(ApplicationStatus.ALLOCATED)
.build()); .build());
assertThrows(HasFinalStatusException.class, () -> runFlowAsSuperuser()); assertThrows(HasFinalStatusException.class, this::runFlowAsSuperuser);
} }
@Test @Test
public void testFailure_applicationDoesNotExist() throws Exception { public void testFailure_applicationDoesNotExist() throws Exception {
setupDomainApplication("tld", TldState.QUIET_PERIOD); setupDomainApplication("tld", TldState.QUIET_PERIOD);
setEppInput("domain_allocate_bad_application_roid.xml"); setEppInput("domain_allocate_bad_application_roid.xml");
assertThrows(MissingApplicationException.class, () -> runFlowAsSuperuser()); assertThrows(MissingApplicationException.class, this::runFlowAsSuperuser);
} }
@Test @Test
@ -653,7 +653,7 @@ public class DomainAllocateFlowTest
public void testFailure_max10Years() throws Exception { public void testFailure_max10Years() throws Exception {
setupDomainApplication("tld", TldState.QUIET_PERIOD); setupDomainApplication("tld", TldState.QUIET_PERIOD);
setEppInput("domain_allocate_11_years.xml"); setEppInput("domain_allocate_11_years.xml");
assertThrows(ExceedsMaxRegistrationYearsException.class, () -> runFlowAsSuperuser()); assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlowAsSuperuser);
} }
@Test @Test

View file

@ -246,7 +246,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_encoded_signed_mark_corrupt.xml"); setEppInput("domain_create_sunrush_encoded_signed_mark_corrupt.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarkParsingErrorException.class, () -> runFlow()); assertThrows(SignedMarkParsingErrorException.class, this::runFlow);
} }
@Test @Test
@ -255,7 +255,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_encoded_signed_mark_revoked_cert.xml"); setEppInput("domain_create_sunrush_encoded_signed_mark_revoked_cert.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarkCertificateRevokedException.class, () -> runFlow()); assertThrows(SignedMarkCertificateRevokedException.class, this::runFlow);
} }
@Test @Test
@ -266,7 +266,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli(); clock.advanceOneMilli();
clock.setTo(DateTime.parse("2022-01-01")); clock.setTo(DateTime.parse("2022-01-01"));
clock.setTo(DateTime.parse("2022-01-01")); clock.setTo(DateTime.parse("2022-01-01"));
assertThrows(SignedMarkCertificateExpiredException.class, () -> runFlow()); assertThrows(SignedMarkCertificateExpiredException.class, this::runFlow);
} }
@Test @Test
@ -276,7 +276,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
clock.setTo(DateTime.parse("2012-07-22T00:01:00Z")); clock.setTo(DateTime.parse("2012-07-22T00:01:00Z"));
assertThrows(SignedMarkCertificateNotYetValidException.class, () -> runFlow()); assertThrows(SignedMarkCertificateNotYetValidException.class, this::runFlow);
} }
@Test @Test
@ -293,7 +293,7 @@ public class DomainApplicationCreateFlowTest
public void verify(byte[] smdXml) throws GeneralSecurityException { public void verify(byte[] smdXml) throws GeneralSecurityException {
throw new GeneralSecurityException(); throw new GeneralSecurityException();
}}; }};
assertThrows(SignedMarkCertificateInvalidException.class, () -> runFlow()); assertThrows(SignedMarkCertificateInvalidException.class, this::runFlow);
} }
@Test @Test
@ -303,7 +303,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_encoded_signed_mark.xml"); setEppInput("domain_create_sunrush_encoded_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarkCertificateSignatureException.class, () -> runFlow()); assertThrows(SignedMarkCertificateSignatureException.class, this::runFlow);
} }
@Test @Test
@ -312,7 +312,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_encoded_signed_mark_signature_corrupt.xml"); setEppInput("domain_create_sunrush_encoded_signed_mark_signature_corrupt.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarkSignatureException.class, () -> runFlow()); assertThrows(SignedMarkSignatureException.class, this::runFlow);
} }
@Test @Test
@ -388,7 +388,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_allowedinsunrise.xml"); setEppInput("domain_create_landrush_allowedinsunrise.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(DomainReservedException.class, () -> runFlow()); assertThrows(DomainReservedException.class, this::runFlow);
} }
@Test @Test
@ -399,7 +399,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli(); clock.advanceOneMilli();
// Modify the Registrar to block premium names. // Modify the Registrar to block premium names.
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build()); persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
assertThrows(PremiumNameBlockedException.class, () -> runFlow()); assertThrows(PremiumNameBlockedException.class, this::runFlow);
} }
@Test @Test
@ -408,7 +408,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_premium.xml"); setEppInput("domain_create_landrush_premium.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(FeesRequiredForPremiumNameException.class, () -> runFlow()); assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
} }
@Test @Test
@ -517,7 +517,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput("domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.6")); setEppInput("domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -527,7 +527,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput( setEppInput(
"domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.11")); "domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -537,7 +537,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput( setEppInput(
"domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.12")); "domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -547,7 +547,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput( setEppInput(
"domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.6")); "domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -557,7 +557,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput( setEppInput(
"domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.11")); "domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -567,7 +567,7 @@ public class DomainApplicationCreateFlowTest
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput( setEppInput(
"domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.12")); "domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -576,7 +576,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.6")); setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -585,7 +585,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.11")); setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -594,7 +594,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.12")); setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -700,7 +700,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_without_marks.xml"); setEppInput("domain_create_sunrise_without_marks.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(LandrushApplicationDisallowedDuringSunriseException.class, () -> runFlow()); assertThrows(LandrushApplicationDisallowedDuringSunriseException.class, this::runFlow);
} }
@Test @Test
@ -715,7 +715,7 @@ public class DomainApplicationCreateFlowTest
.setState(State.SUSPENDED) .setState(State.SUSPENDED)
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(RegistrarMustBeActiveToCreateDomainsException.class, () -> runFlow()); assertThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow);
} }
@Test @Test
@ -724,7 +724,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_signed_mark.xml"); setEppInput("domain_create_landrush_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SunriseApplicationDisallowedDuringLandrushException.class, () -> runFlow()); assertThrows(SunriseApplicationDisallowedDuringLandrushException.class, this::runFlow);
} }
@Test @Test
@ -732,7 +732,7 @@ public class DomainApplicationCreateFlowTest
SignedMarkRevocationList.create(clock.nowUtc(), ImmutableMap.of(SMD_ID, clock.nowUtc())).save(); SignedMarkRevocationList.create(clock.nowUtc(), ImmutableMap.of(SMD_ID, clock.nowUtc())).save();
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarkRevokedErrorException.class, () -> runFlow()); assertThrows(SignedMarkRevokedErrorException.class, this::runFlow);
} }
@Test @Test
@ -741,7 +741,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_14_nameservers.xml"); setEppInput("domain_create_sunrush_14_nameservers.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(TooManyNameserversException.class, () -> runFlow()); assertThrows(TooManyNameserversException.class, this::runFlow);
} }
@Test @Test
@ -749,7 +749,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_with_secdns_maxsiglife.xml"); setEppInput("domain_create_sunrise_with_secdns_maxsiglife.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(MaxSigLifeNotSupportedException.class, () -> runFlow()); assertThrows(MaxSigLifeNotSupportedException.class, this::runFlow);
} }
@Test @Test
@ -757,7 +757,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_signed_mark_with_secdns_9_records.xml"); setEppInput("domain_create_sunrise_signed_mark_with_secdns_9_records.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(TooManyDsRecordsException.class, () -> runFlow()); assertThrows(TooManyDsRecordsException.class, this::runFlow);
} }
@Test @Test
@ -765,7 +765,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_wrong_extension.xml"); setEppInput("domain_create_sunrise_wrong_extension.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(UnimplementedExtensionException.class, () -> runFlow()); assertThrows(UnimplementedExtensionException.class, this::runFlow);
} }
@Test @Test
@ -773,7 +773,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_signed_mark_reserved.xml"); setEppInput("domain_create_sunrise_signed_mark_reserved.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(DomainReservedException.class, () -> runFlow()); assertThrows(DomainReservedException.class, this::runFlow);
} }
@Test @Test
@ -825,7 +825,7 @@ public class DomainApplicationCreateFlowTest
persistSunriseApplication(); persistSunriseApplication();
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(UncontestedSunriseApplicationBlockedInLandrushException.class, () -> runFlow()); assertThrows(UncontestedSunriseApplicationBlockedInLandrushException.class, this::runFlow);
} }
@Test @Test
@ -912,7 +912,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_lrp.xml"); setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(InvalidLrpTokenException.class, () -> runFlow()); assertThrows(InvalidLrpTokenException.class, this::runFlow);
} }
@Test @Test
@ -932,7 +932,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_lrp.xml"); setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(InvalidLrpTokenException.class, () -> runFlow()); assertThrows(InvalidLrpTokenException.class, this::runFlow);
} }
@Test @Test
@ -951,7 +951,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_lrp.xml"); setEppInput("domain_create_landrush_lrp.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(InvalidLrpTokenException.class, () -> runFlow()); assertThrows(InvalidLrpTokenException.class, this::runFlow);
} }
@Test @Test
@ -1006,7 +1006,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush.xml"); setEppInput("domain_create_landrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(InvalidLrpTokenException.class, () -> runFlow()); assertThrows(InvalidLrpTokenException.class, this::runFlow);
} }
@Test @Test
@ -1015,7 +1015,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_months.xml"); setEppInput("domain_create_landrush_months.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(BadPeriodUnitException.class, () -> runFlow()); assertThrows(BadPeriodUnitException.class, this::runFlow);
} }
@Test @Test
@ -1024,7 +1024,7 @@ public class DomainApplicationCreateFlowTest
persistActiveContact("jd1234"); persistActiveContact("jd1234");
persistActiveContact("sh8013"); persistActiveContact("sh8013");
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, () -> runFlow()); expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.net)"); assertThat(thrown).hasMessageThat().contains("(ns2.example.net)");
} }
@ -1034,7 +1034,7 @@ public class DomainApplicationCreateFlowTest
persistActiveHost("ns2.example.net"); persistActiveHost("ns2.example.net");
persistActiveContact("jd1234"); persistActiveContact("jd1234");
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, () -> runFlow()); expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)"); assertThat(thrown).hasMessageThat().contains("(sh8013)");
} }
@ -1044,7 +1044,7 @@ public class DomainApplicationCreateFlowTest
createTld("foo", TldState.SUNRISE); createTld("foo", TldState.SUNRISE);
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(TldDoesNotExistException.class, () -> runFlow()); assertThrows(TldDoesNotExistException.class, this::runFlow);
} }
@Test @Test
@ -1052,7 +1052,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -1060,7 +1060,7 @@ public class DomainApplicationCreateFlowTest
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -1068,7 +1068,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.SUNRUSH); createTld("tld", TldState.SUNRUSH);
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(LaunchPhaseMismatchException.class, () -> runFlow()); assertThrows(LaunchPhaseMismatchException.class, this::runFlow);
} }
@Test @Test
@ -1076,7 +1076,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.QUIET_PERIOD); createTld("tld", TldState.QUIET_PERIOD);
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -1084,7 +1084,7 @@ public class DomainApplicationCreateFlowTest
createTld("tld", TldState.GENERAL_AVAILABILITY); createTld("tld", TldState.GENERAL_AVAILABILITY);
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -1092,7 +1092,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_signed_mark.xml"); setEppInput("domain_create_landrush_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(LaunchPhaseMismatchException.class, () -> runFlow()); assertThrows(LaunchPhaseMismatchException.class, this::runFlow);
} }
@Test @Test
@ -1149,7 +1149,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_duplicate_contact.xml"); setEppInput("domain_create_sunrise_duplicate_contact.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(DuplicateContactForRoleException.class, () -> runFlow()); assertThrows(DuplicateContactForRoleException.class, this::runFlow);
} }
@Test @Test
@ -1158,7 +1158,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
// We need to test for missing type, but not for invalid - the schema enforces that for us. // We need to test for missing type, but not for invalid - the schema enforces that for us.
assertThrows(MissingContactTypeException.class, () -> runFlow()); assertThrows(MissingContactTypeException.class, this::runFlow);
} }
@Test @Test
@ -1166,7 +1166,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_no_matching_marks.xml"); setEppInput("domain_create_sunrise_no_matching_marks.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(NoMarksFoundMatchingDomainException.class, () -> runFlow()); assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
} }
@Test @Test
@ -1175,7 +1175,7 @@ public class DomainApplicationCreateFlowTest
clock.setTo(DateTime.parse("2013-08-09T10:05:59Z").minusSeconds(1)); clock.setTo(DateTime.parse("2013-08-09T10:05:59Z").minusSeconds(1));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(NoMarksFoundMatchingDomainException.class, () -> runFlow()); assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
} }
@Test @Test
@ -1184,7 +1184,7 @@ public class DomainApplicationCreateFlowTest
clock.setTo(DateTime.parse("2017-07-23T22:00:00.000Z")); clock.setTo(DateTime.parse("2017-07-23T22:00:00.000Z"));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(NoMarksFoundMatchingDomainException.class, () -> runFlow()); assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
} }
@Test @Test
@ -1192,7 +1192,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_hex_encoding.xml"); setEppInput("domain_create_sunrise_hex_encoding.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(Base64RequiredForEncodedSignedMarksException.class, () -> runFlow()); assertThrows(Base64RequiredForEncodedSignedMarksException.class, this::runFlow);
} }
@Test @Test
@ -1200,7 +1200,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_bad_encoding.xml"); setEppInput("domain_create_sunrise_bad_encoding.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarkEncodingErrorException.class, () -> runFlow()); assertThrows(SignedMarkEncodingErrorException.class, this::runFlow);
} }
@Test @Test
@ -1208,7 +1208,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_bad_encoded_xml.xml"); setEppInput("domain_create_sunrise_bad_encoded_xml.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarkParsingErrorException.class, () -> runFlow()); assertThrows(SignedMarkParsingErrorException.class, this::runFlow);
} }
@Test @Test
@ -1217,7 +1217,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_bad_idn_minna.xml"); setEppInput("domain_create_sunrush_bad_idn_minna.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(InvalidIdnDomainLabelException.class, () -> runFlow()); assertThrows(InvalidIdnDomainLabelException.class, this::runFlow);
} }
@Test @Test
@ -1227,7 +1227,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(InvalidTrademarkValidatorException.class, () -> runFlow()); assertThrows(InvalidTrademarkValidatorException.class, this::runFlow);
} }
@Test @Test
@ -1235,7 +1235,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_signed_mark.xml"); setEppInput("domain_create_sunrise_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarksMustBeEncodedException.class, () -> runFlow()); assertThrows(SignedMarksMustBeEncodedException.class, this::runFlow);
} }
@Test @Test
@ -1243,7 +1243,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_code_with_mark.xml"); setEppInput("domain_create_sunrise_code_with_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(UnsupportedMarkTypeException.class, () -> runFlow()); assertThrows(UnsupportedMarkTypeException.class, this::runFlow);
} }
@Test @Test
@ -1251,7 +1251,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_empty_encoded_signed_mark.xml"); setEppInput("domain_create_sunrise_empty_encoded_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(SignedMarkParsingErrorException.class, () -> runFlow()); assertThrows(SignedMarkParsingErrorException.class, this::runFlow);
} }
@Test @Test
@ -1260,7 +1260,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(NoticeCannotBeUsedWithSignedMarkException.class, () -> runFlow()); assertThrows(NoticeCannotBeUsedWithSignedMarkException.class, this::runFlow);
} }
@Test @Test
@ -1268,7 +1268,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrise_two_signed_marks.xml"); setEppInput("domain_create_sunrise_two_signed_marks.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(TooManySignedMarksException.class, () -> runFlow()); assertThrows(TooManySignedMarksException.class, this::runFlow);
} }
@Test @Test
@ -1278,7 +1278,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush.xml"); setEppInput("domain_create_sunrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(MissingClaimsNoticeException.class, () -> runFlow()); assertThrows(MissingClaimsNoticeException.class, this::runFlow);
} }
@Test @Test
@ -1287,7 +1287,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_claim_notice.xml"); setEppInput("domain_create_landrush_claim_notice.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(UnexpectedClaimsNoticeException.class, () -> runFlow()); assertThrows(UnexpectedClaimsNoticeException.class, this::runFlow);
} }
@Test @Test
@ -1299,7 +1299,7 @@ public class DomainApplicationCreateFlowTest
persistResource(Registry.get("tld").asBuilder() persistResource(Registry.get("tld").asBuilder()
.setClaimsPeriodEnd(clock.nowUtc()) .setClaimsPeriodEnd(clock.nowUtc())
.build()); .build());
assertThrows(ClaimsPeriodEndedException.class, () -> runFlow()); assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
} }
@Test @Test
@ -1310,7 +1310,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(ExpiredClaimException.class, () -> runFlow()); assertThrows(ExpiredClaimException.class, this::runFlow);
} }
@Test @Test
@ -1321,7 +1321,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(AcceptedTooLongAgoException.class, () -> runFlow()); assertThrows(AcceptedTooLongAgoException.class, this::runFlow);
} }
@Test @Test
@ -1332,7 +1332,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_malformed_claim_notice1.xml"); setEppInput("domain_create_sunrush_malformed_claim_notice1.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(MalformedTcnIdException.class, () -> runFlow()); assertThrows(MalformedTcnIdException.class, this::runFlow);
} }
@Test @Test
@ -1343,7 +1343,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_sunrush_malformed_claim_notice2.xml"); setEppInput("domain_create_sunrush_malformed_claim_notice2.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(MalformedTcnIdException.class, () -> runFlow()); assertThrows(MalformedTcnIdException.class, this::runFlow);
} }
@Test @Test
@ -1354,7 +1354,7 @@ public class DomainApplicationCreateFlowTest
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(InvalidTcnIdChecksumException.class, () -> runFlow()); assertThrows(InvalidTcnIdChecksumException.class, this::runFlow);
} }
@Test @Test
@ -1365,7 +1365,7 @@ public class DomainApplicationCreateFlowTest
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -1376,7 +1376,7 @@ public class DomainApplicationCreateFlowTest
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -1387,7 +1387,7 @@ public class DomainApplicationCreateFlowTest
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -1404,7 +1404,7 @@ public class DomainApplicationCreateFlowTest
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -1421,7 +1421,7 @@ public class DomainApplicationCreateFlowTest
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -1438,7 +1438,7 @@ public class DomainApplicationCreateFlowTest
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -1447,7 +1447,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.6")); setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
@ -1456,7 +1456,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.11")); setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
@ -1465,7 +1465,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.12")); setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@ -1494,7 +1494,7 @@ public class DomainApplicationCreateFlowTest
.setAllowedRegistrantContactIds(ImmutableSet.of("someone")) .setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
.build()); .build());
RegistrantNotAllowedException thrown = RegistrantNotAllowedException thrown =
expectThrows(RegistrantNotAllowedException.class, () -> runFlow()); expectThrows(RegistrantNotAllowedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("jd1234"); assertThat(thrown).hasMessageThat().contains("jd1234");
} }
@ -1505,7 +1505,7 @@ public class DomainApplicationCreateFlowTest
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net")) .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
.build()); .build());
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1532,7 +1532,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows( assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, () -> runFlow()); NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
} }
@Test @Test
@ -1567,7 +1567,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1585,7 +1585,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows( assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, () -> runFlow()); NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
} }
@Test @Test
@ -1626,7 +1626,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1646,7 +1646,7 @@ public class DomainApplicationCreateFlowTest
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1656,7 +1656,7 @@ public class DomainApplicationCreateFlowTest
setEppInput("domain_create_landrush_11_years.xml"); setEppInput("domain_create_landrush_11_years.xml");
persistContactsAndHosts(); persistContactsAndHosts();
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(ExceedsMaxRegistrationYearsException.class, () -> runFlow()); assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
} }
private void doFailingDomainNameTest(String domainName, Class<? extends Throwable> exception) private void doFailingDomainNameTest(String domainName, Class<? extends Throwable> exception)

View file

@ -126,7 +126,7 @@ public class DomainApplicationDeleteFlowTest
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -137,7 +137,7 @@ public class DomainApplicationDeleteFlowTest
.setDeletionTime(clock.nowUtc().minusSeconds(1)) .setDeletionTime(clock.nowUtc().minusSeconds(1))
.build()); .build());
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -146,7 +146,7 @@ public class DomainApplicationDeleteFlowTest
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistResource( persistResource(
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -164,7 +164,7 @@ public class DomainApplicationDeleteFlowTest
persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -186,7 +186,7 @@ public class DomainApplicationDeleteFlowTest
.setRepoId("1-TLD") .setRepoId("1-TLD")
.setPhase(LaunchPhase.SUNRISE) .setPhase(LaunchPhase.SUNRISE)
.build()); .build());
assertThrows(SunriseApplicationCannotBeDeletedInLandrushException.class, () -> runFlow()); assertThrows(SunriseApplicationCannotBeDeletedInLandrushException.class, this::runFlow);
} }
@Test @Test
@ -232,14 +232,14 @@ public class DomainApplicationDeleteFlowTest
setEppInput("domain_delete_application_landrush.xml", ImmutableMap.of("DOMAIN", "example.tld")); setEppInput("domain_delete_application_landrush.xml", ImmutableMap.of("DOMAIN", "example.tld"));
persistResource( persistResource(
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
assertThrows(LaunchPhaseMismatchException.class, () -> runFlow()); assertThrows(LaunchPhaseMismatchException.class, this::runFlow);
} }
@Test @Test
public void testFailure_wrongExtension() throws Exception { public void testFailure_wrongExtension() throws Exception {
setEppInput("domain_delete_application_wrong_extension.xml"); setEppInput("domain_delete_application_wrong_extension.xml");
persistActiveDomainApplication("example.tld"); persistActiveDomainApplication("example.tld");
assertThrows(UnimplementedExtensionException.class, () -> runFlow()); assertThrows(UnimplementedExtensionException.class, this::runFlow);
} }
@Test @Test
@ -247,7 +247,7 @@ public class DomainApplicationDeleteFlowTest
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
persistResource( persistResource(
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -255,7 +255,7 @@ public class DomainApplicationDeleteFlowTest
createTld("tld", TldState.QUIET_PERIOD); createTld("tld", TldState.QUIET_PERIOD);
persistResource( persistResource(
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -263,7 +263,7 @@ public class DomainApplicationDeleteFlowTest
createTld("tld", TldState.GENERAL_AVAILABILITY); createTld("tld", TldState.GENERAL_AVAILABILITY);
persistResource( persistResource(
newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build());
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -300,7 +300,7 @@ public class DomainApplicationDeleteFlowTest
public void testFailure_applicationIdForDifferentDomain() throws Exception { public void testFailure_applicationIdForDifferentDomain() throws Exception {
persistResource( persistResource(
newDomainApplication("invalid.tld").asBuilder().setRepoId("1-TLD").build()); newDomainApplication("invalid.tld").asBuilder().setRepoId("1-TLD").build());
assertThrows(ApplicationDomainNameMismatchException.class, () -> runFlow()); assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
} }
@Test @Test

View file

@ -264,7 +264,7 @@ public class DomainApplicationInfoFlowTest
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -277,7 +277,7 @@ public class DomainApplicationInfoFlowTest
.setRegistrant(Key.create(persistActiveContact("jd1234"))) .setRegistrant(Key.create(persistActiveContact("jd1234")))
.build()); .build());
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -287,7 +287,7 @@ public class DomainApplicationInfoFlowTest
AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build()); AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build());
sessionMetadata.setClientId("ClientZ"); sessionMetadata.setClientId("ClientZ");
persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST); persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST);
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -298,14 +298,14 @@ public class DomainApplicationInfoFlowTest
.setRegistrant(Key.create(persistActiveContact("jd1234"))) .setRegistrant(Key.create(persistActiveContact("jd1234")))
.setPhase(LaunchPhase.SUNRUSH) .setPhase(LaunchPhase.SUNRUSH)
.build()); .build());
assertThrows(ApplicationDomainNameMismatchException.class, () -> runFlow()); assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
} }
@Test @Test
public void testFailure_noApplicationId() throws Exception { public void testFailure_noApplicationId() throws Exception {
setEppInput("domain_info_sunrise_no_application_id.xml"); setEppInput("domain_info_sunrise_no_application_id.xml");
persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST); persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST);
assertThrows(MissingApplicationIdException.class, () -> runFlow()); assertThrows(MissingApplicationIdException.class, this::runFlow);
} }
@Test @Test
@ -313,7 +313,7 @@ public class DomainApplicationInfoFlowTest
persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST); persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST);
application = persistResource( application = persistResource(
application.asBuilder().setPhase(LaunchPhase.SUNRISE).build()); application.asBuilder().setPhase(LaunchPhase.SUNRISE).build());
assertThrows(ApplicationLaunchPhaseMismatchException.class, () -> runFlow()); assertThrows(ApplicationLaunchPhaseMismatchException.class, this::runFlow);
} }
/** Test that we load contacts and hosts as a batch rather than individually. */ /** Test that we load contacts and hosts as a batch rather than individually. */

View file

@ -372,7 +372,7 @@ public class DomainApplicationUpdateFlowTest
setEppInput("domain_update_sunrise_dsdata_add.xml"); setEppInput("domain_update_sunrise_dsdata_add.xml");
persistResource(newApplicationBuilder().setDsData(builder.build()).build()); persistResource(newApplicationBuilder().setDsData(builder.build()).build());
assertThrows(TooManyDsRecordsException.class, () -> runFlow()); assertThrows(TooManyDsRecordsException.class, this::runFlow);
} }
private void modifyApplicationToHave13Nameservers() throws Exception { private void modifyApplicationToHave13Nameservers() throws Exception {
@ -395,27 +395,27 @@ public class DomainApplicationUpdateFlowTest
// Modify application to have 13 nameservers. We will then remove one and add one in the test. // Modify application to have 13 nameservers. We will then remove one and add one in the test.
modifyApplicationToHave13Nameservers(); modifyApplicationToHave13Nameservers();
setEppInput("domain_update_sunrise_add_nameserver.xml"); setEppInput("domain_update_sunrise_add_nameserver.xml");
assertThrows(TooManyNameserversException.class, () -> runFlow()); assertThrows(TooManyNameserversException.class, this::runFlow);
} }
@Test @Test
public void testFailure_wrongExtension() throws Exception { public void testFailure_wrongExtension() throws Exception {
setEppInput("domain_update_sunrise_wrong_extension.xml"); setEppInput("domain_update_sunrise_wrong_extension.xml");
assertThrows(UnimplementedExtensionException.class, () -> runFlow()); assertThrows(UnimplementedExtensionException.class, this::runFlow);
} }
@Test @Test
public void testFailure_applicationDomainNameMismatch() throws Exception { public void testFailure_applicationDomainNameMismatch() throws Exception {
persistReferencedEntities(); persistReferencedEntities();
persistResource(newApplicationBuilder().setFullyQualifiedDomainName("something.tld").build()); persistResource(newApplicationBuilder().setFullyQualifiedDomainName("something.tld").build());
assertThrows(ApplicationDomainNameMismatchException.class, () -> runFlow()); assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
} }
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
persistReferencedEntities(); persistReferencedEntities();
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -424,7 +424,7 @@ public class DomainApplicationUpdateFlowTest
persistReferencedEntities(); persistReferencedEntities();
persistResource(newApplicationBuilder().setDeletionTime(START_OF_TIME).build()); persistResource(newApplicationBuilder().setDeletionTime(START_OF_TIME).build());
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -434,7 +434,7 @@ public class DomainApplicationUpdateFlowTest
persistReferencedEntities(); persistReferencedEntities();
persistResource(newApplicationBuilder().setStatusValues( persistResource(newApplicationBuilder().setStatusValues(
ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)).build()); ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)).build());
assertThrows(ResourceHasClientUpdateProhibitedException.class, () -> runFlow()); assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
} }
@Test @Test
@ -443,14 +443,14 @@ public class DomainApplicationUpdateFlowTest
persistResource(newApplicationBuilder().setStatusValues( persistResource(newApplicationBuilder().setStatusValues(
ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED)).build()); ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED)).build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited"); assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
} }
private void doIllegalApplicationStatusTest(ApplicationStatus status) throws Exception { private void doIllegalApplicationStatusTest(ApplicationStatus status) throws Exception {
persistReferencedEntities(); persistReferencedEntities();
persistResource(newApplicationBuilder().setApplicationStatus(status).build()); persistResource(newApplicationBuilder().setApplicationStatus(status).build());
assertThrows(ApplicationStatusProhibitsUpdateException.class, () -> runFlow()); assertThrows(ApplicationStatusProhibitsUpdateException.class, this::runFlow);
} }
@Test @Test
@ -475,7 +475,7 @@ public class DomainApplicationUpdateFlowTest
persistActiveContact("mak21"); persistActiveContact("mak21");
persistNewApplication(); persistNewApplication();
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, () -> runFlow()); expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.tld)"); assertThat(thrown).hasMessageThat().contains("(ns2.example.tld)");
} }
@ -486,7 +486,7 @@ public class DomainApplicationUpdateFlowTest
persistActiveContact("mak21"); persistActiveContact("mak21");
persistNewApplication(); persistNewApplication();
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, () -> runFlow()); expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)"); assertThat(thrown).hasMessageThat().contains("(sh8013)");
} }
@ -500,7 +500,7 @@ public class DomainApplicationUpdateFlowTest
persistResource(reloadDomainApplication().asBuilder().setContacts(ImmutableSet.of( persistResource(reloadDomainApplication().asBuilder().setContacts(ImmutableSet.of(
DesignatedContact.create(Type.TECH, Key.create( DesignatedContact.create(Type.TECH, Key.create(
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc()))))).build()); loadByForeignKey(ContactResource.class, "foo", clock.nowUtc()))))).build());
assertThrows(DuplicateContactForRoleException.class, () -> runFlow()); assertThrows(DuplicateContactForRoleException.class, this::runFlow);
} }
@Test @Test
@ -508,7 +508,7 @@ public class DomainApplicationUpdateFlowTest
setEppInput("domain_update_sunrise_prohibited_status.xml"); setEppInput("domain_update_sunrise_prohibited_status.xml");
persistReferencedEntities(); persistReferencedEntities();
persistNewApplication(); persistNewApplication();
assertThrows(StatusNotClientSettableException.class, () -> runFlow()); assertThrows(StatusNotClientSettableException.class, this::runFlow);
} }
@ -529,7 +529,7 @@ public class DomainApplicationUpdateFlowTest
setEppInput("domain_update_sunrise_duplicate_contact.xml"); setEppInput("domain_update_sunrise_duplicate_contact.xml");
persistReferencedEntities(); persistReferencedEntities();
persistNewApplication(); persistNewApplication();
assertThrows(DuplicateContactForRoleException.class, () -> runFlow()); assertThrows(DuplicateContactForRoleException.class, this::runFlow);
} }
@Test @Test
@ -538,7 +538,7 @@ public class DomainApplicationUpdateFlowTest
persistReferencedEntities(); persistReferencedEntities();
persistNewApplication(); persistNewApplication();
// We need to test for missing type, but not for invalid - the schema enforces that for us. // We need to test for missing type, but not for invalid - the schema enforces that for us.
assertThrows(MissingContactTypeException.class, () -> runFlow()); assertThrows(MissingContactTypeException.class, this::runFlow);
} }
@Test @Test
@ -546,7 +546,7 @@ public class DomainApplicationUpdateFlowTest
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistReferencedEntities(); persistReferencedEntities();
persistApplication(); persistApplication();
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -565,7 +565,7 @@ public class DomainApplicationUpdateFlowTest
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistReferencedEntities(); persistReferencedEntities();
persistApplication(); persistApplication();
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -587,7 +587,7 @@ public class DomainApplicationUpdateFlowTest
.setNameservers(ImmutableSet.of(Key.create( .setNameservers(ImmutableSet.of(Key.create(
loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc())))) loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc()))))
.build()); .build());
assertThrows(AddRemoveSameValueException.class, () -> runFlow()); assertThrows(AddRemoveSameValueException.class, this::runFlow);
} }
@Test @Test
@ -600,7 +600,7 @@ public class DomainApplicationUpdateFlowTest
Key.create( Key.create(
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc()))))) loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))))
.build()); .build());
assertThrows(AddRemoveSameValueException.class, () -> runFlow()); assertThrows(AddRemoveSameValueException.class, this::runFlow);
} }
@Test @Test
@ -612,7 +612,7 @@ public class DomainApplicationUpdateFlowTest
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)), DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)))) DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
.build()); .build());
assertThrows(MissingAdminContactException.class, () -> runFlow()); assertThrows(MissingAdminContactException.class, this::runFlow);
} }
@Test @Test
@ -624,7 +624,7 @@ public class DomainApplicationUpdateFlowTest
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)), DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)))) DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
.build()); .build());
assertThrows(MissingTechnicalContactException.class, () -> runFlow()); assertThrows(MissingTechnicalContactException.class, this::runFlow);
} }
@Test @Test
@ -636,7 +636,7 @@ public class DomainApplicationUpdateFlowTest
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234")) .setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(RegistrantNotAllowedException.class, () -> runFlow()); assertThrows(RegistrantNotAllowedException.class, this::runFlow);
} }
@Test @Test
@ -648,7 +648,7 @@ public class DomainApplicationUpdateFlowTest
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo")) .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(NameserversNotAllowedForTldException.class, () -> runFlow()); assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
} }
@Test @Test
@ -676,7 +676,7 @@ public class DomainApplicationUpdateFlowTest
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows( assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, () -> runFlow()); NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
} }
@Test @Test
@ -730,7 +730,7 @@ public class DomainApplicationUpdateFlowTest
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.tld"); assertThat(thrown).hasMessageThat().contains("ns2.example.tld");
} }
@ -748,7 +748,7 @@ public class DomainApplicationUpdateFlowTest
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows( assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, () -> runFlow()); NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
} }
@Test @Test
@ -809,7 +809,7 @@ public class DomainApplicationUpdateFlowTest
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.tld"); assertThat(thrown).hasMessageThat().contains("ns2.example.tld");
} }
@ -829,7 +829,7 @@ public class DomainApplicationUpdateFlowTest
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.tld"); assertThat(thrown).hasMessageThat().contains("ns2.example.tld");
} }
@ -842,7 +842,7 @@ public class DomainApplicationUpdateFlowTest
"domain_update_sunrise_fee.xml", "domain_update_sunrise_fee.xml",
ImmutableMap.of("DOMAIN", "non-free-update.tld", "AMOUNT", "12.00")); ImmutableMap.of("DOMAIN", "non-free-update.tld", "AMOUNT", "12.00"));
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test

View file

@ -274,20 +274,20 @@ public class DomainCheckFlowTest
@Test @Test
public void testFailure_tooManyIds() throws Exception { public void testFailure_tooManyIds() throws Exception {
setEppInput("domain_check_51.xml"); setEppInput("domain_check_51.xml");
assertThrows(TooManyResourceChecksException.class, () -> runFlow()); assertThrows(TooManyResourceChecksException.class, this::runFlow);
} }
@Test @Test
public void testFailure_wrongTld() throws Exception { public void testFailure_wrongTld() throws Exception {
setEppInput("domain_check.xml"); setEppInput("domain_check.xml");
assertThrows(TldDoesNotExistException.class, () -> runFlow()); assertThrows(TldDoesNotExistException.class, this::runFlow);
} }
@Test @Test
public void testFailure_notAuthorizedForTld() throws Exception { public void testFailure_notAuthorizedForTld() throws Exception {
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -386,7 +386,7 @@ public class DomainCheckFlowTest
@Test @Test
public void testFailure_predelegation() throws Exception { public void testFailure_predelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -673,152 +673,152 @@ public class DomainCheckFlowTest
@Test @Test
public void testFeeExtension_wrongCurrency_v06() throws Exception { public void testFeeExtension_wrongCurrency_v06() throws Exception {
setEppInput("domain_check_fee_euro_v06.xml"); setEppInput("domain_check_fee_euro_v06.xml");
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_wrongCurrency_v11() throws Exception { public void testFeeExtension_wrongCurrency_v11() throws Exception {
setEppInput("domain_check_fee_euro_v11.xml"); setEppInput("domain_check_fee_euro_v11.xml");
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_wrongCurrency_v12() throws Exception { public void testFeeExtension_wrongCurrency_v12() throws Exception {
setEppInput("domain_check_fee_euro_v12.xml"); setEppInput("domain_check_fee_euro_v12.xml");
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_periodNotInYears_v06() throws Exception { public void testFeeExtension_periodNotInYears_v06() throws Exception {
setEppInput("domain_check_fee_bad_period_v06.xml"); setEppInput("domain_check_fee_bad_period_v06.xml");
assertThrows(BadPeriodUnitException.class, () -> runFlow()); assertThrows(BadPeriodUnitException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_periodNotInYears_v11() throws Exception { public void testFeeExtension_periodNotInYears_v11() throws Exception {
setEppInput("domain_check_fee_bad_period_v11.xml"); setEppInput("domain_check_fee_bad_period_v11.xml");
assertThrows(BadPeriodUnitException.class, () -> runFlow()); assertThrows(BadPeriodUnitException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_periodNotInYears_v12() throws Exception { public void testFeeExtension_periodNotInYears_v12() throws Exception {
setEppInput("domain_check_fee_bad_period_v12.xml"); setEppInput("domain_check_fee_bad_period_v12.xml");
assertThrows(BadPeriodUnitException.class, () -> runFlow()); assertThrows(BadPeriodUnitException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_commandWithPhase_v06() throws Exception { public void testFeeExtension_commandWithPhase_v06() throws Exception {
setEppInput("domain_check_fee_command_phase_v06.xml"); setEppInput("domain_check_fee_command_phase_v06.xml");
assertThrows(FeeChecksDontSupportPhasesException.class, () -> runFlow()); assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_commandWithPhase_v11() throws Exception { public void testFeeExtension_commandWithPhase_v11() throws Exception {
setEppInput("domain_check_fee_command_phase_v11.xml"); setEppInput("domain_check_fee_command_phase_v11.xml");
assertThrows(FeeChecksDontSupportPhasesException.class, () -> runFlow()); assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_commandWithPhase_v12() throws Exception { public void testFeeExtension_commandWithPhase_v12() throws Exception {
setEppInput("domain_check_fee_command_phase_v12.xml"); setEppInput("domain_check_fee_command_phase_v12.xml");
assertThrows(FeeChecksDontSupportPhasesException.class, () -> runFlow()); assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_commandSubphase_v06() throws Exception { public void testFeeExtension_commandSubphase_v06() throws Exception {
setEppInput("domain_check_fee_command_subphase_v06.xml"); setEppInput("domain_check_fee_command_subphase_v06.xml");
assertThrows(FeeChecksDontSupportPhasesException.class, () -> runFlow()); assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_commandSubphase_v11() throws Exception { public void testFeeExtension_commandSubphase_v11() throws Exception {
setEppInput("domain_check_fee_command_subphase_v11.xml"); setEppInput("domain_check_fee_command_subphase_v11.xml");
assertThrows(FeeChecksDontSupportPhasesException.class, () -> runFlow()); assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_commandSubphase_v12() throws Exception { public void testFeeExtension_commandSubphase_v12() throws Exception {
setEppInput("domain_check_fee_command_subphase_v12.xml"); setEppInput("domain_check_fee_command_subphase_v12.xml");
assertThrows(FeeChecksDontSupportPhasesException.class, () -> runFlow()); assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
} }
// This test is only relevant for v06, since domain names are not specified in v11 or v12. // This test is only relevant for v06, since domain names are not specified in v11 or v12.
@Test @Test
public void testFeeExtension_feeCheckNotInAvailabilityCheck() throws Exception { public void testFeeExtension_feeCheckNotInAvailabilityCheck() throws Exception {
setEppInput("domain_check_fee_not_in_avail.xml"); setEppInput("domain_check_fee_not_in_avail.xml");
assertThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, () -> runFlow()); assertThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_multiyearRestore_v06() throws Exception { public void testFeeExtension_multiyearRestore_v06() throws Exception {
setEppInput("domain_check_fee_multiyear_restore_v06.xml"); setEppInput("domain_check_fee_multiyear_restore_v06.xml");
assertThrows(RestoresAreAlwaysForOneYearException.class, () -> runFlow()); assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_multiyearRestore_v11() throws Exception { public void testFeeExtension_multiyearRestore_v11() throws Exception {
setEppInput("domain_check_fee_multiyear_restore_v11.xml"); setEppInput("domain_check_fee_multiyear_restore_v11.xml");
assertThrows(RestoresAreAlwaysForOneYearException.class, () -> runFlow()); assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_multiyearRestore_v12() throws Exception { public void testFeeExtension_multiyearRestore_v12() throws Exception {
setEppInput("domain_check_fee_multiyear_restore_v12.xml"); setEppInput("domain_check_fee_multiyear_restore_v12.xml");
assertThrows(RestoresAreAlwaysForOneYearException.class, () -> runFlow()); assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_multiyearTransfer_v06() throws Exception { public void testFeeExtension_multiyearTransfer_v06() throws Exception {
setEppInput("domain_check_fee_multiyear_transfer_v06.xml"); setEppInput("domain_check_fee_multiyear_transfer_v06.xml");
assertThrows(TransfersAreAlwaysForOneYearException.class, () -> runFlow()); assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_multiyearTransfer_v11() throws Exception { public void testFeeExtension_multiyearTransfer_v11() throws Exception {
setEppInput("domain_check_fee_multiyear_transfer_v11.xml"); setEppInput("domain_check_fee_multiyear_transfer_v11.xml");
assertThrows(TransfersAreAlwaysForOneYearException.class, () -> runFlow()); assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_multiyearTransfer_v12() throws Exception { public void testFeeExtension_multiyearTransfer_v12() throws Exception {
setEppInput("domain_check_fee_multiyear_transfer_v12.xml"); setEppInput("domain_check_fee_multiyear_transfer_v12.xml");
assertThrows(TransfersAreAlwaysForOneYearException.class, () -> runFlow()); assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_unknownCommand_v06() throws Exception { public void testFeeExtension_unknownCommand_v06() throws Exception {
setEppInput("domain_check_fee_unknown_command_v06.xml"); setEppInput("domain_check_fee_unknown_command_v06.xml");
assertThrows(UnknownFeeCommandException.class, () -> runFlow()); assertThrows(UnknownFeeCommandException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_unknownCommand_v11() throws Exception { public void testFeeExtension_unknownCommand_v11() throws Exception {
setEppInput("domain_check_fee_unknown_command_v11.xml"); setEppInput("domain_check_fee_unknown_command_v11.xml");
assertThrows(UnknownFeeCommandException.class, () -> runFlow()); assertThrows(UnknownFeeCommandException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_unknownCommand_v12() throws Exception { public void testFeeExtension_unknownCommand_v12() throws Exception {
setEppInput("domain_check_fee_unknown_command_v12.xml"); setEppInput("domain_check_fee_unknown_command_v12.xml");
assertThrows(UnknownFeeCommandException.class, () -> runFlow()); assertThrows(UnknownFeeCommandException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_invalidCommand_v06() throws Exception { public void testFeeExtension_invalidCommand_v06() throws Exception {
setEppInput("domain_check_fee_invalid_command_v06.xml"); setEppInput("domain_check_fee_invalid_command_v06.xml");
assertThrows(UnknownFeeCommandException.class, () -> runFlow()); assertThrows(UnknownFeeCommandException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_invalidCommand_v11() throws Exception { public void testFeeExtension_invalidCommand_v11() throws Exception {
setEppInput("domain_check_fee_invalid_command_v11.xml"); setEppInput("domain_check_fee_invalid_command_v11.xml");
assertThrows(UnknownFeeCommandException.class, () -> runFlow()); assertThrows(UnknownFeeCommandException.class, this::runFlow);
} }
@Test @Test
public void testFeeExtension_invalidCommand_v12() throws Exception { public void testFeeExtension_invalidCommand_v12() throws Exception {
setEppInput("domain_check_fee_invalid_command_v12.xml"); setEppInput("domain_check_fee_invalid_command_v12.xml");
assertThrows(UnknownFeeCommandException.class, () -> runFlow()); assertThrows(UnknownFeeCommandException.class, this::runFlow);
} }
private void runEapFeeCheckTest(String inputFile, String outputFile) throws Exception { private void runEapFeeCheckTest(String inputFile, String outputFile) throws Exception {

View file

@ -102,20 +102,20 @@ public class DomainClaimsCheckFlowTest
@Test @Test
public void testFailure_TooManyIds() throws Exception { public void testFailure_TooManyIds() throws Exception {
setEppInput("domain_check_claims_51.xml"); setEppInput("domain_check_claims_51.xml");
assertThrows(TooManyResourceChecksException.class, () -> runFlow()); assertThrows(TooManyResourceChecksException.class, this::runFlow);
} }
@Test @Test
public void testFailure_tldDoesntExist() throws Exception { public void testFailure_tldDoesntExist() throws Exception {
setEppInput("domain_check_claims_bad_tld.xml"); setEppInput("domain_check_claims_bad_tld.xml");
assertThrows(TldDoesNotExistException.class, () -> runFlow()); assertThrows(TldDoesNotExistException.class, this::runFlow);
} }
@Test @Test
public void testFailure_notAuthorizedForTld() throws Exception { public void testFailure_notAuthorizedForTld() throws Exception {
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -136,7 +136,7 @@ public class DomainClaimsCheckFlowTest
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
persistResource(Registry.get("tld").asBuilder().build()); persistResource(Registry.get("tld").asBuilder().build());
setEppInput("domain_check_claims.xml"); setEppInput("domain_check_claims.xml");
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -144,7 +144,7 @@ public class DomainClaimsCheckFlowTest
createTld("tld", TldState.SUNRISE); createTld("tld", TldState.SUNRISE);
persistResource(Registry.get("tld").asBuilder().build()); persistResource(Registry.get("tld").asBuilder().build());
setEppInput("domain_check_claims.xml"); setEppInput("domain_check_claims.xml");
assertThrows(DomainClaimsCheckNotAllowedInSunrise.class, () -> runFlow()); assertThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow);
} }
@Test @Test
@ -154,7 +154,7 @@ public class DomainClaimsCheckFlowTest
persistResource( persistResource(
Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build()); Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build());
setEppInput("domain_check_claims_multiple_tlds.xml"); setEppInput("domain_check_claims_multiple_tlds.xml");
assertThrows(ClaimsPeriodEndedException.class, () -> runFlow()); assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
} }
@Test @Test

View file

@ -386,7 +386,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTlds("foo.tld", "tld"); createTlds("foo.tld", "tld");
setEppInput("domain_create_wildcard.xml", ImmutableMap.of("DOMAIN", "foo.tld")); setEppInput("domain_create_wildcard.xml", ImmutableMap.of("DOMAIN", "foo.tld"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(DomainNameExistsAsTldException.class, () -> runFlow()); assertThrows(DomainNameExistsAsTldException.class, this::runFlow);
} }
@Test @Test
@ -394,7 +394,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTlds("foo.tld", "tld"); createTlds("foo.tld", "tld");
setEppInput("domain_create_wildcard.xml", ImmutableMap.of("DOMAIN", "FOO.TLD")); setEppInput("domain_create_wildcard.xml", ImmutableMap.of("DOMAIN", "FOO.TLD"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(BadDomainNameCharacterException.class, () -> runFlow()); assertThrows(BadDomainNameCharacterException.class, this::runFlow);
} }
@Test @Test
@ -534,63 +534,63 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_refundableFee_v06() throws Exception { public void testFailure_refundableFee_v06() throws Exception {
setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.6")); setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_refundableFee_v11() throws Exception { public void testFailure_refundableFee_v11() throws Exception {
setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.11")); setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_refundableFee_v12() throws Exception { public void testFailure_refundableFee_v12() throws Exception {
setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.12")); setEppInput("domain_create_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v06() throws Exception { public void testFailure_gracePeriodFee_v06() throws Exception {
setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.6")); setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v11() throws Exception { public void testFailure_gracePeriodFee_v11() throws Exception {
setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.11")); setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v12() throws Exception { public void testFailure_gracePeriodFee_v12() throws Exception {
setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.12")); setEppInput("domain_create_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v06() throws Exception { public void testFailure_appliedFee_v06() throws Exception {
setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.6")); setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v11() throws Exception { public void testFailure_appliedFee_v11() throws Exception {
setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.11")); setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v12() throws Exception { public void testFailure_appliedFee_v12() throws Exception {
setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.12")); setEppInput("domain_create_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -610,7 +610,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_metadataNotFromTool() throws Exception { public void testFailure_metadataNotFromTool() throws Exception {
setEppInput("domain_create_metadata.xml"); setEppInput("domain_create_metadata.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(OnlyToolCanPassMetadataException.class, () -> runFlow()); assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
} }
@Test @Test
@ -637,7 +637,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setLrpPeriod(new Interval(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1))) .setLrpPeriod(new Interval(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1)))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
InvalidLrpTokenException thrown = expectThrows(InvalidLrpTokenException.class, () -> runFlow()); InvalidLrpTokenException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("Invalid limited registration period token"); assertThat(thrown).hasMessageThat().contains("Invalid limited registration period token");
} }
@ -737,7 +737,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_periodInMonths() throws Exception { public void testFailure_periodInMonths() throws Exception {
setEppInput("domain_create_months.xml"); setEppInput("domain_create_months.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(BadPeriodUnitException.class, () -> runFlow()); assertThrows(BadPeriodUnitException.class, this::runFlow);
} }
@Test @Test
@ -769,7 +769,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("example", CLAIMS_KEY));
setEppInput("domain_create.xml"); setEppInput("domain_create.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MissingClaimsNoticeException.class, () -> runFlow()); assertThrows(MissingClaimsNoticeException.class, this::runFlow);
} }
@Test @Test
@ -777,7 +777,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_claim_notice.xml"); setEppInput("domain_create_claim_notice.xml");
persistClaimsList(ImmutableMap.of()); persistClaimsList(ImmutableMap.of());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnexpectedClaimsNoticeException.class, () -> runFlow()); assertThrows(UnexpectedClaimsNoticeException.class, this::runFlow);
} }
@Test @Test
@ -788,35 +788,35 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(Registry.get("tld").asBuilder() persistResource(Registry.get("tld").asBuilder()
.setClaimsPeriodEnd(clock.nowUtc()) .setClaimsPeriodEnd(clock.nowUtc())
.build()); .build());
assertThrows(ClaimsPeriodEndedException.class, () -> runFlow()); assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
} }
@Test @Test
public void testFailure_tooManyNameservers() throws Exception { public void testFailure_tooManyNameservers() throws Exception {
setEppInput("domain_create_14_nameservers.xml"); setEppInput("domain_create_14_nameservers.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(TooManyNameserversException.class, () -> runFlow()); assertThrows(TooManyNameserversException.class, this::runFlow);
} }
@Test @Test
public void testFailure_secDnsMaxSigLife() throws Exception { public void testFailure_secDnsMaxSigLife() throws Exception {
setEppInput("domain_create_dsdata.xml"); setEppInput("domain_create_dsdata.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MaxSigLifeNotSupportedException.class, () -> runFlow()); assertThrows(MaxSigLifeNotSupportedException.class, this::runFlow);
} }
@Test @Test
public void testFailure_secDnsTooManyDsRecords() throws Exception { public void testFailure_secDnsTooManyDsRecords() throws Exception {
setEppInput("domain_create_dsdata_9_records.xml"); setEppInput("domain_create_dsdata_9_records.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(TooManyDsRecordsException.class, () -> runFlow()); assertThrows(TooManyDsRecordsException.class, this::runFlow);
} }
@Test @Test
public void testFailure_wrongExtension() throws Exception { public void testFailure_wrongExtension() throws Exception {
setEppInput("domain_create_wrong_extension.xml"); setEppInput("domain_create_wrong_extension.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnimplementedExtensionException.class, () -> runFlow()); assertThrows(UnimplementedExtensionException.class, this::runFlow);
} }
@Test @Test
@ -825,7 +825,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource( persistResource(
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -834,7 +834,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource( persistResource(
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -843,7 +843,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource( persistResource(
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -858,7 +858,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -873,7 +873,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -888,7 +888,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -912,14 +912,14 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_reserved() throws Exception { public void testFailure_reserved() throws Exception {
setEppInput("domain_create_reserved.xml"); setEppInput("domain_create_reserved.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(DomainReservedException.class, () -> runFlow()); assertThrows(DomainReservedException.class, this::runFlow);
} }
@Test @Test
public void testFailure_anchorTenantViaAuthCode_wrongAuthCode() throws Exception { public void testFailure_anchorTenantViaAuthCode_wrongAuthCode() throws Exception {
setEppInput("domain_create_anchor_wrong_authcode.xml"); setEppInput("domain_create_anchor_wrong_authcode.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(DomainReservedException.class, () -> runFlow()); assertThrows(DomainReservedException.class, this::runFlow);
} }
@Test @Test
@ -1017,7 +1017,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistActiveContact("jd1234"); persistActiveContact("jd1234");
persistActiveContact("sh8013"); persistActiveContact("sh8013");
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, () -> runFlow()); expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.net)"); assertThat(thrown).hasMessageThat().contains("(ns2.example.net)");
} }
@ -1032,7 +1032,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.advanceOneMilli(); clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown = LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows( expectThrows(
LinkedResourceInPendingDeleteProhibitsOperationException.class, () -> runFlow()); LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.net"); assertThat(thrown).hasMessageThat().contains("ns2.example.net");
} }
@ -1041,7 +1041,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistContactsAndHosts(); persistContactsAndHosts();
persistActiveDomainApplication(getUniqueIdFromCommand()); persistActiveDomainApplication(getUniqueIdFromCommand());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(DomainHasOpenApplicationsException.class, () -> runFlow()); assertThrows(DomainHasOpenApplicationsException.class, this::runFlow);
} }
@Test @Test
@ -1067,7 +1067,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistActiveHost("ns2.example.net"); persistActiveHost("ns2.example.net");
persistActiveContact("jd1234"); persistActiveContact("jd1234");
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, () -> runFlow()); expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)"); assertThat(thrown).hasMessageThat().contains("(sh8013)");
} }
@ -1082,7 +1082,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.advanceOneMilli(); clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown = LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows( expectThrows(
LinkedResourceInPendingDeleteProhibitsOperationException.class, () -> runFlow()); LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("jd1234"); assertThat(thrown).hasMessageThat().contains("jd1234");
} }
@ -1090,42 +1090,42 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_wrongTld() throws Exception { public void testFailure_wrongTld() throws Exception {
persistContactsAndHosts("net"); persistContactsAndHosts("net");
deleteTld("tld"); deleteTld("tld");
assertThrows(TldDoesNotExistException.class, () -> runFlow()); assertThrows(TldDoesNotExistException.class, this::runFlow);
} }
@Test @Test
public void testFailure_predelegation() throws Exception { public void testFailure_predelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_sunrise() throws Exception { public void testFailure_sunrise() throws Exception {
createTld("tld", TldState.SUNRISE); createTld("tld", TldState.SUNRISE);
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_sunrush() throws Exception { public void testFailure_sunrush() throws Exception {
createTld("tld", TldState.SUNRUSH); createTld("tld", TldState.SUNRUSH);
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_landrush() throws Exception { public void testFailure_landrush() throws Exception {
createTld("tld", TldState.LANDRUSH); createTld("tld", TldState.LANDRUSH);
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_quietPeriod() throws Exception { public void testFailure_quietPeriod() throws Exception {
createTld("tld", TldState.QUIET_PERIOD); createTld("tld", TldState.QUIET_PERIOD);
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
@ -1198,7 +1198,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_duplicateContact() throws Exception { public void testFailure_duplicateContact() throws Exception {
setEppInput("domain_create_duplicate_contact.xml"); setEppInput("domain_create_duplicate_contact.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(DuplicateContactForRoleException.class, () -> runFlow()); assertThrows(DuplicateContactForRoleException.class, this::runFlow);
} }
@Test @Test
@ -1206,35 +1206,35 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
// We need to test for missing type, but not for invalid - the schema enforces that for us. // We need to test for missing type, but not for invalid - the schema enforces that for us.
setEppInput("domain_create_missing_contact_type.xml"); setEppInput("domain_create_missing_contact_type.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MissingContactTypeException.class, () -> runFlow()); assertThrows(MissingContactTypeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_missingRegistrant() throws Exception { public void testFailure_missingRegistrant() throws Exception {
setEppInput("domain_create_missing_registrant.xml"); setEppInput("domain_create_missing_registrant.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MissingRegistrantException.class, () -> runFlow()); assertThrows(MissingRegistrantException.class, this::runFlow);
} }
@Test @Test
public void testFailure_missingAdmin() throws Exception { public void testFailure_missingAdmin() throws Exception {
setEppInput("domain_create_missing_admin.xml"); setEppInput("domain_create_missing_admin.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MissingAdminContactException.class, () -> runFlow()); assertThrows(MissingAdminContactException.class, this::runFlow);
} }
@Test @Test
public void testFailure_missingTech() throws Exception { public void testFailure_missingTech() throws Exception {
setEppInput("domain_create_missing_tech.xml"); setEppInput("domain_create_missing_tech.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MissingTechnicalContactException.class, () -> runFlow()); assertThrows(MissingTechnicalContactException.class, this::runFlow);
} }
@Test @Test
public void testFailure_missingNonRegistrantContacts() throws Exception { public void testFailure_missingNonRegistrantContacts() throws Exception {
setEppInput("domain_create_missing_non_registrant_contacts.xml"); setEppInput("domain_create_missing_non_registrant_contacts.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MissingAdminContactException.class, () -> runFlow()); assertThrows(MissingAdminContactException.class, this::runFlow);
} }
@Test @Test
@ -1242,7 +1242,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("xn--q9jyb4c"); createTld("xn--q9jyb4c");
setEppInput("domain_create_bad_idn_minna.xml"); setEppInput("domain_create_bad_idn_minna.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
assertThrows(InvalidIdnDomainLabelException.class, () -> runFlow()); assertThrows(InvalidIdnDomainLabelException.class, this::runFlow);
} }
@Test @Test
@ -1250,14 +1250,14 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_bad_validator_id.xml"); setEppInput("domain_create_bad_validator_id.xml");
persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(InvalidTrademarkValidatorException.class, () -> runFlow()); assertThrows(InvalidTrademarkValidatorException.class, this::runFlow);
} }
@Test @Test
public void testFailure_codeMark() throws Exception { public void testFailure_codeMark() throws Exception {
setEppInput("domain_create_code_with_mark.xml"); setEppInput("domain_create_code_with_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UnsupportedMarkTypeException.class, () -> runFlow()); assertThrows(UnsupportedMarkTypeException.class, this::runFlow);
} }
@Test @Test
@ -1265,7 +1265,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRISE); createTld("tld", TldState.SUNRISE);
setEppInput("domain_create_signed_mark.xml"); setEppInput("domain_create_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
@ -1273,7 +1273,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2010-08-17T09:00:00.0Z")); clock.setTo(DateTime.parse("2010-08-17T09:00:00.0Z"));
setEppInput("domain_create_claim_notice.xml"); setEppInput("domain_create_claim_notice.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(ExpiredClaimException.class, () -> runFlow()); assertThrows(ExpiredClaimException.class, this::runFlow);
} }
@Test @Test
@ -1281,7 +1281,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-09-16T09:00:00.0Z")); clock.setTo(DateTime.parse("2009-09-16T09:00:00.0Z"));
setEppInput("domain_create_claim_notice.xml"); setEppInput("domain_create_claim_notice.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(AcceptedTooLongAgoException.class, () -> runFlow()); assertThrows(AcceptedTooLongAgoException.class, this::runFlow);
} }
@Test @Test
@ -1289,7 +1289,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_malformed_claim_notice1.xml"); setEppInput("domain_create_malformed_claim_notice1.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MalformedTcnIdException.class, () -> runFlow()); assertThrows(MalformedTcnIdException.class, this::runFlow);
} }
@Test @Test
@ -1297,7 +1297,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_malformed_claim_notice2.xml"); setEppInput("domain_create_malformed_claim_notice2.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(MalformedTcnIdException.class, () -> runFlow()); assertThrows(MalformedTcnIdException.class, this::runFlow);
} }
@Test @Test
@ -1305,7 +1305,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z")); clock.setTo(DateTime.parse("2009-08-16T09:00:00.0Z"));
setEppInput("domain_create_bad_checksum_claim_notice.xml"); setEppInput("domain_create_bad_checksum_claim_notice.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(InvalidTcnIdChecksumException.class, () -> runFlow()); assertThrows(InvalidTcnIdChecksumException.class, this::runFlow);
} }
@Test @Test
@ -1318,7 +1318,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistResource(loadRegistrar("TheRegistrar").asBuilder() persistResource(loadRegistrar("TheRegistrar").asBuilder()
.setBlockPremiumNames(true) .setBlockPremiumNames(true)
.build()); .build());
assertThrows(PremiumNameBlockedException.class, () -> runFlow()); assertThrows(PremiumNameBlockedException.class, this::runFlow);
} }
@Test @Test
@ -1326,7 +1326,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("example"); createTld("example");
setEppInput("domain_create_premium.xml"); setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
assertThrows(FeesRequiredForPremiumNameException.class, () -> runFlow()); assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
} }
@Test @Test
@ -1337,7 +1337,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("net"); createTld("net");
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6")); setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UndeclaredServiceExtensionException.class, () -> runFlow()); assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
} }
@Test @Test
@ -1348,7 +1348,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("net"); createTld("net");
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11")); setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UndeclaredServiceExtensionException.class, () -> runFlow()); assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
} }
@Test @Test
@ -1359,28 +1359,28 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("net"); createTld("net");
setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12")); setEppInput("domain_create_fee.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(UndeclaredServiceExtensionException.class, () -> runFlow()); assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
} }
@Test @Test
public void testFailure_feeGivenInWrongScale_v06() throws Exception { public void testFailure_feeGivenInWrongScale_v06() throws Exception {
setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.6")); setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.6"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
public void testFailure_feeGivenInWrongScale_v11() throws Exception { public void testFailure_feeGivenInWrongScale_v11() throws Exception {
setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.11")); setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
public void testFailure_feeGivenInWrongScale_v12() throws Exception { public void testFailure_feeGivenInWrongScale_v12() throws Exception {
setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.12")); setEppInput("domain_create_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.12"));
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
@ -1393,7 +1393,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.asBuilder() .asBuilder()
.setState(State.SUSPENDED) .setState(State.SUSPENDED)
.build()); .build());
assertThrows(RegistrarMustBeActiveToCreateDomainsException.class, () -> runFlow()); assertThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow);
} }
private void doFailingDomainNameTest( private void doFailingDomainNameTest(
@ -1476,7 +1476,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRISE); createTld("tld", TldState.SUNRISE);
setEppInput("domain_create_registration_sunrise.xml"); setEppInput("domain_create_registration_sunrise.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
@ -1527,7 +1527,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRUSH); createTld("tld", TldState.SUNRUSH);
setEppInput("domain_create_registration_sunrush.xml"); setEppInput("domain_create_registration_sunrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
@ -1539,7 +1539,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setAllowedTlds(ImmutableSet.of("irrelevant")) .setAllowedTlds(ImmutableSet.of("irrelevant"))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -1590,7 +1590,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.LANDRUSH); createTld("tld", TldState.LANDRUSH);
setEppInput("domain_create_registration_landrush.xml"); setEppInput("domain_create_registration_landrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, () -> runFlow()); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
} }
@Test @Test
@ -1644,7 +1644,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setAllowedRegistrantContactIds(ImmutableSet.of("someone")) .setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
.build()); .build());
RegistrantNotAllowedException thrown = RegistrantNotAllowedException thrown =
expectThrows(RegistrantNotAllowedException.class, () -> runFlow()); expectThrows(RegistrantNotAllowedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("jd1234"); assertThat(thrown).hasMessageThat().contains("jd1234");
} }
@ -1655,7 +1655,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net")) .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
.build()); .build());
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1667,7 +1667,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows( assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, () -> runFlow()); NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
} }
@Test @Test
@ -1709,7 +1709,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns1.example.net:ns2.example.net:ns3.example.net")) + "ns1.example.net:ns2.example.net:ns3.example.net"))
.build()); .build());
assertThrows( assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, () -> runFlow()); NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
} }
@Test @Test
@ -1723,7 +1723,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns2.example.net:ns3.example.net")) "reserved", "example,NAMESERVER_RESTRICTED,ns2.example.net:ns3.example.net"))
.build()); .build());
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1739,7 +1739,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.net:ns2.example.net")) "reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.net:ns2.example.net"))
.build()); .build());
DomainNotAllowedForTldWithCreateRestrictionException thrown = DomainNotAllowedForTldWithCreateRestrictionException thrown =
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, () -> runFlow()); expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("example.tld"); assertThat(thrown).hasMessageThat().contains("example.tld");
} }
@ -1789,7 +1789,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns1.example.net:ns2.example.net:ns3.example.net")) + "ns1.example.net:ns2.example.net:ns3.example.net"))
.build()); .build());
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1808,7 +1808,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns2.example.net:ns3.example.net:ns4.example.net")) + "ns2.example.net:ns3.example.net:ns4.example.net"))
.build()); .build());
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1829,7 +1829,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns1.example.net:ns2.example.net:ns3.example.net")) + "ns1.example.net:ns2.example.net:ns3.example.net"))
.build()); .build());
DomainNotAllowedForTldWithCreateRestrictionException thrown = DomainNotAllowedForTldWithCreateRestrictionException thrown =
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, () -> runFlow()); expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("example.tld"); assertThat(thrown).hasMessageThat().contains("example.tld");
} }
@ -1958,7 +1958,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_max10Years() throws Exception { public void testFailure_max10Years() throws Exception {
setEppInput("domain_create_11_years.xml"); setEppInput("domain_create_11_years.xml");
persistContactsAndHosts(); persistContactsAndHosts();
assertThrows(ExceedsMaxRegistrationYearsException.class, () -> runFlow()); assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
} }
@Test @Test

View file

@ -638,7 +638,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testFailure_predelegation() throws Exception { public void testFailure_predelegation() throws Exception {
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
setUpSuccessfulTest(); setUpSuccessfulTest();
assertThrows(BadCommandForRegistryPhaseException.class, () -> runFlow()); assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
} }
@Test @Test
@ -653,7 +653,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -661,7 +661,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testFailure_existedButWasDeleted() throws Exception { public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -675,14 +675,14 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
domain = persistResource(domain.asBuilder() domain = persistResource(domain.asBuilder()
.addSubordinateHost(subordinateHost.getFullyQualifiedHostName()) .addSubordinateHost(subordinateHost.getFullyQualifiedHostName())
.build()); .build());
assertThrows(DomainToDeleteHasHostsException.class, () -> runFlow()); assertThrows(DomainToDeleteHasHostsException.class, this::runFlow);
} }
@Test @Test
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -699,7 +699,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
setUpSuccessfulTest(); setUpSuccessfulTest();
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -718,7 +718,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.addStatusValue(StatusValue.CLIENT_DELETE_PROHIBITED) .addStatusValue(StatusValue.CLIENT_DELETE_PROHIBITED)
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("clientDeleteProhibited"); assertThat(thrown).hasMessageThat().contains("clientDeleteProhibited");
} }
@ -728,7 +728,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED) .addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED)
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverDeleteProhibited"); assertThat(thrown).hasMessageThat().contains("serverDeleteProhibited");
} }
@ -738,7 +738,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
.addStatusValue(StatusValue.PENDING_DELETE) .addStatusValue(StatusValue.PENDING_DELETE)
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertThat(thrown).hasMessageThat().contains("pendingDelete");
} }
@ -762,7 +762,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
public void testFailure_metadataNotFromTool() throws Exception { public void testFailure_metadataNotFromTool() throws Exception {
setEppInput("domain_delete_metadata.xml"); setEppInput("domain_delete_metadata.xml");
persistResource(newDomainResource(getUniqueIdFromCommand())); persistResource(newDomainResource(getUniqueIdFromCommand()));
assertThrows(OnlyToolCanPassMetadataException.class, () -> runFlow()); assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
} }
@Test @Test

View file

@ -376,7 +376,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -386,7 +386,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
.setDeletionTime(clock.nowUtc().minusDays(1)) .setDeletionTime(clock.nowUtc().minusDays(1))
.build()); .build());
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -399,7 +399,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
.build()); .build());
sessionMetadata.setClientId("ClientZ"); sessionMetadata.setClientId("ClientZ");
setEppInput("domain_info_with_auth.xml"); setEppInput("domain_info_with_auth.xml");
assertThrows(BadAuthInfoForResourceException.class, () -> runFlow()); assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
} }
@Test @Test
@ -410,7 +410,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("diffpw"))) .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("diffpw")))
.build()); .build());
setEppInput("domain_info_with_auth.xml"); setEppInput("domain_info_with_auth.xml");
assertThrows(BadAuthInfoForResourceException.class, () -> runFlow()); assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
} }
@Test @Test
@ -425,7 +425,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml"); setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our registrant. // Replace the ROID in the xml file with the one for our registrant.
eppLoader.replaceAll("JD1234-REP", registrant.getRepoId()); eppLoader.replaceAll("JD1234-REP", registrant.getRepoId());
assertThrows(BadAuthInfoForResourceException.class, () -> runFlow()); assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
} }
@Test @Test
@ -439,7 +439,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml"); setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our registrant. // Replace the ROID in the xml file with the one for our registrant.
eppLoader.replaceAll("JD1234-REP", registrant.getRepoId()); eppLoader.replaceAll("JD1234-REP", registrant.getRepoId());
assertThrows(BadAuthInfoForResourceException.class, () -> runFlow()); assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
} }
@Test @Test
@ -454,7 +454,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml"); setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our contact. // Replace the ROID in the xml file with the one for our contact.
eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
assertThrows(BadAuthInfoForResourceException.class, () -> runFlow()); assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
} }
@Test @Test
@ -468,7 +468,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml"); setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our contact. // Replace the ROID in the xml file with the one for our contact.
eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
assertThrows(BadAuthInfoForResourceException.class, () -> runFlow()); assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
} }
@Test @Test
@ -479,7 +479,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml"); setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our unrelated contact. // Replace the ROID in the xml file with the one for our unrelated contact.
eppLoader.replaceAll("JD1234-REP", unrelatedContact.getRepoId()); eppLoader.replaceAll("JD1234-REP", unrelatedContact.getRepoId());
assertThrows(BadAuthInfoForResourceException.class, () -> runFlow()); assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
} }
@Test @Test
@ -489,7 +489,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
setEppInput("domain_info_with_contact_auth.xml"); setEppInput("domain_info_with_contact_auth.xml");
// Replace the ROID in the xml file with the one for our unrelated contact. // Replace the ROID in the xml file with the one for our unrelated contact.
eppLoader.replaceAll("JD1234-REP", unrelatedContact.getRepoId()); eppLoader.replaceAll("JD1234-REP", unrelatedContact.getRepoId());
assertThrows(BadAuthInfoForResourceException.class, () -> runFlow()); assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
} }
/** /**
@ -568,7 +568,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_wrongCurrency() throws Exception { public void testFeeExtension_wrongCurrency() throws Exception {
setEppInput("domain_info_fee_create_euro.xml"); setEppInput("domain_info_fee_create_euro.xml");
persistTestEntities(false); persistTestEntities(false);
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
/** Test requesting a period that isn't in years. */ /** Test requesting a period that isn't in years. */
@ -576,7 +576,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_periodNotInYears() throws Exception { public void testFeeExtension_periodNotInYears() throws Exception {
setEppInput("domain_info_fee_bad_period.xml"); setEppInput("domain_info_fee_bad_period.xml");
persistTestEntities(false); persistTestEntities(false);
assertThrows(BadPeriodUnitException.class, () -> runFlow()); assertThrows(BadPeriodUnitException.class, this::runFlow);
} }
/** Test a command that specifies a phase. */ /** Test a command that specifies a phase. */
@ -584,7 +584,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_commandPhase() throws Exception { public void testFeeExtension_commandPhase() throws Exception {
setEppInput("domain_info_fee_command_phase.xml"); setEppInput("domain_info_fee_command_phase.xml");
persistTestEntities(false); persistTestEntities(false);
assertThrows(FeeChecksDontSupportPhasesException.class, () -> runFlow()); assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
} }
/** Test a command that specifies a subphase. */ /** Test a command that specifies a subphase. */
@ -592,7 +592,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_commandSubphase() throws Exception { public void testFeeExtension_commandSubphase() throws Exception {
setEppInput("domain_info_fee_command_subphase.xml"); setEppInput("domain_info_fee_command_subphase.xml");
persistTestEntities(false); persistTestEntities(false);
assertThrows(FeeChecksDontSupportPhasesException.class, () -> runFlow()); assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
} }
/** Test a restore for more than one year. */ /** Test a restore for more than one year. */
@ -600,7 +600,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_multiyearRestore() throws Exception { public void testFeeExtension_multiyearRestore() throws Exception {
setEppInput("domain_info_fee_multiyear_restore.xml"); setEppInput("domain_info_fee_multiyear_restore.xml");
persistTestEntities(false); persistTestEntities(false);
assertThrows(RestoresAreAlwaysForOneYearException.class, () -> runFlow()); assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
} }
/** Test a transfer for more than one year. */ /** Test a transfer for more than one year. */
@ -608,7 +608,7 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
public void testFeeExtension_multiyearTransfer() throws Exception { public void testFeeExtension_multiyearTransfer() throws Exception {
setEppInput("domain_info_fee_multiyear_transfer.xml"); setEppInput("domain_info_fee_multiyear_transfer.xml");
persistTestEntities(false); persistTestEntities(false);
assertThrows(TransfersAreAlwaysForOneYearException.class, () -> runFlow()); assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
} }
/** Test that we load contacts and hosts as a batch rather than individually. */ /** Test that we load contacts and hosts as a batch rather than individually. */

View file

@ -293,63 +293,63 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_refundableFee_v06() throws Exception { public void testFailure_refundableFee_v06() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_06_MAP); setEppInput("domain_renew_fee_refundable.xml", FEE_06_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_refundableFee_v11() throws Exception { public void testFailure_refundableFee_v11() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_11_MAP); setEppInput("domain_renew_fee_refundable.xml", FEE_11_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_refundableFee_v12() throws Exception { public void testFailure_refundableFee_v12() throws Exception {
setEppInput("domain_renew_fee_refundable.xml", FEE_12_MAP); setEppInput("domain_renew_fee_refundable.xml", FEE_12_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v06() throws Exception { public void testFailure_gracePeriodFee_v06() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_06_MAP); setEppInput("domain_renew_fee_grace_period.xml", FEE_06_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v11() throws Exception { public void testFailure_gracePeriodFee_v11() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_11_MAP); setEppInput("domain_renew_fee_grace_period.xml", FEE_11_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v12() throws Exception { public void testFailure_gracePeriodFee_v12() throws Exception {
setEppInput("domain_renew_fee_grace_period.xml", FEE_12_MAP); setEppInput("domain_renew_fee_grace_period.xml", FEE_12_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v06() throws Exception { public void testFailure_appliedFee_v06() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_06_MAP); setEppInput("domain_renew_fee_applied.xml", FEE_06_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v11() throws Exception { public void testFailure_appliedFee_v11() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_11_MAP); setEppInput("domain_renew_fee_applied.xml", FEE_11_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v12() throws Exception { public void testFailure_appliedFee_v12() throws Exception {
setEppInput("domain_renew_fee_applied.xml", FEE_12_MAP); setEppInput("domain_renew_fee_applied.xml", FEE_12_MAP);
persistDomain(); persistDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -404,7 +404,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -412,7 +412,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_existedButWasDeleted() throws Exception { public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -420,7 +420,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_clientRenewProhibited() throws Exception { public void testFailure_clientRenewProhibited() throws Exception {
persistDomain(StatusValue.CLIENT_RENEW_PROHIBITED); persistDomain(StatusValue.CLIENT_RENEW_PROHIBITED);
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("clientRenewProhibited"); assertThat(thrown).hasMessageThat().contains("clientRenewProhibited");
} }
@ -428,7 +428,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_serverRenewProhibited() throws Exception { public void testFailure_serverRenewProhibited() throws Exception {
persistDomain(StatusValue.SERVER_RENEW_PROHIBITED); persistDomain(StatusValue.SERVER_RENEW_PROHIBITED);
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverRenewProhibited"); assertThat(thrown).hasMessageThat().contains("serverRenewProhibited");
} }
@ -440,7 +440,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.addStatusValue(StatusValue.PENDING_DELETE) .addStatusValue(StatusValue.PENDING_DELETE)
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertThat(thrown).hasMessageThat().contains("pendingDelete");
} }
@ -453,7 +453,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20))) .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build()); .build());
persistDomain(); persistDomain();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -465,7 +465,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20))) .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build()); .build());
persistDomain(); persistDomain();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -477,7 +477,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20))) .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build()); .build());
persistDomain(); persistDomain();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -494,7 +494,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistDomain(); persistDomain();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -511,7 +511,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistDomain(); persistDomain();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -528,28 +528,28 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistDomain(); persistDomain();
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
public void testFailure_feeGivenInWrongScale_v06() throws Exception { public void testFailure_feeGivenInWrongScale_v06() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_06_MAP); setEppInput("domain_renew_fee_bad_scale.xml", FEE_06_MAP);
persistDomain(); persistDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
public void testFailure_feeGivenInWrongScale_v11() throws Exception { public void testFailure_feeGivenInWrongScale_v11() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_11_MAP); setEppInput("domain_renew_fee_bad_scale.xml", FEE_11_MAP);
persistDomain(); persistDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
public void testFailure_feeGivenInWrongScale_v12() throws Exception { public void testFailure_feeGivenInWrongScale_v12() throws Exception {
setEppInput("domain_renew_fee_bad_scale.xml", FEE_12_MAP); setEppInput("domain_renew_fee_bad_scale.xml", FEE_12_MAP);
persistDomain(); persistDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
@ -560,7 +560,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRegistrationExpirationTime(DateTime.parse("2001-09-08T22:00:00.0Z")) .setRegistrationExpirationTime(DateTime.parse("2001-09-08T22:00:00.0Z"))
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingTransfer"); assertThat(thrown).hasMessageThat().contains("pendingTransfer");
} }
@ -568,14 +568,14 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_periodInMonths() throws Exception { public void testFailure_periodInMonths() throws Exception {
setEppInput("domain_renew_months.xml"); setEppInput("domain_renew_months.xml");
persistDomain(); persistDomain();
assertThrows(BadPeriodUnitException.class, () -> runFlow()); assertThrows(BadPeriodUnitException.class, this::runFlow);
} }
@Test @Test
public void testFailure_max10Years() throws Exception { public void testFailure_max10Years() throws Exception {
setEppInput("domain_renew_11_years.xml"); setEppInput("domain_renew_11_years.xml");
persistDomain(); persistDomain();
assertThrows(ExceedsMaxRegistrationYearsException.class, () -> runFlow()); assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
} }
@Test @Test
@ -585,14 +585,14 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
persistResource(reloadResourceByForeignKey().asBuilder() persistResource(reloadResourceByForeignKey().asBuilder()
.setRegistrationExpirationTime(DateTime.parse("2000-04-04T22:00:00.0Z")) .setRegistrationExpirationTime(DateTime.parse("2000-04-04T22:00:00.0Z"))
.build()); .build());
assertThrows(IncorrectCurrentExpirationDateException.class, () -> runFlow()); assertThrows(IncorrectCurrentExpirationDateException.class, this::runFlow);
} }
@Test @Test
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -608,7 +608,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistDomain(); persistDomain();
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -626,7 +626,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build()); persistResource(Registry.get("example").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_renew_premium.xml"); setEppInput("domain_renew_premium.xml");
persistDomain(); persistDomain();
assertThrows(FeesRequiredForPremiumNameException.class, () -> runFlow()); assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
} }
@Test @Test

View file

@ -234,63 +234,63 @@ public class DomainRestoreRequestFlowTest extends
public void testFailure_refundableFee_v06() throws Exception { public void testFailure_refundableFee_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_06_MAP); setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_06_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_refundableFee_v11() throws Exception { public void testFailure_refundableFee_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_11_MAP); setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_11_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_refundableFee_v12() throws Exception { public void testFailure_refundableFee_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_12_MAP); setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_12_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v06() throws Exception { public void testFailure_gracePeriodFee_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_06_MAP); setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_06_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v11() throws Exception { public void testFailure_gracePeriodFee_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_11_MAP); setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_11_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_gracePeriodFee_v12() throws Exception { public void testFailure_gracePeriodFee_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_12_MAP); setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_12_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v06() throws Exception { public void testFailure_appliedFee_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_06_MAP); setEppInput("domain_update_restore_request_fee_applied.xml", FEE_06_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v11() throws Exception { public void testFailure_appliedFee_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_11_MAP); setEppInput("domain_update_restore_request_fee_applied.xml", FEE_11_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
public void testFailure_appliedFee_v12() throws Exception { public void testFailure_appliedFee_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_applied.xml", FEE_12_MAP); setEppInput("domain_update_restore_request_fee_applied.xml", FEE_12_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(UnsupportedFeeAttributeException.class, () -> runFlow()); assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
} }
@Test @Test
@ -334,7 +334,7 @@ public class DomainRestoreRequestFlowTest extends
@Test @Test
public void testFailure_doesNotExist() throws Exception { public void testFailure_doesNotExist() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -344,7 +344,7 @@ public class DomainRestoreRequestFlowTest extends
persistPendingDeleteDomain(); persistPendingDeleteDomain();
persistResource( persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build()); Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -353,7 +353,7 @@ public class DomainRestoreRequestFlowTest extends
persistPendingDeleteDomain(); persistPendingDeleteDomain();
persistResource( persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build()); Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
@Test @Test
@ -362,7 +362,7 @@ public class DomainRestoreRequestFlowTest extends
persistPendingDeleteDomain(); persistPendingDeleteDomain();
persistResource( persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build()); Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
private void runWrongCurrencyTest(Map<String, String> substitutions) throws Exception { private void runWrongCurrencyTest(Map<String, String> substitutions) throws Exception {
@ -378,7 +378,7 @@ public class DomainRestoreRequestFlowTest extends
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR))) .setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
assertThrows(CurrencyUnitMismatchException.class, () -> runFlow()); assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
} }
@Test @Test
@ -400,21 +400,21 @@ public class DomainRestoreRequestFlowTest extends
public void testFailure_feeGivenInWrongScale_v06() throws Exception { public void testFailure_feeGivenInWrongScale_v06() throws Exception {
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_06_MAP); setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_06_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
public void testFailure_feeGivenInWrongScale_v11() throws Exception { public void testFailure_feeGivenInWrongScale_v11() throws Exception {
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_11_MAP); setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_11_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
public void testFailure_feeGivenInWrongScale_v12() throws Exception { public void testFailure_feeGivenInWrongScale_v12() throws Exception {
setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_12_MAP); setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_12_MAP);
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(CurrencyValueScaleException.class, () -> runFlow()); assertThrows(CurrencyValueScaleException.class, this::runFlow);
} }
@Test @Test
@ -425,54 +425,54 @@ public class DomainRestoreRequestFlowTest extends
.setDeletionTime(clock.nowUtc().plusDays(4)) .setDeletionTime(clock.nowUtc().plusDays(4))
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE)) .setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
.build()); .build());
assertThrows(DomainNotEligibleForRestoreException.class, () -> runFlow()); assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
} }
@Test @Test
public void testFailure_notDeleted() throws Exception { public void testFailure_notDeleted() throws Exception {
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
assertThrows(DomainNotEligibleForRestoreException.class, () -> runFlow()); assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
} }
@Test @Test
public void testFailure_fullyDeleted() throws Exception { public void testFailure_fullyDeleted() throws Exception {
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
assertThrows(ResourceDoesNotExistException.class, () -> runFlow()); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
} }
@Test @Test
public void testFailure_withChange() throws Exception { public void testFailure_withChange() throws Exception {
persistPendingDeleteDomain(); persistPendingDeleteDomain();
setEppInput("domain_update_restore_request_with_change.xml"); setEppInput("domain_update_restore_request_with_change.xml");
assertThrows(RestoreCommandIncludesChangesException.class, () -> runFlow()); assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
} }
@Test @Test
public void testFailure_withAdd() throws Exception { public void testFailure_withAdd() throws Exception {
persistPendingDeleteDomain(); persistPendingDeleteDomain();
setEppInput("domain_update_restore_request_with_add.xml"); setEppInput("domain_update_restore_request_with_add.xml");
assertThrows(RestoreCommandIncludesChangesException.class, () -> runFlow()); assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
} }
@Test @Test
public void testFailure_withRemove() throws Exception { public void testFailure_withRemove() throws Exception {
persistPendingDeleteDomain(); persistPendingDeleteDomain();
setEppInput("domain_update_restore_request_with_remove.xml"); setEppInput("domain_update_restore_request_with_remove.xml");
assertThrows(RestoreCommandIncludesChangesException.class, () -> runFlow()); assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
} }
@Test @Test
public void testFailure_withSecDnsExtension() throws Exception { public void testFailure_withSecDnsExtension() throws Exception {
persistPendingDeleteDomain(); persistPendingDeleteDomain();
setEppInput("domain_update_restore_request_with_secdns.xml"); setEppInput("domain_update_restore_request_with_secdns.xml");
assertThrows(UnimplementedExtensionException.class, () -> runFlow()); assertThrows(UnimplementedExtensionException.class, this::runFlow);
} }
@Test @Test
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -489,7 +489,7 @@ public class DomainRestoreRequestFlowTest extends
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -508,7 +508,7 @@ public class DomainRestoreRequestFlowTest extends
persistPendingDeleteDomain(); persistPendingDeleteDomain();
// Modify the Registrar to block premium names. // Modify the Registrar to block premium names.
persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build()); persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build());
assertThrows(PremiumNameBlockedException.class, () -> runFlow()); assertThrows(PremiumNameBlockedException.class, this::runFlow);
} }
@Test @Test
@ -520,7 +520,7 @@ public class DomainRestoreRequestFlowTest extends
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED")) .setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
.build()); .build());
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(DomainReservedException.class, () -> runFlow()); assertThrows(DomainReservedException.class, this::runFlow);
} }
@Test @Test
@ -528,7 +528,7 @@ public class DomainRestoreRequestFlowTest extends
createTld("example"); createTld("example");
setEppInput("domain_update_restore_request_premium.xml"); setEppInput("domain_update_restore_request_premium.xml");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
assertThrows(FeesRequiredForPremiumNameException.class, () -> runFlow()); assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
} }
@Test @Test

View file

@ -440,7 +440,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_metadata.xml"); setEppInput("domain_update_metadata.xml");
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(OnlyToolCanPassMetadataException.class, () -> runFlow()); assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
} }
@Test @Test
@ -794,7 +794,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
newDomainResource(getUniqueIdFromCommand()).asBuilder() newDomainResource(getUniqueIdFromCommand()).asBuilder()
.setDsData(builder.build()) .setDsData(builder.build())
.build()); .build());
assertThrows(TooManyDsRecordsException.class, () -> runFlow()); assertThrows(TooManyDsRecordsException.class, this::runFlow);
} }
@Test @Test
@ -804,7 +804,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistDomain(); persistDomain();
// Modify domain so it has 13 nameservers. We will then try to add one in the test. // Modify domain so it has 13 nameservers. We will then try to add one in the test.
modifyDomainToHave13Nameservers(); modifyDomainToHave13Nameservers();
assertThrows(TooManyNameserversException.class, () -> runFlow()); assertThrows(TooManyNameserversException.class, this::runFlow);
} }
@Test @Test
@ -812,14 +812,14 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_wrong_extension.xml"); setEppInput("domain_update_wrong_extension.xml");
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(UnimplementedExtensionException.class, () -> runFlow()); assertThrows(UnimplementedExtensionException.class, this::runFlow);
} }
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
persistReferencedEntities(); persistReferencedEntities();
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -828,7 +828,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReferencedEntities(); persistReferencedEntities();
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -839,7 +839,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistActiveContact("mak21"); persistActiveContact("mak21");
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, () -> runFlow()); expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.foo)"); assertThat(thrown).hasMessageThat().contains("(ns2.example.foo)");
} }
@ -850,7 +850,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistActiveContact("mak21"); persistActiveContact("mak21");
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, () -> runFlow()); expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)"); assertThat(thrown).hasMessageThat().contains("(sh8013)");
} }
@ -867,7 +867,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
DesignatedContact.create(Type.TECH, Key.create( DesignatedContact.create(Type.TECH, Key.create(
loadByForeignKey(ContactResource.class, "foo", clock.nowUtc()))))) loadByForeignKey(ContactResource.class, "foo", clock.nowUtc())))))
.build()); .build());
assertThrows(DuplicateContactForRoleException.class, () -> runFlow()); assertThrows(DuplicateContactForRoleException.class, this::runFlow);
} }
@Test @Test
@ -875,7 +875,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_prohibited_status.xml"); setEppInput("domain_update_prohibited_status.xml");
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(StatusNotClientSettableException.class, () -> runFlow()); assertThrows(StatusNotClientSettableException.class, this::runFlow);
} }
@Test @Test
@ -935,7 +935,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
newDomainResource(getUniqueIdFromCommand()).asBuilder() newDomainResource(getUniqueIdFromCommand()).asBuilder()
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)) .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.build()); .build());
assertThrows(ResourceHasClientUpdateProhibitedException.class, () -> runFlow()); assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
} }
@Test @Test
@ -946,7 +946,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setStatusValues(ImmutableSet.of(SERVER_UPDATE_PROHIBITED)) .setStatusValues(ImmutableSet.of(SERVER_UPDATE_PROHIBITED))
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited"); assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
} }
@ -959,7 +959,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.addStatusValue(StatusValue.PENDING_DELETE) .addStatusValue(StatusValue.PENDING_DELETE)
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertThat(thrown).hasMessageThat().contains("pendingDelete");
} }
@ -968,7 +968,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_duplicate_contact.xml"); setEppInput("domain_update_duplicate_contact.xml");
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(DuplicateContactForRoleException.class, () -> runFlow()); assertThrows(DuplicateContactForRoleException.class, this::runFlow);
} }
@Test @Test
@ -977,7 +977,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_missing_contact_type.xml"); setEppInput("domain_update_missing_contact_type.xml");
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(MissingContactTypeException.class, () -> runFlow()); assertThrows(MissingContactTypeException.class, this::runFlow);
} }
@Test @Test
@ -985,7 +985,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -1004,7 +1004,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(NotAuthorizedForTldException.class, () -> runFlow()); assertThrows(NotAuthorizedForTldException.class, this::runFlow);
} }
@Test @Test
@ -1027,7 +1027,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setNameservers(ImmutableSet.of(Key.create( .setNameservers(ImmutableSet.of(Key.create(
loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc())))) loadByForeignKey(HostResource.class, "ns1.example.foo", clock.nowUtc()))))
.build()); .build());
assertThrows(AddRemoveSameValueException.class, () -> runFlow()); assertThrows(AddRemoveSameValueException.class, this::runFlow);
} }
@Test @Test
@ -1041,7 +1041,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
Key.create( Key.create(
loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc()))))) loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc())))))
.build()); .build());
assertThrows(AddRemoveSameValueException.class, () -> runFlow()); assertThrows(AddRemoveSameValueException.class, this::runFlow);
} }
@Test @Test
@ -1054,7 +1054,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)), DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)))) DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
.build()); .build());
assertThrows(MissingAdminContactException.class, () -> runFlow()); assertThrows(MissingAdminContactException.class, this::runFlow);
} }
@Test @Test
@ -1067,7 +1067,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)), DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)),
DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)))) DesignatedContact.create(Type.TECH, Key.create(sh8013Contact))))
.build()); .build());
assertThrows(MissingTechnicalContactException.class, () -> runFlow()); assertThrows(MissingTechnicalContactException.class, this::runFlow);
} }
@Test @Test
@ -1083,7 +1083,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
clock.advanceOneMilli(); clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown = LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows( expectThrows(
LinkedResourceInPendingDeleteProhibitsOperationException.class, () -> runFlow()); LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("mak21"); assertThat(thrown).hasMessageThat().contains("mak21");
} }
@ -1101,7 +1101,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
clock.advanceOneMilli(); clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown = LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows( expectThrows(
LinkedResourceInPendingDeleteProhibitsOperationException.class, () -> runFlow()); LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo"); assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
} }
@ -1114,7 +1114,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setAllowedRegistrantContactIds(ImmutableSet.of("contact1234")) .setAllowedRegistrantContactIds(ImmutableSet.of("contact1234"))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(RegistrantNotAllowedException.class, () -> runFlow()); assertThrows(RegistrantNotAllowedException.class, this::runFlow);
} }
@Test @Test
@ -1126,7 +1126,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo")) .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
assertThrows(NameserversNotAllowedForTldException.class, () -> runFlow()); assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
} }
@Test @Test
@ -1209,7 +1209,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo")) .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo"))
.build()); .build());
assertThrows( assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, () -> runFlow()); NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
} }
@Test @Test
@ -1238,7 +1238,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns3.example.foo")) "reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns3.example.foo"))
.build()); .build());
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo"); assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
} }
@ -1255,7 +1255,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo")) "reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
.build()); .build());
assertThrows( assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, () -> runFlow()); NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
} }
@Test @Test
@ -1300,7 +1300,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns3.example.foo")) "reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns3.example.foo"))
.build()); .build());
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo"); assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
} }
@ -1335,7 +1335,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReservedList("reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo")) persistReservedList("reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo"))
.build()); .build());
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo"); assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
} }
@ -1353,7 +1353,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo")) "reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
.build()); .build());
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, () -> runFlow()); expectThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.foo"); assertThat(thrown).hasMessageThat().contains("ns2.example.foo");
} }
@ -1372,7 +1372,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReservedList( persistReservedList(
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo")) "reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
.build()); .build());
assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, () -> runFlow()); assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
} }
@Test @Test
@ -1387,7 +1387,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
persistReservedList( persistReservedList(
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo")) "reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
.build()); .build());
assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, () -> runFlow()); assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
} }
@Test @Test
@ -1441,7 +1441,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11")); setEppInput("domain_update_fee.xml", ImmutableMap.of("FEE_VERSION", "0.11"));
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(FeesMismatchException.class, () -> runFlow()); assertThrows(FeesMismatchException.class, this::runFlow);
} }
// This test should throw an exception, because the fee extension is required when the fee is not // This test should throw an exception, because the fee extension is required when the fee is not
@ -1451,7 +1451,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
setEppInput("domain_update_wildcard.xml", ImmutableMap.of("DOMAIN", "non-free-update.tld")); setEppInput("domain_update_wildcard.xml", ImmutableMap.of("DOMAIN", "non-free-update.tld"));
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
assertThrows(FeesRequiredForNonFreeOperationException.class, () -> runFlow()); assertThrows(FeesRequiredForNonFreeOperationException.class, this::runFlow);
} }
@Test @Test

View file

@ -76,7 +76,7 @@ public class HostCheckFlowTest extends ResourceCheckFlowTestCase<HostCheckFlow,
@Test @Test
public void testTooManyIds() throws Exception { public void testTooManyIds() throws Exception {
setEppInput("host_check_51.xml"); setEppInput("host_check_51.xml");
assertThrows(TooManyResourceChecksException.class, () -> runFlow()); assertThrows(TooManyResourceChecksException.class, this::runFlow);
} }
@Test @Test

View file

@ -126,7 +126,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
createTlds("bar.tld", "tld"); createTlds("bar.tld", "tld");
setEppHostCreateInputWithIps("ns1.bar.tld"); setEppHostCreateInputWithIps("ns1.bar.tld");
assertThrows(HostNameTooShallowException.class, () -> runFlow()); assertThrows(HostNameTooShallowException.class, this::runFlow);
} }
@Test @Test
@ -154,7 +154,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
setEppHostCreateInput("ns1.example.tld", null); setEppHostCreateInput("ns1.example.tld", null);
createTld("tld"); createTld("tld");
persistActiveDomain("example.tld"); persistActiveDomain("example.tld");
assertThrows(SubordinateHostMustHaveIpException.class, () -> runFlow()); assertThrows(SubordinateHostMustHaveIpException.class, this::runFlow);
} }
@Test @Test
@ -162,7 +162,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
setEppHostCreateInputWithIps("ns1.example.external"); setEppHostCreateInputWithIps("ns1.example.external");
createTld("tld"); createTld("tld");
persistActiveDomain("example.tld"); persistActiveDomain("example.tld");
assertThrows(UnexpectedExternalHostIpException.class, () -> runFlow()); assertThrows(UnexpectedExternalHostIpException.class, this::runFlow);
} }
@Test @Test
@ -170,7 +170,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
setEppHostCreateInput("ns1.example.tld", null); setEppHostCreateInput("ns1.example.tld", null);
createTld("tld"); createTld("tld");
SuperordinateDomainDoesNotExistException thrown = SuperordinateDomainDoesNotExistException thrown =
expectThrows(SuperordinateDomainDoesNotExistException.class, () -> runFlow()); expectThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(example.tld)"); assertThat(thrown).hasMessageThat().contains("(example.tld)");
} }
@ -185,7 +185,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
SuperordinateDomainInPendingDeleteException thrown = SuperordinateDomainInPendingDeleteException thrown =
expectThrows(SuperordinateDomainInPendingDeleteException.class, () -> runFlow()); expectThrows(SuperordinateDomainInPendingDeleteException.class, this::runFlow);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Superordinate domain for this hostname is in pending delete"); .contains("Superordinate domain for this hostname is in pending delete");
@ -196,7 +196,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
setEppHostCreateInput("ns1.example.tld", null); setEppHostCreateInput("ns1.example.tld", null);
persistActiveHost(getUniqueIdFromCommand()); persistActiveHost(getUniqueIdFromCommand());
ResourceAlreadyExistsException thrown = ResourceAlreadyExistsException thrown =
expectThrows(ResourceAlreadyExistsException.class, () -> runFlow()); expectThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains( .contains(
@ -206,27 +206,27 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
@Test @Test
public void testFailure_nonLowerCaseHostname() throws Exception { public void testFailure_nonLowerCaseHostname() throws Exception {
setEppHostCreateInput("ns1.EXAMPLE.tld", null); setEppHostCreateInput("ns1.EXAMPLE.tld", null);
assertThrows(HostNameNotLowerCaseException.class, () -> runFlow()); assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_nonPunyCodedHostname() throws Exception { public void testFailure_nonPunyCodedHostname() throws Exception {
setEppHostCreateInput("ns1.çauçalito.みんな", null); setEppHostCreateInput("ns1.çauçalito.みんな", null);
HostNameNotPunyCodedException thrown = HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, () -> runFlow()); expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.xn--q9jyb4c"); assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.xn--q9jyb4c");
} }
@Test @Test
public void testFailure_nonCanonicalHostname() throws Exception { public void testFailure_nonCanonicalHostname() throws Exception {
setEppHostCreateInput("ns1.example.tld.", null); setEppHostCreateInput("ns1.example.tld.", null);
assertThrows(HostNameNotNormalizedException.class, () -> runFlow()); assertThrows(HostNameNotNormalizedException.class, this::runFlow);
} }
@Test @Test
public void testFailure_longHostName() throws Exception { public void testFailure_longHostName() throws Exception {
setEppHostCreateInputWithIps("a" + Strings.repeat(".labelpart", 25) + ".tld"); setEppHostCreateInputWithIps("a" + Strings.repeat(".labelpart", 25) + ".tld");
assertThrows(HostNameTooLongException.class, () -> runFlow()); assertThrows(HostNameTooLongException.class, this::runFlow);
} }
@Test @Test
@ -236,7 +236,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
"<host:addr ip=\"v4\">192.0.2.2</host:addr>\n" "<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\">192.0.2.29</host:addr>\n"
+ "<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>"); + "<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>");
assertThrows(IpAddressVersionMismatchException.class, () -> runFlow()); assertThrows(IpAddressVersionMismatchException.class, this::runFlow);
} }
private void doFailingHostNameTest(String hostName, Class<? extends Throwable> exception) private void doFailingHostNameTest(String hostName, Class<? extends Throwable> exception)
@ -279,7 +279,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
public void testFailure_ccTldInBailiwick() throws Exception { public void testFailure_ccTldInBailiwick() throws Exception {
createTld("co.uk"); createTld("co.uk");
setEppHostCreateInputWithIps("foo.co.uk"); setEppHostCreateInputWithIps("foo.co.uk");
assertThrows(HostNameTooShallowException.class, () -> runFlow()); assertThrows(HostNameTooShallowException.class, this::runFlow);
} }
@Test @Test

View file

@ -85,7 +85,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)"); assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)");
} }
@ -93,7 +93,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
public void testFailure_existedButWasDeleted() throws Exception { public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedHost("ns1.example.tld", clock.nowUtc().minusDays(1)); persistDeletedHost("ns1.example.tld", clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)"); assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)");
} }
@ -130,7 +130,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistActiveHost("ns1.example.tld"); persistActiveHost("ns1.example.tld");
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -181,7 +181,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't help. .setPersistedCurrentSponsorClientId("TheRegistrar") // Shouldn't help.
.setSuperordinateDomain(Key.create(domain)) .setSuperordinateDomain(Key.create(domain))
.build()); .build());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -236,7 +236,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help. .setPersistedCurrentSponsorClientId("NewRegistrar") // Shouldn't help.
.setSuperordinateDomain(Key.create(domain)) .setSuperordinateDomain(Key.create(domain))
.build()); .build());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -246,7 +246,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setNameservers(ImmutableSet.of( .setNameservers(ImmutableSet.of(
Key.create(persistActiveHost("ns1.example.tld")))) Key.create(persistActiveHost("ns1.example.tld"))))
.build()); .build());
assertThrows(ResourceToDeleteIsReferencedException.class, () -> runFlow()); assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
} }
@Test @Test
@ -256,27 +256,27 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.setNameservers(ImmutableSet.of( .setNameservers(ImmutableSet.of(
Key.create(persistActiveHost("ns1.example.tld")))) Key.create(persistActiveHost("ns1.example.tld"))))
.build()); .build());
assertThrows(ResourceToDeleteIsReferencedException.class, () -> runFlow()); assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
} }
@Test @Test
public void testFailure_nonLowerCaseHostname() throws Exception { public void testFailure_nonLowerCaseHostname() throws Exception {
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET")); setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET"));
assertThrows(HostNameNotLowerCaseException.class, () -> runFlow()); assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_nonPunyCodedHostname() throws Exception { public void testFailure_nonPunyCodedHostname() throws Exception {
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld")); setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld"));
HostNameNotPunyCodedException thrown = HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, () -> runFlow()); expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld"); assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
} }
@Test @Test
public void testFailure_nonCanonicalHostname() throws Exception { public void testFailure_nonCanonicalHostname() throws Exception {
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld.")); setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld."));
assertThrows(HostNameNotNormalizedException.class, () -> runFlow()); assertThrows(HostNameNotNormalizedException.class, this::runFlow);
} }
@Test @Test

View file

@ -147,7 +147,7 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -156,28 +156,28 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
persistResource( persistResource(
persistHostResource().asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); persistHostResource().asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@Test @Test
public void testFailure_nonLowerCaseHostname() throws Exception { public void testFailure_nonLowerCaseHostname() throws Exception {
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET")); setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "NS1.EXAMPLE.NET"));
assertThrows(HostNameNotLowerCaseException.class, () -> runFlow()); assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_nonPunyCodedHostname() throws Exception { public void testFailure_nonPunyCodedHostname() throws Exception {
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld")); setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld"));
HostNameNotPunyCodedException thrown = HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, () -> runFlow()); expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld"); assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
} }
@Test @Test
public void testFailure_nonCanonicalHostname() throws Exception { public void testFailure_nonCanonicalHostname() throws Exception {
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld.")); setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld."));
assertThrows(HostNameNotNormalizedException.class, () -> runFlow()); assertThrows(HostNameNotNormalizedException.class, this::runFlow);
} }
@Test @Test

View file

@ -408,7 +408,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
null, null,
null); null);
persistActiveHost(oldHostName()); persistActiveHost(oldHostName());
assertThrows(CannotRenameExternalHostException.class, () -> runFlow()); assertThrows(CannotRenameExternalHostException.class, this::runFlow);
} }
@Test @Test
@ -760,7 +760,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
createTld("tld"); createTld("tld");
persistActiveHost(oldHostName()); persistActiveHost(oldHostName());
SuperordinateDomainDoesNotExistException thrown = SuperordinateDomainDoesNotExistException thrown =
expectThrows(SuperordinateDomainDoesNotExistException.class, () -> runFlow()); expectThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(example.tld)"); assertThat(thrown).hasMessageThat().contains("(example.tld)");
} }
@ -781,7 +781,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveSubordinateHost(oldHostName(), domain); persistActiveSubordinateHost(oldHostName(), domain);
clock.advanceOneMilli(); clock.advanceOneMilli();
SuperordinateDomainInPendingDeleteException thrown = SuperordinateDomainInPendingDeleteException thrown =
expectThrows(SuperordinateDomainInPendingDeleteException.class, () -> runFlow()); expectThrows(SuperordinateDomainInPendingDeleteException.class, this::runFlow);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Superordinate domain for this hostname is in pending delete"); .contains("Superordinate domain for this hostname is in pending delete");
@ -790,7 +790,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
@Test @Test
public void testFailure_neverExisted() throws Exception { public void testFailure_neverExisted() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -798,7 +798,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_neverExisted_updateWithoutNameChange() throws Exception { public void testFailure_neverExisted_updateWithoutNameChange() throws Exception {
setEppInput("host_update_name_unchanged.xml"); setEppInput("host_update_name_unchanged.xml");
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -806,7 +806,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_existedButWasDeleted() throws Exception { public void testFailure_existedButWasDeleted() throws Exception {
persistDeletedHost(oldHostName(), clock.nowUtc().minusDays(1)); persistDeletedHost(oldHostName(), clock.nowUtc().minusDays(1));
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, () -> runFlow()); expectThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -817,7 +817,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
clock.advanceOneMilli(); clock.advanceOneMilli();
setEppHostUpdateInput("ns1.example.tld", "ns1.example.tld", null, null); setEppHostUpdateInput("ns1.example.tld", "ns1.example.tld", null, null);
HostAlreadyExistsException thrown = HostAlreadyExistsException thrown =
expectThrows(HostAlreadyExistsException.class, () -> runFlow()); expectThrows(HostAlreadyExistsException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.tld"); assertThat(thrown).hasMessageThat().contains("ns1.example.tld");
} }
@ -827,28 +827,28 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
persistActiveHost("ns2.example.tld"); persistActiveHost("ns2.example.tld");
HostAlreadyExistsException thrown = HostAlreadyExistsException thrown =
expectThrows(HostAlreadyExistsException.class, () -> runFlow()); expectThrows(HostAlreadyExistsException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.tld"); assertThat(thrown).hasMessageThat().contains("ns2.example.tld");
} }
@Test @Test
public void testFailure_referToNonLowerCaseHostname() throws Exception { public void testFailure_referToNonLowerCaseHostname() throws Exception {
setEppHostUpdateInput("ns1.EXAMPLE.tld", "ns2.example.tld", null, null); setEppHostUpdateInput("ns1.EXAMPLE.tld", "ns2.example.tld", null, null);
assertThrows(HostNameNotLowerCaseException.class, () -> runFlow()); assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_renameToNonLowerCaseHostname() throws Exception { public void testFailure_renameToNonLowerCaseHostname() throws Exception {
persistActiveHost("ns1.example.tld"); persistActiveHost("ns1.example.tld");
setEppHostUpdateInput("ns1.example.tld", "ns2.EXAMPLE.tld", null, null); setEppHostUpdateInput("ns1.example.tld", "ns2.EXAMPLE.tld", null, null);
assertThrows(HostNameNotLowerCaseException.class, () -> runFlow()); assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
} }
@Test @Test
public void testFailure_referToNonPunyCodedHostname() throws Exception { public void testFailure_referToNonPunyCodedHostname() throws Exception {
setEppHostUpdateInput("ns1.çauçalito.tld", "ns1.sausalito.tld", null, null); setEppHostUpdateInput("ns1.çauçalito.tld", "ns1.sausalito.tld", null, null);
HostNameNotPunyCodedException thrown = HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, () -> runFlow()); expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld"); assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
} }
@ -857,7 +857,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveHost("ns1.sausalito.tld"); persistActiveHost("ns1.sausalito.tld");
setEppHostUpdateInput("ns1.sausalito.tld", "ns1.çauçalito.tld", null, null); setEppHostUpdateInput("ns1.sausalito.tld", "ns1.çauçalito.tld", null, null);
HostNameNotPunyCodedException thrown = HostNameNotPunyCodedException thrown =
expectThrows(HostNameNotPunyCodedException.class, () -> runFlow()); expectThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld"); assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
} }
@ -865,14 +865,14 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_referToNonCanonicalHostname() throws Exception { public void testFailure_referToNonCanonicalHostname() throws Exception {
persistActiveHost("ns1.example.tld."); persistActiveHost("ns1.example.tld.");
setEppHostUpdateInput("ns1.example.tld.", "ns2.example.tld", null, null); setEppHostUpdateInput("ns1.example.tld.", "ns2.example.tld", null, null);
assertThrows(HostNameNotNormalizedException.class, () -> runFlow()); assertThrows(HostNameNotNormalizedException.class, this::runFlow);
} }
@Test @Test
public void testFailure_renameToNonCanonicalHostname() throws Exception { public void testFailure_renameToNonCanonicalHostname() throws Exception {
persistActiveHost("ns1.example.tld"); persistActiveHost("ns1.example.tld");
setEppHostUpdateInput("ns1.example.tld", "ns2.example.tld.", null, null); setEppHostUpdateInput("ns1.example.tld", "ns2.example.tld.", null, null);
assertThrows(HostNameNotNormalizedException.class, () -> runFlow()); assertThrows(HostNameNotNormalizedException.class, this::runFlow);
} }
@Test @Test
@ -884,7 +884,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
"<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>"); "<host:addr ip=\"v6\">1080:0:0:0:8:800:200C:417A</host:addr>");
createTld("tld"); createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
assertThrows(CannotRemoveSubordinateHostLastIpException.class, () -> runFlow()); assertThrows(CannotRemoveSubordinateHostLastIpException.class, this::runFlow);
} }
@Test @Test
@ -896,7 +896,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
null); null);
createTld("tld"); createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
assertThrows(RenameHostToExternalRemoveIpException.class, () -> runFlow()); assertThrows(RenameHostToExternalRemoveIpException.class, this::runFlow);
} }
@Test @Test
@ -908,7 +908,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
null); null);
createTld("tld"); createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
assertThrows(CannotAddIpToExternalHostException.class, () -> runFlow()); assertThrows(CannotAddIpToExternalHostException.class, this::runFlow);
} }
@Test @Test
@ -921,7 +921,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
"<host:status s=\"clientUpdateProhibited\"/>", "<host:status s=\"clientUpdateProhibited\"/>",
"<host:status s=\"clientUpdateProhibited\"/>"); "<host:status s=\"clientUpdateProhibited\"/>");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
assertThrows(AddRemoveSameValueException.class, () -> runFlow()); assertThrows(AddRemoveSameValueException.class, this::runFlow);
} }
@Test @Test
@ -933,7 +933,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
"ns2.example.tld", "ns2.example.tld",
"<host:addr ip=\"v4\">192.0.2.22</host:addr>", "<host:addr ip=\"v4\">192.0.2.22</host:addr>",
"<host:addr ip=\"v4\">192.0.2.22</host:addr>"); "<host:addr ip=\"v4\">192.0.2.22</host:addr>");
assertThrows(AddRemoveSameValueException.class, () -> runFlow()); assertThrows(AddRemoveSameValueException.class, this::runFlow);
} }
@Test @Test
@ -957,7 +957,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)) .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld"))) .setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
.build()); .build());
assertThrows(ResourceHasClientUpdateProhibitedException.class, () -> runFlow()); assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
} }
@Test @Test
@ -969,7 +969,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld"))) .setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited"); assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
} }
@ -982,7 +982,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld"))) .setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
.build()); .build());
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, () -> runFlow()); expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertThat(thrown).hasMessageThat().contains("pendingDelete");
} }
@ -991,7 +991,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
createTld("tld"); createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
setEppInput("host_update_prohibited_status.xml"); setEppInput("host_update_prohibited_status.xml");
assertThrows(StatusNotClientSettableException.class, () -> runFlow()); assertThrows(StatusNotClientSettableException.class, this::runFlow);
} }
@Test @Test
@ -1012,7 +1012,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistActiveHost("ns1.example.tld"); persistActiveHost("ns1.example.tld");
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -1059,7 +1059,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1"))) .setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
.build()); .build());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -1092,7 +1092,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1"))) .setInetAddresses(ImmutableSet.of(InetAddresses.forString("127.0.0.1")))
.build()); .build());
assertThrows(ResourceNotOwnedException.class, () -> runFlow()); assertThrows(ResourceNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -1112,7 +1112,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.foo"));
assertAboutHosts().that(host).hasPersistedCurrentSponsorClientId("TheRegistrar"); assertAboutHosts().that(host).hasPersistedCurrentSponsorClientId("TheRegistrar");
assertThrows(HostDomainNotOwnedException.class, () -> runFlow()); assertThrows(HostDomainNotOwnedException.class, this::runFlow);
} }
@Test @Test
@ -1132,7 +1132,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
assertAboutDomains().that(domain).hasPersistedCurrentSponsorClientId("TheRegistrar"); assertAboutDomains().that(domain).hasPersistedCurrentSponsorClientId("TheRegistrar");
assertAboutHosts().that(host).hasPersistedCurrentSponsorClientId("TheRegistrar"); assertAboutHosts().that(host).hasPersistedCurrentSponsorClientId("TheRegistrar");
assertThrows(HostDomainNotOwnedException.class, () -> runFlow()); assertThrows(HostDomainNotOwnedException.class, this::runFlow);
} }
@Test @Test

View file

@ -221,6 +221,6 @@ public class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
public void testFailure_messageIdProvided() throws Exception { public void testFailure_messageIdProvided() throws Exception {
setEppInput("poll_with_id.xml"); setEppInput("poll_with_id.xml");
assertTransactionalFlow(false); assertTransactionalFlow(false);
assertThrows(UnexpectedMessageIdException.class, () -> runFlow()); assertThrows(UnexpectedMessageIdException.class, this::runFlow);
} }
} }

View file

@ -44,6 +44,6 @@ public class LogoutFlowTest extends FlowTestCase<LogoutFlow> {
@Test @Test
public void testFailure() throws Exception { public void testFailure() throws Exception {
sessionMetadata.setClientId(null); // Turn off the implicit login sessionMetadata.setClientId(null); // Turn off the implicit login
assertThrows(NotLoggedInException.class, () -> runFlow()); assertThrows(NotLoggedInException.class, this::runFlow);
} }
} }

View file

@ -165,7 +165,7 @@ public class TimedTransitionPropertyTest {
timedString = forMapify("0", StringTimedTransition.class); timedString = forMapify("0", StringTimedTransition.class);
// Simulate a load from Datastore by clearing, but don't insert any transitions. // Simulate a load from Datastore by clearing, but don't insert any transitions.
timedString.clear(); timedString.clear();
assertThrows(IllegalStateException.class, () -> timedString.checkValidity()); assertThrows(IllegalStateException.class, timedString::checkValidity);
} }
@Test @Test
@ -177,6 +177,6 @@ public class TimedTransitionPropertyTest {
// omit a transition corresponding to START_OF_TIME. // omit a transition corresponding to START_OF_TIME.
timedString.clear(); timedString.clear();
timedString.put(DATE_1, transition1); timedString.put(DATE_1, transition1);
assertThrows(IllegalStateException.class, () -> timedString.checkValidity()); assertThrows(IllegalStateException.class, timedString::checkValidity);
} }
} }

View file

@ -159,7 +159,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
createTldWithEscrowEnabled("lol"); createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ")); clock.setTo(DateTime.parse("2000-01-01TZ"));
action.modeStrings = ImmutableSet.of("full"); action.modeStrings = ImmutableSet.of("full");
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -167,7 +167,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
createTldWithEscrowEnabled("lol"); createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ")); clock.setTo(DateTime.parse("2000-01-01TZ"));
action.tlds = ImmutableSet.of("tld"); action.tlds = ImmutableSet.of("tld");
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -175,7 +175,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
createTldWithEscrowEnabled("lol"); createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ")); clock.setTo(DateTime.parse("2000-01-01TZ"));
action.watermarks = ImmutableSet.of(clock.nowUtc()); action.watermarks = ImmutableSet.of(clock.nowUtc());
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -183,7 +183,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
createTldWithEscrowEnabled("lol"); createTldWithEscrowEnabled("lol");
clock.setTo(DateTime.parse("2000-01-01TZ")); clock.setTo(DateTime.parse("2000-01-01TZ"));
action.revision = Optional.of(42); action.revision = Optional.of(42);
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -241,7 +241,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
action.modeStrings = ImmutableSet.of(); action.modeStrings = ImmutableSet.of();
action.tlds = ImmutableSet.of("lol"); action.tlds = ImmutableSet.of("lol");
action.watermarks = ImmutableSet.of(clock.nowUtc()); action.watermarks = ImmutableSet.of(clock.nowUtc());
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -253,7 +253,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
action.modeStrings = ImmutableSet.of("full", "thing"); action.modeStrings = ImmutableSet.of("full", "thing");
action.tlds = ImmutableSet.of("lol"); action.tlds = ImmutableSet.of("lol");
action.watermarks = ImmutableSet.of(clock.nowUtc()); action.watermarks = ImmutableSet.of(clock.nowUtc());
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -265,7 +265,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
action.modeStrings = ImmutableSet.of("full"); action.modeStrings = ImmutableSet.of("full");
action.tlds = ImmutableSet.of(); action.tlds = ImmutableSet.of();
action.watermarks = ImmutableSet.of(clock.nowUtc()); action.watermarks = ImmutableSet.of(clock.nowUtc());
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -277,7 +277,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
action.modeStrings = ImmutableSet.of("full"); action.modeStrings = ImmutableSet.of("full");
action.tlds = ImmutableSet.of("lol"); action.tlds = ImmutableSet.of("lol");
action.watermarks = ImmutableSet.of(); action.watermarks = ImmutableSet.of();
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -289,7 +289,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
action.modeStrings = ImmutableSet.of("full"); action.modeStrings = ImmutableSet.of("full");
action.tlds = ImmutableSet.of("lol"); action.tlds = ImmutableSet.of("lol");
action.watermarks = ImmutableSet.of(DateTime.parse("2001-01-01T01:36:45Z")); action.watermarks = ImmutableSet.of(DateTime.parse("2001-01-01T01:36:45Z"));
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test
@ -302,7 +302,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
action.tlds = ImmutableSet.of("lol"); action.tlds = ImmutableSet.of("lol");
action.watermarks = ImmutableSet.of(DateTime.parse("2001-01-01T00:00:00Z")); action.watermarks = ImmutableSet.of(DateTime.parse("2001-01-01T00:00:00Z"));
action.revision = Optional.of(-1); action.revision = Optional.of(-1);
assertThrows(BadRequestException.class, () -> action.run()); assertThrows(BadRequestException.class, action::run);
} }
@Test @Test

View file

@ -199,7 +199,7 @@ public class NordnUploadActionTest {
public void testFailure_nullRegistryUser() throws Exception { public void testFailure_nullRegistryUser() throws Exception {
persistClaimsModeDomain(); persistClaimsModeDomain();
persistResource(Registry.get("tld").asBuilder().setLordnUsername(null).build()); persistResource(Registry.get("tld").asBuilder().setLordnUsername(null).build());
VerifyException thrown = expectThrows(VerifyException.class, () -> action.run()); VerifyException thrown = expectThrows(VerifyException.class, action::run);
assertThat(thrown).hasMessageThat().contains("lordnUsername is not set for tld."); assertThat(thrown).hasMessageThat().contains("lordnUsername is not set for tld.");
} }
@ -207,7 +207,7 @@ public class NordnUploadActionTest {
public void testFetchFailure() throws Exception { public void testFetchFailure() throws Exception {
persistClaimsModeDomain(); persistClaimsModeDomain();
when(httpResponse.getResponseCode()).thenReturn(SC_INTERNAL_SERVER_ERROR); when(httpResponse.getResponseCode()).thenReturn(SC_INTERNAL_SERVER_ERROR);
assertThrows(UrlFetchException.class, () -> action.run()); assertThrows(UrlFetchException.class, action::run);
} }
private HTTPRequest getCapturedHttpRequest() throws Exception { private HTTPRequest getCapturedHttpRequest() throws Exception {

View file

@ -165,13 +165,13 @@ public class NordnVerifyActionTest {
@Test @Test
public void failureVerifyUnauthorized() throws Exception { public void failureVerifyUnauthorized() throws Exception {
when(httpResponse.getResponseCode()).thenReturn(SC_UNAUTHORIZED); when(httpResponse.getResponseCode()).thenReturn(SC_UNAUTHORIZED);
assertThrows(Exception.class, () -> action.run()); assertThrows(Exception.class, action::run);
} }
@Test @Test
public void failureVerifyNotReady() throws Exception { public void failureVerifyNotReady() throws Exception {
when(httpResponse.getResponseCode()).thenReturn(SC_NO_CONTENT); when(httpResponse.getResponseCode()).thenReturn(SC_NO_CONTENT);
ConflictException thrown = expectThrows(ConflictException.class, () -> action.run()); ConflictException thrown = expectThrows(ConflictException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Not ready"); assertThat(thrown).hasMessageThat().contains("Not ready");
} }
} }

View file

@ -85,7 +85,7 @@ public class DeleteEntityActionTest {
Entity entity = new Entity("not", "here"); Entity entity = new Entity("not", "here");
String rawKey = KeyFactory.keyToString(entity.getKey()); String rawKey = KeyFactory.keyToString(entity.getKey());
action.rawKeys = rawKey; action.rawKeys = rawKey;
BadRequestException thrown = expectThrows(BadRequestException.class, () -> action.run()); BadRequestException thrown = expectThrows(BadRequestException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Could not find entity with key " + rawKey); assertThat(thrown).hasMessageThat().contains("Could not find entity with key " + rawKey);
} }
@ -97,7 +97,7 @@ public class DeleteEntityActionTest {
Entity entity = new Entity("non", "existent"); Entity entity = new Entity("non", "existent");
String rawKey = KeyFactory.keyToString(entity.getKey()); String rawKey = KeyFactory.keyToString(entity.getKey());
action.rawKeys = String.format("%s,%s", ofyKey, rawKey); action.rawKeys = String.format("%s,%s", ofyKey, rawKey);
BadRequestException thrown = expectThrows(BadRequestException.class, () -> action.run()); BadRequestException thrown = expectThrows(BadRequestException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Could not find entity with key " + rawKey); assertThat(thrown).hasMessageThat().contains("Could not find entity with key " + rawKey);
} }
} }