Merge JUnitBackport's expectThrows into assertThrows

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

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

View file

@ -25,7 +25,7 @@ import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
import static google.registry.testing.DatastoreHelper.persistDomainAsDeleted; import static google.registry.testing.DatastoreHelper.persistDomainAsDeleted;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
@ -207,7 +207,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
.setCreationTimeForTest(DateTime.now(UTC).minusYears(1)) .setCreationTimeForTest(DateTime.now(UTC).minusYears(1))
.build()); .build());
action.registryAdminClientId = null; action.registryAdminClientId = null;
IllegalStateException thrown = expectThrows(IllegalStateException.class, this::runMapreduce); IllegalStateException thrown = assertThrows(IllegalStateException.class, this::runMapreduce);
assertThat(thrown).hasMessageThat().contains("Registry admin client ID must be configured"); assertThat(thrown).hasMessageThat().contains("Registry admin client ID must be configured");
} }

View file

@ -28,7 +28,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveDomain;
import static google.registry.testing.DatastoreHelper.persistDeletedDomain; import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD; import static org.joda.money.CurrencyUnit.USD;
@ -646,7 +646,7 @@ public class ExpandRecurringBillingEventsActionTest
public void testFailure_cursorAfterExecutionTime() throws Exception { public void testFailure_cursorAfterExecutionTime() throws Exception {
action.cursorTimeParam = Optional.of(clock.nowUtc().plusYears(1)); action.cursorTimeParam = Optional.of(clock.nowUtc().plusYears(1));
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, this::runMapreduce); assertThrows(IllegalArgumentException.class, this::runMapreduce);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Cursor time must be earlier than execution time."); .contains("Cursor time must be earlier than execution time.");
@ -657,7 +657,7 @@ public class ExpandRecurringBillingEventsActionTest
// The clock advances one milli on runMapreduce. // The clock advances one milli on runMapreduce.
action.cursorTimeParam = Optional.of(clock.nowUtc().plusMillis(1)); action.cursorTimeParam = Optional.of(clock.nowUtc().plusMillis(1));
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, this::runMapreduce); assertThrows(IllegalArgumentException.class, this::runMapreduce);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Cursor time must be earlier than execution time."); .contains("Cursor time must be earlier than execution time.");

View file

@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistActiveDomain;
import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost; import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -96,7 +96,7 @@ public final class DnsInjectionTest {
when(req.getParameter("type")).thenReturn("domain"); when(req.getParameter("type")).thenReturn("domain");
when(req.getParameter("name")).thenReturn("example.lol"); when(req.getParameter("name")).thenReturn("example.lol");
NotFoundException thrown = NotFoundException thrown =
expectThrows(NotFoundException.class, () -> component.refreshDns().run()); assertThrows(NotFoundException.class, () -> component.refreshDns().run());
assertThat(thrown).hasMessageThat().contains("domain example.lol not found"); assertThat(thrown).hasMessageThat().contains("domain example.lol not found");
} }
@ -114,7 +114,7 @@ public final class DnsInjectionTest {
when(req.getParameter("type")).thenReturn("host"); when(req.getParameter("type")).thenReturn("host");
when(req.getParameter("name")).thenReturn("ns1.example.lol"); when(req.getParameter("name")).thenReturn("ns1.example.lol");
NotFoundException thrown = NotFoundException thrown =
expectThrows(NotFoundException.class, () -> component.refreshDns().run()); assertThrows(NotFoundException.class, () -> component.refreshDns().run());
assertThat(thrown).hasMessageThat().contains("host ns1.example.lol not found"); assertThat(thrown).hasMessageThat().contains("host ns1.example.lol not found");
} }
} }

View file

@ -16,7 +16,7 @@ package google.registry.dns;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
@ -64,7 +64,7 @@ public class DnsQueueTest {
@Test @Test
public void test_addHostRefreshTask_failsOnUnknownTld() throws Exception { public void test_addHostRefreshTask_failsOnUnknownTld() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> { () -> {
try { try {
@ -94,7 +94,7 @@ public class DnsQueueTest {
@Test @Test
public void test_addDomainRefreshTask_failsOnUnknownTld() throws Exception { public void test_addDomainRefreshTask_failsOnUnknownTld() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> { () -> {
try { try {

View file

@ -19,7 +19,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistActiveDomain;
import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost; import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@ -163,7 +163,7 @@ public class PublishDnsUpdatesActionTest {
ImmutableSet.of( ImmutableSet.of(
"ns1.example.xn--q9jyb4c", "ns2.example.xn--q9jyb4c", "ns1.example2.xn--q9jyb4c"); "ns1.example.xn--q9jyb4c", "ns2.example.xn--q9jyb4c", "ns1.example2.xn--q9jyb4c");
doThrow(new RuntimeException()).when(dnsWriter).commit(); doThrow(new RuntimeException()).when(dnsWriter).commit();
expectThrows(RuntimeException.class, action::run); assertThrows(RuntimeException.class, action::run);
verify(dnsMetrics).incrementPublishDomainRequests(2, PublishStatus.ACCEPTED); verify(dnsMetrics).incrementPublishDomainRequests(2, PublishStatus.ACCEPTED);
verify(dnsMetrics).incrementPublishDomainRequests(0, PublishStatus.REJECTED); verify(dnsMetrics).incrementPublishDomainRequests(0, PublishStatus.REJECTED);
@ -249,7 +249,7 @@ public class PublishDnsUpdatesActionTest {
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com"); action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
action.lockHandler = new FakeLockHandler(false); action.lockHandler = new FakeLockHandler(false);
ServiceUnavailableException thrown = ServiceUnavailableException thrown =
expectThrows(ServiceUnavailableException.class, action::run); assertThrows(ServiceUnavailableException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Lock failure"); assertThat(thrown).hasMessageThat().contains("Lock failure");
verifyNoMoreInteractions(dnsWriter); verifyNoMoreInteractions(dnsWriter);

View file

@ -20,7 +20,6 @@ import static google.registry.testing.DatastoreHelper.persistActiveDomain;
import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost; import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
@ -77,7 +76,7 @@ public class RefreshDnsActionTest {
persistActiveDomain("example.xn--q9jyb4c"); persistActiveDomain("example.xn--q9jyb4c");
persistActiveHost("ns1.example.xn--q9jyb4c"); persistActiveHost("ns1.example.xn--q9jyb4c");
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> { () -> {
try { try {

View file

@ -17,7 +17,6 @@ package google.registry.dns.writer.dnsupdate;
import static com.google.common.io.BaseEncoding.base16; import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -139,7 +138,7 @@ public class DnsMessageTransportTest {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
when(mockSocket.getOutputStream()).thenReturn(outputStream); when(mockSocket.getOutputStream()).thenReturn(outputStream);
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> resolver.send(oversize)); assertThrows(IllegalArgumentException.class, () -> resolver.send(oversize));
assertThat(thrown).hasMessageThat().contains("message larger than maximum"); assertThat(thrown).hasMessageThat().contains("message larger than maximum");
} }
@ -149,7 +148,7 @@ public class DnsMessageTransportTest {
when(mockSocket.getInputStream()) when(mockSocket.getInputStream())
.thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse))); .thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse)));
when(mockSocket.getOutputStream()).thenReturn(new ByteArrayOutputStream()); when(mockSocket.getOutputStream()).thenReturn(new ByteArrayOutputStream());
VerifyException thrown = expectThrows(VerifyException.class, () -> resolver.send(simpleQuery)); VerifyException thrown = assertThrows(VerifyException.class, () -> resolver.send(simpleQuery));
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains( .contains(
@ -166,7 +165,7 @@ public class DnsMessageTransportTest {
when(mockSocket.getInputStream()) when(mockSocket.getInputStream())
.thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse))); .thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse)));
when(mockSocket.getOutputStream()).thenReturn(new ByteArrayOutputStream()); when(mockSocket.getOutputStream()).thenReturn(new ByteArrayOutputStream());
VerifyException thrown = expectThrows(VerifyException.class, () -> resolver.send(simpleQuery)); VerifyException thrown = assertThrows(VerifyException.class, () -> resolver.send(simpleQuery));
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("response opcode 'STATUS' does not match query opcode 'QUERY'"); .contains("response opcode 'STATUS' does not match query opcode 'QUERY'");

View file

@ -26,7 +26,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHo
import static google.registry.testing.DatastoreHelper.persistDeletedDomain; import static google.registry.testing.DatastoreHelper.persistDeletedDomain;
import static google.registry.testing.DatastoreHelper.persistDeletedHost; import static google.registry.testing.DatastoreHelper.persistDeletedHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyZeroInteractions;
@ -388,7 +388,7 @@ public class DnsUpdateWriterTest {
persistResource(domain); persistResource(domain);
when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL)); when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL));
VerifyException thrown = VerifyException thrown =
expectThrows( assertThrows(
VerifyException.class, VerifyException.class,
() -> { () -> {
writer.publishDomain("example.tld"); writer.publishDomain("example.tld");
@ -407,7 +407,7 @@ public class DnsUpdateWriterTest {
persistResource(host); persistResource(host);
when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL)); when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL));
VerifyException thrown = VerifyException thrown =
expectThrows( assertThrows(
VerifyException.class, VerifyException.class,
() -> { () -> {
writer.publishHost("ns1.example.tld"); writer.publishHost("ns1.example.tld");

View file

@ -19,7 +19,6 @@ import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_; import static com.google.common.truth.Truth.assert_;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.logging.Level.INFO; import static java.util.logging.Level.INFO;
@ -203,7 +202,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 = assertThrows(BadRequestException.class, action::run);
assertThat(thrown).hasMessageThat().contains("Cannot deserialize task from payload"); assertThat(thrown).hasMessageThat().contains("Cannot deserialize task from payload");
} }
} }

View file

@ -17,7 +17,7 @@ package google.registry.export;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.export.CheckSnapshotAction.CHECK_SNAPSHOT_KINDS_TO_LOAD_PARAM; import static google.registry.export.CheckSnapshotAction.CHECK_SNAPSHOT_KINDS_TO_LOAD_PARAM;
import static google.registry.export.CheckSnapshotAction.CHECK_SNAPSHOT_NAME_PARAM; import static google.registry.export.CheckSnapshotAction.CHECK_SNAPSHOT_NAME_PARAM;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -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 = assertThrows(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 = assertThrows(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 = assertThrows(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 = assertThrows(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

@ -20,7 +20,7 @@ import static google.registry.export.ExportReservedTermsAction.RESERVED_TERMS_FI
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_OK;
@ -123,14 +123,14 @@ public class ExportReservedTermsActionTest {
any(MediaType.class), any(MediaType.class),
anyString(), anyString(),
any(byte[].class))).thenThrow(new IOException("errorMessage")); any(byte[].class))).thenThrow(new IOException("errorMessage"));
RuntimeException thrown = expectThrows(RuntimeException.class, () -> runAction("tld")); RuntimeException thrown = assertThrows(RuntimeException.class, () -> runAction("tld"));
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR); verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
assertThat(thrown).hasCauseThat().hasMessageThat().isEqualTo("errorMessage"); assertThat(thrown).hasCauseThat().hasMessageThat().isEqualTo("errorMessage");
} }
@Test @Test
public void test_uploadFileToDrive_failsWhenTldDoesntExist() throws Exception { public void test_uploadFileToDrive_failsWhenTldDoesntExist() throws Exception {
RuntimeException thrown = expectThrows(RuntimeException.class, () -> runAction("fakeTld")); RuntimeException thrown = assertThrows(RuntimeException.class, () -> runAction("fakeTld"));
verify(response).setStatus(SC_INTERNAL_SERVER_ERROR); verify(response).setStatus(SC_INTERNAL_SERVER_ERROR);
assertThat(thrown) assertThat(thrown)
.hasCauseThat() .hasCauseThat()

View file

@ -22,7 +22,7 @@ import static google.registry.export.LoadSnapshotAction.LOAD_SNAPSHOT_KINDS_PARA
import static google.registry.export.LoadSnapshotAction.PATH; import static google.registry.export.LoadSnapshotAction.PATH;
import static google.registry.export.LoadSnapshotAction.QUEUE; import static google.registry.export.LoadSnapshotAction.QUEUE;
import static google.registry.export.LoadSnapshotAction.enqueueLoadSnapshotTask; import static google.registry.export.LoadSnapshotAction.enqueueLoadSnapshotTask;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import static org.joda.time.DateTimeZone.UTC; import static org.joda.time.DateTimeZone.UTC;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
@ -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 = assertThrows(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); assertThrows(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

@ -21,7 +21,7 @@ import static google.registry.export.PublishDetailReportAction.GCS_FOLDER_PREFIX
import static google.registry.export.PublishDetailReportAction.REGISTRAR_ID_PARAM; import static google.registry.export.PublishDetailReportAction.REGISTRAR_ID_PARAM;
import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.loadRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.anyString;
@ -105,7 +105,7 @@ public class PublishDetailReportActionTest {
@Test @Test
public void testFailure_noRegistrarParameter() throws Exception { public void testFailure_noRegistrarParameter() throws Exception {
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(
@ -119,7 +119,7 @@ public class PublishDetailReportActionTest {
@Test @Test
public void testFailure_noGcsBucketParameter() throws Exception { public void testFailure_noGcsBucketParameter() throws Exception {
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(
@ -133,7 +133,7 @@ public class PublishDetailReportActionTest {
@Test @Test
public void testFailure_noGcsFolderPrefixParameter() throws Exception { public void testFailure_noGcsFolderPrefixParameter() throws Exception {
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(
@ -147,7 +147,7 @@ public class PublishDetailReportActionTest {
@Test @Test
public void testFailure_noReportNameParameter() throws Exception { public void testFailure_noReportNameParameter() throws Exception {
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(
@ -161,7 +161,7 @@ public class PublishDetailReportActionTest {
@Test @Test
public void testFailure_registrarNotFound() throws Exception { public void testFailure_registrarNotFound() throws Exception {
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(
@ -178,7 +178,7 @@ public class PublishDetailReportActionTest {
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setDriveFolderId(null).build()); loadRegistrar("TheRegistrar").asBuilder().setDriveFolderId(null).build());
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(
@ -193,7 +193,7 @@ public class PublishDetailReportActionTest {
@Test @Test
public void testFailure_gcsBucketNotFound() throws Exception { public void testFailure_gcsBucketNotFound() throws Exception {
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(
@ -208,7 +208,7 @@ public class PublishDetailReportActionTest {
@Test @Test
public void testFailure_gcsFileNotFound() throws Exception { public void testFailure_gcsFileNotFound() throws Exception {
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(
@ -226,7 +226,7 @@ public class PublishDetailReportActionTest {
anyString(), any(MediaType.class), anyString(), any(byte[].class))) anyString(), any(MediaType.class), anyString(), any(byte[].class)))
.thenThrow(new IOException("Drive is down")); .thenThrow(new IOException("Drive is down"));
InternalServerErrorException thrown = InternalServerErrorException thrown =
expectThrows( assertThrows(
InternalServerErrorException.class, InternalServerErrorException.class,
() -> () ->
action.handleJsonRequest( action.handleJsonRequest(

View file

@ -21,7 +21,7 @@ import static google.registry.export.UpdateSnapshotViewAction.UPDATE_SNAPSHOT_DA
import static google.registry.export.UpdateSnapshotViewAction.UPDATE_SNAPSHOT_KIND_PARAM; import static google.registry.export.UpdateSnapshotViewAction.UPDATE_SNAPSHOT_KIND_PARAM;
import static google.registry.export.UpdateSnapshotViewAction.UPDATE_SNAPSHOT_TABLE_ID_PARAM; import static google.registry.export.UpdateSnapshotViewAction.UPDATE_SNAPSHOT_TABLE_ID_PARAM;
import static google.registry.export.UpdateSnapshotViewAction.createViewUpdateTask; import static google.registry.export.UpdateSnapshotViewAction.createViewUpdateTask;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.anyString;
@ -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); assertThrows(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

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

View file

@ -20,7 +20,7 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.tmch.ClaimsListShardTest.createTestClaimsListShard; import static google.registry.model.tmch.ClaimsListShardTest.createTestClaimsListShard;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.LogsSubject.assertAboutLogs; import static google.registry.testing.LogsSubject.assertAboutLogs;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
@ -136,7 +136,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);
EppException thrown = expectThrows(NotLoggedInException.class, this::runFlow); EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

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

View file

@ -18,7 +18,7 @@ import static google.registry.model.eppoutput.CheckData.ContactCheck.create;
import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistDeletedContact; import static google.registry.testing.DatastoreHelper.persistDeletedContact;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ResourceCheckFlowTestCase; import google.registry.flows.ResourceCheckFlowTestCase;
@ -79,7 +79,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");
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow); EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

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

View file

@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistDeletedContact; import static google.registry.testing.DatastoreHelper.persistDeletedContact;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import google.registry.flows.EppException; import google.registry.flows.EppException;
@ -74,7 +74,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -83,7 +83,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -112,7 +112,7 @@ public class ContactDeleteFlowTest
newContactResource(getUniqueIdFromCommand()).asBuilder() newContactResource(getUniqueIdFromCommand()).asBuilder()
.setStatusValues(ImmutableSet.of(statusValue)) .setStatusValues(ImmutableSet.of(statusValue))
.build()); .build());
EppException thrown = expectThrows(exception, this::runFlow); EppException thrown = assertThrows(exception, this::runFlow);
assertThat(thrown).hasMessageThat().contains(statusValue.getXmlName()); assertThat(thrown).hasMessageThat().contains(statusValue.getXmlName());
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -121,7 +121,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());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -148,7 +148,7 @@ public class ContactDeleteFlowTest
createTld("tld"); createTld("tld");
persistResource( persistResource(
newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand()))); newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand())));
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow); EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -157,7 +157,7 @@ public class ContactDeleteFlowTest
createTld("tld"); createTld("tld");
persistResource( persistResource(
newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand()))); newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand())));
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow); EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -166,7 +166,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -175,7 +175,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -22,7 +22,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistDeletedContact; import static google.registry.testing.DatastoreHelper.persistDeletedContact;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -258,7 +258,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -267,7 +267,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -276,7 +276,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());
EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow); EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -293,7 +293,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());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -346,7 +346,7 @@ public class ContactUpdateFlowTest
.setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)) .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED))
.build()); .build());
EppException thrown = EppException thrown =
expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow); assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -358,7 +358,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, this::runFlow); assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited"); assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -371,7 +371,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, this::runFlow); assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertThat(thrown).hasMessageThat().contains("pendingDelete");
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -387,7 +387,7 @@ public class ContactUpdateFlowTest
setEppInput("contact_update_hebrew_int.xml"); setEppInput("contact_update_hebrew_int.xml");
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
EppException thrown = EppException thrown =
expectThrows(BadInternationalizedPostalInfoException.class, this::runFlow); assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -396,7 +396,7 @@ public class ContactUpdateFlowTest
setEppInput("contact_update_decline_disclosure.xml"); setEppInput("contact_update_decline_disclosure.xml");
persistActiveContact(getUniqueIdFromCommand()); persistActiveContact(getUniqueIdFromCommand());
EppException thrown = EppException thrown =
expectThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow); assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -404,7 +404,7 @@ public class ContactUpdateFlowTest
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());
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow); EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

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

View file

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

View file

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

View file

@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -287,7 +287,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -301,7 +301,7 @@ public class DomainApplicationInfoFlowTest
.setRegistrant(Key.create(persistActiveContact("jd1234"))) .setRegistrant(Key.create(persistActiveContact("jd1234")))
.build()); .build());
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -310,7 +310,7 @@ public class DomainApplicationInfoFlowTest
persistResource(AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build()); persistResource(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);
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -323,7 +323,7 @@ public class DomainApplicationInfoFlowTest
.setRegistrant(Key.create(persistActiveContact("jd1234"))) .setRegistrant(Key.create(persistActiveContact("jd1234")))
.setPhase(LaunchPhase.SUNRUSH) .setPhase(LaunchPhase.SUNRUSH)
.build()); .build());
EppException thrown = expectThrows(ApplicationDomainNameMismatchException.class, this::runFlow); EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -331,7 +331,7 @@ public class DomainApplicationInfoFlowTest
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);
EppException thrown = expectThrows(MissingApplicationIdException.class, this::runFlow); EppException thrown = assertThrows(MissingApplicationIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -340,7 +340,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.asBuilder().setPhase(LaunchPhase.SUNRISE).build()); application = persistResource(application.asBuilder().setPhase(LaunchPhase.SUNRISE).build());
EppException thrown = EppException thrown =
expectThrows(ApplicationLaunchPhaseMismatchException.class, this::runFlow); assertThrows(ApplicationLaunchPhaseMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

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

View file

@ -25,7 +25,7 @@ import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD; import static org.joda.money.CurrencyUnit.USD;
@ -330,14 +330,14 @@ 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");
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow); EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@Test @Test
public void testFailure_wrongTld() throws Exception { public void testFailure_wrongTld() throws Exception {
setEppInput("domain_check.xml"); setEppInput("domain_check.xml");
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow); EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -345,7 +345,7 @@ public class DomainCheckFlowTest
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());
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -361,7 +361,7 @@ public class DomainCheckFlowTest
private void doFailingBadLabelTest(String label, Class<? extends EppException> expectedException) private void doFailingBadLabelTest(String label, Class<? extends EppException> expectedException)
throws Exception { throws Exception {
setEppInput("domain_check_template.xml", ImmutableMap.of("LABEL", label)); setEppInput("domain_check_template.xml", ImmutableMap.of("LABEL", label));
EppException thrown = expectThrows(expectedException, this::runFlow); EppException thrown = assertThrows(expectedException, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -446,7 +446,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);
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -780,84 +780,84 @@ 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");
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -866,91 +866,91 @@ public class DomainCheckFlowTest
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");
EppException thrown = EppException thrown =
expectThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow); assertThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTlds;
import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.loadRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -103,14 +103,14 @@ 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");
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow); EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow); EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -118,7 +118,7 @@ public class DomainClaimsCheckFlowTest
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());
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -139,7 +139,7 @@ public class DomainClaimsCheckFlowTest
public void testFailure_predelgation() throws Exception { public void testFailure_predelgation() throws Exception {
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
setEppInput("domain_check_claims.xml"); setEppInput("domain_check_claims.xml");
EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -147,7 +147,7 @@ public class DomainClaimsCheckFlowTest
public void testFailure_sunrise() throws Exception { public void testFailure_sunrise() throws Exception {
createTld("tld", TldState.SUNRISE); createTld("tld", TldState.SUNRISE);
setEppInput("domain_check_claims.xml"); setEppInput("domain_check_claims.xml");
EppException thrown = expectThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow); EppException thrown = assertThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -156,7 +156,7 @@ public class DomainClaimsCheckFlowTest
createTld("tld", TldState.SUNRISE); createTld("tld", TldState.SUNRISE);
setEppInput("domain_check_claims_allocationtoken.xml"); setEppInput("domain_check_claims_allocationtoken.xml");
EppException thrown = EppException thrown =
expectThrows(DomainClaimsCheckNotAllowedWithAllocationTokens.class, this::runFlow); assertThrows(DomainClaimsCheckNotAllowedWithAllocationTokens.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -166,7 +166,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");
EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow); EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -42,7 +42,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
@ -391,7 +391,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_invalidAllocationToken() throws Exception { public void testFailure_invalidAllocationToken() throws Exception {
setEppInput("domain_create_allocationtoken.xml"); setEppInput("domain_create_allocationtoken.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(InvalidAllocationTokenException.class, this::runFlow); EppException thrown = assertThrows(InvalidAllocationTokenException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -406,7 +406,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
EppException thrown = EppException thrown =
expectThrows(AlreadyRedeemedAllocationTokenException.class, this::runFlow); assertThrows(AlreadyRedeemedAllocationTokenException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -443,7 +443,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();
EppException thrown = expectThrows(DomainNameExistsAsTldException.class, this::runFlow); EppException thrown = assertThrows(DomainNameExistsAsTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -452,7 +452,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();
EppException thrown = expectThrows(BadDomainNameCharacterException.class, this::runFlow); EppException thrown = assertThrows(BadDomainNameCharacterException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -600,7 +600,7 @@ 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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -608,7 +608,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -616,7 +616,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -624,7 +624,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -632,7 +632,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -640,7 +640,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -648,7 +648,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -656,7 +656,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -664,7 +664,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -688,7 +688,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();
EppException thrown = expectThrows(OnlyToolCanPassMetadataException.class, this::runFlow); EppException thrown = assertThrows(OnlyToolCanPassMetadataException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -708,7 +708,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
setEppInput("domain_create_lrp.xml"); setEppInput("domain_create_lrp.xml");
persistContactsAndHosts(); persistContactsAndHosts();
Exception e = expectThrows(InvalidLrpTokenException.class, this::runFlow); Exception e = assertThrows(InvalidLrpTokenException.class, this::runFlow);
assertThat(e).hasMessageThat().isEqualTo("Invalid limited registration period token"); assertThat(e).hasMessageThat().isEqualTo("Invalid limited registration period token");
assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull(); assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull();
} }
@ -721,7 +721,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setLrpPeriod(new Interval(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1))) .setLrpPeriod(new Interval(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1)))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
InvalidLrpTokenException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow); InvalidLrpTokenException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("Invalid limited registration period token"); assertThat(thrown).hasMessageThat().contains("Invalid limited registration period token");
} }
@ -848,7 +848,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_periodInMonths() throws Exception { public void testFailure_periodInMonths() throws Exception {
setEppInput("domain_create_months.xml"); setEppInput("domain_create_months.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -879,7 +879,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();
EppException thrown = expectThrows(MissingClaimsNoticeException.class, this::runFlow); EppException thrown = assertThrows(MissingClaimsNoticeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -888,7 +888,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();
EppException thrown = expectThrows(UnexpectedClaimsNoticeException.class, this::runFlow); EppException thrown = assertThrows(UnexpectedClaimsNoticeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -898,7 +898,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY));
persistContactsAndHosts(); persistContactsAndHosts();
persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build()); persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build());
EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow); EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -906,7 +906,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(TooManyNameserversException.class, this::runFlow); EppException thrown = assertThrows(TooManyNameserversException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -914,7 +914,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
public void testFailure_secDnsMaxSigLife() throws Exception { public void testFailure_secDnsMaxSigLife() throws Exception {
setEppInput("domain_create_dsdata.xml"); setEppInput("domain_create_dsdata.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(MaxSigLifeNotSupportedException.class, this::runFlow); EppException thrown = assertThrows(MaxSigLifeNotSupportedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -922,7 +922,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(TooManyDsRecordsException.class, this::runFlow); EppException thrown = assertThrows(TooManyDsRecordsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -930,7 +930,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow); EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -940,7 +940,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();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -950,7 +950,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();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -960,7 +960,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();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -978,7 +978,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -996,7 +996,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1014,7 +1014,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1023,7 +1023,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistContactsAndHosts(); persistContactsAndHosts();
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
ResourceAlreadyExistsException thrown = ResourceAlreadyExistsException thrown =
expectThrows(ResourceAlreadyExistsException.class, this::runFlow); assertThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertAboutEppExceptions() assertAboutEppExceptions()
.that(thrown) .that(thrown)
.marshalsToXml() .marshalsToXml()
@ -1036,7 +1036,7 @@ 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();
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow); EppException thrown = assertThrows(DomainReservedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1044,7 +1044,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow); EppException thrown = assertThrows(DomainReservedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1144,7 +1144,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistActiveContact("jd1234"); persistActiveContact("jd1234");
persistActiveContact("sh8013"); persistActiveContact("sh8013");
LinkedResourcesDoNotExistException thrown = LinkedResourcesDoNotExistException thrown =
expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow); assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns2.example.net)"); assertThat(thrown).hasMessageThat().contains("(ns2.example.net)");
} }
@ -1160,7 +1160,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown = LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow); assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns2.example.net"); assertThat(thrown).hasMessageThat().contains("ns2.example.net");
} }
@ -1169,7 +1169,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistContactsAndHosts(); persistContactsAndHosts();
persistActiveDomainApplication(getUniqueIdFromCommand()); persistActiveDomainApplication(getUniqueIdFromCommand());
clock.advanceOneMilli(); clock.advanceOneMilli();
EppException thrown = expectThrows(DomainHasOpenApplicationsException.class, this::runFlow); EppException thrown = assertThrows(DomainHasOpenApplicationsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1198,7 +1198,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, this::runFlow); assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(sh8013)"); assertThat(thrown).hasMessageThat().contains("(sh8013)");
} }
@ -1214,7 +1214,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
LinkedResourceInPendingDeleteProhibitsOperationException thrown = LinkedResourceInPendingDeleteProhibitsOperationException thrown =
expectThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow); assertThrows(LinkedResourceInPendingDeleteProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("jd1234"); assertThat(thrown).hasMessageThat().contains("jd1234");
} }
@ -1222,7 +1222,7 @@ 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");
EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow); EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1231,7 +1231,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.PREDELEGATION); createTld("tld", TldState.PREDELEGATION);
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1240,7 +1240,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRISE); createTld("tld", TldState.SUNRISE);
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1249,7 +1249,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.SUNRUSH); createTld("tld", TldState.SUNRUSH);
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1258,7 +1258,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.LANDRUSH); createTld("tld", TldState.LANDRUSH);
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1267,7 +1267,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.START_DATE_SUNRISE); createTld("tld", TldState.START_DATE_SUNRISE);
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow); assertThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1276,7 +1276,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
createTld("tld", TldState.QUIET_PERIOD); createTld("tld", TldState.QUIET_PERIOD);
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1355,7 +1355,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();
EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow); EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1364,7 +1364,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
// We need to test for missing type, but not for invalid - the schema enforces that for us. // 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();
EppException thrown = expectThrows(MissingContactTypeException.class, this::runFlow); EppException thrown = assertThrows(MissingContactTypeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1372,7 +1372,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(MissingRegistrantException.class, this::runFlow); EppException thrown = assertThrows(MissingRegistrantException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1380,7 +1380,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(MissingAdminContactException.class, this::runFlow); EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1388,7 +1388,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(MissingTechnicalContactException.class, this::runFlow); EppException thrown = assertThrows(MissingTechnicalContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1396,7 +1396,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(MissingAdminContactException.class, this::runFlow); EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1405,7 +1405,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");
EppException thrown = expectThrows(InvalidIdnDomainLabelException.class, this::runFlow); EppException thrown = assertThrows(InvalidIdnDomainLabelException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1414,7 +1414,7 @@ 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();
EppException thrown = expectThrows(InvalidTrademarkValidatorException.class, this::runFlow); EppException thrown = assertThrows(InvalidTrademarkValidatorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1422,7 +1422,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(UnsupportedMarkTypeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedMarkTypeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1432,7 +1432,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_signed_mark.xml"); setEppInput("domain_create_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1441,7 +1441,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();
EppException thrown = expectThrows(ExpiredClaimException.class, this::runFlow); EppException thrown = assertThrows(ExpiredClaimException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1450,7 +1450,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();
EppException thrown = expectThrows(AcceptedTooLongAgoException.class, this::runFlow); EppException thrown = assertThrows(AcceptedTooLongAgoException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1459,7 +1459,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();
EppException thrown = expectThrows(MalformedTcnIdException.class, this::runFlow); EppException thrown = assertThrows(MalformedTcnIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1468,7 +1468,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();
EppException thrown = expectThrows(MalformedTcnIdException.class, this::runFlow); EppException thrown = assertThrows(MalformedTcnIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1477,7 +1477,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();
EppException thrown = expectThrows(InvalidTcnIdChecksumException.class, this::runFlow); EppException thrown = assertThrows(InvalidTcnIdChecksumException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1489,7 +1489,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
persistContactsAndHosts("net"); persistContactsAndHosts("net");
// 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());
EppException thrown = expectThrows(PremiumNameBlockedException.class, this::runFlow); EppException thrown = assertThrows(PremiumNameBlockedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1499,7 +1499,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
assertThat(Registry.get("example").getPremiumPriceAckRequired()).isTrue(); assertThat(Registry.get("example").getPremiumPriceAckRequired()).isTrue();
setEppInput("domain_create_premium.xml"); setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1511,7 +1511,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build()); loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_create_premium.xml"); setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1523,7 +1523,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build()); loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_create_premium.xml"); setEppInput("domain_create_premium.xml");
persistContactsAndHosts("net"); persistContactsAndHosts("net");
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1535,7 +1535,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();
EppException thrown = expectThrows(UndeclaredServiceExtensionException.class, this::runFlow); EppException thrown = assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1547,7 +1547,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();
EppException thrown = expectThrows(UndeclaredServiceExtensionException.class, this::runFlow); EppException thrown = assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1559,7 +1559,7 @@ 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();
EppException thrown = expectThrows(UndeclaredServiceExtensionException.class, this::runFlow); EppException thrown = assertThrows(UndeclaredServiceExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1567,7 +1567,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1575,7 +1575,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1583,7 +1583,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1598,7 +1598,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setState(State.SUSPENDED) .setState(State.SUSPENDED)
.build()); .build());
EppException thrown = EppException thrown =
expectThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow); assertThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1607,7 +1607,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_uppercase.xml"); setEppInput("domain_create_uppercase.xml");
eppLoader.replaceAll("Example.tld", domainName); eppLoader.replaceAll("Example.tld", domainName);
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(exception, this::runFlow); EppException thrown = assertThrows(exception, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1683,7 +1683,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_sunrise.xml"); setEppInput("domain_create_registration_sunrise.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1736,7 +1736,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_start_date_sunrise.xml"); setEppInput("domain_create_registration_start_date_sunrise.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow); assertThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1776,7 +1776,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.setTo(DateTime.parse("2014-09-09T09:09:09Z")); clock.setTo(DateTime.parse("2014-09-09T09:09:09Z"));
setEppInput("domain_create_registration_start_date_sunrise_wrong_encoded_signed_mark.xml"); setEppInput("domain_create_registration_start_date_sunrise_wrong_encoded_signed_mark.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow); EppException thrown = assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1787,7 +1787,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_start_date_sunrise_claims_notice.xml"); setEppInput("domain_create_registration_start_date_sunrise_claims_notice.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow); assertThrows(MustHaveSignedMarksInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1797,7 +1797,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_sunrush.xml"); setEppInput("domain_create_registration_sunrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1810,7 +1810,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setAllowedTlds(ImmutableSet.of("irrelevant")) .setAllowedTlds(ImmutableSet.of("irrelevant"))
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1863,7 +1863,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
setEppInput("domain_create_registration_landrush.xml"); setEppInput("domain_create_registration_landrush.xml");
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow); assertThrows(NoGeneralRegistrationsInCurrentPhaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1920,7 +1920,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.setAllowedRegistrantContactIds(ImmutableSet.of("someone")) .setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
.build()); .build());
RegistrantNotAllowedException thrown = RegistrantNotAllowedException thrown =
expectThrows(RegistrantNotAllowedException.class, this::runFlow); assertThrows(RegistrantNotAllowedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("jd1234"); assertThat(thrown).hasMessageThat().contains("jd1234");
} }
@ -1933,7 +1933,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, this::runFlow); assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -1947,7 +1947,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
.build()); .build());
persistContactsAndHosts(); persistContactsAndHosts();
EppException thrown = EppException thrown =
expectThrows( assertThrows(
NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow); NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1994,7 +1994,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());
EppException thrown = EppException thrown =
expectThrows( assertThrows(
NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow); NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -2010,7 +2010,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, this::runFlow); assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -2026,7 +2026,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.net:ns2.example.net")) "reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.net:ns2.example.net"))
.build()); .build());
DomainNotAllowedForTldWithCreateRestrictionException thrown = DomainNotAllowedForTldWithCreateRestrictionException thrown =
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow); assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("example.tld"); assertThat(thrown).hasMessageThat().contains("example.tld");
} }
@ -2076,7 +2076,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns1.example.net:ns2.example.net:ns3.example.net")) + "ns1.example.net:ns2.example.net:ns3.example.net"))
.build()); .build());
NameserversNotAllowedForTldException thrown = NameserversNotAllowedForTldException thrown =
expectThrows(NameserversNotAllowedForTldException.class, this::runFlow); assertThrows(NameserversNotAllowedForTldException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -2095,7 +2095,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns2.example.net:ns3.example.net:ns4.example.net")) + "ns2.example.net:ns3.example.net:ns4.example.net"))
.build()); .build());
NameserversNotAllowedForDomainException thrown = NameserversNotAllowedForDomainException thrown =
expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow); assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertThat(thrown).hasMessageThat().contains("ns1.example.net");
} }
@ -2116,7 +2116,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
+ "ns1.example.net:ns2.example.net:ns3.example.net")) + "ns1.example.net:ns2.example.net:ns3.example.net"))
.build()); .build());
DomainNotAllowedForTldWithCreateRestrictionException thrown = DomainNotAllowedForTldWithCreateRestrictionException thrown =
expectThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow); assertThrows(DomainNotAllowedForTldWithCreateRestrictionException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("example.tld"); assertThat(thrown).hasMessageThat().contains("example.tld");
} }
@ -2170,7 +2170,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1), clock.nowUtc().plusDays(1),
Money.of(USD, 0))) Money.of(USD, 0)))
.build()); .build());
EppException thrown = expectThrows(FeeDescriptionParseException.class, this::runFlow); EppException thrown = assertThrows(FeeDescriptionParseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -2198,7 +2198,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1), clock.nowUtc().plusDays(1),
Money.of(USD, 0))) Money.of(USD, 0)))
.build()); .build());
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("CREATE"); assertThat(thrown).hasMessageThat().contains("CREATE");
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -2222,7 +2222,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1), clock.nowUtc().plusDays(1),
Money.of(USD, 0))) Money.of(USD, 0)))
.build()); .build());
EppException thrown = expectThrows(FeeDescriptionMultipleMatchesException.class, this::runFlow); EppException thrown = assertThrows(FeeDescriptionMultipleMatchesException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ea"); assertThat(thrown).hasMessageThat().contains("ea");
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -2326,7 +2326,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
clock.nowUtc().plusDays(1), clock.nowUtc().plusDays(1),
Money.of(USD, 0))) Money.of(USD, 0)))
.build()); .build());
Exception e = expectThrows(FeesRequiredDuringEarlyAccessProgramException.class, this::runFlow); Exception e = assertThrows(FeesRequiredDuringEarlyAccessProgramException.class, this::runFlow);
assertThat(e) assertThat(e)
.hasMessageThat() .hasMessageThat()
.isEqualTo( .isEqualTo(
@ -2374,7 +2374,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();
EppException thrown = expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow); EppException thrown = assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

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

View file

@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -411,7 +411,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -423,7 +423,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -438,7 +438,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");
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow); EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -452,7 +452,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");
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow); EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -470,7 +470,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());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow); EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -487,7 +487,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());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow); EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -505,7 +505,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());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow); EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -522,7 +522,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());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow); EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -534,7 +534,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());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow); EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -545,7 +545,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());
EppException thrown = expectThrows(BadAuthInfoForResourceException.class, this::runFlow); EppException thrown = assertThrows(BadAuthInfoForResourceException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -625,7 +625,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);
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -634,7 +634,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);
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -643,7 +643,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);
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -652,7 +652,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);
EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -661,7 +661,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);
EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -670,7 +670,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);
EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -28,7 +28,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.EUR; import static org.joda.money.CurrencyUnit.EUR;
@ -304,7 +304,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_refundableFee_v06() throws Exception { 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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -312,7 +312,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -320,7 +320,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -328,7 +328,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -336,7 +336,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -344,7 +344,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -352,7 +352,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -360,7 +360,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -368,7 +368,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -429,7 +429,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -437,7 +437,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_existedButWasDeleted() throws Exception { 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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -445,7 +445,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_clientRenewProhibited() throws Exception { public void testFailure_clientRenewProhibited() throws Exception {
persistDomain(StatusValue.CLIENT_RENEW_PROHIBITED); persistDomain(StatusValue.CLIENT_RENEW_PROHIBITED);
ResourceStatusProhibitsOperationException thrown = ResourceStatusProhibitsOperationException thrown =
expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow); assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("clientRenewProhibited"); assertThat(thrown).hasMessageThat().contains("clientRenewProhibited");
} }
@ -453,7 +453,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, this::runFlow); assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverRenewProhibited"); assertThat(thrown).hasMessageThat().contains("serverRenewProhibited");
} }
@ -467,7 +467,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, this::runFlow); assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertThat(thrown).hasMessageThat().contains("pendingDelete");
} }
@ -480,7 +480,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20))) .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build()); .build());
persistDomain(); persistDomain();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -493,7 +493,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20))) .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build()); .build());
persistDomain(); persistDomain();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -506,7 +506,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20))) .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20)))
.build()); .build());
persistDomain(); persistDomain();
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -524,7 +524,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistDomain(); persistDomain();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -542,7 +542,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistDomain(); persistDomain();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -560,7 +560,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setServerStatusChangeBillingCost(Money.of(EUR, 19)) .setServerStatusChangeBillingCost(Money.of(EUR, 19))
.build()); .build());
persistDomain(); persistDomain();
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -568,7 +568,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -576,7 +576,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -584,7 +584,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -597,7 +597,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, this::runFlow); assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingTransfer"); assertThat(thrown).hasMessageThat().contains("pendingTransfer");
} }
@ -605,7 +605,7 @@ 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();
EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -613,7 +613,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
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();
EppException thrown = expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow); EppException thrown = assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -627,7 +627,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
.setRegistrationExpirationTime(DateTime.parse("2000-04-04T22:00:00.0Z")) .setRegistrationExpirationTime(DateTime.parse("2000-04-04T22:00:00.0Z"))
.build()); .build());
EppException thrown = EppException thrown =
expectThrows(IncorrectCurrentExpirationDateException.class, this::runFlow); assertThrows(IncorrectCurrentExpirationDateException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -635,7 +635,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -652,7 +652,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();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -671,7 +671,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();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -683,7 +683,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build()); loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_renew_premium.xml"); setEppInput("domain_renew_premium.xml");
persistDomain(); persistDomain();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -28,7 +28,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
@ -245,7 +245,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_refundableFee_v06() throws Exception { 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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -253,7 +253,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -261,7 +261,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -269,7 +269,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -277,7 +277,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -285,7 +285,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -293,7 +293,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -301,7 +301,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -309,7 +309,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -349,7 +349,7 @@ public class DomainRestoreRequestFlowTest
@Test @Test
public void testFailure_doesNotExist() throws Exception { public void testFailure_doesNotExist() throws Exception {
ResourceDoesNotExistException thrown = ResourceDoesNotExistException thrown =
expectThrows(ResourceDoesNotExistException.class, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -359,7 +359,7 @@ public class DomainRestoreRequestFlowTest
persistPendingDeleteDomain(); persistPendingDeleteDomain();
persistResource( persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build()); Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -369,7 +369,7 @@ public class DomainRestoreRequestFlowTest
persistPendingDeleteDomain(); persistPendingDeleteDomain();
persistResource( persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build()); Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -379,7 +379,7 @@ public class DomainRestoreRequestFlowTest
persistPendingDeleteDomain(); persistPendingDeleteDomain();
persistResource( persistResource(
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build()); Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, 100)).build());
EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -396,7 +396,7 @@ public class DomainRestoreRequestFlowTest
.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());
EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -419,7 +419,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -427,7 +427,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -435,7 +435,7 @@ public class DomainRestoreRequestFlowTest
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();
EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -447,21 +447,21 @@ public class DomainRestoreRequestFlowTest
.setDeletionTime(clock.nowUtc().plusDays(4)) .setDeletionTime(clock.nowUtc().plusDays(4))
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE)) .setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
.build()); .build());
EppException thrown = expectThrows(DomainNotEligibleForRestoreException.class, this::runFlow); EppException thrown = assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@Test @Test
public void testFailure_notDeleted() throws Exception { public void testFailure_notDeleted() throws Exception {
persistActiveDomain(getUniqueIdFromCommand()); persistActiveDomain(getUniqueIdFromCommand());
EppException thrown = expectThrows(DomainNotEligibleForRestoreException.class, this::runFlow); EppException thrown = assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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));
EppException thrown = expectThrows(ResourceDoesNotExistException.class, this::runFlow); EppException thrown = assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -469,7 +469,7 @@ public class DomainRestoreRequestFlowTest
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");
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow); EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -477,7 +477,7 @@ public class DomainRestoreRequestFlowTest
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");
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow); EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -485,7 +485,7 @@ public class DomainRestoreRequestFlowTest
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");
EppException thrown = expectThrows(RestoreCommandIncludesChangesException.class, this::runFlow); EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -493,7 +493,7 @@ public class DomainRestoreRequestFlowTest
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");
EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow); EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -501,7 +501,7 @@ public class DomainRestoreRequestFlowTest
public void testFailure_unauthorizedClient() throws Exception { public void testFailure_unauthorizedClient() throws Exception {
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -510,7 +510,7 @@ public class DomainRestoreRequestFlowTest
sessionMetadata.setClientId("NewRegistrar"); sessionMetadata.setClientId("NewRegistrar");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
EppException thrown = EppException thrown =
expectThrows( assertThrows(
ResourceNotOwnedException.class, ResourceNotOwnedException.class,
() -> runFlowAssertResponse(loadFile("domain_update_response.xml"))); () -> runFlowAssertResponse(loadFile("domain_update_response.xml")));
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
@ -521,7 +521,7 @@ public class DomainRestoreRequestFlowTest
persistResource( persistResource(
loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
persistPendingDeleteDomain(); persistPendingDeleteDomain();
EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -541,7 +541,7 @@ public class DomainRestoreRequestFlowTest
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());
EppException thrown = expectThrows(PremiumNameBlockedException.class, this::runFlow); EppException thrown = assertThrows(PremiumNameBlockedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -554,7 +554,7 @@ public class DomainRestoreRequestFlowTest
.setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED")) .setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED"))
.build()); .build());
persistPendingDeleteDomain(); persistPendingDeleteDomain();
EppException thrown = expectThrows(DomainReservedException.class, this::runFlow); EppException thrown = assertThrows(DomainReservedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -563,7 +563,7 @@ public class DomainRestoreRequestFlowTest
createTld("example"); createTld("example");
setEppInput("domain_update_restore_request_premium.xml"); setEppInput("domain_update_restore_request_premium.xml");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -575,7 +575,7 @@ public class DomainRestoreRequestFlowTest
loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build()); loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build());
setEppInput("domain_update_restore_request_premium.xml"); setEppInput("domain_update_restore_request_premium.xml");
persistPendingDeleteDomain(); persistPendingDeleteDomain();
EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -18,7 +18,7 @@ import static google.registry.model.eppoutput.CheckData.HostCheck.create;
import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistDeletedHost; import static google.registry.testing.DatastoreHelper.persistDeletedHost;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ResourceCheckFlowTestCase; import google.registry.flows.ResourceCheckFlowTestCase;
@ -78,7 +78,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");
EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow); EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -26,7 +26,7 @@ import static google.registry.testing.DatastoreHelper.persistDeletedHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HostResourceSubject.assertAboutHosts; import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
@ -127,7 +127,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
createTlds("bar.tld", "tld"); createTlds("bar.tld", "tld");
setEppHostCreateInputWithIps("ns1.bar.tld"); setEppHostCreateInputWithIps("ns1.bar.tld");
EppException thrown = expectThrows(HostNameTooShallowException.class, this::runFlow); EppException thrown = assertThrows(HostNameTooShallowException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -156,7 +156,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");
EppException thrown = expectThrows(SubordinateHostMustHaveIpException.class, this::runFlow); EppException thrown = assertThrows(SubordinateHostMustHaveIpException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -165,7 +165,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");
EppException thrown = expectThrows(UnexpectedExternalHostIpException.class, this::runFlow); EppException thrown = assertThrows(UnexpectedExternalHostIpException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -174,7 +174,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, this::runFlow); assertThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(example.tld)"); assertThat(thrown).hasMessageThat().contains("(example.tld)");
} }
@ -190,7 +190,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
.build()); .build());
clock.advanceOneMilli(); clock.advanceOneMilli();
SuperordinateDomainInPendingDeleteException thrown = SuperordinateDomainInPendingDeleteException thrown =
expectThrows(SuperordinateDomainInPendingDeleteException.class, this::runFlow); assertThrows(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");
@ -201,7 +201,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, this::runFlow); assertThrows(ResourceAlreadyExistsException.class, this::runFlow);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains( .contains(
@ -211,7 +211,7 @@ 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);
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -219,21 +219,21 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
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, this::runFlow); assertThrows(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);
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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");
EppException thrown = expectThrows(HostNameTooLongException.class, this::runFlow); EppException thrown = assertThrows(HostNameTooLongException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -244,14 +244,14 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
"<host:addr ip=\"v4\">192.0.2.2</host:addr>\n" "<host:addr ip=\"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>");
EppException thrown = expectThrows(IpAddressVersionMismatchException.class, this::runFlow); EppException thrown = assertThrows(IpAddressVersionMismatchException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
private void doFailingHostNameTest(String hostName, Class<? extends EppException> exception) private void doFailingHostNameTest(String hostName, Class<? extends EppException> exception)
throws Exception { throws Exception {
setEppHostCreateInputWithIps(hostName); setEppHostCreateInputWithIps(hostName);
EppException thrown = expectThrows(exception, this::runFlow); EppException thrown = assertThrows(exception, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -289,7 +289,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");
EppException thrown = expectThrows(HostNameTooShallowException.class, this::runFlow); EppException thrown = assertThrows(HostNameTooShallowException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -25,7 +25,7 @@ import static google.registry.testing.DatastoreHelper.persistDeletedHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.HostResourceSubject.assertAboutHosts; import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -87,7 +87,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)"); assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)");
} }
@ -95,7 +95,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)"); assertThat(thrown).hasMessageThat().contains("(ns1.example.tld)");
} }
@ -106,7 +106,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.asBuilder() .asBuilder()
.setStatusValues(ImmutableSet.of(statusValue)) .setStatusValues(ImmutableSet.of(statusValue))
.build()); .build());
Exception e = expectThrows(exception, this::runFlow); Exception e = assertThrows(exception, this::runFlow);
assertThat(e).hasMessageThat().contains(statusValue.getXmlName()); assertThat(e).hasMessageThat().contains(statusValue.getXmlName());
} }
@ -132,7 +132,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");
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -191,7 +191,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());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -257,7 +257,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());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -269,7 +269,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.asBuilder() .asBuilder()
.setNameservers(ImmutableSet.of(Key.create(persistActiveHost("ns1.example.tld")))) .setNameservers(ImmutableSet.of(Key.create(persistActiveHost("ns1.example.tld"))))
.build()); .build());
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow); EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -281,14 +281,14 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
.asBuilder() .asBuilder()
.setNameservers(ImmutableSet.of(Key.create(persistActiveHost("ns1.example.tld")))) .setNameservers(ImmutableSet.of(Key.create(persistActiveHost("ns1.example.tld"))))
.build()); .build());
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow); EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@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"));
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -296,14 +296,14 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
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, this::runFlow); assertThrows(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."));
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -150,7 +150,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -159,14 +159,14 @@ 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, this::runFlow); assertThrows(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"));
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -174,14 +174,14 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
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, this::runFlow); assertThrows(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."));
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

@ -34,7 +34,7 @@ import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptio
import static google.registry.testing.GenericEppResourceSubject.assertAboutEppResources; import static google.registry.testing.GenericEppResourceSubject.assertAboutEppResources;
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
import static google.registry.testing.HostResourceSubject.assertAboutHosts; import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
@ -416,7 +416,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
DomainResource domain = persistActiveDomain("example.tld"); DomainResource domain = persistActiveDomain("example.tld");
persistActiveHost(oldHostName()); persistActiveHost(oldHostName());
assertThat(domain.getSubordinateHosts()).isEmpty(); assertThat(domain.getSubordinateHosts()).isEmpty();
expectThrows(CannotRenameExternalHostException.class, this::runFlow); assertThrows(CannotRenameExternalHostException.class, this::runFlow);
assertNoDnsTasksEnqueued(); assertNoDnsTasksEnqueued();
} }
@ -448,7 +448,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_externalToExternal() throws Exception { public void testFailure_externalToExternal() throws Exception {
setEppHostUpdateInput("ns1.example.foo", "ns2.example.tld", null, null); setEppHostUpdateInput("ns1.example.foo", "ns2.example.tld", null, null);
persistActiveHost(oldHostName()); persistActiveHost(oldHostName());
EppException thrown = expectThrows(CannotRenameExternalHostException.class, this::runFlow); EppException thrown = assertThrows(CannotRenameExternalHostException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -814,7 +814,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
createTld("tld"); createTld("tld");
persistActiveHost(oldHostName()); persistActiveHost(oldHostName());
SuperordinateDomainDoesNotExistException thrown = SuperordinateDomainDoesNotExistException thrown =
expectThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow); assertThrows(SuperordinateDomainDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("(example.tld)"); assertThat(thrown).hasMessageThat().contains("(example.tld)");
} }
@ -837,7 +837,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, this::runFlow); assertThrows(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");
@ -846,7 +846,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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -854,7 +854,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_neverExisted_updateWithoutNameChange() throws Exception { 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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -862,7 +862,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_existedButWasDeleted() throws Exception { 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, this::runFlow); assertThrows(ResourceDoesNotExistException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
} }
@ -873,7 +873,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, this::runFlow); assertThrows(HostAlreadyExistsException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("ns1.example.tld"); assertThat(thrown).hasMessageThat().contains("ns1.example.tld");
} }
@ -883,14 +883,14 @@ 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, this::runFlow); assertThrows(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);
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -898,7 +898,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
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);
EppException thrown = expectThrows(HostNameNotLowerCaseException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotLowerCaseException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -906,7 +906,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
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, this::runFlow); assertThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld"); assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
} }
@ -915,7 +915,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
persistActiveHost("ns1.sausalito.tld"); 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, this::runFlow); assertThrows(HostNameNotPunyCodedException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld"); assertThat(thrown).hasMessageThat().contains("expected ns1.xn--aualito-txac.tld");
} }
@ -923,7 +923,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
public void testFailure_referToNonCanonicalHostname() throws Exception { 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);
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -931,7 +931,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
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);
EppException thrown = expectThrows(HostNameNotNormalizedException.class, this::runFlow); EppException thrown = assertThrows(HostNameNotNormalizedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -945,7 +945,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
createTld("tld"); createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
EppException thrown = EppException thrown =
expectThrows(CannotRemoveSubordinateHostLastIpException.class, this::runFlow); assertThrows(CannotRemoveSubordinateHostLastIpException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -954,7 +954,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
setEppHostUpdateInput("ns1.example.tld", "ns2.example.com", null, null); setEppHostUpdateInput("ns1.example.tld", "ns2.example.com", null, null);
createTld("tld"); createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
EppException thrown = expectThrows(RenameHostToExternalRemoveIpException.class, this::runFlow); EppException thrown = assertThrows(RenameHostToExternalRemoveIpException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -964,7 +964,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
"ns1.example.tld", "ns2.example.com", "<host:addr ip=\"v4\">192.0.2.22</host:addr>", null); "ns1.example.tld", "ns2.example.com", "<host:addr ip=\"v4\">192.0.2.22</host:addr>", null);
createTld("tld"); createTld("tld");
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
EppException thrown = expectThrows(CannotAddIpToExternalHostException.class, this::runFlow); EppException thrown = assertThrows(CannotAddIpToExternalHostException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -978,7 +978,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"));
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow); EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -991,7 +991,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>");
EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow); EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1020,7 +1020,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld"))) .setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
.build()); .build());
EppException thrown = EppException thrown =
expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow); assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1034,7 +1034,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, this::runFlow); assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited"); assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited");
} }
@ -1048,7 +1048,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, this::runFlow); assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertThat(thrown).hasMessageThat().contains("pendingDelete");
} }
@ -1057,7 +1057,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");
EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow); EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1077,7 +1077,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");
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1131,7 +1131,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());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1167,7 +1167,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());
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1187,7 +1187,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");
EppException thrown = expectThrows(HostDomainNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(HostDomainNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1205,7 +1205,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");
EppException thrown = expectThrows(HostDomainNotOwnedException.class, this::runFlow); EppException thrown = assertThrows(HostDomainNotOwnedException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
@ -1244,7 +1244,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
hostName, hostName,
"<host:addr ip=\"v4\">192.0.2.22</host:addr>", "<host:addr ip=\"v4\">192.0.2.22</host:addr>",
"<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>");
EppException thrown = expectThrows(exception, this::runFlow); EppException thrown = assertThrows(exception, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }

View file

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

View file

@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import google.registry.flows.EppException; import google.registry.flows.EppException;
@ -223,7 +223,7 @@ 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);
EppException thrown = expectThrows(UnexpectedMessageIdException.class, this::runFlow); EppException thrown = assertThrows(UnexpectedMessageIdException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
} }

View file

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

View file

@ -16,7 +16,7 @@ package google.registry.flows.session;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.FlowTestCase; import google.registry.flows.FlowTestCase;
@ -46,7 +46,7 @@ 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
EppException thrown = expectThrows(NotLoggedInException.class, this::runFlow); EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml(); assertAboutEppExceptions().that(thrown).marshalsToXml();
} }
} }

View file

@ -17,7 +17,6 @@ package google.registry.groups;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.groups.DirectoryGroupsConnection.getDefaultGroupPermissions; import static google.registry.groups.DirectoryGroupsConnection.getDefaultGroupPermissions;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static javax.servlet.http.HttpServletResponse.SC_CONFLICT; import static javax.servlet.http.HttpServletResponse.SC_CONFLICT;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
@ -122,7 +121,7 @@ public class DirectoryGroupsConnectionTest {
when(membersInsert.execute()).thenThrow( when(membersInsert.execute()).thenThrow(
makeResponseException(SC_NOT_FOUND, "Resource Not Found: memberKey")); makeResponseException(SC_NOT_FOUND, "Resource Not Found: memberKey"));
RuntimeException thrown = RuntimeException thrown =
expectThrows( assertThrows(
RuntimeException.class, RuntimeException.class,
() -> connection.addMemberToGroup("spam@example.com", "jim@example.com", Role.MEMBER)); () -> connection.addMemberToGroup("spam@example.com", "jim@example.com", Role.MEMBER));
assertThat(thrown) assertThat(thrown)

View file

@ -29,7 +29,6 @@ import static google.registry.testing.DatastoreHelper.persistEppResourceInFirstB
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import com.google.appengine.tools.mapreduce.InputReader; import com.google.appengine.tools.mapreduce.InputReader;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
@ -81,14 +80,14 @@ public class EppResourceInputsTest {
@Test @Test
public void testFailure_keyInputType_polymorphicSubclass() throws Exception { public void testFailure_keyInputType_polymorphicSubclass() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> createKeyInput(DomainResource.class)); assertThrows(IllegalArgumentException.class, () -> createKeyInput(DomainResource.class));
assertThat(thrown).hasMessageThat().contains("non-polymorphic"); assertThat(thrown).hasMessageThat().contains("non-polymorphic");
} }
@Test @Test
public void testFailure_keyInputType_noInheritanceBetweenTypes_eppResource() throws Exception { public void testFailure_keyInputType_noInheritanceBetweenTypes_eppResource() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> createKeyInput(EppResource.class, DomainBase.class)); () -> createKeyInput(EppResource.class, DomainBase.class));
assertThat(thrown).hasMessageThat().contains("inheritance"); assertThat(thrown).hasMessageThat().contains("inheritance");
@ -104,7 +103,7 @@ public class EppResourceInputsTest {
@Test @Test
public void testFailure_entityInputType_noInheritanceBetweenTypes_eppResource() throws Exception { public void testFailure_entityInputType_noInheritanceBetweenTypes_eppResource() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> createEntityInput(EppResource.class, DomainResource.class)); () -> createEntityInput(EppResource.class, DomainResource.class));
assertThat(thrown).hasMessageThat().contains("inheritance"); assertThat(thrown).hasMessageThat().contains("inheritance");
@ -113,7 +112,7 @@ public class EppResourceInputsTest {
@Test @Test
public void testFailure_entityInputType_noInheritanceBetweenTypes_subclasses() throws Exception { public void testFailure_entityInputType_noInheritanceBetweenTypes_subclasses() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> createEntityInput(DomainBase.class, DomainResource.class)); () -> createEntityInput(DomainBase.class, DomainResource.class));
assertThat(thrown).hasMessageThat().contains("inheritance"); assertThat(thrown).hasMessageThat().contains("inheritance");

View file

@ -19,7 +19,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistActiveDomain;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static org.joda.money.CurrencyUnit.USD; import static org.joda.money.CurrencyUnit.USD;
import static org.joda.time.DateTimeZone.UTC; import static org.joda.time.DateTimeZone.UTC;
@ -178,7 +178,7 @@ public class BillingEventTest extends EntityTestCase {
@Test @Test
public void testFailure_syntheticFlagWithoutCreationTime() { public void testFailure_syntheticFlagWithoutCreationTime() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
oneTime oneTime
@ -194,7 +194,7 @@ public class BillingEventTest extends EntityTestCase {
@Test @Test
public void testFailure_syntheticCreationTimeWithoutFlag() { public void testFailure_syntheticCreationTimeWithoutFlag() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> oneTime.asBuilder().setSyntheticCreationTime(now.plusDays(10)).build()); () -> oneTime.asBuilder().setSyntheticCreationTime(now.plusDays(10)).build());
assertThat(thrown) assertThat(thrown)
@ -205,7 +205,7 @@ public class BillingEventTest extends EntityTestCase {
@Test @Test
public void testFailure_syntheticFlagWithoutCancellationMatchingKey() { public void testFailure_syntheticFlagWithoutCancellationMatchingKey() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
oneTime oneTime
@ -223,7 +223,7 @@ public class BillingEventTest extends EntityTestCase {
@Test @Test
public void testFailure_cancellationMatchingKeyWithoutFlag() { public void testFailure_cancellationMatchingKeyWithoutFlag() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
oneTime oneTime
@ -266,7 +266,7 @@ public class BillingEventTest extends EntityTestCase {
@Test @Test
public void testFailure_cancellation_forGracePeriodWithoutBillingEvent() { public void testFailure_cancellation_forGracePeriodWithoutBillingEvent() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
BillingEvent.Cancellation.forGracePeriod( BillingEvent.Cancellation.forGracePeriod(
@ -280,7 +280,7 @@ public class BillingEventTest extends EntityTestCase {
@Test @Test
public void testFailure_cancellationWithNoBillingEvent() { public void testFailure_cancellationWithNoBillingEvent() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
cancellationOneTime cancellationOneTime
@ -294,7 +294,7 @@ public class BillingEventTest extends EntityTestCase {
@Test @Test
public void testFailure_cancellationWithBothBillingEvents() { public void testFailure_cancellationWithBothBillingEvents() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
cancellationOneTime cancellationOneTime

View file

@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.loadRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static org.joda.money.CurrencyUnit.USD; import static org.joda.money.CurrencyUnit.USD;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -98,7 +97,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
@Test @Test
public void testBadTimeOrdering_causesError() throws Exception { public void testBadTimeOrdering_causesError() throws Exception {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
new RegistrarBillingEntry.Builder() new RegistrarBillingEntry.Builder()
@ -122,7 +121,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
@Test @Test
public void testRegistrarMismatch_causesError() throws Exception { public void testRegistrarMismatch_causesError() throws Exception {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
new RegistrarBillingEntry.Builder() new RegistrarBillingEntry.Builder()
@ -168,7 +167,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
@Test @Test
public void testZeroAmount_causesError() throws Exception { public void testZeroAmount_causesError() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
new RegistrarBillingEntry.Builder() new RegistrarBillingEntry.Builder()

View file

@ -19,7 +19,7 @@ import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.joda.money.CurrencyUnit.JPY; import static org.joda.money.CurrencyUnit.JPY;
import static org.joda.money.CurrencyUnit.USD; import static org.joda.money.CurrencyUnit.USD;
@ -77,7 +77,7 @@ public class RegistrarCreditTest extends EntityTestCase {
@Test @Test
public void testFailure_missingTld() throws Exception { public void testFailure_missingTld() throws Exception {
NullPointerException thrown = NullPointerException thrown =
expectThrows( assertThrows(
NullPointerException.class, () -> promoCredit.asBuilder().setTld(null).build()); NullPointerException.class, () -> promoCredit.asBuilder().setTld(null).build());
assertThat(thrown).hasMessageThat().contains("tld"); assertThat(thrown).hasMessageThat().contains("tld");
} }
@ -85,7 +85,7 @@ public class RegistrarCreditTest extends EntityTestCase {
@Test @Test
public void testFailure_NonexistentTld() throws Exception { public void testFailure_NonexistentTld() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> promoCredit.asBuilder().setTld("example").build()); () -> promoCredit.asBuilder().setTld("example").build());
assertThat(thrown).hasMessageThat().contains("example"); assertThat(thrown).hasMessageThat().contains("example");
@ -95,7 +95,7 @@ public class RegistrarCreditTest extends EntityTestCase {
public void testFailure_CurrencyDoesNotMatchTldCurrency() throws Exception { public void testFailure_CurrencyDoesNotMatchTldCurrency() throws Exception {
assertThat(Registry.get("tld").getCurrency()).isEqualTo(USD); assertThat(Registry.get("tld").getCurrency()).isEqualTo(USD);
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> promoCredit.asBuilder().setTld("tld").setCurrency(JPY).build()); () -> promoCredit.asBuilder().setTld("tld").setCurrency(JPY).build());
assertThat(thrown).hasMessageThat().contains("currency"); assertThat(thrown).hasMessageThat().contains("currency");

View file

@ -21,7 +21,7 @@ import static google.registry.model.common.Cursor.CursorType.RECURRING_BILLING;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistActiveDomain;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
@ -71,7 +71,7 @@ public class CursorTest extends EntityTestCase {
final DateTime time = DateTime.parse("2012-07-12T03:30:00.000Z"); final DateTime time = DateTime.parse("2012-07-12T03:30:00.000Z");
final DomainResource domain = persistActiveDomain("notaregistry.tld"); final DomainResource domain = persistActiveDomain("notaregistry.tld");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
ofy().transact(() -> ofy().save().entity(Cursor.create(RDE_UPLOAD, time, domain)))); ofy().transact(() -> ofy().save().entity(Cursor.create(RDE_UPLOAD, time, domain))));
@ -84,7 +84,7 @@ public class CursorTest extends EntityTestCase {
public void testFailure_invalidScopeOnKeyCreate() throws Exception { public void testFailure_invalidScopeOnKeyCreate() throws Exception {
createTld("tld"); createTld("tld");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> Cursor.createKey(RDE_UPLOAD, persistActiveDomain("notaregistry.tld"))); () -> Cursor.createKey(RDE_UPLOAD, persistActiveDomain("notaregistry.tld")));
assertThat(thrown) assertThat(thrown)
@ -95,7 +95,7 @@ public class CursorTest extends EntityTestCase {
@Test @Test
public void testFailure_createGlobalKeyForScopedCursorType() throws Exception { public void testFailure_createGlobalKeyForScopedCursorType() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> Cursor.createGlobalKey(RDE_UPLOAD)); assertThrows(IllegalArgumentException.class, () -> Cursor.createGlobalKey(RDE_UPLOAD));
assertThat(thrown).hasMessageThat().contains("Cursor type is not a global cursor"); assertThat(thrown).hasMessageThat().contains("Cursor type is not a global cursor");
} }
@ -103,7 +103,7 @@ public class CursorTest extends EntityTestCase {
public void testFailure_invalidScopeOnGlobalKeyCreate() throws Exception { public void testFailure_invalidScopeOnGlobalKeyCreate() throws Exception {
createTld("tld"); createTld("tld");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> Cursor.createKey(RECURRING_BILLING, persistActiveDomain("notaregistry.tld"))); () -> Cursor.createKey(RECURRING_BILLING, persistActiveDomain("notaregistry.tld")));
assertThat(thrown) assertThat(thrown)
@ -114,7 +114,7 @@ public class CursorTest extends EntityTestCase {
@Test @Test
public void testFailure_nullScope() throws Exception { public void testFailure_nullScope() throws Exception {
NullPointerException thrown = NullPointerException thrown =
expectThrows( assertThrows(
NullPointerException.class, NullPointerException.class,
() -> Cursor.create(RECURRING_BILLING, START_OF_TIME, null)); () -> Cursor.create(RECURRING_BILLING, START_OF_TIME, null));
assertThat(thrown).hasMessageThat().contains("Cursor scope cannot be null"); assertThat(thrown).hasMessageThat().contains("Cursor scope cannot be null");
@ -124,7 +124,7 @@ public class CursorTest extends EntityTestCase {
public void testFailure_nullCursorType() throws Exception { public void testFailure_nullCursorType() throws Exception {
createTld("tld"); createTld("tld");
NullPointerException thrown = NullPointerException thrown =
expectThrows( assertThrows(
NullPointerException.class, NullPointerException.class,
() -> Cursor.create(null, START_OF_TIME, Registry.get("tld"))); () -> Cursor.create(null, START_OF_TIME, Registry.get("tld")));
assertThat(thrown).hasMessageThat().contains("Cursor type cannot be null"); assertThat(thrown).hasMessageThat().contains("Cursor type cannot be null");
@ -134,7 +134,7 @@ public class CursorTest extends EntityTestCase {
public void testFailure_nullTime() throws Exception { public void testFailure_nullTime() throws Exception {
createTld("tld"); createTld("tld");
NullPointerException thrown = NullPointerException thrown =
expectThrows( assertThrows(
NullPointerException.class, () -> Cursor.create(RDE_UPLOAD, null, Registry.get("tld"))); NullPointerException.class, () -> Cursor.create(RDE_UPLOAD, null, Registry.get("tld")));
assertThat(thrown).hasMessageThat().contains("Cursor time cannot be null"); assertThat(thrown).hasMessageThat().contains("Cursor time cannot be null");
} }

View file

@ -20,7 +20,7 @@ import static google.registry.testing.ContactResourceSubject.assertAboutContacts
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps; import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -200,7 +200,7 @@ public class ContactResourceTest extends EntityTestCase {
@Test @Test
public void testSetCreationTime_cantBeCalledTwice() { public void testSetCreationTime_cantBeCalledTwice() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> contactResource.asBuilder().setCreationTime(END_OF_TIME)); () -> contactResource.asBuilder().setCreationTime(END_OF_TIME));
assertThat(thrown).hasMessageThat().contains("creationTime can only be set once"); assertThat(thrown).hasMessageThat().contains("creationTime can only be set once");

View file

@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat; import static com.google.common.truth.Truth8.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
@ -67,7 +67,7 @@ public class AllocationTokenTest extends EntityTestCase {
.setToken("foobar") .setToken("foobar")
.setCreationTime(DateTime.parse("2010-11-12T05:00:00Z")); .setCreationTime(DateTime.parse("2010-11-12T05:00:00Z"));
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> builder.setCreationTime(DateTime.parse("2010-11-13T05:00:00Z"))); () -> builder.setCreationTime(DateTime.parse("2010-11-13T05:00:00Z")));
assertThat(thrown).hasMessageThat().isEqualTo("creationTime can only be set once"); assertThat(thrown).hasMessageThat().isEqualTo("creationTime can only be set once");
@ -77,7 +77,7 @@ public class AllocationTokenTest extends EntityTestCase {
public void testSetToken_cantCallMoreThanOnce() throws Exception { public void testSetToken_cantCallMoreThanOnce() throws Exception {
AllocationToken.Builder builder = new AllocationToken.Builder().setToken("foobar"); AllocationToken.Builder builder = new AllocationToken.Builder().setToken("foobar");
IllegalStateException thrown = IllegalStateException thrown =
expectThrows(IllegalStateException.class, () -> builder.setToken("barfoo")); assertThrows(IllegalStateException.class, () -> builder.setToken("barfoo"));
assertThat(thrown).hasMessageThat().isEqualTo("token can only be set once"); assertThat(thrown).hasMessageThat().isEqualTo("token can only be set once");
} }
} }

View file

@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.newHostResource; import static google.registry.testing.DatastoreHelper.newHostResource;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD; import static org.joda.money.CurrencyUnit.USD;
@ -446,7 +446,7 @@ public class DomainResourceTest extends EntityTestCase {
@Test @Test
public void testFailure_uppercaseDomainName() { public void testFailure_uppercaseDomainName() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> domain.asBuilder().setFullyQualifiedDomainName("AAA.BBB")); () -> domain.asBuilder().setFullyQualifiedDomainName("AAA.BBB"));
assertThat(thrown) assertThat(thrown)
@ -457,7 +457,7 @@ public class DomainResourceTest extends EntityTestCase {
@Test @Test
public void testFailure_utf8DomainName() { public void testFailure_utf8DomainName() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> domain.asBuilder().setFullyQualifiedDomainName("みんな.みんな")); () -> domain.asBuilder().setFullyQualifiedDomainName("みんな.みんな"));
assertThat(thrown) assertThat(thrown)

View file

@ -15,7 +15,7 @@
package google.registry.model.domain; package google.registry.model.domain;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.joda.time.DateTimeZone.UTC; import static org.joda.time.DateTimeZone.UTC;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
@ -93,7 +93,7 @@ public class GracePeriodTest {
@Test @Test
public void testFailure_forBillingEvent_autoRenew() { public void testFailure_forBillingEvent_autoRenew() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> GracePeriod.forBillingEvent(GracePeriodStatus.AUTO_RENEW, onetime)); () -> GracePeriod.forBillingEvent(GracePeriodStatus.AUTO_RENEW, onetime));
assertThat(thrown).hasMessageThat().contains("autorenew"); assertThat(thrown).hasMessageThat().contains("autorenew");
@ -102,7 +102,7 @@ public class GracePeriodTest {
@Test @Test
public void testFailure_createForRecurring_notAutoRenew() { public void testFailure_createForRecurring_notAutoRenew() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
GracePeriod.createForRecurring( GracePeriod.createForRecurring(

View file

@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.newDomainResource;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.HostResourceSubject.assertAboutHosts; import static google.registry.testing.HostResourceSubject.assertAboutHosts;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.net.InetAddresses; import com.google.common.net.InetAddresses;
@ -158,7 +158,7 @@ public class HostResourceTest extends EntityTestCase {
@Test @Test
public void testFailure_uppercaseHostName() { public void testFailure_uppercaseHostName() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> host.asBuilder().setFullyQualifiedHostName("AAA.BBB.CCC")); () -> host.asBuilder().setFullyQualifiedHostName("AAA.BBB.CCC"));
assertThat(thrown) assertThat(thrown)
@ -169,7 +169,7 @@ public class HostResourceTest extends EntityTestCase {
@Test @Test
public void testFailure_utf8HostName() { public void testFailure_utf8HostName() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> host.asBuilder().setFullyQualifiedHostName("みんな.みんな.みんな")); () -> host.asBuilder().setFullyQualifiedHostName("みんな.みんな.みんな"));
assertThat(thrown) assertThat(thrown)

View file

@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainApplication; import static google.registry.testing.DatastoreHelper.newDomainApplication;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.joda.time.DateTimeZone.UTC; import static org.joda.time.DateTimeZone.UTC;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -45,7 +45,7 @@ public class DomainApplicationIndexTest extends EntityTestCase {
@Test @Test
public void testFailure_create_nullReferences() { public void testFailure_create_nullReferences() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> DomainApplicationIndex.createWithSpecifiedKeys("blah.com", null)); () -> DomainApplicationIndex.createWithSpecifiedKeys("blah.com", null));
assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty."); assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty.");
@ -54,7 +54,7 @@ public class DomainApplicationIndexTest extends EntityTestCase {
@Test @Test
public void testFailure_create_emptyReferences() { public void testFailure_create_emptyReferences() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> createWithSpecifiedKeys("blah.com", ImmutableSet.of())); () -> createWithSpecifiedKeys("blah.com", ImmutableSet.of()));
assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty."); assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty.");

View file

@ -19,7 +19,7 @@ import static google.registry.model.ofy.CommitLogBucket.getBucketKey;
import static google.registry.model.ofy.CommitLogBucket.loadAllBuckets; import static google.registry.model.ofy.CommitLogBucket.loadAllBuckets;
import static google.registry.model.ofy.CommitLogBucket.loadBucket; import static google.registry.model.ofy.CommitLogBucket.loadBucket;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
@ -66,14 +66,14 @@ public class CommitLogBucketTest {
@Test @Test
public void test_getBucketKey_bucketNumberTooLow_throws() { public void test_getBucketKey_bucketNumberTooLow_throws() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> getBucketKey(0)); assertThrows(IllegalArgumentException.class, () -> getBucketKey(0));
assertThat(thrown).hasMessageThat().contains("0 not in ["); assertThat(thrown).hasMessageThat().contains("0 not in [");
} }
@Test @Test
public void test_getBucketKey_bucketNumberTooHigh_throws() { public void test_getBucketKey_bucketNumberTooHigh_throws() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> getBucketKey(11)); assertThrows(IllegalArgumentException.class, () -> getBucketKey(11));
assertThat(thrown).hasMessageThat().contains("11 not in ["); assertThat(thrown).hasMessageThat().contains("11 not in [");
} }

View file

@ -15,7 +15,7 @@
package google.registry.model.ofy; package google.registry.model.ofy;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.time.DateTimeZone.UTC; import static org.joda.time.DateTimeZone.UTC;
@ -58,7 +58,7 @@ public class CommitLogCheckpointTest {
@Test @Test
public void test_create_notEnoughBucketTimestamps_throws() { public void test_create_notEnoughBucketTimestamps_throws() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(1, T1, 2, T2))); () -> CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(1, T1, 2, T2)));
assertThat(thrown).hasMessageThat().contains("Bucket ids are incorrect"); assertThat(thrown).hasMessageThat().contains("Bucket ids are incorrect");
@ -67,7 +67,7 @@ public class CommitLogCheckpointTest {
@Test @Test
public void test_create_tooManyBucketTimestamps_throws() { public void test_create_tooManyBucketTimestamps_throws() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
CommitLogCheckpoint.create( CommitLogCheckpoint.create(
@ -78,7 +78,7 @@ public class CommitLogCheckpointTest {
@Test @Test
public void test_create_wrongBucketIds_throws() { public void test_create_wrongBucketIds_throws() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
CommitLogCheckpoint.create( CommitLogCheckpoint.create(
@ -89,7 +89,7 @@ public class CommitLogCheckpointTest {
@Test @Test
public void test_create_wrongBucketIdOrder_throws() { public void test_create_wrongBucketIdOrder_throws() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
CommitLogCheckpoint.create( CommitLogCheckpoint.create(

View file

@ -20,7 +20,7 @@ import static com.googlecode.objectify.ObjectifyService.register;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey; import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.CommitLogBucket.getBucketKey; import static google.registry.model.ofy.CommitLogBucket.getBucketKey;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
@ -161,7 +161,7 @@ public class OfyCommitLogTest {
final CommitLogManifest backupsArentAllowedOnMe = final CommitLogManifest backupsArentAllowedOnMe =
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of()); CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of());
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> ofy().transactNew(() -> ofy().delete().entity(backupsArentAllowedOnMe))); () -> ofy().transactNew(() -> ofy().delete().entity(backupsArentAllowedOnMe)));
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @NotBackedUp"); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @NotBackedUp");
@ -172,7 +172,7 @@ public class OfyCommitLogTest {
final CommitLogManifest backupsArentAllowedOnMe = final CommitLogManifest backupsArentAllowedOnMe =
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of()); CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of());
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> ofy().transactNew(() -> ofy().save().entity(backupsArentAllowedOnMe))); () -> ofy().transactNew(() -> ofy().save().entity(backupsArentAllowedOnMe)));
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @NotBackedUp"); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @NotBackedUp");
@ -182,7 +182,7 @@ public class OfyCommitLogTest {
public void testTransactNew_deleteVirtualEntityKey_throws() throws Exception { public void testTransactNew_deleteVirtualEntityKey_throws() throws Exception {
final Key<TestVirtualObject> virtualEntityKey = TestVirtualObject.createKey("virtual"); final Key<TestVirtualObject> virtualEntityKey = TestVirtualObject.createKey("virtual");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> ofy().transactNew(() -> ofy().delete().key(virtualEntityKey))); () -> ofy().transactNew(() -> ofy().delete().key(virtualEntityKey)));
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity"); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity");
@ -192,7 +192,7 @@ public class OfyCommitLogTest {
public void testTransactNew_saveVirtualEntity_throws() throws Exception { public void testTransactNew_saveVirtualEntity_throws() throws Exception {
final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual"); final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> ofy().transactNew(() -> ofy().save().entity(virtualEntity))); () -> ofy().transactNew(() -> ofy().save().entity(virtualEntity)));
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity"); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity");
@ -202,7 +202,7 @@ public class OfyCommitLogTest {
public void test_deleteWithoutBackup_withVirtualEntityKey_throws() throws Exception { public void test_deleteWithoutBackup_withVirtualEntityKey_throws() throws Exception {
final Key<TestVirtualObject> virtualEntityKey = TestVirtualObject.createKey("virtual"); final Key<TestVirtualObject> virtualEntityKey = TestVirtualObject.createKey("virtual");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> ofy().deleteWithoutBackup().key(virtualEntityKey)); () -> ofy().deleteWithoutBackup().key(virtualEntityKey));
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity"); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity");
@ -212,7 +212,7 @@ public class OfyCommitLogTest {
public void test_saveWithoutBackup_withVirtualEntity_throws() throws Exception { public void test_saveWithoutBackup_withVirtualEntity_throws() throws Exception {
final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual"); final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, () -> ofy().saveWithoutBackup().entity(virtualEntity)); IllegalArgumentException.class, () -> ofy().saveWithoutBackup().entity(virtualEntity));
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity"); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity");
} }
@ -220,7 +220,7 @@ public class OfyCommitLogTest {
@Test @Test
public void testTransact_twoSavesOnSameKey_throws() throws Exception { public void testTransact_twoSavesOnSameKey_throws() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
ofy() ofy()
@ -235,7 +235,7 @@ public class OfyCommitLogTest {
@Test @Test
public void testTransact_saveAndDeleteSameKey_throws() throws Exception { public void testTransact_saveAndDeleteSameKey_throws() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
ofy() ofy()

View file

@ -17,7 +17,7 @@ package google.registry.model.ofy;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.initOfy; import static google.registry.model.ofy.ObjectifyService.initOfy;
import static google.registry.testing.DatastoreHelper.newContactResource; import static google.registry.testing.DatastoreHelper.newContactResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig; import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper; import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
@ -72,7 +72,7 @@ public class OfyFilterTest {
@Test @Test
public void testFilterRegistersTypes() throws Exception { public void testFilterRegistersTypes() throws Exception {
UnregisteredEntity entity = new UnregisteredEntity(5L); UnregisteredEntity entity = new UnregisteredEntity(5L);
IllegalStateException e = expectThrows(IllegalStateException.class, () -> Key.create(entity)); IllegalStateException e = assertThrows(IllegalStateException.class, () -> Key.create(entity));
assertThat(e) assertThat(e)
.hasMessageThat() .hasMessageThat()
.isEqualTo( .isEqualTo(

View file

@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newContactResource; import static google.registry.testing.DatastoreHelper.newContactResource;
import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
@ -90,7 +89,7 @@ public class OfyTest {
// Set the clock in Ofy to the same time as the backup group root's save time. // Set the clock in Ofy to the same time as the backup group root's save time.
Ofy ofy = new Ofy(new FakeClock(groupTimestamp)); Ofy ofy = new Ofy(new FakeClock(groupTimestamp));
TimestampInversionException thrown = TimestampInversionException thrown =
expectThrows(TimestampInversionException.class, () -> ofy.transact(work)); assertThrows(TimestampInversionException.class, () -> ofy.transact(work));
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains( .contains(
@ -121,7 +120,7 @@ public class OfyTest {
@Test @Test
public void testSavingKeyTwice() { public void testSavingKeyTwice() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
ofy() ofy()
@ -139,7 +138,7 @@ public class OfyTest {
@Test @Test
public void testDeletingKeyTwice() { public void testDeletingKeyTwice() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
ofy() ofy()
@ -157,7 +156,7 @@ public class OfyTest {
@Test @Test
public void testSaveDeleteKey() { public void testSaveDeleteKey() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
ofy() ofy()
@ -175,7 +174,7 @@ public class OfyTest {
@Test @Test
public void testDeleteSaveKey() { public void testDeleteSaveKey() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
ofy() ofy()
@ -404,7 +403,7 @@ public class OfyTest {
@Test @Test
public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntity() { public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntity() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> getBaseEntityClassFromEntityOrKey(new SystemClock())); () -> getBaseEntityClassFromEntityOrKey(new SystemClock()));
assertThat(thrown).hasMessageThat().contains("SystemClock"); assertThat(thrown).hasMessageThat().contains("SystemClock");
@ -413,7 +412,7 @@ public class OfyTest {
@Test @Test
public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntityKey() { public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntityKey() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
getBaseEntityClassFromEntityOrKey( getBaseEntityClassFromEntityOrKey(

View file

@ -19,7 +19,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.rde.RdeMode.FULL; import static google.registry.model.rde.RdeMode.FULL;
import static google.registry.model.rde.RdeRevision.getNextRevision; import static google.registry.model.rde.RdeRevision.getNextRevision;
import static google.registry.model.rde.RdeRevision.saveRevision; import static google.registry.model.rde.RdeRevision.saveRevision;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.base.VerifyException; import com.google.common.base.VerifyException;
import com.googlecode.objectify.VoidWork; import com.googlecode.objectify.VoidWork;
@ -67,7 +67,7 @@ public class RdeRevisionTest {
@Test @Test
public void testSaveRevision_objectDoesntExist_newRevisionIsOne_throwsVe() throws Exception { public void testSaveRevision_objectDoesntExist_newRevisionIsOne_throwsVe() throws Exception {
VerifyException thrown = VerifyException thrown =
expectThrows( assertThrows(
VerifyException.class, VerifyException.class,
() -> () ->
ofy() ofy()
@ -85,7 +85,7 @@ public class RdeRevisionTest {
public void testSaveRevision_objectExistsAtZero_newRevisionIsZero_throwsVe() throws Exception { public void testSaveRevision_objectExistsAtZero_newRevisionIsZero_throwsVe() throws Exception {
save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0); save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0);
VerifyException thrown = VerifyException thrown =
expectThrows( assertThrows(
VerifyException.class, VerifyException.class,
() -> () ->
ofy() ofy()
@ -119,7 +119,7 @@ public class RdeRevisionTest {
public void testSaveRevision_objectExistsAtZero_newRevisionIsTwo_throwsVe() throws Exception { public void testSaveRevision_objectExistsAtZero_newRevisionIsTwo_throwsVe() throws Exception {
save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0); save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0);
VerifyException thrown = VerifyException thrown =
expectThrows( assertThrows(
VerifyException.class, VerifyException.class,
() -> () ->
ofy() ofy()
@ -136,7 +136,7 @@ public class RdeRevisionTest {
@Test @Test
public void testSaveRevision_negativeRevision_throwsIae() throws Exception { public void testSaveRevision_negativeRevision_throwsIae() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
ofy() ofy()
@ -153,7 +153,7 @@ public class RdeRevisionTest {
@Test @Test
public void testSaveRevision_callerNotInTransaction_throwsIse() throws Exception { public void testSaveRevision_callerNotInTransaction_throwsIse() throws Exception {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> saveRevision("frenzy", DateTime.parse("1984-12-18TZ"), FULL, 1)); () -> saveRevision("frenzy", DateTime.parse("1984-12-18TZ"), FULL, 1));
assertThat(thrown).hasMessageThat().contains("transaction"); assertThat(thrown).hasMessageThat().contains("transaction");

View file

@ -27,7 +27,6 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResources; import static google.registry.testing.DatastoreHelper.persistSimpleResources;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -141,7 +140,7 @@ public class RegistrarTest extends EntityTestCase {
@Test @Test
public void testFailure_passwordNull() throws Exception { public void testFailure_passwordNull() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, () -> new Registrar.Builder().setPassword(null)); IllegalArgumentException.class, () -> new Registrar.Builder().setPassword(null));
assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long."); assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long.");
} }
@ -149,7 +148,7 @@ public class RegistrarTest extends EntityTestCase {
@Test @Test
public void testFailure_passwordTooShort() throws Exception { public void testFailure_passwordTooShort() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, () -> new Registrar.Builder().setPassword("abcde")); IllegalArgumentException.class, () -> new Registrar.Builder().setPassword("abcde"));
assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long."); assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long.");
} }
@ -157,7 +156,7 @@ public class RegistrarTest extends EntityTestCase {
@Test @Test
public void testFailure_passwordTooLong() throws Exception { public void testFailure_passwordTooLong() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> new Registrar.Builder().setPassword("abcdefghijklmnopq")); () -> new Registrar.Builder().setPassword("abcdefghijklmnopq"));
assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long."); assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long.");
@ -320,7 +319,7 @@ public class RegistrarTest extends EntityTestCase {
@Test @Test
public void testFailure_missingRegistrarType() throws Exception { public void testFailure_missingRegistrarType() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> new Registrar.Builder().setRegistrarName("blah").build()); () -> new Registrar.Builder().setRegistrarName("blah").build());
assertThat(thrown).hasMessageThat().contains("Registrar type cannot be null"); assertThat(thrown).hasMessageThat().contains("Registrar type cannot be null");
@ -329,7 +328,7 @@ public class RegistrarTest extends EntityTestCase {
@Test @Test
public void testFailure_missingRegistrarName() throws Exception { public void testFailure_missingRegistrarName() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
new Registrar.Builder().setClientId("blahid").setType(Registrar.Type.TEST).build()); new Registrar.Builder().setClientId("blahid").setType(Registrar.Type.TEST).build());
@ -339,7 +338,7 @@ public class RegistrarTest extends EntityTestCase {
@Test @Test
public void testFailure_missingAddress() throws Exception { public void testFailure_missingAddress() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
new Registrar.Builder() new Registrar.Builder()
@ -438,28 +437,28 @@ public class RegistrarTest extends EntityTestCase {
@Test @Test
public void testFailure_loadByClientId_clientIdIsNull() throws Exception { public void testFailure_loadByClientId_clientIdIsNull() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(null)); assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(null));
assertThat(thrown).hasMessageThat().contains("clientId must be specified"); assertThat(thrown).hasMessageThat().contains("clientId must be specified");
} }
@Test @Test
public void testFailure_loadByClientId_clientIdIsEmpty() throws Exception { public void testFailure_loadByClientId_clientIdIsEmpty() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId("")); assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(""));
assertThat(thrown).hasMessageThat().contains("clientId must be specified"); assertThat(thrown).hasMessageThat().contains("clientId must be specified");
} }
@Test @Test
public void testFailure_loadByClientIdCached_clientIdIsNull() throws Exception { public void testFailure_loadByClientIdCached_clientIdIsNull() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(null)); assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(null));
assertThat(thrown).hasMessageThat().contains("clientId must be specified"); assertThat(thrown).hasMessageThat().contains("clientId must be specified");
} }
@Test @Test
public void testFailure_loadByClientIdCached_clientIdIsEmpty() throws Exception { public void testFailure_loadByClientIdCached_clientIdIsEmpty() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached("")); assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(""));
assertThat(thrown).hasMessageThat().contains("clientId must be specified"); assertThat(thrown).hasMessageThat().contains("clientId must be specified");
} }
} }

View file

@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.newRegistry;
import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.EUR; import static org.joda.money.CurrencyUnit.EUR;
@ -196,7 +195,7 @@ public class RegistryTest extends EntityTestCase {
"tld-reserved057", "tld-reserved057",
"lol,RESERVED_FOR_ANCHOR_TENANT,another_conflict"); "lol,RESERVED_FOR_ANCHOR_TENANT,another_conflict");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> { () -> {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -354,21 +353,21 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_tldNeverSet() { public void testFailure_tldNeverSet() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> new Registry.Builder().build()); assertThrows(IllegalArgumentException.class, () -> new Registry.Builder().build());
assertThat(thrown).hasMessageThat().contains("No registry TLD specified"); assertThat(thrown).hasMessageThat().contains("No registry TLD specified");
} }
@Test @Test
public void testFailure_setTldStr_null() { public void testFailure_setTldStr_null() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(null)); assertThrows(IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(null));
assertThat(thrown).hasMessageThat().contains("TLD must not be null"); assertThat(thrown).hasMessageThat().contains("TLD must not be null");
} }
@Test @Test
public void testFailure_setTldStr_invalidTld() { public void testFailure_setTldStr_invalidTld() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(".tld").build()); IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(".tld").build());
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
@ -378,7 +377,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_setTldStr_nonCanonicalTld() { public void testFailure_setTldStr_nonCanonicalTld() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, () -> new Registry.Builder().setTldStr("TLD").build()); IllegalArgumentException.class, () -> new Registry.Builder().setTldStr("TLD").build());
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
@ -420,7 +419,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_pricingEngineIsRequired() { public void testFailure_pricingEngineIsRequired() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> new Registry.Builder().setTldStr("invalid").build()); () -> new Registry.Builder().setTldStr("invalid").build());
assertThat(thrown) assertThat(thrown)
@ -431,7 +430,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_negativeRenewBillingCostTransitionValue() { public void testFailure_negativeRenewBillingCostTransitionValue() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
Registry.get("tld") Registry.get("tld")
@ -444,7 +443,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_negativeCreateBillingCost() { public void testFailure_negativeCreateBillingCost() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, -42))); () -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, -42)));
assertThat(thrown).hasMessageThat().contains("createBillingCost cannot be negative"); assertThat(thrown).hasMessageThat().contains("createBillingCost cannot be negative");
@ -453,7 +452,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_negativeRestoreBillingCost() { public void testFailure_negativeRestoreBillingCost() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, -42))); () -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, -42)));
assertThat(thrown).hasMessageThat().contains("restoreBillingCost cannot be negative"); assertThat(thrown).hasMessageThat().contains("restoreBillingCost cannot be negative");
@ -462,7 +461,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_negativeServerStatusChangeBillingCost() { public void testFailure_negativeServerStatusChangeBillingCost() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
Registry.get("tld") Registry.get("tld")
@ -474,7 +473,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_renewBillingCostTransitionValue_wrongCurrency() { public void testFailure_renewBillingCostTransitionValue_wrongCurrency() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
Registry.get("tld") Registry.get("tld")
@ -488,7 +487,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_createBillingCost_wrongCurrency() { public void testFailure_createBillingCost_wrongCurrency() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(EUR, 42)).build()); () -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(EUR, 42)).build());
assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency"); assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency");
@ -497,7 +496,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_restoreBillingCost_wrongCurrency() { public void testFailure_restoreBillingCost_wrongCurrency() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(EUR, 42)).build()); () -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(EUR, 42)).build());
assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency"); assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency");
@ -506,7 +505,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_serverStatusChangeBillingCost_wrongCurrency() { public void testFailure_serverStatusChangeBillingCost_wrongCurrency() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
Registry.get("tld") Registry.get("tld")
@ -544,7 +543,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_eapFee_wrongCurrency() { public void testFailure_eapFee_wrongCurrency() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
Registry.get("tld") Registry.get("tld")
@ -557,7 +556,7 @@ public class RegistryTest extends EntityTestCase {
@Test @Test
public void testFailure_roidSuffixTooLong() { public void testFailure_roidSuffixTooLong() {
IllegalArgumentException e = IllegalArgumentException e =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> Registry.get("tld").asBuilder().setRoidSuffix("123456789")); () -> Registry.get("tld").asBuilder().setRoidSuffix("123456789"));
assertThat(e).hasMessageThat().isEqualTo("ROID suffix must be in format ^[A-Z0-9_]{1,8}$"); assertThat(e).hasMessageThat().isEqualTo("ROID suffix must be in format ^[A-Z0-9_]{1,8}$");

View file

@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
@ -82,7 +81,7 @@ public class PremiumListTest {
@Test @Test
public void testParse_cannotIncludeDuplicateLabels() { public void testParse_cannotIncludeDuplicateLabels() {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
PremiumList.get("tld") PremiumList.get("tld")

View file

@ -34,7 +34,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.loadPremiumListEntries; import static google.registry.testing.DatastoreHelper.loadPremiumListEntries;
import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.joda.time.Duration.standardMinutes; import static org.joda.time.Duration.standardMinutes;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -112,7 +112,7 @@ public class PremiumListUtilsTest {
throws Exception { throws Exception {
deletePremiumList(PremiumList.get("tld").get()); deletePremiumList(PremiumList.get("tld").get());
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, () -> getPremiumPrice("blah", Registry.get("tld"))); IllegalStateException.class, () -> getPremiumPrice("blah", Registry.get("tld")));
assertThat(thrown).hasMessageThat().contains("Could not load premium list 'tld'"); assertThat(thrown).hasMessageThat().contains("Could not load premium list 'tld'");
} }

View file

@ -34,7 +34,6 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -266,7 +265,7 @@ public class ReservedListTest {
assertThat(matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar")).isFalse(); assertThat(matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar")).isFalse();
persistReservedList("reserved2", "lol,RESERVED_FOR_ANCHOR_TENANT,bar"); persistReservedList("reserved2", "lol,RESERVED_FOR_ANCHOR_TENANT,bar");
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar")); () -> matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar"));
assertThat(thrown) assertThat(thrown)
@ -469,7 +468,7 @@ public class ReservedListTest {
@Test @Test
public void testSave_badSyntax() throws Exception { public void testSave_badSyntax() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> persistReservedList("tld", "lol,FULLY_BLOCKED,e,e # yup")); () -> persistReservedList("tld", "lol,FULLY_BLOCKED,e,e # yup"));
assertThat(thrown).hasMessageThat().contains("Could not parse line in reserved list"); assertThat(thrown).hasMessageThat().contains("Could not parse line in reserved list");
@ -484,7 +483,7 @@ public class ReservedListTest {
@Test @Test
public void testSave_additionalRestrictionWithIncompatibleReservationType() throws Exception { public void testSave_additionalRestrictionWithIncompatibleReservationType() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
persistResource( persistResource(
@ -504,7 +503,7 @@ public class ReservedListTest {
@Test @Test
public void testSave_badNameservers_invalidSyntax() throws Exception { public void testSave_badNameservers_invalidSyntax() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
persistReservedList( persistReservedList(
@ -517,7 +516,7 @@ public class ReservedListTest {
@Test @Test
public void testSave_badNameservers_tooFewPartsForHostname() throws Exception { public void testSave_badNameservers_tooFewPartsForHostname() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
persistReservedList( persistReservedList(
@ -530,7 +529,7 @@ public class ReservedListTest {
@Test @Test
public void testSave_noPasswordWithAnchorTenantReservation() throws Exception { public void testSave_noPasswordWithAnchorTenantReservation() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
persistResource( persistResource(
@ -548,7 +547,7 @@ public class ReservedListTest {
@Test @Test
public void testSave_noNameserversWithNameserverRestrictedReservation() throws Exception { public void testSave_noNameserversWithNameserverRestrictedReservation() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
persistResource( persistResource(
@ -568,7 +567,7 @@ public class ReservedListTest {
public void testParse_cannotIncludeDuplicateLabels() { public void testParse_cannotIncludeDuplicateLabels() {
ReservedList rl = new ReservedList.Builder().setName("blah").build(); ReservedList rl = new ReservedList.Builder().setName("blah").build();
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> () ->
rl.parse( rl.parse(

View file

@ -17,7 +17,7 @@ package google.registry.model.server;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
@ -47,7 +47,7 @@ public class KmsSecretRevisionTest {
@Test @Test
public void test_setEncryptedValue_tooLong_throwsException() { public void test_setEncryptedValue_tooLong_throwsException() {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> () ->
secretRevision = secretRevision =

View file

@ -20,7 +20,7 @@ import static google.registry.model.server.Lock.LockState.FREE;
import static google.registry.model.server.Lock.LockState.IN_USE; import static google.registry.model.server.Lock.LockState.IN_USE;
import static google.registry.model.server.Lock.LockState.OWNER_DIED; import static google.registry.model.server.Lock.LockState.OWNER_DIED;
import static google.registry.model.server.Lock.LockState.TIMED_OUT; import static google.registry.model.server.Lock.LockState.TIMED_OUT;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
@ -136,7 +136,7 @@ public class LockTest {
@Test @Test
public void testFailure_emptyResourceName() throws Exception { public void testFailure_emptyResourceName() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> Lock.acquire("", "", TWO_MILLIS, requestStatusChecker)); () -> Lock.acquire("", "", TWO_MILLIS, requestStatusChecker));
assertThat(thrown).hasMessageThat().contains("resourceName cannot be null or empty"); assertThat(thrown).hasMessageThat().contains("resourceName cannot be null or empty");

View file

@ -21,7 +21,7 @@ import static google.registry.pricing.PricingEngineProxy.isDomainPremium;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.USD; import static org.joda.money.CurrencyUnit.USD;
@ -145,7 +145,7 @@ public class PricingEngineProxyTest {
.setPremiumPricingEngine("fake") .setPremiumPricingEngine("fake")
.build()); .build());
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> getDomainCreateCost("bad.example", clock.nowUtc(), 1)); () -> getDomainCreateCost("bad.example", clock.nowUtc(), 1));
assertThat(thrown) assertThat(thrown)

View file

@ -17,7 +17,7 @@ package google.registry.proxy;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.proxy.ProxyConfig.Environment.TEST; import static google.registry.proxy.ProxyConfig.Environment.TEST;
import static google.registry.proxy.ProxyConfig.getProxyConfig; import static google.registry.proxy.ProxyConfig.getProxyConfig;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import com.beust.jcommander.ParameterException; import com.beust.jcommander.ParameterException;
@ -94,7 +94,7 @@ public class ProxyModuleTest {
@Test @Test
public void testFailure_parseArgs_wrongEnvironment() { public void testFailure_parseArgs_wrongEnvironment() {
ParameterException e = ParameterException e =
expectThrows( assertThrows(
ParameterException.class, ParameterException.class,
() -> { () -> {
String[] args = {"--env", "beta"}; String[] args = {"--env", "beta"};

View file

@ -22,7 +22,7 @@ import static google.registry.proxy.TestUtils.makeHttpPostRequest;
import static google.registry.proxy.TestUtils.makeHttpResponse; import static google.registry.proxy.TestUtils.makeHttpResponse;
import static google.registry.proxy.handler.EppServiceHandler.CLIENT_CERTIFICATE_HASH_KEY; import static google.registry.proxy.handler.EppServiceHandler.CLIENT_CERTIFICATE_HASH_KEY;
import static google.registry.proxy.handler.RelayHandler.RELAY_CHANNEL_KEY; import static google.registry.proxy.handler.RelayHandler.RELAY_CHANNEL_KEY;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
@ -96,7 +96,7 @@ public class BackendMetricsHandlerTest {
public void testFailure_outbound_wrongType() { public void testFailure_outbound_wrongType() {
Object request = new Object(); Object request = new Object();
IllegalArgumentException e = IllegalArgumentException e =
expectThrows(IllegalArgumentException.class, () -> channel.writeOutbound(request)); assertThrows(IllegalArgumentException.class, () -> channel.writeOutbound(request));
assertThat(e).hasMessageThat().isEqualTo("Outgoing request must be FullHttpRequest."); assertThat(e).hasMessageThat().isEqualTo("Outgoing request must be FullHttpRequest.");
} }
@ -104,7 +104,7 @@ public class BackendMetricsHandlerTest {
public void testFailure_inbound_wrongType() { public void testFailure_inbound_wrongType() {
Object response = new Object(); Object response = new Object();
IllegalArgumentException e = IllegalArgumentException e =
expectThrows(IllegalArgumentException.class, () -> channel.writeInbound(response)); assertThrows(IllegalArgumentException.class, () -> channel.writeInbound(response));
assertThat(e).hasMessageThat().isEqualTo("Incoming response must be FullHttpResponse."); assertThat(e).hasMessageThat().isEqualTo("Incoming response must be FullHttpResponse.");
} }
@ -159,7 +159,7 @@ public class BackendMetricsHandlerTest {
public void testFailure_responseBeforeRequest() { public void testFailure_responseBeforeRequest() {
FullHttpResponse response = makeHttpResponse("phantom response", HttpResponseStatus.OK); FullHttpResponse response = makeHttpResponse("phantom response", HttpResponseStatus.OK);
IllegalStateException e = IllegalStateException e =
expectThrows(IllegalStateException.class, () -> channel.writeInbound(response)); assertThrows(IllegalStateException.class, () -> channel.writeInbound(response));
assertThat(e).hasMessageThat().isEqualTo("Response received before request is sent."); assertThat(e).hasMessageThat().isEqualTo("Response received before request is sent.");
} }

View file

@ -17,7 +17,7 @@ package google.registry.proxy.handler;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.proxy.Protocol.PROTOCOL_KEY; import static google.registry.proxy.Protocol.PROTOCOL_KEY;
import static google.registry.proxy.handler.EppServiceHandler.CLIENT_CERTIFICATE_HASH_KEY; import static google.registry.proxy.handler.EppServiceHandler.CLIENT_CERTIFICATE_HASH_KEY;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
@ -108,7 +108,7 @@ public class EppQuotaHandlerTest {
when(quotaManager.acquireQuota(QuotaRequest.create(clientCertHash))) when(quotaManager.acquireQuota(QuotaRequest.create(clientCertHash)))
.thenReturn(QuotaResponse.create(false, clientCertHash, now)); .thenReturn(QuotaResponse.create(false, clientCertHash, now));
OverQuotaException e = OverQuotaException e =
expectThrows(OverQuotaException.class, () -> channel.writeInbound(message)); assertThrows(OverQuotaException.class, () -> channel.writeInbound(message));
assertThat(e).hasMessageThat().contains(clientCertHash); assertThat(e).hasMessageThat().contains(clientCertHash);
verify(metrics).registerQuotaRejection("epp", clientCertHash); verify(metrics).registerQuotaRejection("epp", clientCertHash);
verifyNoMoreInteractions(metrics); verifyNoMoreInteractions(metrics);
@ -136,7 +136,7 @@ public class EppQuotaHandlerTest {
// Blocks the second user. // Blocks the second user.
OverQuotaException e = OverQuotaException e =
expectThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); assertThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message));
assertThat(e).hasMessageThat().contains(otherClientCertHash); assertThat(e).hasMessageThat().contains(otherClientCertHash);
verify(metrics).registerQuotaRejection("epp", otherClientCertHash); verify(metrics).registerQuotaRejection("epp", otherClientCertHash);
verifyNoMoreInteractions(metrics); verifyNoMoreInteractions(metrics);
@ -162,7 +162,7 @@ public class EppQuotaHandlerTest {
// Blocks the second channel. // Blocks the second channel.
OverQuotaException e = OverQuotaException e =
expectThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); assertThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message));
assertThat(e).hasMessageThat().contains(clientCertHash); assertThat(e).hasMessageThat().contains(clientCertHash);
verify(metrics).registerQuotaRejection("epp", clientCertHash); verify(metrics).registerQuotaRejection("epp", clientCertHash);
verifyNoMoreInteractions(metrics); verifyNoMoreInteractions(metrics);

View file

@ -17,7 +17,7 @@ package google.registry.proxy.handler;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.proxy.Protocol.PROTOCOL_KEY; import static google.registry.proxy.Protocol.PROTOCOL_KEY;
import static google.registry.proxy.handler.ProxyProtocolHandler.REMOTE_ADDRESS_KEY; import static google.registry.proxy.handler.ProxyProtocolHandler.REMOTE_ADDRESS_KEY;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
@ -103,7 +103,7 @@ public class WhoisQuotaHandlerTest {
when(quotaManager.acquireQuota(QuotaRequest.create(remoteAddress))) when(quotaManager.acquireQuota(QuotaRequest.create(remoteAddress)))
.thenReturn(QuotaResponse.create(false, remoteAddress, now)); .thenReturn(QuotaResponse.create(false, remoteAddress, now));
OverQuotaException e = OverQuotaException e =
expectThrows(OverQuotaException.class, () -> channel.writeInbound(message)); assertThrows(OverQuotaException.class, () -> channel.writeInbound(message));
assertThat(e).hasMessageThat().contains("none"); assertThat(e).hasMessageThat().contains("none");
verify(metrics).registerQuotaRejection("whois", "none"); verify(metrics).registerQuotaRejection("whois", "none");
verifyNoMoreInteractions(metrics); verifyNoMoreInteractions(metrics);
@ -131,7 +131,7 @@ public class WhoisQuotaHandlerTest {
// Blocks the second user. // Blocks the second user.
OverQuotaException e = OverQuotaException e =
expectThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); assertThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message));
assertThat(e).hasMessageThat().contains("none"); assertThat(e).hasMessageThat().contains("none");
verify(metrics).registerQuotaRejection("whois", "none"); verify(metrics).registerQuotaRejection("whois", "none");
verifyNoMoreInteractions(metrics); verifyNoMoreInteractions(metrics);
@ -166,7 +166,7 @@ public class WhoisQuotaHandlerTest {
// Blocks the second channel. // Blocks the second channel.
OverQuotaException e = OverQuotaException e =
expectThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); assertThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message));
assertThat(e).hasMessageThat().contains("none"); assertThat(e).hasMessageThat().contains("none");
verify(metrics).registerQuotaRejection("whois", "none"); verify(metrics).registerQuotaRejection("whois", "none");

View file

@ -15,7 +15,7 @@
package google.registry.proxy.quota; package google.registry.proxy.quota;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.ResourceUtils.readResourceUtf8; import static google.registry.util.ResourceUtils.readResourceUtf8;
import google.registry.proxy.ProxyConfig.Quota; import google.registry.proxy.ProxyConfig.Quota;
@ -76,7 +76,7 @@ public class QuotaConfigTest {
quotaConfig = loadQuotaConfig("quota_config_unlimited_tokens.yaml"); quotaConfig = loadQuotaConfig("quota_config_unlimited_tokens.yaml");
assertThat(quotaConfig.hasUnlimitedTokens("some_user")).isTrue(); assertThat(quotaConfig.hasUnlimitedTokens("some_user")).isTrue();
IllegalStateException e = IllegalStateException e =
expectThrows(IllegalStateException.class, () -> quotaConfig.getTokenAmount("some_user")); assertThrows(IllegalStateException.class, () -> quotaConfig.getTokenAmount("some_user"));
assertThat(e) assertThat(e)
.hasMessageThat() .hasMessageThat()
.contains("User ID some_user is provisioned with unlimited tokens"); .contains("User ID some_user is provisioned with unlimited tokens");
@ -85,7 +85,7 @@ public class QuotaConfigTest {
@Test @Test
public void testFailure_duplicateUserId() { public void testFailure_duplicateUserId() {
IllegalArgumentException e = IllegalArgumentException e =
expectThrows( assertThrows(
IllegalArgumentException.class, () -> loadQuotaConfig("quota_config_duplicate.yaml")); IllegalArgumentException.class, () -> loadQuotaConfig("quota_config_duplicate.yaml"));
assertThat(e).hasMessageThat().contains("Multiple entries with same key"); assertThat(e).hasMessageThat().contains("Multiple entries with same key");
} }

View file

@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.joda.time.Duration.standardDays; import static org.joda.time.Duration.standardDays;
import static org.joda.time.Duration.standardSeconds; import static org.joda.time.Duration.standardSeconds;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -97,7 +97,7 @@ public class EscrowTaskRunnerTest {
persistResource( persistResource(
Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-07TZ"), registry)); Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-07TZ"), registry));
NoContentException thrown = NoContentException thrown =
expectThrows( assertThrows(
NoContentException.class, NoContentException.class,
() -> () ->
runner.lockRunAndRollForward( runner.lockRunAndRollForward(
@ -112,7 +112,7 @@ public class EscrowTaskRunnerTest {
persistResource( persistResource(
Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-06TZ"), registry)); Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-06TZ"), registry));
ServiceUnavailableException thrown = ServiceUnavailableException thrown =
expectThrows( assertThrows(
ServiceUnavailableException.class, ServiceUnavailableException.class,
() -> { () -> {
runner.lockHandler = new FakeLockHandler(false); runner.lockHandler = new FakeLockHandler(false);

View file

@ -18,7 +18,6 @@ import static com.google.common.base.Strings.repeat;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.keyring.api.PgpHelper.KeyRequirement.ENCRYPT; import static google.registry.keyring.api.PgpHelper.KeyRequirement.ENCRYPT;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
@ -193,7 +192,7 @@ public class GhostrydeTest {
ByteArrayInputStream bsIn = new ByteArrayInputStream(ciphertext); ByteArrayInputStream bsIn = new ByteArrayInputStream(ciphertext);
IllegalStateException thrown = IllegalStateException thrown =
expectThrows( assertThrows(
IllegalStateException.class, IllegalStateException.class,
() -> { () -> {
try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) { try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) {
@ -254,7 +253,7 @@ public class GhostrydeTest {
ByteArrayInputStream bsIn = new ByteArrayInputStream(bsOut.toByteArray()); ByteArrayInputStream bsIn = new ByteArrayInputStream(bsOut.toByteArray());
PGPException thrown = PGPException thrown =
expectThrows( assertThrows(
PGPException.class, PGPException.class,
() -> { () -> {
try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) { try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) {

View file

@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.GcsTestingUtils.writeGcsFile; import static google.registry.testing.GcsTestingUtils.writeGcsFile;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST; import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_OK;
import static org.joda.time.DateTimeZone.UTC; import static org.joda.time.DateTimeZone.UTC;
@ -173,7 +172,7 @@ public class RdeReportActionTest {
when(httpResponse.getContent()).thenReturn(IIRDEA_BAD_XML.read()); when(httpResponse.getContent()).thenReturn(IIRDEA_BAD_XML.read());
when(urlFetchService.fetch(request.capture())).thenReturn(httpResponse); when(urlFetchService.fetch(request.capture())).thenReturn(httpResponse);
InternalServerErrorException thrown = InternalServerErrorException thrown =
expectThrows( assertThrows(
InternalServerErrorException.class, InternalServerErrorException.class,
() -> createAction().runWithLock(loadRdeReportCursor())); () -> createAction().runWithLock(loadRdeReportCursor()));
assertThat(thrown).hasMessageThat().contains("The structure of the report is invalid."); assertThat(thrown).hasMessageThat().contains("The structure of the report is invalid.");

View file

@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource;
import static google.registry.testing.GcsTestingUtils.readGcsFile; import static google.registry.testing.GcsTestingUtils.readGcsFile;
import static google.registry.testing.GcsTestingUtils.writeGcsFile; import static google.registry.testing.GcsTestingUtils.writeGcsFile;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.SystemInfo.hasCommand; import static google.registry.testing.SystemInfo.hasCommand;
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
@ -309,7 +309,7 @@ public class RdeUploadActionTest {
RdeUploadAction action = createAction(uploadUrl); RdeUploadAction action = createAction(uploadUrl);
action.lazyJsch = Lazies.of(createThrowingJSchSpy(action.lazyJsch.get(), 3)); action.lazyJsch = Lazies.of(createThrowingJSchSpy(action.lazyJsch.get(), 3));
RuntimeException thrown = RuntimeException thrown =
expectThrows(RuntimeException.class, () -> action.runWithLock(uploadCursor)); assertThrows(RuntimeException.class, () -> action.runWithLock(uploadCursor));
assertThat(thrown).hasMessageThat().contains("The crow flies in square circles."); assertThat(thrown).hasMessageThat().contains("The crow flies in square circles.");
} }
@ -384,7 +384,7 @@ public class RdeUploadActionTest {
persistResource( persistResource(
Cursor.create(CursorType.RDE_STAGING, stagingCursor, Registry.get("tld"))); Cursor.create(CursorType.RDE_STAGING, stagingCursor, Registry.get("tld")));
ServiceUnavailableException thrown = ServiceUnavailableException thrown =
expectThrows( assertThrows(
ServiceUnavailableException.class, () -> createAction(null).runWithLock(uploadCursor)); ServiceUnavailableException.class, () -> createAction(null).runWithLock(uploadCursor));
assertThat(thrown).hasMessageThat().contains("Waiting for RdeStagingAction to complete"); assertThat(thrown).hasMessageThat().contains("Waiting for RdeStagingAction to complete");
} }

View file

@ -16,7 +16,7 @@ package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes; import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.appengine.tools.cloudstorage.GcsFilename; import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.appengine.tools.cloudstorage.GcsService; import com.google.appengine.tools.cloudstorage.GcsService;
@ -61,7 +61,7 @@ public class RdeHostInputTest {
@Test @Test
public void testNegativeShards_throwsIllegalArgumentException() throws Exception { public void testNegativeShards_throwsIllegalArgumentException() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> getInput(Optional.of(-1))); assertThrows(IllegalArgumentException.class, () -> getInput(Optional.of(-1)));
assertThat(thrown).hasMessageThat().contains("Number of shards must be greater than zero"); assertThat(thrown).hasMessageThat().contains("Number of shards must be greater than zero");
} }
@ -69,7 +69,7 @@ public class RdeHostInputTest {
@Test @Test
public void testZeroShards_throwsIllegalArgumentException() throws Exception { public void testZeroShards_throwsIllegalArgumentException() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> getInput(Optional.of(0))); assertThrows(IllegalArgumentException.class, () -> getInput(Optional.of(0)));
assertThat(thrown).hasMessageThat().contains("Number of shards must be greater than zero"); assertThat(thrown).hasMessageThat().contains("Number of shards must be greater than zero");
} }

View file

@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistNewRegistrar; import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.JUnitBackports.expectThrows;
import static org.joda.time.DateTimeZone.UTC; import static org.joda.time.DateTimeZone.UTC;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -273,7 +272,7 @@ public class RdeImportUtilsTest extends ShardableTestCase {
xmlInput = DEPOSIT_BADTLD_XML.openBufferedStream(); xmlInput = DEPOSIT_BADTLD_XML.openBufferedStream();
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
Exception e = Exception e =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badtld.xml")); () -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badtld.xml"));
assertThat(e).hasMessageThat().isEqualTo("TLD 'badtld' not found in the registry"); assertThat(e).hasMessageThat().isEqualTo("TLD 'badtld' not found in the registry");
@ -285,7 +284,7 @@ public class RdeImportUtilsTest extends ShardableTestCase {
xmlInput = DEPOSIT_GETLD_XML.openBufferedStream(); xmlInput = DEPOSIT_GETLD_XML.openBufferedStream();
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
Exception e = Exception e =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-getld.xml")); () -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-getld.xml"));
assertThat(e) assertThat(e)
@ -299,7 +298,7 @@ public class RdeImportUtilsTest extends ShardableTestCase {
xmlInput = DEPOSIT_BADREGISTRAR_XML.openBufferedStream(); xmlInput = DEPOSIT_BADREGISTRAR_XML.openBufferedStream();
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
Exception e = Exception e =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badregistrar.xml")); () -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badregistrar.xml"));
assertThat(e).hasMessageThat().isEqualTo("Registrar 'RegistrarY' not found in the registry"); assertThat(e).hasMessageThat().isEqualTo("Registrar 'RegistrarY' not found in the registry");

View file

@ -16,7 +16,7 @@ package google.registry.rde.imports;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.rde.imports.RdeImportsTestData.loadBytes; import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import com.google.common.io.ByteSource; import com.google.common.io.ByteSource;
import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.rde.imports.RdeParser.RdeHeader;
@ -74,7 +74,7 @@ public class RdeParserTest {
@Test @Test
public void testGetContactNotAtElement_throwsIllegalStateException() throws Exception { public void testGetContactNotAtElement_throwsIllegalStateException() throws Exception {
try (RdeParser parser = new RdeParser(xml)) { try (RdeParser parser = new RdeParser(xml)) {
IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getContact); IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getContact);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Not at element urn:ietf:params:xml:ns:rdeContact-1.0:contact"); .contains("Not at element urn:ietf:params:xml:ns:rdeContact-1.0:contact");
@ -158,7 +158,7 @@ public class RdeParserTest {
@Test @Test
public void testGetDomainNotAtElement_throwsIllegalStateException() throws Exception { public void testGetDomainNotAtElement_throwsIllegalStateException() throws Exception {
try (RdeParser parser = new RdeParser(xml)) { try (RdeParser parser = new RdeParser(xml)) {
IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getDomain); IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getDomain);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Not at element urn:ietf:params:xml:ns:rdeDomain-1.0:domain"); .contains("Not at element urn:ietf:params:xml:ns:rdeDomain-1.0:domain");
@ -270,7 +270,7 @@ public class RdeParserTest {
@Test @Test
public void testGetHostNotAtElement_throwsIllegalStateException() throws Exception { public void testGetHostNotAtElement_throwsIllegalStateException() throws Exception {
try (RdeParser parser = new RdeParser(xml)) { try (RdeParser parser = new RdeParser(xml)) {
IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getHost); IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getHost);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Not at element urn:ietf:params:xml:ns:rdeHost-1.0:host"); .contains("Not at element urn:ietf:params:xml:ns:rdeHost-1.0:host");
@ -384,7 +384,7 @@ public class RdeParserTest {
public void testGetRegistrarNotAtElement_throwsIllegalStateException() throws Exception { public void testGetRegistrarNotAtElement_throwsIllegalStateException() throws Exception {
try (RdeParser parser = new RdeParser(xml)) { try (RdeParser parser = new RdeParser(xml)) {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows(IllegalStateException.class, parser::getRegistrar); assertThrows(IllegalStateException.class, parser::getRegistrar);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Not at element urn:ietf:params:xml:ns:rdeRegistrar-1.0:registrar"); .contains("Not at element urn:ietf:params:xml:ns:rdeRegistrar-1.0:registrar");
@ -423,7 +423,7 @@ public class RdeParserTest {
@Test @Test
public void testGetNndnNotAtElement_throwsIllegalStateException() throws Exception { public void testGetNndnNotAtElement_throwsIllegalStateException() throws Exception {
try (RdeParser parser = new RdeParser(xml)) { try (RdeParser parser = new RdeParser(xml)) {
IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getNndn); IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getNndn);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Not at element urn:ietf:params:xml:ns:rdeNNDN-1.0:NNDN"); .contains("Not at element urn:ietf:params:xml:ns:rdeNNDN-1.0:NNDN");
@ -461,7 +461,7 @@ public class RdeParserTest {
@Test @Test
public void testGetIdnNotAtElement_throwsIllegalStateException() throws Exception { public void testGetIdnNotAtElement_throwsIllegalStateException() throws Exception {
try (RdeParser parser = new RdeParser(xml)) { try (RdeParser parser = new RdeParser(xml)) {
IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getIdn); IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getIdn);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Not at element urn:ietf:params:xml:ns:rdeIDN-1.0:idnTableRef"); .contains("Not at element urn:ietf:params:xml:ns:rdeIDN-1.0:idnTableRef");
@ -502,7 +502,7 @@ public class RdeParserTest {
public void testGetEppParamsNotAtElement_throwsIllegalStateException() throws Exception { public void testGetEppParamsNotAtElement_throwsIllegalStateException() throws Exception {
try (RdeParser parser = new RdeParser(xml)) { try (RdeParser parser = new RdeParser(xml)) {
IllegalStateException thrown = IllegalStateException thrown =
expectThrows(IllegalStateException.class, parser::getEppParams); assertThrows(IllegalStateException.class, parser::getEppParams);
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Not at element urn:ietf:params:xml:ns:rdeEppParams-1.0:eppParams"); .contains("Not at element urn:ietf:params:xml:ns:rdeEppParams-1.0:eppParams");

View file

@ -26,7 +26,7 @@ import static google.registry.testing.DatastoreHelper.getHistoryEntries;
import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveHost;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
@ -214,7 +214,7 @@ public class XjcToDomainResourceConverterTest {
persistActiveContact("sh8013"); persistActiveContact("sh8013");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pendingRestorePeriod.xml"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pendingRestorePeriod.xml");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); assertThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain));
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Unsupported grace period status: PENDING_RESTORE"); .contains("Unsupported grace period status: PENDING_RESTORE");
@ -270,7 +270,7 @@ public class XjcToDomainResourceConverterTest {
persistActiveHost("ns2.example.net"); persistActiveHost("ns2.example.net");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_attrs.xml"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_attrs.xml");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); assertThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain));
assertThat(thrown).hasMessageThat().contains("Host attributes are not yet supported"); assertThat(thrown).hasMessageThat().contains("Host attributes are not yet supported");
} }
@ -281,7 +281,7 @@ public class XjcToDomainResourceConverterTest {
persistActiveHost("ns1.example.net"); persistActiveHost("ns1.example.net");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_objs.xml"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_objs.xml");
IllegalStateException thrown = IllegalStateException thrown =
expectThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); assertThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain));
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("HostResource not found with name 'ns2.example.net'"); .contains("HostResource not found with name 'ns2.example.net'");
@ -292,7 +292,7 @@ public class XjcToDomainResourceConverterTest {
persistActiveContact("sh8013"); persistActiveContact("sh8013");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
IllegalStateException thrown = IllegalStateException thrown =
expectThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); assertThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain));
assertThat(thrown).hasMessageThat().contains("Registrant not found: 'jd1234'"); assertThat(thrown).hasMessageThat().contains("Registrant not found: 'jd1234'");
} }
@ -302,7 +302,7 @@ public class XjcToDomainResourceConverterTest {
persistActiveContact("sh8013"); persistActiveContact("sh8013");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_registrant_missing.xml"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_registrant_missing.xml");
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); assertThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain));
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()
.contains("Registrant is missing for domain 'example1.example'"); .contains("Registrant is missing for domain 'example1.example'");
@ -313,7 +313,7 @@ public class XjcToDomainResourceConverterTest {
persistActiveContact("jd1234"); persistActiveContact("jd1234");
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
IllegalStateException thrown = IllegalStateException thrown =
expectThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); assertThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain));
assertThat(thrown).hasMessageThat().contains("Contact not found: 'sh8013'"); assertThat(thrown).hasMessageThat().contains("Contact not found: 'sh8013'");
} }

View file

@ -15,7 +15,7 @@
package google.registry.reporting; package google.registry.reporting;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -52,7 +52,7 @@ public class ReportingModuleTest {
public void testInvalidYearMonthParameter_throwsException() { public void testInvalidYearMonthParameter_throwsException() {
when(req.getParameter("yearMonth")).thenReturn("201705"); when(req.getParameter("yearMonth")).thenReturn("201705");
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, () -> ReportingModule.provideYearMonthOptional(req)); BadRequestException.class, () -> ReportingModule.provideYearMonthOptional(req));
assertThat(thrown) assertThat(thrown)
.hasMessageThat() .hasMessageThat()

View file

@ -16,7 +16,7 @@ package google.registry.reporting.billing;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage; import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -144,7 +144,7 @@ public class BillingEmailUtilsTest {
} }
); );
RuntimeException thrown = RuntimeException thrown =
expectThrows(RuntimeException.class, () -> emailUtils.emailOverallInvoice()); assertThrows(RuntimeException.class, () -> emailUtils.emailOverallInvoice());
assertThat(thrown).hasMessageThat().isEqualTo("javax.mail.MessagingException: expected"); assertThat(thrown).hasMessageThat().isEqualTo("javax.mail.MessagingException: expected");
// Verify we sent an e-mail alert // Verify we sent an e-mail alert
verify(emailService).sendMessage(msgCaptor.capture()); verify(emailService).sendMessage(msgCaptor.capture());

View file

@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.loadRegistrar;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.GcsTestingUtils.writeGcsFile; import static google.registry.testing.GcsTestingUtils.writeGcsFile;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_OK;
import static org.mockito.Matchers.any; import static org.mockito.Matchers.any;
@ -169,7 +169,7 @@ public class CopyDetailReportsActionTest {
when(driveConnection.createFile(any(), any(), any(), any())) when(driveConnection.createFile(any(), any(), any(), any()))
.thenThrow(new IOException("expected")); .thenThrow(new IOException("expected"));
RuntimeException thrown = expectThrows(RuntimeException.class, action::run); RuntimeException thrown = assertThrows(RuntimeException.class, action::run);
assertThat(thrown).hasMessageThat().isEqualTo("java.io.IOException: expected"); assertThat(thrown).hasMessageThat().isEqualTo("java.io.IOException: expected");
verify(driveConnection, times(3)) verify(driveConnection, times(3))
.createFile( .createFile(

View file

@ -18,7 +18,7 @@ import static com.google.common.net.MediaType.CSV_UTF_8;
import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8; import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.api.client.http.LowLevelHttpRequest; import com.google.api.client.http.LowLevelHttpRequest;
@ -125,7 +125,7 @@ public class IcannHttpReporterTest {
@Test @Test
public void testFail_invalidFilename_nonSixDigitYearMonth() throws Exception { public void testFail_invalidFilename_nonSixDigitYearMonth() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> { () -> {
IcannHttpReporter reporter = createReporter(); IcannHttpReporter reporter = createReporter();
@ -141,7 +141,7 @@ public class IcannHttpReporterTest {
@Test @Test
public void testFail_invalidFilename_notActivityOrTransactions() throws Exception { public void testFail_invalidFilename_notActivityOrTransactions() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> { () -> {
IcannHttpReporter reporter = createReporter(); IcannHttpReporter reporter = createReporter();
@ -156,7 +156,7 @@ public class IcannHttpReporterTest {
@Test @Test
public void testFail_invalidFilename_invalidTldName() throws Exception { public void testFail_invalidFilename_invalidTldName() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> { () -> {
IcannHttpReporter reporter = createReporter(); IcannHttpReporter reporter = createReporter();
@ -172,7 +172,7 @@ public class IcannHttpReporterTest {
@Test @Test
public void testFail_invalidFilename_tldDoesntExist() throws Exception { public void testFail_invalidFilename_tldDoesntExist() throws Exception {
IllegalArgumentException thrown = IllegalArgumentException thrown =
expectThrows( assertThrows(
IllegalArgumentException.class, IllegalArgumentException.class,
() -> { () -> {
IcannHttpReporter reporter = createReporter(); IcannHttpReporter reporter = createReporter();

View file

@ -15,7 +15,7 @@
package google.registry.reporting.icann; package google.registry.reporting.icann;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import google.registry.reporting.icann.IcannReportingModule.ReportType; import google.registry.reporting.icann.IcannReportingModule.ReportType;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
@ -45,7 +45,7 @@ public class IcannReportingModuleTest {
@Test @Test
public void testInvalidSubdir_throwsException() { public void testInvalidSubdir_throwsException() {
BadRequestException thrown = BadRequestException thrown =
expectThrows( assertThrows(
BadRequestException.class, BadRequestException.class,
() -> () ->
IcannReportingModule.provideSubdir(Optional.of("/whoops"), new YearMonth(2017, 6))); IcannReportingModule.provideSubdir(Optional.of("/whoops"), new YearMonth(2017, 6)));

View file

@ -15,7 +15,7 @@
package google.registry.reporting.icann; package google.registry.reporting.icann;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -134,7 +134,7 @@ public class IcannReportingStagingActionTest {
when(stager.stageReports(ReportType.ACTIVITY)) when(stager.stageReports(ReportType.ACTIVITY))
.thenThrow(new BigqueryJobFailureException("Expected failure", null, null, null)); .thenThrow(new BigqueryJobFailureException("Expected failure", null, null, null));
BigqueryJobFailureException thrown = BigqueryJobFailureException thrown =
expectThrows(BigqueryJobFailureException.class, action::run); assertThrows(BigqueryJobFailureException.class, action::run);
assertThat(thrown).hasMessageThat().isEqualTo("Expected failure"); assertThat(thrown).hasMessageThat().isEqualTo("Expected failure");
verify(stager, times(3)).stageReports(ReportType.ACTIVITY); verify(stager, times(3)).stageReports(ReportType.ACTIVITY);
verify(emailUtils) verify(emailUtils)

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