From 606b470cd04a84df1570d61b5fa70bb53e6a290f Mon Sep 17 00:00:00 2001 From: cushon Date: Mon, 26 Feb 2018 09:38:17 -0800 Subject: [PATCH] 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 --- .../batch/DeleteProberDataActionTest.java | 4 +- ...xpandRecurringBillingEventsActionTest.java | 6 +- .../google/registry/dns/DnsInjectionTest.java | 6 +- .../google/registry/dns/DnsQueueTest.java | 6 +- .../dns/PublishDnsUpdatesActionTest.java | 6 +- .../registry/dns/RefreshDnsActionTest.java | 3 +- .../dnsupdate/DnsMessageTransportTest.java | 7 +- .../writer/dnsupdate/DnsUpdateWriterTest.java | 6 +- .../export/BigqueryPollJobActionTest.java | 3 +- .../export/CheckSnapshotActionTest.java | 10 +- .../export/ExportReservedTermsActionTest.java | 6 +- .../export/LoadSnapshotActionTest.java | 6 +- .../export/PublishDetailReportActionTest.java | 20 +- .../export/UpdateSnapshotViewActionTest.java | 4 +- .../registry/flows/ExtensionManagerTest.java | 14 +- .../registry/flows/ResourceFlowTestCase.java | 4 +- .../registry/flows/TlsCredentialsTest.java | 6 +- .../flows/contact/ContactCheckFlowTest.java | 4 +- .../flows/contact/ContactCreateFlowTest.java | 8 +- .../flows/contact/ContactDeleteFlowTest.java | 14 +- .../flows/contact/ContactInfoFlowTest.java | 6 +- .../ContactTransferApproveFlowTest.java | 29 +-- .../ContactTransferCancelFlowTest.java | 24 +-- .../contact/ContactTransferQueryFlowTest.java | 14 +- .../ContactTransferRejectFlowTest.java | 24 +-- .../ContactTransferRequestFlowTest.java | 20 +- .../flows/contact/ContactUpdateFlowTest.java | 22 +- .../flows/domain/DomainAllocateFlowTest.java | 30 +-- .../DomainApplicationCreateFlowTest.java | 176 ++++++++-------- .../DomainApplicationDeleteFlowTest.java | 26 +-- .../domain/DomainApplicationInfoFlowTest.java | 14 +- .../DomainApplicationUpdateFlowTest.java | 62 +++--- .../flows/domain/DomainCheckFlowTest.java | 62 +++--- .../domain/DomainClaimsCheckFlowTest.java | 16 +- .../flows/domain/DomainCreateFlowTest.java | 188 +++++++++--------- .../flows/domain/DomainDeleteFlowTest.java | 24 +-- .../flows/domain/DomainInfoFlowTest.java | 34 ++-- .../flows/domain/DomainRenewFlowTest.java | 64 +++--- .../domain/DomainRestoreRequestFlowTest.java | 64 +++--- .../domain/DomainTransferApproveFlowTest.java | 28 +-- .../domain/DomainTransferCancelFlowTest.java | 28 +-- .../domain/DomainTransferQueryFlowTest.java | 14 +- .../domain/DomainTransferRejectFlowTest.java | 28 +-- .../domain/DomainTransferRequestFlowTest.java | 65 +++--- .../flows/domain/DomainUpdateFlowTest.java | 78 ++++---- .../token/AllocationTokenFlowUtilsTest.java | 8 +- .../flows/host/HostCheckFlowTest.java | 4 +- .../flows/host/HostCreateFlowTest.java | 28 +-- .../flows/host/HostDeleteFlowTest.java | 24 +-- .../registry/flows/host/HostInfoFlowTest.java | 12 +- .../flows/host/HostUpdateFlowTest.java | 62 +++--- .../registry/flows/poll/PollAckFlowTest.java | 5 +- .../flows/poll/PollRequestFlowTest.java | 4 +- .../flows/session/LoginFlowTestCase.java | 4 +- .../flows/session/LogoutFlowTest.java | 4 +- .../groups/DirectoryGroupsConnectionTest.java | 3 +- .../inputs/EppResourceInputsTest.java | 9 +- .../model/billing/BillingEventTest.java | 16 +- .../billing/RegistrarBillingEntryTest.java | 7 +- .../model/billing/RegistrarCreditTest.java | 8 +- .../registry/model/common/CursorTest.java | 16 +- .../model/contact/ContactResourceTest.java | 4 +- .../model/domain/AllocationTokenTest.java | 6 +- .../model/domain/DomainResourceTest.java | 6 +- .../model/domain/GracePeriodTest.java | 6 +- .../registry/model/host/HostResourceTest.java | 6 +- .../index/DomainApplicationIndexTest.java | 6 +- .../model/ofy/CommitLogBucketTest.java | 6 +- .../model/ofy/CommitLogCheckpointTest.java | 10 +- .../registry/model/ofy/OfyCommitLogTest.java | 18 +- .../registry/model/ofy/OfyFilterTest.java | 4 +- .../google/registry/model/ofy/OfyTest.java | 15 +- .../registry/model/rde/RdeRevisionTest.java | 12 +- .../model/registrar/RegistrarTest.java | 21 +- .../registry/model/registry/RegistryTest.java | 33 ++- .../model/registry/label/PremiumListTest.java | 3 +- .../registry/label/PremiumListUtilsTest.java | 4 +- .../registry/label/ReservedListTest.java | 17 +- .../model/server/KmsSecretRevisionTest.java | 4 +- .../registry/model/server/LockTest.java | 4 +- .../pricing/PricingEngineProxyTest.java | 4 +- .../registry/proxy/ProxyModuleTest.java | 4 +- .../handler/BackendMetricsHandlerTest.java | 8 +- .../proxy/handler/EppQuotaHandlerTest.java | 8 +- .../proxy/handler/WhoisQuotaHandlerTest.java | 8 +- .../registry/proxy/quota/QuotaConfigTest.java | 6 +- .../registry/rde/EscrowTaskRunnerTest.java | 6 +- .../google/registry/rde/GhostrydeTest.java | 5 +- .../registry/rde/RdeReportActionTest.java | 3 +- .../registry/rde/RdeUploadActionTest.java | 6 +- .../rde/imports/RdeHostInputTest.java | 6 +- .../rde/imports/RdeImportUtilsTest.java | 7 +- .../registry/rde/imports/RdeParserTest.java | 16 +- .../XjcToDomainResourceConverterTest.java | 14 +- .../reporting/ReportingModuleTest.java | 4 +- .../billing/BillingEmailUtilsTest.java | 4 +- .../billing/CopyDetailReportsActionTest.java | 4 +- .../icann/IcannHttpReporterTest.java | 10 +- .../icann/IcannReportingModuleTest.java | 4 +- .../IcannReportingStagingActionTest.java | 4 +- .../icann/IcannReportingUploadActionTest.java | 4 +- .../registry/request/RequestModuleTest.java | 5 +- .../request/RequestParametersTest.java | 16 +- .../google/registry/request/RouterTest.java | 8 +- .../auth/RequestAuthenticatorTest.java | 12 +- .../request/lock/LockHandlerImplTest.java | 6 +- .../storage/drive/DriveConnectionTest.java | 4 +- .../registry/tldconfig/idn/IdnTableTest.java | 6 +- .../google/registry/tmch/LordnTaskTest.java | 5 +- .../registry/tmch/NordnUploadActionTest.java | 3 +- .../registry/tmch/NordnVerifyActionTest.java | 3 +- .../registry/tmch/SmdrlCsvParserTest.java | 8 +- .../tmch/TmchCertificateAuthorityTest.java | 12 +- .../registry/tmch/TmchCrlActionTest.java | 8 +- .../registry/tmch/TmchXmlSignatureTest.java | 13 +- .../tools/CreateCreditBalanceCommandTest.java | 16 +- .../tools/CreateCreditCommandTest.java | 20 +- .../tools/CreateDomainCommandTest.java | 114 +++++------ .../registry/tools/CreateHostCommandTest.java | 3 +- .../tools/CreateLrpTokensCommandTest.java | 14 +- .../tools/CreatePremiumListCommandTest.java | 8 +- .../tools/CreateRegistrarCommandTest.java | 29 ++- .../CreateRegistrarGroupsCommandTest.java | 4 +- .../tools/CreateReservedListCommandTest.java | 6 +- .../registry/tools/CreateTldCommandTest.java | 55 ++--- .../tools/DeleteCreditCommandTest.java | 10 +- .../tools/DeletePremiumListCommandTest.java | 6 +- .../tools/DeleteReservedListCommandTest.java | 6 +- .../registry/tools/EppToolCommandTest.java | 4 +- .../GenerateAllocationTokensCommandTest.java | 4 +- .../GenerateEscrowDepositCommandTest.java | 22 +- .../tools/GetApplicationIdsCommandTest.java | 3 +- .../tools/GetLrpTokenCommandTest.java | 4 +- .../tools/GetRegistrarCommandTest.java | 5 +- .../tools/GetResourceByKeyCommandTest.java | 11 +- .../tools/ListCursorsCommandTest.java | 4 +- .../tools/ListDomainsCommandTest.java | 4 +- .../registry/tools/LockDomainCommandTest.java | 6 +- .../registry/tools/MutatingCommandTest.java | 19 +- .../tools/RegistrarContactCommandTest.java | 6 +- .../registry/tools/SetupOteCommandTest.java | 28 +-- .../UniformRapidSuspensionCommandTest.java | 12 +- .../tools/UnlockDomainCommandTest.java | 6 +- .../UpdateApplicationStatusCommandTest.java | 5 +- .../tools/UpdateClaimsNoticeCommandTest.java | 3 +- .../tools/UpdateCursorsCommandTest.java | 3 +- .../tools/UpdateDomainCommandTest.java | 36 ++-- .../tools/UpdateRegistrarCommandTest.java | 9 +- .../tools/UpdateReservedListCommandTest.java | 4 +- .../registry/tools/UpdateSmdCommandTest.java | 13 +- .../registry/tools/UpdateTldCommandTest.java | 76 +++---- .../ValidateEscrowDepositCommandTest.java | 4 +- .../ValidateLoginCredentialsCommandTest.java | 7 +- .../registry/tools/VerifyOteCommandTest.java | 6 +- .../tools/params/DateTimeParameterTest.java | 3 +- .../tools/params/DurationParameterTest.java | 3 +- .../tools/params/EnumParameterTest.java | 4 +- .../tools/params/IntervalParameterTest.java | 3 +- .../params/KeyValueMapParameterTest.java | 3 +- .../tools/params/MoneyParameterTest.java | 3 +- .../tools/params/PathParameterTest.java | 15 +- .../tools/params/YearMonthParameterTest.java | 3 +- .../tools/server/CreateGroupsActionTest.java | 8 +- .../tools/server/DeleteEntityActionTest.java | 6 +- .../registry/ui/forms/FormFieldTest.java | 19 +- .../registry/ui/forms/FormFieldsTest.java | 8 +- .../ui/server/RegistrarFormFieldsTest.java | 6 +- .../google/registry/util/ConcurrentTest.java | 4 +- .../registry/util/PosixTarHeaderTest.java | 4 +- .../google/registry/util/RetrierTest.java | 8 +- .../registry/util/SerializeUtilsTest.java | 6 +- .../google/registry/util/SqlTemplateTest.java | 24 +-- .../registry/util/TaskEnqueuerTest.java | 3 +- .../registry/util/TeeOutputStreamTest.java | 7 +- .../google/registry/util/TypeUtilsTest.java | 6 +- .../registry/util/UrlFetchUtilsTest.java | 4 +- .../registry/whois/WhoisHttpServerTest.java | 4 +- .../google/registry/xjc/XjcObjectTest.java | 6 +- .../google/registry/xjc/XmlTestdataTest.java | 4 +- .../registry/testing/JUnitBackports.java | 21 +- 180 files changed, 1325 insertions(+), 1381 deletions(-) diff --git a/javatests/google/registry/batch/DeleteProberDataActionTest.java b/javatests/google/registry/batch/DeleteProberDataActionTest.java index 4da8fc51a..d8cf885e8 100644 --- a/javatests/google/registry/batch/DeleteProberDataActionTest.java +++ b/javatests/google/registry/batch/DeleteProberDataActionTest.java @@ -25,7 +25,7 @@ import static google.registry.testing.DatastoreHelper.persistDeletedDomain; import static google.registry.testing.DatastoreHelper.persistDomainAsDeleted; import static google.registry.testing.DatastoreHelper.persistResource; 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.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME; @@ -207,7 +207,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase component.refreshDns().run()); + assertThrows(NotFoundException.class, () -> component.refreshDns().run()); 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("name")).thenReturn("ns1.example.lol"); NotFoundException thrown = - expectThrows(NotFoundException.class, () -> component.refreshDns().run()); + assertThrows(NotFoundException.class, () -> component.refreshDns().run()); assertThat(thrown).hasMessageThat().contains("host ns1.example.lol not found"); } } diff --git a/javatests/google/registry/dns/DnsQueueTest.java b/javatests/google/registry/dns/DnsQueueTest.java index e6c278f2d..6328cab88 100644 --- a/javatests/google/registry/dns/DnsQueueTest.java +++ b/javatests/google/registry/dns/DnsQueueTest.java @@ -16,7 +16,7 @@ package google.registry.dns; import static com.google.common.truth.Truth.assertThat; 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.assertTasksEnqueued; @@ -64,7 +64,7 @@ public class DnsQueueTest { @Test public void test_addHostRefreshTask_failsOnUnknownTld() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> { try { @@ -94,7 +94,7 @@ public class DnsQueueTest { @Test public void test_addDomainRefreshTask_failsOnUnknownTld() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> { try { diff --git a/javatests/google/registry/dns/PublishDnsUpdatesActionTest.java b/javatests/google/registry/dns/PublishDnsUpdatesActionTest.java index bc4f9b7a1..e951da72e 100644 --- a/javatests/google/registry/dns/PublishDnsUpdatesActionTest.java +++ b/javatests/google/registry/dns/PublishDnsUpdatesActionTest.java @@ -19,7 +19,7 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost; 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.mock; import static org.mockito.Mockito.verify; @@ -163,7 +163,7 @@ public class PublishDnsUpdatesActionTest { ImmutableSet.of( "ns1.example.xn--q9jyb4c", "ns2.example.xn--q9jyb4c", "ns1.example2.xn--q9jyb4c"); 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(0, PublishStatus.REJECTED); @@ -249,7 +249,7 @@ public class PublishDnsUpdatesActionTest { action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com"); action.lockHandler = new FakeLockHandler(false); ServiceUnavailableException thrown = - expectThrows(ServiceUnavailableException.class, action::run); + assertThrows(ServiceUnavailableException.class, action::run); assertThat(thrown).hasMessageThat().contains("Lock failure"); verifyNoMoreInteractions(dnsWriter); diff --git a/javatests/google/registry/dns/RefreshDnsActionTest.java b/javatests/google/registry/dns/RefreshDnsActionTest.java index b42751169..1dd224749 100644 --- a/javatests/google/registry/dns/RefreshDnsActionTest.java +++ b/javatests/google/registry/dns/RefreshDnsActionTest.java @@ -20,7 +20,6 @@ import static google.registry.testing.DatastoreHelper.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHost; 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.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -77,7 +76,7 @@ public class RefreshDnsActionTest { persistActiveDomain("example.xn--q9jyb4c"); persistActiveHost("ns1.example.xn--q9jyb4c"); BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> { try { diff --git a/javatests/google/registry/dns/writer/dnsupdate/DnsMessageTransportTest.java b/javatests/google/registry/dns/writer/dnsupdate/DnsMessageTransportTest.java index 56db82bc8..2caf137c3 100644 --- a/javatests/google/registry/dns/writer/dnsupdate/DnsMessageTransportTest.java +++ b/javatests/google/registry/dns/writer/dnsupdate/DnsMessageTransportTest.java @@ -17,7 +17,6 @@ package google.registry.dns.writer.dnsupdate; import static com.google.common.io.BaseEncoding.base16; import static com.google.common.truth.Truth.assertThat; 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.verify; import static org.mockito.Mockito.when; @@ -139,7 +138,7 @@ public class DnsMessageTransportTest { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); when(mockSocket.getOutputStream()).thenReturn(outputStream); IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> resolver.send(oversize)); + assertThrows(IllegalArgumentException.class, () -> resolver.send(oversize)); assertThat(thrown).hasMessageThat().contains("message larger than maximum"); } @@ -149,7 +148,7 @@ public class DnsMessageTransportTest { when(mockSocket.getInputStream()) .thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse))); when(mockSocket.getOutputStream()).thenReturn(new ByteArrayOutputStream()); - VerifyException thrown = expectThrows(VerifyException.class, () -> resolver.send(simpleQuery)); + VerifyException thrown = assertThrows(VerifyException.class, () -> resolver.send(simpleQuery)); assertThat(thrown) .hasMessageThat() .contains( @@ -166,7 +165,7 @@ public class DnsMessageTransportTest { when(mockSocket.getInputStream()) .thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse))); when(mockSocket.getOutputStream()).thenReturn(new ByteArrayOutputStream()); - VerifyException thrown = expectThrows(VerifyException.class, () -> resolver.send(simpleQuery)); + VerifyException thrown = assertThrows(VerifyException.class, () -> resolver.send(simpleQuery)); assertThat(thrown) .hasMessageThat() .contains("response opcode 'STATUS' does not match query opcode 'QUERY'"); diff --git a/javatests/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java b/javatests/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java index 8df7af845..8f75ed9cc 100644 --- a/javatests/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java +++ b/javatests/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java @@ -26,7 +26,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveSubordinateHo import static google.registry.testing.DatastoreHelper.persistDeletedDomain; import static google.registry.testing.DatastoreHelper.persistDeletedHost; 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.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; @@ -388,7 +388,7 @@ public class DnsUpdateWriterTest { persistResource(domain); when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL)); VerifyException thrown = - expectThrows( + assertThrows( VerifyException.class, () -> { writer.publishDomain("example.tld"); @@ -407,7 +407,7 @@ public class DnsUpdateWriterTest { persistResource(host); when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL)); VerifyException thrown = - expectThrows( + assertThrows( VerifyException.class, () -> { writer.publishHost("ns1.example.tld"); diff --git a/javatests/google/registry/export/BigqueryPollJobActionTest.java b/javatests/google/registry/export/BigqueryPollJobActionTest.java index a9850cbbe..6d7cf01da 100644 --- a/javatests/google/registry/export/BigqueryPollJobActionTest.java +++ b/javatests/google/registry/export/BigqueryPollJobActionTest.java @@ -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.assert_; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.logging.Level.INFO; @@ -203,7 +202,7 @@ public class BigqueryPollJobActionTest { when(bigqueryJobsGet.execute()).thenReturn( new Job().setStatus(new JobStatus().setState("DONE"))); 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"); } } diff --git a/javatests/google/registry/export/CheckSnapshotActionTest.java b/javatests/google/registry/export/CheckSnapshotActionTest.java index dae76994b..d75f62fa9 100644 --- a/javatests/google/registry/export/CheckSnapshotActionTest.java +++ b/javatests/google/registry/export/CheckSnapshotActionTest.java @@ -17,7 +17,7 @@ package google.registry.export; 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_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.assertTasksEnqueued; import static org.mockito.Mockito.mock; @@ -122,7 +122,7 @@ public class CheckSnapshotActionTest { public void testPost_forPendingBackup_returnsNotModified() throws Exception { 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"); } @@ -138,7 +138,7 @@ public class CheckSnapshotActionTest { .plus(Duration.standardMinutes(3)) .plus(Duration.millis(1234))); - NoContentException thrown = expectThrows(NoContentException.class, action::run); + NoContentException thrown = assertThrows(NoContentException.class, action::run); assertThat(thrown) .hasMessageThat() .contains( @@ -186,7 +186,7 @@ public class CheckSnapshotActionTest { when(backupService.findByName("some_backup")) .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"); } @@ -216,7 +216,7 @@ public class CheckSnapshotActionTest { when(backupService.findByName("some_backup")) .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"); } } diff --git a/javatests/google/registry/export/ExportReservedTermsActionTest.java b/javatests/google/registry/export/ExportReservedTermsActionTest.java index a593c5faa..a459af9c0 100644 --- a/javatests/google/registry/export/ExportReservedTermsActionTest.java +++ b/javatests/google/registry/export/ExportReservedTermsActionTest.java @@ -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.persistReservedList; 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 javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; import static javax.servlet.http.HttpServletResponse.SC_OK; @@ -123,14 +123,14 @@ public class ExportReservedTermsActionTest { any(MediaType.class), anyString(), 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); assertThat(thrown).hasCauseThat().hasMessageThat().isEqualTo("errorMessage"); } @Test 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); assertThat(thrown) .hasCauseThat() diff --git a/javatests/google/registry/export/LoadSnapshotActionTest.java b/javatests/google/registry/export/LoadSnapshotActionTest.java index 6583431b9..479a66479 100644 --- a/javatests/google/registry/export/LoadSnapshotActionTest.java +++ b/javatests/google/registry/export/LoadSnapshotActionTest.java @@ -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.QUEUE; 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 org.joda.time.DateTimeZone.UTC; import static org.mockito.Matchers.any; @@ -182,7 +182,7 @@ public class LoadSnapshotActionTest { @Test public void testFailure_doPost_badGcsFilename() throws Exception { action.snapshotFile = "gs://bucket/snapshot"; - BadRequestException thrown = expectThrows(BadRequestException.class, action::run); + BadRequestException thrown = assertThrows(BadRequestException.class, action::run); assertThat(thrown) .hasMessageThat() .contains("Error calling load snapshot: backup info file extension missing"); @@ -192,7 +192,7 @@ public class LoadSnapshotActionTest { public void testFailure_doPost_bigqueryThrowsException() throws Exception { when(bigqueryJobsInsert.execute()).thenThrow(new IOException("The Internet has gone missing")); InternalServerErrorException thrown = - expectThrows(InternalServerErrorException.class, action::run); + assertThrows(InternalServerErrorException.class, action::run); assertThat(thrown) .hasMessageThat() .contains("Error loading snapshot: The Internet has gone missing"); diff --git a/javatests/google/registry/export/PublishDetailReportActionTest.java b/javatests/google/registry/export/PublishDetailReportActionTest.java index 72a9ed60f..301039899 100644 --- a/javatests/google/registry/export/PublishDetailReportActionTest.java +++ b/javatests/google/registry/export/PublishDetailReportActionTest.java @@ -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.testing.DatastoreHelper.loadRegistrar; 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 org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; @@ -105,7 +105,7 @@ public class PublishDetailReportActionTest { @Test public void testFailure_noRegistrarParameter() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> action.handleJsonRequest( @@ -119,7 +119,7 @@ public class PublishDetailReportActionTest { @Test public void testFailure_noGcsBucketParameter() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> action.handleJsonRequest( @@ -133,7 +133,7 @@ public class PublishDetailReportActionTest { @Test public void testFailure_noGcsFolderPrefixParameter() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> action.handleJsonRequest( @@ -147,7 +147,7 @@ public class PublishDetailReportActionTest { @Test public void testFailure_noReportNameParameter() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> action.handleJsonRequest( @@ -161,7 +161,7 @@ public class PublishDetailReportActionTest { @Test public void testFailure_registrarNotFound() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> action.handleJsonRequest( @@ -178,7 +178,7 @@ public class PublishDetailReportActionTest { persistResource( loadRegistrar("TheRegistrar").asBuilder().setDriveFolderId(null).build()); BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> action.handleJsonRequest( @@ -193,7 +193,7 @@ public class PublishDetailReportActionTest { @Test public void testFailure_gcsBucketNotFound() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> action.handleJsonRequest( @@ -208,7 +208,7 @@ public class PublishDetailReportActionTest { @Test public void testFailure_gcsFileNotFound() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> action.handleJsonRequest( @@ -226,7 +226,7 @@ public class PublishDetailReportActionTest { anyString(), any(MediaType.class), anyString(), any(byte[].class))) .thenThrow(new IOException("Drive is down")); InternalServerErrorException thrown = - expectThrows( + assertThrows( InternalServerErrorException.class, () -> action.handleJsonRequest( diff --git a/javatests/google/registry/export/UpdateSnapshotViewActionTest.java b/javatests/google/registry/export/UpdateSnapshotViewActionTest.java index eee61a3b5..b05ff0442 100644 --- a/javatests/google/registry/export/UpdateSnapshotViewActionTest.java +++ b/javatests/google/registry/export/UpdateSnapshotViewActionTest.java @@ -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_TABLE_ID_PARAM; 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 org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; @@ -124,7 +124,7 @@ public class UpdateSnapshotViewActionTest { when(bigqueryTables.update(anyString(), anyString(), anyString(), any(Table.class))) .thenThrow(new IOException("I'm sorry Dave, I can't let you do that")); InternalServerErrorException thrown = - expectThrows(InternalServerErrorException.class, action::run); + assertThrows(InternalServerErrorException.class, action::run); assertThat(thrown).hasMessageThat().contains("Error in update snapshot view action"); } } diff --git a/javatests/google/registry/flows/ExtensionManagerTest.java b/javatests/google/registry/flows/ExtensionManagerTest.java index 3f348a1da..6fc646455 100644 --- a/javatests/google/registry/flows/ExtensionManagerTest.java +++ b/javatests/google/registry/flows/ExtensionManagerTest.java @@ -16,7 +16,7 @@ package google.registry.flows; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -63,7 +63,7 @@ public class ExtensionManagerTest { .build(); manager.register(MetadataExtension.class, LaunchCreateExtension.class); EppException thrown = - expectThrows(UnsupportedRepeatedExtensionException.class, manager::validate); + assertThrows(UnsupportedRepeatedExtensionException.class, manager::validate); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -99,7 +99,7 @@ public class ExtensionManagerTest { .build(); manager.register(FeeInfoCommandExtensionV06.class); EppException thrown = - expectThrows(UndeclaredServiceExtensionException.class, manager::validate); + assertThrows(UndeclaredServiceExtensionException.class, manager::validate); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -136,7 +136,7 @@ public class ExtensionManagerTest { .setSuppliedExtensions(MetadataExtension.class) .build(); manager.register(MetadataExtension.class); - EppException thrown = expectThrows(OnlyToolCanPassMetadataException.class, manager::validate); + EppException thrown = assertThrows(OnlyToolCanPassMetadataException.class, manager::validate); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -164,7 +164,7 @@ public class ExtensionManagerTest { .build(); manager.register(DomainTransferRequestSuperuserExtension.class); EppException thrown = - expectThrows(UnauthorizedForSuperuserExtensionException.class, manager::validate); + assertThrows(UnauthorizedForSuperuserExtensionException.class, manager::validate); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -179,7 +179,7 @@ public class ExtensionManagerTest { .build(); manager.register(DomainTransferRequestSuperuserExtension.class); EppException thrown = - expectThrows(UnauthorizedForSuperuserExtensionException.class, manager::validate); + assertThrows(UnauthorizedForSuperuserExtensionException.class, manager::validate); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -191,7 +191,7 @@ public class ExtensionManagerTest { .setDeclaredUris() .setSuppliedExtensions(LaunchCreateExtension.class) .build(); - EppException thrown = expectThrows(UnimplementedExtensionException.class, manager::validate); + EppException thrown = assertThrows(UnimplementedExtensionException.class, manager::validate); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/ResourceFlowTestCase.java b/javatests/google/registry/flows/ResourceFlowTestCase.java index f68e70fb7..856fcdbd8 100644 --- a/javatests/google/registry/flows/ResourceFlowTestCase.java +++ b/javatests/google/registry/flows/ResourceFlowTestCase.java @@ -20,7 +20,7 @@ import static google.registry.model.EppResourceUtils.loadByForeignKey; import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.tmch.ClaimsListShardTest.createTestClaimsListShard; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.LogsSubject.assertAboutLogs; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; @@ -136,7 +136,7 @@ public abstract class ResourceFlowTestCase TlsCredentials.EppTlsModule.provideClientCertificateHash(req)); assertThat(thrown).hasMessageThat().contains("Missing header: X-SSL-Certificate"); @@ -57,7 +57,7 @@ public final class TlsCredentialsTest { public void testProvideRequestedServername_missing() { HttpServletRequest req = mock(HttpServletRequest.class); BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> TlsCredentials.EppTlsModule.provideRequestedServername(req)); assertThat(thrown).hasMessageThat().contains("Missing header: X-Requested-Servername-SNI"); diff --git a/javatests/google/registry/flows/contact/ContactCheckFlowTest.java b/javatests/google/registry/flows/contact/ContactCheckFlowTest.java index ec4bd325a..28c9f32c5 100644 --- a/javatests/google/registry/flows/contact/ContactCheckFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactCheckFlowTest.java @@ -18,7 +18,7 @@ import static google.registry.model.eppoutput.CheckData.ContactCheck.create; import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistDeletedContact; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.ResourceCheckFlowTestCase; @@ -79,7 +79,7 @@ public class ContactCheckFlowTest @Test public void testTooManyIds() throws Exception { setEppInput("contact_check_51.xml"); - EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow); + EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/contact/ContactCreateFlowTest.java b/javatests/google/registry/flows/contact/ContactCreateFlowTest.java index 01c02b59e..c050d6951 100644 --- a/javatests/google/registry/flows/contact/ContactCreateFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactCreateFlowTest.java @@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.assertNoBillingEvents; import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistDeletedContact; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.ResourceFlowTestCase; @@ -71,7 +71,7 @@ public class ContactCreateFlowTest public void testFailure_alreadyExists() throws Exception { persistActiveContact(getUniqueIdFromCommand()); ResourceAlreadyExistsException thrown = - expectThrows(ResourceAlreadyExistsException.class, this::runFlow); + assertThrows(ResourceAlreadyExistsException.class, this::runFlow); assertThat(thrown) .hasMessageThat() .contains( @@ -89,7 +89,7 @@ public class ContactCreateFlowTest public void testFailure_nonAsciiInIntAddress() throws Exception { setEppInput("contact_create_hebrew_int.xml"); EppException thrown = - expectThrows(BadInternationalizedPostalInfoException.class, this::runFlow); + assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -97,7 +97,7 @@ public class ContactCreateFlowTest public void testFailure_declineDisclosure() throws Exception { setEppInput("contact_create_decline_disclosure.xml"); EppException thrown = - expectThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow); + assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/contact/ContactDeleteFlowTest.java b/javatests/google/registry/flows/contact/ContactDeleteFlowTest.java index 0bc0ed6d3..a3c2ea04b 100644 --- a/javatests/google/registry/flows/contact/ContactDeleteFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactDeleteFlowTest.java @@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistDeletedContact; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableSet; import google.registry.flows.EppException; @@ -74,7 +74,7 @@ public class ContactDeleteFlowTest @Test public void testFailure_neverExisted() throws Exception { ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -83,7 +83,7 @@ public class ContactDeleteFlowTest public void testFailure_existedButWasDeleted() throws Exception { persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -112,7 +112,7 @@ public class ContactDeleteFlowTest newContactResource(getUniqueIdFromCommand()).asBuilder() .setStatusValues(ImmutableSet.of(statusValue)) .build()); - EppException thrown = expectThrows(exception, this::runFlow); + EppException thrown = assertThrows(exception, this::runFlow); assertThat(thrown).hasMessageThat().contains(statusValue.getXmlName()); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -121,7 +121,7 @@ public class ContactDeleteFlowTest public void testFailure_unauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistActiveContact(getUniqueIdFromCommand()); - EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); + EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -148,7 +148,7 @@ public class ContactDeleteFlowTest createTld("tld"); persistResource( newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand()))); - EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow); + EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -157,7 +157,7 @@ public class ContactDeleteFlowTest createTld("tld"); persistResource( newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand()))); - EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow); + EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/contact/ContactInfoFlowTest.java b/javatests/google/registry/flows/contact/ContactInfoFlowTest.java index 5376447de..3e88fd139 100644 --- a/javatests/google/registry/flows/contact/ContactInfoFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactInfoFlowTest.java @@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -166,7 +166,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase doFailingTest("contact_transfer_approve_with_authinfo.xml")); + EppException thrown = + assertThrows( + BadAuthInfoForResourceException.class, + () -> doFailingTest("contact_transfer_approve_with_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -155,7 +156,7 @@ public class ContactTransferApproveFlowTest public void testFailure_neverBeenTransferred() throws Exception { changeTransferStatus(null); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -164,7 +165,7 @@ public class ContactTransferApproveFlowTest public void testFailure_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -173,7 +174,7 @@ public class ContactTransferApproveFlowTest public void testFailure_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -182,7 +183,7 @@ public class ContactTransferApproveFlowTest public void testFailure_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -191,7 +192,7 @@ public class ContactTransferApproveFlowTest public void testFailure_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -200,7 +201,7 @@ public class ContactTransferApproveFlowTest public void testFailure_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -209,7 +210,7 @@ public class ContactTransferApproveFlowTest public void testFailure_gainingClient() throws Exception { setClientIdForFlow("NewRegistrar"); EppException thrown = - expectThrows( + assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -218,7 +219,7 @@ public class ContactTransferApproveFlowTest public void testFailure_unrelatedClient() throws Exception { setClientIdForFlow("ClientZ"); EppException thrown = - expectThrows( + assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -228,7 +229,7 @@ public class ContactTransferApproveFlowTest contact = persistResource( contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -241,7 +242,7 @@ public class ContactTransferApproveFlowTest contact = persistResource( contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_approve.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); diff --git a/javatests/google/registry/flows/contact/ContactTransferCancelFlowTest.java b/javatests/google/registry/flows/contact/ContactTransferCancelFlowTest.java index 6dae5ab84..4f6cb06c0 100644 --- a/javatests/google/registry/flows/contact/ContactTransferCancelFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactTransferCancelFlowTest.java @@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage; import static google.registry.testing.DatastoreHelper.getPollMessages; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException; @@ -132,7 +132,7 @@ public class ContactTransferCancelFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("contact_transfer_cancel_with_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -142,7 +142,7 @@ public class ContactTransferCancelFlowTest public void testFailure_neverBeenTransferred() throws Exception { changeTransferStatus(null); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -151,7 +151,7 @@ public class ContactTransferCancelFlowTest public void testFailure_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -160,7 +160,7 @@ public class ContactTransferCancelFlowTest public void testFailure_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -169,7 +169,7 @@ public class ContactTransferCancelFlowTest public void testFailure_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -178,7 +178,7 @@ public class ContactTransferCancelFlowTest public void testFailure_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -187,7 +187,7 @@ public class ContactTransferCancelFlowTest public void testFailure_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -196,7 +196,7 @@ public class ContactTransferCancelFlowTest public void testFailure_sponsoringClient() throws Exception { setClientIdForFlow("TheRegistrar"); EppException thrown = - expectThrows( + assertThrows( NotTransferInitiatorException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -206,7 +206,7 @@ public class ContactTransferCancelFlowTest public void testFailure_unrelatedClient() throws Exception { setClientIdForFlow("ClientZ"); EppException thrown = - expectThrows( + assertThrows( NotTransferInitiatorException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -217,7 +217,7 @@ public class ContactTransferCancelFlowTest contact = persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -228,7 +228,7 @@ public class ContactTransferCancelFlowTest public void testFailure_nonexistentContact() throws Exception { deleteResource(contact); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_cancel.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); diff --git a/javatests/google/registry/flows/contact/ContactTransferQueryFlowTest.java b/javatests/google/registry/flows/contact/ContactTransferQueryFlowTest.java index ec6fea2aa..b276d0e65 100644 --- a/javatests/google/registry/flows/contact/ContactTransferQueryFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactTransferQueryFlowTest.java @@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.assertNoBillingEvents; import static google.registry.testing.DatastoreHelper.deleteResource; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException; @@ -145,7 +145,7 @@ public class ContactTransferQueryFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("contact_transfer_query_with_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -157,7 +157,7 @@ public class ContactTransferQueryFlowTest // code above will write the wrong ROID into the file. contact = contact.asBuilder().setRepoId("DEADBEEF_TLD-ROID").build(); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("contact_transfer_query_with_roid.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -167,7 +167,7 @@ public class ContactTransferQueryFlowTest public void testFailure_neverBeenTransferred() throws Exception { changeTransferStatus(null); EppException thrown = - expectThrows( + assertThrows( NoTransferHistoryToQueryException.class, () -> doFailingTest("contact_transfer_query.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -177,7 +177,7 @@ public class ContactTransferQueryFlowTest public void testFailure_unrelatedClient() throws Exception { setClientIdForFlow("ClientZ"); EppException thrown = - expectThrows( + assertThrows( NotAuthorizedToViewTransferException.class, () -> doFailingTest("contact_transfer_query.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -188,7 +188,7 @@ public class ContactTransferQueryFlowTest contact = persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_query.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -198,7 +198,7 @@ public class ContactTransferQueryFlowTest public void testFailure_nonexistentContact() throws Exception { deleteResource(contact); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_query.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertAboutEppExceptions().that(thrown).marshalsToXml(); diff --git a/javatests/google/registry/flows/contact/ContactTransferRejectFlowTest.java b/javatests/google/registry/flows/contact/ContactTransferRejectFlowTest.java index f610e0f46..ec9991503 100644 --- a/javatests/google/registry/flows/contact/ContactTransferRejectFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactTransferRejectFlowTest.java @@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage; import static google.registry.testing.DatastoreHelper.getPollMessages; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException; @@ -147,7 +147,7 @@ public class ContactTransferRejectFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("contact_transfer_reject_with_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -157,7 +157,7 @@ public class ContactTransferRejectFlowTest public void testFailure_neverBeenTransferred() throws Exception { changeTransferStatus(null); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -166,7 +166,7 @@ public class ContactTransferRejectFlowTest public void testFailure_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -175,7 +175,7 @@ public class ContactTransferRejectFlowTest public void testFailure_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -184,7 +184,7 @@ public class ContactTransferRejectFlowTest public void testFailure_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -193,7 +193,7 @@ public class ContactTransferRejectFlowTest public void testFailure_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -202,7 +202,7 @@ public class ContactTransferRejectFlowTest public void testFailure_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -211,7 +211,7 @@ public class ContactTransferRejectFlowTest public void testFailure_gainingClient() throws Exception { setClientIdForFlow("NewRegistrar"); EppException thrown = - expectThrows( + assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -220,7 +220,7 @@ public class ContactTransferRejectFlowTest public void testFailure_unrelatedClient() throws Exception { setClientIdForFlow("ClientZ"); EppException thrown = - expectThrows( + assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -230,7 +230,7 @@ public class ContactTransferRejectFlowTest contact = persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -241,7 +241,7 @@ public class ContactTransferRejectFlowTest public void testFailure_nonexistentContact() throws Exception { deleteResource(contact); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_reject.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); diff --git a/javatests/google/registry/flows/contact/ContactTransferRequestFlowTest.java b/javatests/google/registry/flows/contact/ContactTransferRequestFlowTest.java index 821a8986c..e11fa3eda 100644 --- a/javatests/google/registry/flows/contact/ContactTransferRequestFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactTransferRequestFlowTest.java @@ -29,7 +29,7 @@ import static google.registry.testing.DatastoreHelper.getPollMessages; import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; @@ -158,7 +158,7 @@ public class ContactTransferRequestFlowTest @Test public void testFailure_noAuthInfo() throws Exception { EppException thrown = - expectThrows( + assertThrows( MissingTransferRequestAuthInfoException.class, () -> doFailingTest("contact_transfer_request_no_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -174,7 +174,7 @@ public class ContactTransferRequestFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("contact_transfer_request.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -225,7 +225,7 @@ public class ContactTransferRequestFlowTest .build()) .build()); EppException thrown = - expectThrows( + assertThrows( AlreadyPendingTransferException.class, () -> doFailingTest("contact_transfer_request.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -235,7 +235,7 @@ public class ContactTransferRequestFlowTest public void testFailure_sponsoringClient() throws Exception { setClientIdForFlow("TheRegistrar"); EppException thrown = - expectThrows( + assertThrows( ObjectAlreadySponsoredException.class, () -> doFailingTest("contact_transfer_request.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -246,7 +246,7 @@ public class ContactTransferRequestFlowTest contact = persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -257,7 +257,7 @@ public class ContactTransferRequestFlowTest public void testFailure_nonexistentContact() throws Exception { deleteResource(contact); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("contact_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -270,7 +270,7 @@ public class ContactTransferRequestFlowTest persistResource( contact.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build()); ResourceStatusProhibitsOperationException thrown = - expectThrows( + assertThrows( ResourceStatusProhibitsOperationException.class, () -> doFailingTest("contact_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains("clientTransferProhibited"); @@ -283,7 +283,7 @@ public class ContactTransferRequestFlowTest persistResource( contact.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build()); ResourceStatusProhibitsOperationException thrown = - expectThrows( + assertThrows( ResourceStatusProhibitsOperationException.class, () -> doFailingTest("contact_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains("serverTransferProhibited"); @@ -295,7 +295,7 @@ public class ContactTransferRequestFlowTest contact = persistResource(contact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build()); ResourceStatusProhibitsOperationException thrown = - expectThrows( + assertThrows( ResourceStatusProhibitsOperationException.class, () -> doFailingTest("contact_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains("pendingDelete"); diff --git a/javatests/google/registry/flows/contact/ContactUpdateFlowTest.java b/javatests/google/registry/flows/contact/ContactUpdateFlowTest.java index 92f56c865..26f5a3921 100644 --- a/javatests/google/registry/flows/contact/ContactUpdateFlowTest.java +++ b/javatests/google/registry/flows/contact/ContactUpdateFlowTest.java @@ -22,7 +22,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistDeletedContact; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -258,7 +258,7 @@ public class ContactUpdateFlowTest @Test public void testFailure_neverExisted() throws Exception { ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -267,7 +267,7 @@ public class ContactUpdateFlowTest public void testFailure_existedButWasDeleted() throws Exception { persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -276,7 +276,7 @@ public class ContactUpdateFlowTest public void testFailure_statusValueNotClientSettable() throws Exception { setEppInput("contact_update_prohibited_status.xml"); persistActiveContact(getUniqueIdFromCommand()); - EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow); + EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -293,7 +293,7 @@ public class ContactUpdateFlowTest public void testFailure_unauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistActiveContact(getUniqueIdFromCommand()); - EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); + EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -346,7 +346,7 @@ public class ContactUpdateFlowTest .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)) .build()); EppException thrown = - expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow); + assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -358,7 +358,7 @@ public class ContactUpdateFlowTest .setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED)) .build()); ResourceStatusProhibitsOperationException thrown = - expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow); + assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited"); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -371,7 +371,7 @@ public class ContactUpdateFlowTest .setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE)) .build()); ResourceStatusProhibitsOperationException thrown = - expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow); + assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("pendingDelete"); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -387,7 +387,7 @@ public class ContactUpdateFlowTest setEppInput("contact_update_hebrew_int.xml"); persistActiveContact(getUniqueIdFromCommand()); EppException thrown = - expectThrows(BadInternationalizedPostalInfoException.class, this::runFlow); + assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -396,7 +396,7 @@ public class ContactUpdateFlowTest setEppInput("contact_update_decline_disclosure.xml"); persistActiveContact(getUniqueIdFromCommand()); EppException thrown = - expectThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow); + assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -404,7 +404,7 @@ public class ContactUpdateFlowTest public void testFailure_addRemoveSameValue() throws Exception { setEppInput("contact_update_add_remove_same.xml"); persistActiveContact(getUniqueIdFromCommand()); - EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow); + EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java index 38288cf96..dd5166449 100644 --- a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java @@ -31,7 +31,7 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainApplicationSubject.assertAboutApplications; import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; @@ -257,7 +257,7 @@ public class DomainAllocateFlowTest .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net")) .build()); NameserversNotAllowedForTldException thrown = - expectThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser); + assertThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser); assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -273,7 +273,7 @@ public class DomainAllocateFlowTest ImmutableSet.of("ns1.example.net", "ns2.example.net")) .build()); RegistrantNotAllowedException thrown = - expectThrows(RegistrantNotAllowedException.class, this::runFlowAsSuperuser); + assertThrows(RegistrantNotAllowedException.class, this::runFlowAsSuperuser); assertThat(thrown).hasMessageThat().contains("jd1234"); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -289,7 +289,7 @@ public class DomainAllocateFlowTest .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.net, ns2.example.net")) .build()); EppException thrown = - expectThrows( + assertThrows( NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlowAsSuperuser); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -322,7 +322,7 @@ public class DomainAllocateFlowTest "example-one,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net")) .build()); NameserversNotAllowedForDomainException thrown = - expectThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser); + assertThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser); assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -340,7 +340,7 @@ public class DomainAllocateFlowTest "example-one,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net")) .build()); EppException thrown = - expectThrows( + assertThrows( NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlowAsSuperuser); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -379,7 +379,7 @@ public class DomainAllocateFlowTest ImmutableSet.of("ns1.example.net", "ns2.example.net", "ns3.example.net")) .build()); NameserversNotAllowedForDomainException thrown = - expectThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser); + assertThrows(NameserversNotAllowedForDomainException.class, this::runFlowAsSuperuser); assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -399,7 +399,7 @@ public class DomainAllocateFlowTest ImmutableSet.of("ns4.example.net", "ns2.example.net", "ns3.example.net")) .build()); NameserversNotAllowedForTldException thrown = - expectThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser); + assertThrows(NameserversNotAllowedForTldException.class, this::runFlowAsSuperuser); assertThat(thrown).hasMessageThat().contains("ns1.example.net"); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -594,7 +594,7 @@ public class DomainAllocateFlowTest setupDomainApplication("tld", TldState.QUIET_PERIOD); persistActiveDomain(getUniqueIdFromCommand()); EppException thrown = - expectThrows(ResourceAlreadyExistsException.class, this::runFlowAsSuperuser); + assertThrows(ResourceAlreadyExistsException.class, this::runFlowAsSuperuser); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -630,7 +630,7 @@ public class DomainAllocateFlowTest public void testFailure_applicationDeleted() throws Exception { setupDomainApplication("tld", TldState.QUIET_PERIOD); persistResource(application.asBuilder().setDeletionTime(clock.nowUtc()).build()); - EppException thrown = expectThrows(MissingApplicationException.class, this::runFlowAsSuperuser); + EppException thrown = assertThrows(MissingApplicationException.class, this::runFlowAsSuperuser); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -639,7 +639,7 @@ public class DomainAllocateFlowTest setupDomainApplication("tld", TldState.QUIET_PERIOD); persistResource( application.asBuilder().setApplicationStatus(ApplicationStatus.REJECTED).build()); - EppException thrown = expectThrows(HasFinalStatusException.class, this::runFlowAsSuperuser); + EppException thrown = assertThrows(HasFinalStatusException.class, this::runFlowAsSuperuser); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -648,7 +648,7 @@ public class DomainAllocateFlowTest setupDomainApplication("tld", TldState.QUIET_PERIOD); persistResource( application.asBuilder().setApplicationStatus(ApplicationStatus.ALLOCATED).build()); - EppException thrown = expectThrows(HasFinalStatusException.class, this::runFlowAsSuperuser); + EppException thrown = assertThrows(HasFinalStatusException.class, this::runFlowAsSuperuser); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -656,7 +656,7 @@ public class DomainAllocateFlowTest public void testFailure_applicationDoesNotExist() throws Exception { setupDomainApplication("tld", TldState.QUIET_PERIOD); setEppInput("domain_allocate_bad_application_roid.xml"); - EppException thrown = expectThrows(MissingApplicationException.class, this::runFlowAsSuperuser); + EppException thrown = assertThrows(MissingApplicationException.class, this::runFlowAsSuperuser); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -667,7 +667,7 @@ public class DomainAllocateFlowTest setEppInput("domain_allocate_no_nameservers.xml"); assertTransactionalFlow(true); EppException thrown = - expectThrows( + assertThrows( OnlySuperuserCanAllocateException.class, () -> runFlow(CommitMode.LIVE, UserPrivileges.NORMAL)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -678,7 +678,7 @@ public class DomainAllocateFlowTest setupDomainApplication("tld", TldState.QUIET_PERIOD); setEppInput("domain_allocate_11_years.xml"); EppException thrown = - expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlowAsSuperuser); + assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlowAsSuperuser); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java index 2df49e996..c1f9679ea 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationCreateFlowTest.java @@ -32,7 +32,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainApplicationSubject.assertAboutApplications; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.START_OF_TIME; import static java.util.Comparator.comparing; import static org.joda.money.CurrencyUnit.EUR; @@ -253,7 +253,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrush_encoded_signed_mark_corrupt.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(SignedMarkParsingErrorException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkParsingErrorException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -263,7 +263,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrush_encoded_signed_mark_revoked_cert.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(SignedMarkCertificateRevokedException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkCertificateRevokedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -275,7 +275,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); clock.setTo(DateTime.parse("2022-01-01")); clock.setTo(DateTime.parse("2022-01-01")); - EppException thrown = expectThrows(SignedMarkCertificateExpiredException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkCertificateExpiredException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -287,7 +287,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); clock.setTo(DateTime.parse("2012-07-22T00:01:00Z")); EppException thrown = - expectThrows(SignedMarkCertificateNotYetValidException.class, this::runFlow); + assertThrows(SignedMarkCertificateNotYetValidException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -307,7 +307,7 @@ public class DomainApplicationCreateFlowTest throw new GeneralSecurityException(); } }; - EppException thrown = expectThrows(SignedMarkCertificateInvalidException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkCertificateInvalidException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -319,7 +319,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); EppException thrown = - expectThrows(SignedMarkCertificateSignatureException.class, this::runFlow); + assertThrows(SignedMarkCertificateSignatureException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -329,7 +329,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrush_encoded_signed_mark_signature_corrupt.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(SignedMarkSignatureException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkSignatureException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -416,7 +416,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_allowedinsunrise.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(DomainReservedException.class, this::runFlow); + EppException thrown = assertThrows(DomainReservedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -428,7 +428,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); // Modify the Registrar to block premium names. persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build()); - EppException thrown = expectThrows(PremiumNameBlockedException.class, this::runFlow); + EppException thrown = assertThrows(PremiumNameBlockedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -439,7 +439,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_premium.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); + EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -453,7 +453,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_premium.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); + EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -564,7 +564,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); setEppInput("domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.6")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -575,7 +575,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); setEppInput( "domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.11")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -586,7 +586,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); setEppInput( "domain_create_landrush_fee_refundable.xml", ImmutableMap.of("FEE_VERSION", "0.12")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -597,7 +597,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); setEppInput( "domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.6")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -608,7 +608,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); setEppInput( "domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.11")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -619,7 +619,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); setEppInput( "domain_create_landrush_fee_grace_period.xml", ImmutableMap.of("FEE_VERSION", "0.12")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -629,7 +629,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.6")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -639,7 +639,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.11")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -649,7 +649,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); setEppInput("domain_create_landrush_fee_applied.xml", ImmutableMap.of("FEE_VERSION", "0.12")); - EppException thrown = expectThrows(UnsupportedFeeAttributeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -760,7 +760,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); EppException thrown = - expectThrows(LandrushApplicationDisallowedDuringSunriseException.class, this::runFlow); + assertThrows(LandrushApplicationDisallowedDuringSunriseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -777,7 +777,7 @@ public class DomainApplicationCreateFlowTest .build()); clock.advanceOneMilli(); EppException thrown = - expectThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow); + assertThrows(RegistrarMustBeActiveToCreateDomainsException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -788,7 +788,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); EppException thrown = - expectThrows(SunriseApplicationDisallowedDuringLandrushException.class, this::runFlow); + assertThrows(SunriseApplicationDisallowedDuringLandrushException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -797,7 +797,7 @@ public class DomainApplicationCreateFlowTest SignedMarkRevocationList.create(clock.nowUtc(), ImmutableMap.of(SMD_ID, clock.nowUtc())).save(); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(SignedMarkRevokedErrorException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkRevokedErrorException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -807,7 +807,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrush_14_nameservers.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(TooManyNameserversException.class, this::runFlow); + EppException thrown = assertThrows(TooManyNameserversException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -816,7 +816,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_with_secdns_maxsiglife.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(MaxSigLifeNotSupportedException.class, this::runFlow); + EppException thrown = assertThrows(MaxSigLifeNotSupportedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -825,7 +825,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_signed_mark_with_secdns_9_records.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(TooManyDsRecordsException.class, this::runFlow); + EppException thrown = assertThrows(TooManyDsRecordsException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -834,7 +834,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_wrong_extension.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow); + EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -843,7 +843,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_signed_mark_reserved.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(DomainReservedException.class, this::runFlow); + EppException thrown = assertThrows(DomainReservedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -898,7 +898,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); EppException thrown = - expectThrows(UncontestedSunriseApplicationBlockedInLandrushException.class, this::runFlow); + assertThrows(UncontestedSunriseApplicationBlockedInLandrushException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -995,7 +995,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_lrp.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow); + EppException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1019,7 +1019,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_lrp.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow); + EppException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1042,7 +1042,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_lrp.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow); + EppException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1103,7 +1103,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(InvalidLrpTokenException.class, this::runFlow); + EppException thrown = assertThrows(InvalidLrpTokenException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1113,7 +1113,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_months.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); + EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1123,7 +1123,7 @@ public class DomainApplicationCreateFlowTest persistActiveContact("jd1234"); persistActiveContact("sh8013"); LinkedResourcesDoNotExistException thrown = - expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow); + assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("(ns2.example.net)"); } @@ -1133,7 +1133,7 @@ public class DomainApplicationCreateFlowTest persistActiveHost("ns2.example.net"); persistActiveContact("jd1234"); LinkedResourcesDoNotExistException thrown = - expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow); + assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("(sh8013)"); } @@ -1143,7 +1143,7 @@ public class DomainApplicationCreateFlowTest createTld("foo", TldState.SUNRISE); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow); + EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1152,7 +1152,7 @@ public class DomainApplicationCreateFlowTest createTld("tld", TldState.PREDELEGATION); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1161,7 +1161,7 @@ public class DomainApplicationCreateFlowTest persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); persistContactsAndHosts(); - EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); + EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1170,7 +1170,7 @@ public class DomainApplicationCreateFlowTest createTld("tld", TldState.SUNRUSH); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(LaunchPhaseMismatchException.class, this::runFlow); + EppException thrown = assertThrows(LaunchPhaseMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1179,7 +1179,7 @@ public class DomainApplicationCreateFlowTest createTld("tld", TldState.QUIET_PERIOD); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1188,7 +1188,7 @@ public class DomainApplicationCreateFlowTest createTld("tld", TldState.GENERAL_AVAILABILITY); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1197,7 +1197,7 @@ public class DomainApplicationCreateFlowTest createTld("tld", TldState.START_DATE_SUNRISE); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1206,7 +1206,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_signed_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(LaunchPhaseMismatchException.class, this::runFlow); + EppException thrown = assertThrows(LaunchPhaseMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1272,7 +1272,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_duplicate_contact.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow); + EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1282,7 +1282,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); // We need to test for missing type, but not for invalid - the schema enforces that for us. - EppException thrown = expectThrows(MissingContactTypeException.class, this::runFlow); + EppException thrown = assertThrows(MissingContactTypeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1291,7 +1291,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_no_matching_marks.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow); + EppException thrown = assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1301,7 +1301,7 @@ public class DomainApplicationCreateFlowTest clock.setTo(DateTime.parse("2013-08-09T10:05:59Z").minusSeconds(1)); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow); + EppException thrown = assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1311,7 +1311,7 @@ public class DomainApplicationCreateFlowTest clock.setTo(DateTime.parse("2017-07-23T22:00:00.000Z")); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(NoMarksFoundMatchingDomainException.class, this::runFlow); + EppException thrown = assertThrows(NoMarksFoundMatchingDomainException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1321,7 +1321,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); EppException thrown = - expectThrows(Base64RequiredForEncodedSignedMarksException.class, this::runFlow); + assertThrows(Base64RequiredForEncodedSignedMarksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1330,7 +1330,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_bad_encoding.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(SignedMarkEncodingErrorException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkEncodingErrorException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1339,7 +1339,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_bad_encoded_xml.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(SignedMarkParsingErrorException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkParsingErrorException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1349,7 +1349,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrush_bad_idn_minna.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(InvalidIdnDomainLabelException.class, this::runFlow); + EppException thrown = assertThrows(InvalidIdnDomainLabelException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1360,7 +1360,7 @@ public class DomainApplicationCreateFlowTest persistClaimsList(ImmutableMap.of("exampleone", CLAIMS_KEY)); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(InvalidTrademarkValidatorException.class, this::runFlow); + EppException thrown = assertThrows(InvalidTrademarkValidatorException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1369,7 +1369,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_signed_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(SignedMarksMustBeEncodedException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarksMustBeEncodedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1378,7 +1378,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_code_with_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(UnsupportedMarkTypeException.class, this::runFlow); + EppException thrown = assertThrows(UnsupportedMarkTypeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1387,7 +1387,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_empty_encoded_signed_mark.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(SignedMarkParsingErrorException.class, this::runFlow); + EppException thrown = assertThrows(SignedMarkParsingErrorException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1398,7 +1398,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); EppException thrown = - expectThrows(NoticeCannotBeUsedWithSignedMarkException.class, this::runFlow); + assertThrows(NoticeCannotBeUsedWithSignedMarkException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1407,7 +1407,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_two_signed_marks.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(TooManySignedMarksException.class, this::runFlow); + EppException thrown = assertThrows(TooManySignedMarksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1418,7 +1418,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrush.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(MissingClaimsNoticeException.class, this::runFlow); + EppException thrown = assertThrows(MissingClaimsNoticeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1428,7 +1428,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_claim_notice.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(UnexpectedClaimsNoticeException.class, this::runFlow); + EppException thrown = assertThrows(UnexpectedClaimsNoticeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1439,7 +1439,7 @@ public class DomainApplicationCreateFlowTest persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistContactsAndHosts(); persistResource(Registry.get("tld").asBuilder().setClaimsPeriodEnd(clock.nowUtc()).build()); - EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow); + EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1451,7 +1451,7 @@ public class DomainApplicationCreateFlowTest persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(ExpiredClaimException.class, this::runFlow); + EppException thrown = assertThrows(ExpiredClaimException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1463,7 +1463,7 @@ public class DomainApplicationCreateFlowTest persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(AcceptedTooLongAgoException.class, this::runFlow); + EppException thrown = assertThrows(AcceptedTooLongAgoException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1475,7 +1475,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrush_malformed_claim_notice1.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(MalformedTcnIdException.class, this::runFlow); + EppException thrown = assertThrows(MalformedTcnIdException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1487,7 +1487,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrush_malformed_claim_notice2.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(MalformedTcnIdException.class, this::runFlow); + EppException thrown = assertThrows(MalformedTcnIdException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1499,7 +1499,7 @@ public class DomainApplicationCreateFlowTest persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY)); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(InvalidTcnIdChecksumException.class, this::runFlow); + EppException thrown = assertThrows(InvalidTcnIdChecksumException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1511,7 +1511,7 @@ public class DomainApplicationCreateFlowTest Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); + EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1523,7 +1523,7 @@ public class DomainApplicationCreateFlowTest Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); + EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1535,7 +1535,7 @@ public class DomainApplicationCreateFlowTest Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, 20)).build()); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); + EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1555,7 +1555,7 @@ public class DomainApplicationCreateFlowTest .build()); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1575,7 +1575,7 @@ public class DomainApplicationCreateFlowTest .build()); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1595,7 +1595,7 @@ public class DomainApplicationCreateFlowTest .build()); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1605,7 +1605,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.6")); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1615,7 +1615,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.11")); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1625,7 +1625,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_fee_bad_scale.xml", ImmutableMap.of("FEE_VERSION", "0.12")); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(CurrencyValueScaleException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1635,7 +1635,7 @@ public class DomainApplicationCreateFlowTest clock.advanceOneMilli(); persistActiveDomain(getUniqueIdFromCommand()); ResourceAlreadyExistsException thrown = - expectThrows(ResourceAlreadyExistsException.class, this::runFlow); + assertThrows(ResourceAlreadyExistsException.class, this::runFlow); assertAboutEppExceptions() .that(thrown) .marshalsToXml() @@ -1654,7 +1654,7 @@ public class DomainApplicationCreateFlowTest .setAllowedRegistrantContactIds(ImmutableSet.of("someone")) .build()); RegistrantNotAllowedException thrown = - expectThrows(RegistrantNotAllowedException.class, this::runFlow); + assertThrows(RegistrantNotAllowedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml().and().hasMessageThatContains("jd1234"); } @@ -1667,7 +1667,7 @@ public class DomainApplicationCreateFlowTest .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net")) .build()); NameserversNotAllowedForTldException thrown = - expectThrows(NameserversNotAllowedForTldException.class, this::runFlow); + assertThrows(NameserversNotAllowedForTldException.class, this::runFlow); assertAboutEppExceptions() .that(thrown) .marshalsToXml() @@ -1704,7 +1704,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); EppException thrown = - expectThrows( + assertThrows( NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1741,7 +1741,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); NameserversNotAllowedForDomainException thrown = - expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow); + assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("ns1.example.net"); } @@ -1759,7 +1759,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); EppException thrown = - expectThrows( + assertThrows( NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1802,7 +1802,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); NameserversNotAllowedForDomainException thrown = - expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow); + assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("ns1.example.net"); } @@ -1822,7 +1822,7 @@ public class DomainApplicationCreateFlowTest persistContactsAndHosts(); clock.advanceOneMilli(); NameserversNotAllowedForTldException thrown = - expectThrows(NameserversNotAllowedForTldException.class, this::runFlow); + assertThrows(NameserversNotAllowedForTldException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("ns1.example.net"); } @@ -1832,7 +1832,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_landrush_11_years.xml"); persistContactsAndHosts(); clock.advanceOneMilli(); - EppException thrown = expectThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow); + EppException thrown = assertThrows(ExceedsMaxRegistrationYearsException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1841,7 +1841,7 @@ public class DomainApplicationCreateFlowTest setEppInput("domain_create_sunrise_signed_mark_uppercase.xml"); eppLoader.replaceAll("TEST-VALIDATE.tld", domainName); persistContactsAndHosts(); - EppException thrown = expectThrows(exception, this::runFlow); + EppException thrown = assertThrows(exception, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainApplicationDeleteFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationDeleteFlowTest.java index 1bed90da3..86dd2186f 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationDeleteFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationDeleteFlowTest.java @@ -27,7 +27,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveDomainApplication; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -133,7 +133,7 @@ public class DomainApplicationDeleteFlowTest @Test public void testFailure_neverExisted() throws Exception { ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -146,7 +146,7 @@ public class DomainApplicationDeleteFlowTest .setDeletionTime(clock.nowUtc().minusSeconds(1)) .build()); ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -154,7 +154,7 @@ public class DomainApplicationDeleteFlowTest public void testFailure_unauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); - EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); + EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -172,7 +172,7 @@ public class DomainApplicationDeleteFlowTest persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); - EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); + EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -197,7 +197,7 @@ public class DomainApplicationDeleteFlowTest .setPhase(LaunchPhase.SUNRISE) .build()); EppException thrown = - expectThrows(SunriseApplicationCannotBeDeletedInLandrushException.class, this::runFlow); + assertThrows(SunriseApplicationCannotBeDeletedInLandrushException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -246,7 +246,7 @@ public class DomainApplicationDeleteFlowTest public void testFailure_mismatchedPhase() throws Exception { setEppInput("domain_delete_application_landrush.xml", ImmutableMap.of("DOMAIN", "example.tld")); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); - EppException thrown = expectThrows(LaunchPhaseMismatchException.class, this::runFlow); + EppException thrown = assertThrows(LaunchPhaseMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -254,7 +254,7 @@ public class DomainApplicationDeleteFlowTest public void testFailure_wrongExtension() throws Exception { setEppInput("domain_delete_application_wrong_extension.xml"); persistActiveDomainApplication("example.tld"); - EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow); + EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -262,7 +262,7 @@ public class DomainApplicationDeleteFlowTest public void testFailure_predelegation() throws Exception { createTld("tld", TldState.PREDELEGATION); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -270,7 +270,7 @@ public class DomainApplicationDeleteFlowTest public void testFailure_quietPeriod() throws Exception { createTld("tld", TldState.QUIET_PERIOD); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -278,7 +278,7 @@ public class DomainApplicationDeleteFlowTest public void testFailure_generalAvailability() throws Exception { createTld("tld", TldState.GENERAL_AVAILABILITY); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -286,7 +286,7 @@ public class DomainApplicationDeleteFlowTest public void testFailure_startDateSunrise() throws Exception { createTld("tld", TldState.START_DATE_SUNRISE); persistResource(newDomainApplication("example.tld").asBuilder().setRepoId("1-TLD").build()); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -329,7 +329,7 @@ public class DomainApplicationDeleteFlowTest @Test public void testFailure_applicationIdForDifferentDomain() throws Exception { persistResource(newDomainApplication("invalid.tld").asBuilder().setRepoId("1-TLD").build()); - EppException thrown = expectThrows(ApplicationDomainNameMismatchException.class, this::runFlow); + EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java index 8c2118c1e..9465b97a5 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationInfoFlowTest.java @@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; @@ -287,7 +287,7 @@ public class DomainApplicationInfoFlowTest @Test public void testFailure_neverExisted() throws Exception { ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -301,7 +301,7 @@ public class DomainApplicationInfoFlowTest .setRegistrant(Key.create(persistActiveContact("jd1234"))) .build()); ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -310,7 +310,7 @@ public class DomainApplicationInfoFlowTest persistResource(AppEngineRule.makeRegistrar1().asBuilder().setClientId("ClientZ").build()); sessionMetadata.setClientId("ClientZ"); persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST); - EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); + EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -323,7 +323,7 @@ public class DomainApplicationInfoFlowTest .setRegistrant(Key.create(persistActiveContact("jd1234"))) .setPhase(LaunchPhase.SUNRUSH) .build()); - EppException thrown = expectThrows(ApplicationDomainNameMismatchException.class, this::runFlow); + EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -331,7 +331,7 @@ public class DomainApplicationInfoFlowTest public void testFailure_noApplicationId() throws Exception { setEppInput("domain_info_sunrise_no_application_id.xml"); persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST); - EppException thrown = expectThrows(MissingApplicationIdException.class, this::runFlow); + EppException thrown = assertThrows(MissingApplicationIdException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -340,7 +340,7 @@ public class DomainApplicationInfoFlowTest persistTestEntities(HostsState.NO_HOSTS_EXIST, MarksState.NO_MARKS_EXIST); application = persistResource(application.asBuilder().setPhase(LaunchPhase.SUNRISE).build()); EppException thrown = - expectThrows(ApplicationLaunchPhaseMismatchException.class, this::runFlow); + assertThrows(ApplicationLaunchPhaseMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java b/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java index 09277ca27..c00735de2 100644 --- a/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainApplicationUpdateFlowTest.java @@ -29,7 +29,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainApplicationSubject.assertAboutApplications; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.START_OF_TIME; import com.google.common.collect.ImmutableMap; @@ -364,7 +364,7 @@ public class DomainApplicationUpdateFlowTest setEppInput(xmlFilename); persistReferencedEntities(); persistNewApplication(); - EppException thrown = expectThrows(expectedException, this::runFlow); + EppException thrown = assertThrows(expectedException, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -400,7 +400,7 @@ public class DomainApplicationUpdateFlowTest setEppInput("domain_update_sunrise_dsdata_add.xml"); persistResource(newApplicationBuilder().setDsData(builder.build()).build()); - EppException thrown = expectThrows(TooManyDsRecordsException.class, this::runFlow); + EppException thrown = assertThrows(TooManyDsRecordsException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -425,14 +425,14 @@ public class DomainApplicationUpdateFlowTest // Modify application to have 13 nameservers. We will then remove one and add one in the test. modifyApplicationToHave13Nameservers(); setEppInput("domain_update_sunrise_add_nameserver.xml"); - EppException thrown = expectThrows(TooManyNameserversException.class, this::runFlow); + EppException thrown = assertThrows(TooManyNameserversException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFailure_wrongExtension() throws Exception { setEppInput("domain_update_sunrise_wrong_extension.xml"); - EppException thrown = expectThrows(UnimplementedExtensionException.class, this::runFlow); + EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -440,7 +440,7 @@ public class DomainApplicationUpdateFlowTest public void testFailure_applicationDomainNameMismatch() throws Exception { persistReferencedEntities(); persistResource(newApplicationBuilder().setFullyQualifiedDomainName("something.tld").build()); - EppException thrown = expectThrows(ApplicationDomainNameMismatchException.class, this::runFlow); + EppException thrown = assertThrows(ApplicationDomainNameMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -448,7 +448,7 @@ public class DomainApplicationUpdateFlowTest public void testFailure_neverExisted() throws Exception { persistReferencedEntities(); ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -457,7 +457,7 @@ public class DomainApplicationUpdateFlowTest persistReferencedEntities(); persistResource(newApplicationBuilder().setDeletionTime(START_OF_TIME).build()); ResourceDoesNotExistException thrown = - expectThrows(ResourceDoesNotExistException.class, this::runFlow); + assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -470,7 +470,7 @@ public class DomainApplicationUpdateFlowTest .setStatusValues(ImmutableSet.of(StatusValue.CLIENT_UPDATE_PROHIBITED)) .build()); EppException thrown = - expectThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow); + assertThrows(ResourceHasClientUpdateProhibitedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -482,7 +482,7 @@ public class DomainApplicationUpdateFlowTest .setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED)) .build()); ResourceStatusProhibitsOperationException thrown = - expectThrows(ResourceStatusProhibitsOperationException.class, this::runFlow); + assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("serverUpdateProhibited"); } @@ -490,7 +490,7 @@ public class DomainApplicationUpdateFlowTest persistReferencedEntities(); persistResource(newApplicationBuilder().setApplicationStatus(status).build()); EppException thrown = - expectThrows(ApplicationStatusProhibitsUpdateException.class, this::runFlow); + assertThrows(ApplicationStatusProhibitsUpdateException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -516,7 +516,7 @@ public class DomainApplicationUpdateFlowTest persistActiveContact("mak21"); persistNewApplication(); LinkedResourcesDoNotExistException thrown = - expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow); + assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("(ns2.example.tld)"); } @@ -527,7 +527,7 @@ public class DomainApplicationUpdateFlowTest persistActiveContact("mak21"); persistNewApplication(); LinkedResourcesDoNotExistException thrown = - expectThrows(LinkedResourcesDoNotExistException.class, this::runFlow); + assertThrows(LinkedResourcesDoNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("(sh8013)"); } @@ -548,7 +548,7 @@ public class DomainApplicationUpdateFlowTest Key.create( loadByForeignKey(ContactResource.class, "foo", clock.nowUtc()))))) .build()); - EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow); + EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -557,7 +557,7 @@ public class DomainApplicationUpdateFlowTest setEppInput("domain_update_sunrise_prohibited_status.xml"); persistReferencedEntities(); persistNewApplication(); - EppException thrown = expectThrows(StatusNotClientSettableException.class, this::runFlow); + EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -576,7 +576,7 @@ public class DomainApplicationUpdateFlowTest setEppInput("domain_update_sunrise_duplicate_contact.xml"); persistReferencedEntities(); persistNewApplication(); - EppException thrown = expectThrows(DuplicateContactForRoleException.class, this::runFlow); + EppException thrown = assertThrows(DuplicateContactForRoleException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -586,7 +586,7 @@ public class DomainApplicationUpdateFlowTest persistReferencedEntities(); persistNewApplication(); // We need to test for missing type, but not for invalid - the schema enforces that for us. - EppException thrown = expectThrows(MissingContactTypeException.class, this::runFlow); + EppException thrown = assertThrows(MissingContactTypeException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -595,7 +595,7 @@ public class DomainApplicationUpdateFlowTest sessionMetadata.setClientId("NewRegistrar"); persistReferencedEntities(); persistApplication(); - EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow); + EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -615,7 +615,7 @@ public class DomainApplicationUpdateFlowTest loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); persistReferencedEntities(); persistApplication(); - EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); + EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -641,7 +641,7 @@ public class DomainApplicationUpdateFlowTest Key.create( loadByForeignKey(HostResource.class, "ns1.example.tld", clock.nowUtc())))) .build()); - EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow); + EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -658,7 +658,7 @@ public class DomainApplicationUpdateFlowTest Key.create( loadByForeignKey(ContactResource.class, "sh8013", clock.nowUtc()))))) .build()); - EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow); + EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -673,7 +673,7 @@ public class DomainApplicationUpdateFlowTest DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)), DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)))) .build()); - EppException thrown = expectThrows(MissingAdminContactException.class, this::runFlow); + EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -688,7 +688,7 @@ public class DomainApplicationUpdateFlowTest DesignatedContact.create(Type.ADMIN, Key.create(sh8013Contact)), DesignatedContact.create(Type.TECH, Key.create(sh8013Contact)))) .build()); - EppException thrown = expectThrows(MissingTechnicalContactException.class, this::runFlow); + EppException thrown = assertThrows(MissingTechnicalContactException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -702,7 +702,7 @@ public class DomainApplicationUpdateFlowTest .setAllowedRegistrantContactIds(ImmutableSet.of("contact1234")) .build()); clock.advanceOneMilli(); - EppException thrown = expectThrows(RegistrantNotAllowedException.class, this::runFlow); + EppException thrown = assertThrows(RegistrantNotAllowedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -716,7 +716,7 @@ public class DomainApplicationUpdateFlowTest .setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns1.example.foo")) .build()); clock.advanceOneMilli(); - EppException thrown = expectThrows(NameserversNotAllowedForTldException.class, this::runFlow); + EppException thrown = assertThrows(NameserversNotAllowedForTldException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -746,7 +746,7 @@ public class DomainApplicationUpdateFlowTest .build()); clock.advanceOneMilli(); EppException thrown = - expectThrows( + assertThrows( NameserversNotSpecifiedForTldWithNameserverWhitelistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -802,7 +802,7 @@ public class DomainApplicationUpdateFlowTest .build()); clock.advanceOneMilli(); NameserversNotAllowedForDomainException thrown = - expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow); + assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("ns2.example.tld"); } @@ -820,7 +820,7 @@ public class DomainApplicationUpdateFlowTest .build()); clock.advanceOneMilli(); EppException thrown = - expectThrows( + assertThrows( NameserversNotSpecifiedForNameserverRestrictedDomainException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -883,7 +883,7 @@ public class DomainApplicationUpdateFlowTest .build()); clock.advanceOneMilli(); NameserversNotAllowedForDomainException thrown = - expectThrows(NameserversNotAllowedForDomainException.class, this::runFlow); + assertThrows(NameserversNotAllowedForDomainException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("ns2.example.tld"); } @@ -903,7 +903,7 @@ public class DomainApplicationUpdateFlowTest .build()); clock.advanceOneMilli(); NameserversNotAllowedForTldException thrown = - expectThrows(NameserversNotAllowedForTldException.class, this::runFlow); + assertThrows(NameserversNotAllowedForTldException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains("ns2.example.tld"); } @@ -916,7 +916,7 @@ public class DomainApplicationUpdateFlowTest "domain_update_sunrise_fee.xml", ImmutableMap.of("DOMAIN", "non-free-update.tld", "AMOUNT", "12.00")); clock.advanceOneMilli(); - EppException thrown = expectThrows(FeesMismatchException.class, this::runFlow); + EppException thrown = assertThrows(FeesMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainCheckFlowTest.java b/javatests/google/registry/flows/domain/DomainCheckFlowTest.java index 78820585e..1e7b48188 100644 --- a/javatests/google/registry/flows/domain/DomainCheckFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCheckFlowTest.java @@ -25,7 +25,7 @@ import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.START_OF_TIME; import static org.joda.money.CurrencyUnit.USD; @@ -330,14 +330,14 @@ public class DomainCheckFlowTest @Test public void testFailure_tooManyIds() throws Exception { setEppInput("domain_check_51.xml"); - EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow); + EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFailure_wrongTld() throws Exception { setEppInput("domain_check.xml"); - EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow); + EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -345,7 +345,7 @@ public class DomainCheckFlowTest public void testFailure_notAuthorizedForTld() throws Exception { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); - EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); + EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -361,7 +361,7 @@ public class DomainCheckFlowTest private void doFailingBadLabelTest(String label, Class expectedException) throws Exception { setEppInput("domain_check_template.xml", ImmutableMap.of("LABEL", label)); - EppException thrown = expectThrows(expectedException, this::runFlow); + EppException thrown = assertThrows(expectedException, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -446,7 +446,7 @@ public class DomainCheckFlowTest @Test public void testFailure_predelegation() throws Exception { createTld("tld", TldState.PREDELEGATION); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -780,84 +780,84 @@ public class DomainCheckFlowTest @Test public void testFeeExtension_wrongCurrency_v06() throws Exception { setEppInput("domain_check_fee_euro_v06.xml"); - EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_wrongCurrency_v11() throws Exception { setEppInput("domain_check_fee_euro_v11.xml"); - EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_wrongCurrency_v12() throws Exception { setEppInput("domain_check_fee_euro_v12.xml"); - EppException thrown = expectThrows(CurrencyUnitMismatchException.class, this::runFlow); + EppException thrown = assertThrows(CurrencyUnitMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_periodNotInYears_v06() throws Exception { setEppInput("domain_check_fee_bad_period_v06.xml"); - EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); + EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_periodNotInYears_v11() throws Exception { setEppInput("domain_check_fee_bad_period_v11.xml"); - EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); + EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_periodNotInYears_v12() throws Exception { setEppInput("domain_check_fee_bad_period_v12.xml"); - EppException thrown = expectThrows(BadPeriodUnitException.class, this::runFlow); + EppException thrown = assertThrows(BadPeriodUnitException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_commandWithPhase_v06() throws Exception { setEppInput("domain_check_fee_command_phase_v06.xml"); - EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); + EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_commandWithPhase_v11() throws Exception { setEppInput("domain_check_fee_command_phase_v11.xml"); - EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); + EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_commandWithPhase_v12() throws Exception { setEppInput("domain_check_fee_command_phase_v12.xml"); - EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); + EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_commandSubphase_v06() throws Exception { setEppInput("domain_check_fee_command_subphase_v06.xml"); - EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); + EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_commandSubphase_v11() throws Exception { setEppInput("domain_check_fee_command_subphase_v11.xml"); - EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); + EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_commandSubphase_v12() throws Exception { setEppInput("domain_check_fee_command_subphase_v12.xml"); - EppException thrown = expectThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); + EppException thrown = assertThrows(FeeChecksDontSupportPhasesException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -866,91 +866,91 @@ public class DomainCheckFlowTest public void testFeeExtension_feeCheckNotInAvailabilityCheck() throws Exception { setEppInput("domain_check_fee_not_in_avail.xml"); EppException thrown = - expectThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow); + assertThrows(OnlyCheckedNamesCanBeFeeCheckedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_multiyearRestore_v06() throws Exception { setEppInput("domain_check_fee_multiyear_restore_v06.xml"); - EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); + EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_multiyearRestore_v11() throws Exception { setEppInput("domain_check_fee_multiyear_restore_v11.xml"); - EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); + EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_multiyearRestore_v12() throws Exception { setEppInput("domain_check_fee_multiyear_restore_v12.xml"); - EppException thrown = expectThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); + EppException thrown = assertThrows(RestoresAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_multiyearTransfer_v06() throws Exception { setEppInput("domain_check_fee_multiyear_transfer_v06.xml"); - EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); + EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_multiyearTransfer_v11() throws Exception { setEppInput("domain_check_fee_multiyear_transfer_v11.xml"); - EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); + EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_multiyearTransfer_v12() throws Exception { setEppInput("domain_check_fee_multiyear_transfer_v12.xml"); - EppException thrown = expectThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); + EppException thrown = assertThrows(TransfersAreAlwaysForOneYearException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_unknownCommand_v06() throws Exception { setEppInput("domain_check_fee_unknown_command_v06.xml"); - EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); + EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_unknownCommand_v11() throws Exception { setEppInput("domain_check_fee_unknown_command_v11.xml"); - EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); + EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_unknownCommand_v12() throws Exception { setEppInput("domain_check_fee_unknown_command_v12.xml"); - EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); + EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_invalidCommand_v06() throws Exception { setEppInput("domain_check_fee_invalid_command_v06.xml"); - EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); + EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_invalidCommand_v11() throws Exception { setEppInput("domain_check_fee_invalid_command_v11.xml"); - EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); + EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFeeExtension_invalidCommand_v12() throws Exception { setEppInput("domain_check_fee_invalid_command_v12.xml"); - EppException thrown = expectThrows(UnknownFeeCommandException.class, this::runFlow); + EppException thrown = assertThrows(UnknownFeeCommandException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java b/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java index 43d484540..25f125071 100644 --- a/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainClaimsCheckFlowTest.java @@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTlds; import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -103,14 +103,14 @@ public class DomainClaimsCheckFlowTest @Test public void testFailure_TooManyIds() throws Exception { setEppInput("domain_check_claims_51.xml"); - EppException thrown = expectThrows(TooManyResourceChecksException.class, this::runFlow); + EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test public void testFailure_tldDoesntExist() throws Exception { setEppInput("domain_check_claims_bad_tld.xml"); - EppException thrown = expectThrows(TldDoesNotExistException.class, this::runFlow); + EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -118,7 +118,7 @@ public class DomainClaimsCheckFlowTest public void testFailure_notAuthorizedForTld() throws Exception { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); - EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); + EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -139,7 +139,7 @@ public class DomainClaimsCheckFlowTest public void testFailure_predelgation() throws Exception { createTld("tld", TldState.PREDELEGATION); setEppInput("domain_check_claims.xml"); - EppException thrown = expectThrows(BadCommandForRegistryPhaseException.class, this::runFlow); + EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -147,7 +147,7 @@ public class DomainClaimsCheckFlowTest public void testFailure_sunrise() throws Exception { createTld("tld", TldState.SUNRISE); setEppInput("domain_check_claims.xml"); - EppException thrown = expectThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow); + EppException thrown = assertThrows(DomainClaimsCheckNotAllowedInSunrise.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -156,7 +156,7 @@ public class DomainClaimsCheckFlowTest createTld("tld", TldState.SUNRISE); setEppInput("domain_check_claims_allocationtoken.xml"); EppException thrown = - expectThrows(DomainClaimsCheckNotAllowedWithAllocationTokens.class, this::runFlow); + assertThrows(DomainClaimsCheckNotAllowedWithAllocationTokens.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -166,7 +166,7 @@ public class DomainClaimsCheckFlowTest persistResource( Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build()); setEppInput("domain_check_claims_multiple_tlds.xml"); - EppException thrown = expectThrows(ClaimsPeriodEndedException.class, this::runFlow); + EppException thrown = assertThrows(ClaimsPeriodEndedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java index 9c6e7bd64..7e03e9d3a 100644 --- a/javatests/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainCreateFlowTest.java @@ -42,7 +42,7 @@ import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoDnsTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued; @@ -391,7 +391,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase runFlowAssertResponse(loadFile("domain_update_response.xml"))); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -521,7 +521,7 @@ public class DomainRestoreRequestFlowTest persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); persistPendingDeleteDomain(); - EppException thrown = expectThrows(NotAuthorizedForTldException.class, this::runFlow); + EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -541,7 +541,7 @@ public class DomainRestoreRequestFlowTest persistPendingDeleteDomain(); // Modify the Registrar to block premium names. persistResource(loadRegistrar("TheRegistrar").asBuilder().setBlockPremiumNames(true).build()); - EppException thrown = expectThrows(PremiumNameBlockedException.class, this::runFlow); + EppException thrown = assertThrows(PremiumNameBlockedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -554,7 +554,7 @@ public class DomainRestoreRequestFlowTest .setReservedLists(persistReservedList("tld-reserved", "example,FULLY_BLOCKED")) .build()); persistPendingDeleteDomain(); - EppException thrown = expectThrows(DomainReservedException.class, this::runFlow); + EppException thrown = assertThrows(DomainReservedException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -563,7 +563,7 @@ public class DomainRestoreRequestFlowTest createTld("example"); setEppInput("domain_update_restore_request_premium.xml"); persistPendingDeleteDomain(); - EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); + EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -575,7 +575,7 @@ public class DomainRestoreRequestFlowTest loadRegistrar("TheRegistrar").asBuilder().setPremiumPriceAckRequired(true).build()); setEppInput("domain_update_restore_request_premium.xml"); persistPendingDeleteDomain(); - EppException thrown = expectThrows(FeesRequiredForPremiumNameException.class, this::runFlow); + EppException thrown = assertThrows(FeesRequiredForPremiumNameException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/domain/DomainTransferApproveFlowTest.java b/javatests/google/registry/flows/domain/DomainTransferApproveFlowTest.java index 952240ce5..278b69e67 100644 --- a/javatests/google/registry/flows/domain/DomainTransferApproveFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainTransferApproveFlowTest.java @@ -33,7 +33,7 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.START_OF_TIME; import static org.joda.money.CurrencyUnit.USD; @@ -411,7 +411,7 @@ public class DomainTransferApproveFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_approve_contact_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -426,7 +426,7 @@ public class DomainTransferApproveFlowTest .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_approve_domain_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -436,7 +436,7 @@ public class DomainTransferApproveFlowTest public void testFailure_neverBeenTransferred() throws Exception { changeTransferStatus(null); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -445,7 +445,7 @@ public class DomainTransferApproveFlowTest public void testFailure_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -454,7 +454,7 @@ public class DomainTransferApproveFlowTest public void testFailure_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -463,7 +463,7 @@ public class DomainTransferApproveFlowTest public void testFailure_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -472,7 +472,7 @@ public class DomainTransferApproveFlowTest public void testFailure_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -481,7 +481,7 @@ public class DomainTransferApproveFlowTest public void testFailure_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -490,7 +490,7 @@ public class DomainTransferApproveFlowTest public void testFailure_gainingClient() throws Exception { setClientIdForFlow("NewRegistrar"); EppException thrown = - expectThrows( + assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -499,7 +499,7 @@ public class DomainTransferApproveFlowTest public void testFailure_unrelatedClient() throws Exception { setClientIdForFlow("ClientZ"); EppException thrown = - expectThrows( + assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -508,7 +508,7 @@ public class DomainTransferApproveFlowTest public void testFailure_deletedDomain() throws Exception { persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -518,7 +518,7 @@ public class DomainTransferApproveFlowTest public void testFailure_nonexistentDomain() throws Exception { deleteResource(domain); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_approve.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -529,7 +529,7 @@ public class DomainTransferApproveFlowTest persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = - expectThrows( + assertThrows( NotAuthorizedForTldException.class, () -> doSuccessfulTest( diff --git a/javatests/google/registry/flows/domain/DomainTransferCancelFlowTest.java b/javatests/google/registry/flows/domain/DomainTransferCancelFlowTest.java index 422e5662f..1975c277a 100644 --- a/javatests/google/registry/flows/domain/DomainTransferCancelFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainTransferCancelFlowTest.java @@ -30,7 +30,7 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.END_OF_TIME; import com.google.common.collect.ImmutableList; @@ -223,7 +223,7 @@ public class DomainTransferCancelFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_cancel_contact_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -239,7 +239,7 @@ public class DomainTransferCancelFlowTest .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_cancel_domain_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -249,7 +249,7 @@ public class DomainTransferCancelFlowTest public void testFailure_neverBeenTransferred() throws Exception { changeTransferStatus(null); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -258,7 +258,7 @@ public class DomainTransferCancelFlowTest public void testFailure_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -267,7 +267,7 @@ public class DomainTransferCancelFlowTest public void testFailure_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -276,7 +276,7 @@ public class DomainTransferCancelFlowTest public void testFailure_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -285,7 +285,7 @@ public class DomainTransferCancelFlowTest public void testFailure_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -294,7 +294,7 @@ public class DomainTransferCancelFlowTest public void testFailure_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -303,7 +303,7 @@ public class DomainTransferCancelFlowTest public void testFailure_sponsoringClient() throws Exception { setClientIdForFlow("TheRegistrar"); EppException thrown = - expectThrows( + assertThrows( NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -312,7 +312,7 @@ public class DomainTransferCancelFlowTest public void testFailure_unrelatedClient() throws Exception { setClientIdForFlow("ClientZ"); EppException thrown = - expectThrows( + assertThrows( NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -322,7 +322,7 @@ public class DomainTransferCancelFlowTest domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -331,7 +331,7 @@ public class DomainTransferCancelFlowTest public void testFailure_nonexistentDomain() throws Exception { deleteResource(domain); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_cancel.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -341,7 +341,7 @@ public class DomainTransferCancelFlowTest persistResource( loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = - expectThrows( + assertThrows( NotAuthorizedForTldException.class, () -> doSuccessfulTest( diff --git a/javatests/google/registry/flows/domain/DomainTransferQueryFlowTest.java b/javatests/google/registry/flows/domain/DomainTransferQueryFlowTest.java index 0dadbff74..6a4d1c35f 100644 --- a/javatests/google/registry/flows/domain/DomainTransferQueryFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainTransferQueryFlowTest.java @@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.getPollMessages; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException; @@ -170,7 +170,7 @@ public class DomainTransferQueryFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_query_contact_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -186,7 +186,7 @@ public class DomainTransferQueryFlowTest .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_query_domain_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -196,7 +196,7 @@ public class DomainTransferQueryFlowTest public void testFailure_neverBeenTransferred() throws Exception { changeTransferStatus(null); EppException thrown = - expectThrows( + assertThrows( NoTransferHistoryToQueryException.class, () -> doFailingTest("domain_transfer_query.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -206,7 +206,7 @@ public class DomainTransferQueryFlowTest public void testFailure_unrelatedClient() throws Exception { setClientIdForFlow("ClientZ"); EppException thrown = - expectThrows( + assertThrows( NotAuthorizedToViewTransferException.class, () -> doFailingTest("domain_transfer_query.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -217,7 +217,7 @@ public class DomainTransferQueryFlowTest domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_query.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -226,7 +226,7 @@ public class DomainTransferQueryFlowTest public void testFailure_nonexistentDomain() throws Exception { deleteResource(domain); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_query.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } diff --git a/javatests/google/registry/flows/domain/DomainTransferRejectFlowTest.java b/javatests/google/registry/flows/domain/DomainTransferRejectFlowTest.java index 3ded11f77..c97e3b2f0 100644 --- a/javatests/google/registry/flows/domain/DomainTransferRejectFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainTransferRejectFlowTest.java @@ -32,7 +32,7 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.END_OF_TIME; import com.google.common.collect.ImmutableSet; @@ -176,7 +176,7 @@ public class DomainTransferRejectFlowTest persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = - expectThrows( + assertThrows( NotAuthorizedForTldException.class, () -> doSuccessfulTest( @@ -202,7 +202,7 @@ public class DomainTransferRejectFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_reject_contact_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -218,7 +218,7 @@ public class DomainTransferRejectFlowTest .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_reject_domain_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -228,7 +228,7 @@ public class DomainTransferRejectFlowTest public void testFailure_neverBeenTransferred() throws Exception { changeTransferStatus(null); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -237,7 +237,7 @@ public class DomainTransferRejectFlowTest public void testFailure_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -246,7 +246,7 @@ public class DomainTransferRejectFlowTest public void testFailure_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -255,7 +255,7 @@ public class DomainTransferRejectFlowTest public void testFailure_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -264,7 +264,7 @@ public class DomainTransferRejectFlowTest public void testFailure_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -273,7 +273,7 @@ public class DomainTransferRejectFlowTest public void testFailure_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = - expectThrows( + assertThrows( NotPendingTransferException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -282,7 +282,7 @@ public class DomainTransferRejectFlowTest public void testFailure_gainingClient() throws Exception { setClientIdForFlow("NewRegistrar"); EppException thrown = - expectThrows( + assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -291,7 +291,7 @@ public class DomainTransferRejectFlowTest public void testFailure_unrelatedClient() throws Exception { setClientIdForFlow("ClientZ"); EppException thrown = - expectThrows( + assertThrows( ResourceNotOwnedException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -301,7 +301,7 @@ public class DomainTransferRejectFlowTest domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } @@ -310,7 +310,7 @@ public class DomainTransferRejectFlowTest public void testFailure_nonexistentDomain() throws Exception { deleteResource(domain); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_reject.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); } diff --git a/javatests/google/registry/flows/domain/DomainTransferRequestFlowTest.java b/javatests/google/registry/flows/domain/DomainTransferRequestFlowTest.java index cff8723b4..b4d05b097 100644 --- a/javatests/google/registry/flows/domain/DomainTransferRequestFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainTransferRequestFlowTest.java @@ -36,7 +36,6 @@ import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptio import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.testing.HostResourceSubject.assertAboutHosts; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.util.DateTimeUtils.START_OF_TIME; import static org.joda.money.CurrencyUnit.EUR; import static org.joda.money.CurrencyUnit.USD; @@ -671,7 +670,7 @@ public class DomainTransferRequestFlowTest public void testFailure_refundableFee_v06() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_06_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -681,7 +680,7 @@ public class DomainTransferRequestFlowTest public void testFailure_refundableFee_v11() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_11_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -691,7 +690,7 @@ public class DomainTransferRequestFlowTest public void testFailure_refundableFee_v12() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_refundable.xml", FEE_12_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -701,7 +700,7 @@ public class DomainTransferRequestFlowTest public void testFailure_gracePeriodFee_v06() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_06_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -711,7 +710,7 @@ public class DomainTransferRequestFlowTest public void testFailure_gracePeriodFee_v11() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_11_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -721,7 +720,7 @@ public class DomainTransferRequestFlowTest public void testFailure_gracePeriodFee_v12() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_grace_period.xml", FEE_12_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -731,7 +730,7 @@ public class DomainTransferRequestFlowTest public void testFailure_appliedFee_v06() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_06_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -741,7 +740,7 @@ public class DomainTransferRequestFlowTest public void testFailure_appliedFee_v11() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_11_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -751,7 +750,7 @@ public class DomainTransferRequestFlowTest public void testFailure_appliedFee_v12() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( UnsupportedFeeAttributeException.class, () -> doFailingTest("domain_transfer_request_fee_applied.xml", FEE_12_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -792,7 +791,7 @@ public class DomainTransferRequestFlowTest setupDomain("example", "tld"); clock.advanceOneMilli(); EppException thrown = - expectThrows( + assertThrows( TransferPeriodMustBeOneYearException.class, () -> doFailingTest("domain_transfer_request_2_years.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -955,7 +954,7 @@ public class DomainTransferRequestFlowTest persistResource( loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = - expectThrows( + assertThrows( NotAuthorizedForTldException.class, () -> doSuccessfulTest( @@ -1104,7 +1103,7 @@ public class DomainTransferRequestFlowTest .setServerStatusChangeBillingCost(Money.of(EUR, 19)) .build()); EppException thrown = - expectThrows( + assertThrows( CurrencyUnitMismatchException.class, () -> doFailingTest("domain_transfer_request_fee.xml", substitutions)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1132,7 +1131,7 @@ public class DomainTransferRequestFlowTest public void testFailure_feeGivenInWrongScale_v06() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( CurrencyValueScaleException.class, () -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_06_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1142,7 +1141,7 @@ public class DomainTransferRequestFlowTest public void testFailure_feeGivenInWrongScale_v11() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( CurrencyValueScaleException.class, () -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_11_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1152,7 +1151,7 @@ public class DomainTransferRequestFlowTest public void testFailure_feeGivenInWrongScale_v12() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( CurrencyValueScaleException.class, () -> doFailingTest("domain_transfer_request_fee_bad_scale.xml", FEE_12_MAP)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1165,7 +1164,7 @@ public class DomainTransferRequestFlowTest .setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, 20))) .build()); EppException thrown = - expectThrows( + assertThrows( FeesMismatchException.class, () -> doFailingTest("domain_transfer_request_fee.xml", substitutions)); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1195,7 +1194,7 @@ public class DomainTransferRequestFlowTest // Modify the Registrar to block premium names. persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build()); EppException thrown = - expectThrows( + assertThrows( PremiumNameBlockedException.class, () -> doFailingTest("domain_transfer_request_premium.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1205,7 +1204,7 @@ public class DomainTransferRequestFlowTest public void testFailure_registryRequiresAcking_feeNotProvidedOnPremiumName() throws Exception { setupDomain("rich", "example"); EppException thrown = - expectThrows( + assertThrows( FeesRequiredForPremiumNameException.class, () -> doFailingTest("domain_transfer_request_premium.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1219,7 +1218,7 @@ public class DomainTransferRequestFlowTest loadRegistrar("NewRegistrar").asBuilder().setPremiumPriceAckRequired(true).build()); clock.advanceOneMilli(); EppException thrown = - expectThrows( + assertThrows( FeesRequiredForPremiumNameException.class, () -> doFailingTest("domain_transfer_request_premium.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1229,7 +1228,7 @@ public class DomainTransferRequestFlowTest public void testFailure_noAuthInfo() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( MissingTransferRequestAuthInfoException.class, () -> doFailingTest("domain_transfer_request_no_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1246,7 +1245,7 @@ public class DomainTransferRequestFlowTest .setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_request.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1259,7 +1258,7 @@ public class DomainTransferRequestFlowTest // code above will write the wrong ROID into the file. contact = contact.asBuilder().setRepoId("DEADBEEF_TLD-ROID").build(); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_request.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1316,7 +1315,7 @@ public class DomainTransferRequestFlowTest .build()) .build()); EppException thrown = - expectThrows( + assertThrows( AlreadyPendingTransferException.class, () -> doFailingTest("domain_transfer_request.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1333,7 +1332,7 @@ public class DomainTransferRequestFlowTest .setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword"))) .build()); EppException thrown = - expectThrows( + assertThrows( BadAuthInfoForResourceException.class, () -> doFailingTest("domain_transfer_request_domain_authinfo.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1344,7 +1343,7 @@ public class DomainTransferRequestFlowTest setupDomain("example", "tld"); setClientIdForFlow("TheRegistrar"); EppException thrown = - expectThrows( + assertThrows( ObjectAlreadySponsoredException.class, () -> doFailingTest("domain_transfer_request.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1356,7 +1355,7 @@ public class DomainTransferRequestFlowTest domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -1371,7 +1370,7 @@ public class DomainTransferRequestFlowTest eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); assertTransactionalFlow(true); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> runFlow(CommitMode.LIVE, UserPrivileges.NORMAL)); assertThat(thrown).hasMessageThat().contains("(--invalid)"); @@ -1382,7 +1381,7 @@ public class DomainTransferRequestFlowTest createTld("tld"); contact = persistActiveContact("jd1234"); ResourceDoesNotExistException thrown = - expectThrows( + assertThrows( ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", "example.tld")); @@ -1392,7 +1391,7 @@ public class DomainTransferRequestFlowTest public void testFailure_periodInMonths() throws Exception { setupDomain("example", "tld"); EppException thrown = - expectThrows( + assertThrows( BadPeriodUnitException.class, () -> doFailingTest("domain_transfer_request_months.xml")); assertAboutEppExceptions().that(thrown).marshalsToXml(); @@ -1405,7 +1404,7 @@ public class DomainTransferRequestFlowTest persistResource( domain.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build()); ResourceStatusProhibitsOperationException thrown = - expectThrows( + assertThrows( ResourceStatusProhibitsOperationException.class, () -> doFailingTest("domain_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains("clientTransferProhibited"); @@ -1418,7 +1417,7 @@ public class DomainTransferRequestFlowTest persistResource( domain.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build()); ResourceStatusProhibitsOperationException thrown = - expectThrows( + assertThrows( ResourceStatusProhibitsOperationException.class, () -> doFailingTest("domain_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains("serverTransferProhibited"); @@ -1429,7 +1428,7 @@ public class DomainTransferRequestFlowTest setupDomain("example", "tld"); domain = persistResource(domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build()); ResourceStatusProhibitsOperationException thrown = - expectThrows( + assertThrows( ResourceStatusProhibitsOperationException.class, () -> doFailingTest("domain_transfer_request.xml")); assertThat(thrown).hasMessageThat().contains("pendingDelete"); diff --git a/javatests/google/registry/flows/domain/DomainUpdateFlowTest.java b/javatests/google/registry/flows/domain/DomainUpdateFlowTest.java index eb1ff52cd..5b5e37f99 100644 --- a/javatests/google/registry/flows/domain/DomainUpdateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainUpdateFlowTest.java @@ -36,7 +36,7 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainResourceSubject.assertAboutDomains; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.testing.TaskQueueHelper.assertDnsTasksEnqueued; import static org.joda.money.CurrencyUnit.USD; @@ -459,7 +459,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase flowUtils.verifyToken( @@ -93,7 +93,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { AllocationTokenFlowUtils flowUtils = new AllocationTokenFlowUtils(new FailingAllocationTokenCustomLogic()); Exception thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> flowUtils.verifyToken( @@ -154,7 +154,7 @@ public class AllocationTokenFlowUtilsTest extends ShardableTestCase { AllocationTokenFlowUtils flowUtils = new AllocationTokenFlowUtils(new FailingAllocationTokenCustomLogic()); Exception thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> flowUtils.checkDomainsWithToken( diff --git a/javatests/google/registry/flows/host/HostCheckFlowTest.java b/javatests/google/registry/flows/host/HostCheckFlowTest.java index b62824aca..e785715af 100644 --- a/javatests/google/registry/flows/host/HostCheckFlowTest.java +++ b/javatests/google/registry/flows/host/HostCheckFlowTest.java @@ -18,7 +18,7 @@ import static google.registry.model.eppoutput.CheckData.HostCheck.create; import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistDeletedHost; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.ResourceCheckFlowTestCase; @@ -78,7 +78,7 @@ public class HostCheckFlowTest extends ResourceCheckFlowTestCase192.0.2.2\n" + "192.0.2.29\n" + "1080:0:0:0:8:800:200C:417A"); - EppException thrown = expectThrows(IpAddressVersionMismatchException.class, this::runFlow); + EppException thrown = assertThrows(IpAddressVersionMismatchException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } private void doFailingHostNameTest(String hostName, Class exception) throws Exception { setEppHostCreateInputWithIps(hostName); - EppException thrown = expectThrows(exception, this::runFlow); + EppException thrown = assertThrows(exception, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -289,7 +289,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase192.0.2.22", null); createTld("tld"); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); - EppException thrown = expectThrows(CannotAddIpToExternalHostException.class, this::runFlow); + EppException thrown = assertThrows(CannotAddIpToExternalHostException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -978,7 +978,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase", ""); persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld")); - EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow); + EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -991,7 +991,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", "192.0.2.22"); - EppException thrown = expectThrows(AddRemoveSameValueException.class, this::runFlow); + EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @@ -1020,7 +1020,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", "1080:0:0:0:8:800:200C:417A"); - EppException thrown = expectThrows(exception, this::runFlow); + EppException thrown = assertThrows(exception, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/poll/PollAckFlowTest.java b/javatests/google/registry/flows/poll/PollAckFlowTest.java index bb697e769..b8491bfce 100644 --- a/javatests/google/registry/flows/poll/PollAckFlowTest.java +++ b/javatests/google/registry/flows/poll/PollAckFlowTest.java @@ -21,7 +21,6 @@ import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.util.DateTimeUtils.END_OF_TIME; import com.google.common.collect.ImmutableMap; @@ -174,7 +173,7 @@ public class PollAckFlowTest extends FlowTestCase { @Test public void testFailure_noSuchMessage() throws Exception { assertTransactionalFlow(true); - Exception e = expectThrows(MessageDoesNotExistException.class, this::runFlow); + Exception e = assertThrows(MessageDoesNotExistException.class, this::runFlow); assertThat(e) .hasMessageThat() .containsMatch(String.format("(1-3-EXAMPLE-4-%d-2011)", MESSAGE_ID)); @@ -255,7 +254,7 @@ public class PollAckFlowTest extends FlowTestCase { .setParent(createHistoryEntryForEppResource(domain)) .build()); assertTransactionalFlow(true); - Exception e = expectThrows(MessageDoesNotExistException.class, this::runFlow); + Exception e = assertThrows(MessageDoesNotExistException.class, this::runFlow); assertThat(e) .hasMessageThat() .containsMatch(String.format("(1-3-EXAMPLE-4-%d-2011)", MESSAGE_ID)); diff --git a/javatests/google/registry/flows/poll/PollRequestFlowTest.java b/javatests/google/registry/flows/poll/PollRequestFlowTest.java index 2cca3f3f6..5e820ecae 100644 --- a/javatests/google/registry/flows/poll/PollRequestFlowTest.java +++ b/javatests/google/registry/flows/poll/PollRequestFlowTest.java @@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableList; import google.registry.flows.EppException; @@ -223,7 +223,7 @@ public class PollRequestFlowTest extends FlowTestCase { public void testFailure_messageIdProvided() throws Exception { setEppInput("poll_with_id.xml"); assertTransactionalFlow(false); - EppException thrown = expectThrows(UnexpectedMessageIdException.class, this::runFlow); + EppException thrown = assertThrows(UnexpectedMessageIdException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } } diff --git a/javatests/google/registry/flows/session/LoginFlowTestCase.java b/javatests/google/registry/flows/session/LoginFlowTestCase.java index 88d95398a..e73f1ff40 100644 --- a/javatests/google/registry/flows/session/LoginFlowTestCase.java +++ b/javatests/google/registry/flows/session/LoginFlowTestCase.java @@ -18,7 +18,7 @@ import static google.registry.testing.DatastoreHelper.deleteResource; import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.EppException.UnimplementedExtensionException; @@ -65,7 +65,7 @@ public abstract class LoginFlowTestCase extends FlowTestCase { // Also called in subclasses. void doFailingTest(String xmlFilename, Class exception) throws Exception { setEppInput(xmlFilename); - EppException thrown = expectThrows(exception, this::runFlow); + EppException thrown = assertThrows(exception, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } diff --git a/javatests/google/registry/flows/session/LogoutFlowTest.java b/javatests/google/registry/flows/session/LogoutFlowTest.java index acacfbc80..b8cc3f789 100644 --- a/javatests/google/registry/flows/session/LogoutFlowTest.java +++ b/javatests/google/registry/flows/session/LogoutFlowTest.java @@ -16,7 +16,7 @@ package google.registry.flows.session; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.flows.EppException; import google.registry.flows.FlowTestCase; @@ -46,7 +46,7 @@ public class LogoutFlowTest extends FlowTestCase { @Test public void testFailure() throws Exception { sessionMetadata.setClientId(null); // Turn off the implicit login - EppException thrown = expectThrows(NotLoggedInException.class, this::runFlow); + EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } } diff --git a/javatests/google/registry/groups/DirectoryGroupsConnectionTest.java b/javatests/google/registry/groups/DirectoryGroupsConnectionTest.java index 9e4b16482..b9ddbea5e 100644 --- a/javatests/google/registry/groups/DirectoryGroupsConnectionTest.java +++ b/javatests/google/registry/groups/DirectoryGroupsConnectionTest.java @@ -17,7 +17,6 @@ package google.registry.groups; import static com.google.common.truth.Truth.assertThat; import static google.registry.groups.DirectoryGroupsConnection.getDefaultGroupPermissions; 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_INTERNAL_SERVER_ERROR; import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; @@ -122,7 +121,7 @@ public class DirectoryGroupsConnectionTest { when(membersInsert.execute()).thenThrow( makeResponseException(SC_NOT_FOUND, "Resource Not Found: memberKey")); RuntimeException thrown = - expectThrows( + assertThrows( RuntimeException.class, () -> connection.addMemberToGroup("spam@example.com", "jim@example.com", Role.MEMBER)); assertThat(thrown) diff --git a/javatests/google/registry/mapreduce/inputs/EppResourceInputsTest.java b/javatests/google/registry/mapreduce/inputs/EppResourceInputsTest.java index 74d09c750..be7d3a369 100644 --- a/javatests/google/registry/mapreduce/inputs/EppResourceInputsTest.java +++ b/javatests/google/registry/mapreduce/inputs/EppResourceInputsTest.java @@ -29,7 +29,6 @@ import static google.registry.testing.DatastoreHelper.persistEppResourceInFirstB import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.google.appengine.tools.mapreduce.InputReader; import com.googlecode.objectify.Key; @@ -81,14 +80,14 @@ public class EppResourceInputsTest { @Test public void testFailure_keyInputType_polymorphicSubclass() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> createKeyInput(DomainResource.class)); + assertThrows(IllegalArgumentException.class, () -> createKeyInput(DomainResource.class)); assertThat(thrown).hasMessageThat().contains("non-polymorphic"); } @Test public void testFailure_keyInputType_noInheritanceBetweenTypes_eppResource() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> createKeyInput(EppResource.class, DomainBase.class)); assertThat(thrown).hasMessageThat().contains("inheritance"); @@ -104,7 +103,7 @@ public class EppResourceInputsTest { @Test public void testFailure_entityInputType_noInheritanceBetweenTypes_eppResource() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> createEntityInput(EppResource.class, DomainResource.class)); assertThat(thrown).hasMessageThat().contains("inheritance"); @@ -113,7 +112,7 @@ public class EppResourceInputsTest { @Test public void testFailure_entityInputType_noInheritanceBetweenTypes_subclasses() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> createEntityInput(DomainBase.class, DomainResource.class)); assertThat(thrown).hasMessageThat().contains("inheritance"); diff --git a/javatests/google/registry/model/billing/BillingEventTest.java b/javatests/google/registry/model/billing/BillingEventTest.java index 2bd79f56c..0e02addfd 100644 --- a/javatests/google/registry/model/billing/BillingEventTest.java +++ b/javatests/google/registry/model/billing/BillingEventTest.java @@ -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.persistActiveDomain; 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 org.joda.money.CurrencyUnit.USD; import static org.joda.time.DateTimeZone.UTC; @@ -178,7 +178,7 @@ public class BillingEventTest extends EntityTestCase { @Test public void testFailure_syntheticFlagWithoutCreationTime() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> oneTime @@ -194,7 +194,7 @@ public class BillingEventTest extends EntityTestCase { @Test public void testFailure_syntheticCreationTimeWithoutFlag() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> oneTime.asBuilder().setSyntheticCreationTime(now.plusDays(10)).build()); assertThat(thrown) @@ -205,7 +205,7 @@ public class BillingEventTest extends EntityTestCase { @Test public void testFailure_syntheticFlagWithoutCancellationMatchingKey() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> oneTime @@ -223,7 +223,7 @@ public class BillingEventTest extends EntityTestCase { @Test public void testFailure_cancellationMatchingKeyWithoutFlag() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> oneTime @@ -266,7 +266,7 @@ public class BillingEventTest extends EntityTestCase { @Test public void testFailure_cancellation_forGracePeriodWithoutBillingEvent() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> BillingEvent.Cancellation.forGracePeriod( @@ -280,7 +280,7 @@ public class BillingEventTest extends EntityTestCase { @Test public void testFailure_cancellationWithNoBillingEvent() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> cancellationOneTime @@ -294,7 +294,7 @@ public class BillingEventTest extends EntityTestCase { @Test public void testFailure_cancellationWithBothBillingEvents() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> cancellationOneTime diff --git a/javatests/google/registry/model/billing/RegistrarBillingEntryTest.java b/javatests/google/registry/model/billing/RegistrarBillingEntryTest.java index 9e48959e6..611d55390 100644 --- a/javatests/google/registry/model/billing/RegistrarBillingEntryTest.java +++ b/javatests/google/registry/model/billing/RegistrarBillingEntryTest.java @@ -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.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.money.CurrencyUnit.USD; import com.google.common.collect.ImmutableMap; @@ -98,7 +97,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { @Test public void testBadTimeOrdering_causesError() throws Exception { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> new RegistrarBillingEntry.Builder() @@ -122,7 +121,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { @Test public void testRegistrarMismatch_causesError() throws Exception { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> new RegistrarBillingEntry.Builder() @@ -168,7 +167,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase { @Test public void testZeroAmount_causesError() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new RegistrarBillingEntry.Builder() diff --git a/javatests/google/registry/model/billing/RegistrarCreditTest.java b/javatests/google/registry/model/billing/RegistrarCreditTest.java index 72c395750..c3b542c46 100644 --- a/javatests/google/registry/model/billing/RegistrarCreditTest.java +++ b/javatests/google/registry/model/billing/RegistrarCreditTest.java @@ -19,7 +19,7 @@ import static google.registry.model.common.EntityGroupRoot.getCrossTldKey; import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.testing.DatastoreHelper.createTld; 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.USD; @@ -77,7 +77,7 @@ public class RegistrarCreditTest extends EntityTestCase { @Test public void testFailure_missingTld() throws Exception { NullPointerException thrown = - expectThrows( + assertThrows( NullPointerException.class, () -> promoCredit.asBuilder().setTld(null).build()); assertThat(thrown).hasMessageThat().contains("tld"); } @@ -85,7 +85,7 @@ public class RegistrarCreditTest extends EntityTestCase { @Test public void testFailure_NonexistentTld() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> promoCredit.asBuilder().setTld("example").build()); assertThat(thrown).hasMessageThat().contains("example"); @@ -95,7 +95,7 @@ public class RegistrarCreditTest extends EntityTestCase { public void testFailure_CurrencyDoesNotMatchTldCurrency() throws Exception { assertThat(Registry.get("tld").getCurrency()).isEqualTo(USD); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> promoCredit.asBuilder().setTld("tld").setCurrency(JPY).build()); assertThat(thrown).hasMessageThat().contains("currency"); diff --git a/javatests/google/registry/model/common/CursorTest.java b/javatests/google/registry/model/common/CursorTest.java index 710b4e440..92fe6f3a1 100644 --- a/javatests/google/registry/model/common/CursorTest.java +++ b/javatests/google/registry/model/common/CursorTest.java @@ -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.testing.DatastoreHelper.createTld; 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 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 DomainResource domain = persistActiveDomain("notaregistry.tld"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> 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 { createTld("tld"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Cursor.createKey(RDE_UPLOAD, persistActiveDomain("notaregistry.tld"))); assertThat(thrown) @@ -95,7 +95,7 @@ public class CursorTest extends EntityTestCase { @Test public void testFailure_createGlobalKeyForScopedCursorType() throws Exception { 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"); } @@ -103,7 +103,7 @@ public class CursorTest extends EntityTestCase { public void testFailure_invalidScopeOnGlobalKeyCreate() throws Exception { createTld("tld"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Cursor.createKey(RECURRING_BILLING, persistActiveDomain("notaregistry.tld"))); assertThat(thrown) @@ -114,7 +114,7 @@ public class CursorTest extends EntityTestCase { @Test public void testFailure_nullScope() throws Exception { NullPointerException thrown = - expectThrows( + assertThrows( NullPointerException.class, () -> Cursor.create(RECURRING_BILLING, START_OF_TIME, 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 { createTld("tld"); NullPointerException thrown = - expectThrows( + assertThrows( NullPointerException.class, () -> Cursor.create(null, START_OF_TIME, Registry.get("tld"))); assertThat(thrown).hasMessageThat().contains("Cursor type cannot be null"); @@ -134,7 +134,7 @@ public class CursorTest extends EntityTestCase { public void testFailure_nullTime() throws Exception { createTld("tld"); NullPointerException thrown = - expectThrows( + assertThrows( NullPointerException.class, () -> Cursor.create(RDE_UPLOAD, null, Registry.get("tld"))); assertThat(thrown).hasMessageThat().contains("Cursor time cannot be null"); } diff --git a/javatests/google/registry/model/contact/ContactResourceTest.java b/javatests/google/registry/model/contact/ContactResourceTest.java index b2b64d4fc..9382d0d46 100644 --- a/javatests/google/registry/model/contact/ContactResourceTest.java +++ b/javatests/google/registry/model/contact/ContactResourceTest.java @@ -20,7 +20,7 @@ import static google.registry.testing.ContactResourceSubject.assertAboutContacts import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps; import static google.registry.testing.DatastoreHelper.createTld; 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 com.google.common.collect.ImmutableList; @@ -200,7 +200,7 @@ public class ContactResourceTest extends EntityTestCase { @Test public void testSetCreationTime_cantBeCalledTwice() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> contactResource.asBuilder().setCreationTime(END_OF_TIME)); assertThat(thrown).hasMessageThat().contains("creationTime can only be set once"); diff --git a/javatests/google/registry/model/domain/AllocationTokenTest.java b/javatests/google/registry/model/domain/AllocationTokenTest.java index 7d41f6034..83a063490 100644 --- a/javatests/google/registry/model/domain/AllocationTokenTest.java +++ b/javatests/google/registry/model/domain/AllocationTokenTest.java @@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; import static google.registry.model.ofy.ObjectifyService.ofy; 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 google.registry.model.EntityTestCase; @@ -67,7 +67,7 @@ public class AllocationTokenTest extends EntityTestCase { .setToken("foobar") .setCreationTime(DateTime.parse("2010-11-12T05:00:00Z")); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> builder.setCreationTime(DateTime.parse("2010-11-13T05:00:00Z"))); 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 { AllocationToken.Builder builder = new AllocationToken.Builder().setToken("foobar"); IllegalStateException thrown = - expectThrows(IllegalStateException.class, () -> builder.setToken("barfoo")); + assertThrows(IllegalStateException.class, () -> builder.setToken("barfoo")); assertThat(thrown).hasMessageThat().isEqualTo("token can only be set once"); } } diff --git a/javatests/google/registry/model/domain/DomainResourceTest.java b/javatests/google/registry/model/domain/DomainResourceTest.java index 8154c7646..2e9896007 100644 --- a/javatests/google/registry/model/domain/DomainResourceTest.java +++ b/javatests/google/registry/model/domain/DomainResourceTest.java @@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.newHostResource; import static google.registry.testing.DatastoreHelper.persistResource; 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 org.joda.money.CurrencyUnit.USD; @@ -446,7 +446,7 @@ public class DomainResourceTest extends EntityTestCase { @Test public void testFailure_uppercaseDomainName() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> domain.asBuilder().setFullyQualifiedDomainName("AAA.BBB")); assertThat(thrown) @@ -457,7 +457,7 @@ public class DomainResourceTest extends EntityTestCase { @Test public void testFailure_utf8DomainName() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> domain.asBuilder().setFullyQualifiedDomainName("みんな.みんな")); assertThat(thrown) diff --git a/javatests/google/registry/model/domain/GracePeriodTest.java b/javatests/google/registry/model/domain/GracePeriodTest.java index b527d35ec..cc002c83c 100644 --- a/javatests/google/registry/model/domain/GracePeriodTest.java +++ b/javatests/google/registry/model/domain/GracePeriodTest.java @@ -15,7 +15,7 @@ package google.registry.model.domain; 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 com.googlecode.objectify.Key; @@ -93,7 +93,7 @@ public class GracePeriodTest { @Test public void testFailure_forBillingEvent_autoRenew() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> GracePeriod.forBillingEvent(GracePeriodStatus.AUTO_RENEW, onetime)); assertThat(thrown).hasMessageThat().contains("autorenew"); @@ -102,7 +102,7 @@ public class GracePeriodTest { @Test public void testFailure_createForRecurring_notAutoRenew() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> GracePeriod.createForRecurring( diff --git a/javatests/google/registry/model/host/HostResourceTest.java b/javatests/google/registry/model/host/HostResourceTest.java index 6de71aa1f..5743f9dbd 100644 --- a/javatests/google/registry/model/host/HostResourceTest.java +++ b/javatests/google/registry/model/host/HostResourceTest.java @@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.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.net.InetAddresses; @@ -158,7 +158,7 @@ public class HostResourceTest extends EntityTestCase { @Test public void testFailure_uppercaseHostName() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> host.asBuilder().setFullyQualifiedHostName("AAA.BBB.CCC")); assertThat(thrown) @@ -169,7 +169,7 @@ public class HostResourceTest extends EntityTestCase { @Test public void testFailure_utf8HostName() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> host.asBuilder().setFullyQualifiedHostName("みんな.みんな.みんな")); assertThat(thrown) diff --git a/javatests/google/registry/model/index/DomainApplicationIndexTest.java b/javatests/google/registry/model/index/DomainApplicationIndexTest.java index 95613d073..1fc93ac03 100644 --- a/javatests/google/registry/model/index/DomainApplicationIndexTest.java +++ b/javatests/google/registry/model/index/DomainApplicationIndexTest.java @@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.newDomainApplication; import static google.registry.testing.DatastoreHelper.persistResource; 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 com.google.common.collect.ImmutableList; @@ -45,7 +45,7 @@ public class DomainApplicationIndexTest extends EntityTestCase { @Test public void testFailure_create_nullReferences() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> DomainApplicationIndex.createWithSpecifiedKeys("blah.com", null)); assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty."); @@ -54,7 +54,7 @@ public class DomainApplicationIndexTest extends EntityTestCase { @Test public void testFailure_create_emptyReferences() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> createWithSpecifiedKeys("blah.com", ImmutableSet.of())); assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty."); diff --git a/javatests/google/registry/model/ofy/CommitLogBucketTest.java b/javatests/google/registry/model/ofy/CommitLogBucketTest.java index 974e42361..afb677dc0 100644 --- a/javatests/google/registry/model/ofy/CommitLogBucketTest.java +++ b/javatests/google/registry/model/ofy/CommitLogBucketTest.java @@ -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.loadBucket; 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 com.google.common.base.Suppliers; @@ -66,14 +66,14 @@ public class CommitLogBucketTest { @Test public void test_getBucketKey_bucketNumberTooLow_throws() { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> getBucketKey(0)); + assertThrows(IllegalArgumentException.class, () -> getBucketKey(0)); assertThat(thrown).hasMessageThat().contains("0 not in ["); } @Test public void test_getBucketKey_bucketNumberTooHigh_throws() { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> getBucketKey(11)); + assertThrows(IllegalArgumentException.class, () -> getBucketKey(11)); assertThat(thrown).hasMessageThat().contains("11 not in ["); } diff --git a/javatests/google/registry/model/ofy/CommitLogCheckpointTest.java b/javatests/google/registry/model/ofy/CommitLogCheckpointTest.java index 6f93b46ef..e337602fb 100644 --- a/javatests/google/registry/model/ofy/CommitLogCheckpointTest.java +++ b/javatests/google/registry/model/ofy/CommitLogCheckpointTest.java @@ -15,7 +15,7 @@ package google.registry.model.ofy; 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 org.joda.time.DateTimeZone.UTC; @@ -58,7 +58,7 @@ public class CommitLogCheckpointTest { @Test public void test_create_notEnoughBucketTimestamps_throws() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(1, T1, 2, T2))); assertThat(thrown).hasMessageThat().contains("Bucket ids are incorrect"); @@ -67,7 +67,7 @@ public class CommitLogCheckpointTest { @Test public void test_create_tooManyBucketTimestamps_throws() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> CommitLogCheckpoint.create( @@ -78,7 +78,7 @@ public class CommitLogCheckpointTest { @Test public void test_create_wrongBucketIds_throws() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> CommitLogCheckpoint.create( @@ -89,7 +89,7 @@ public class CommitLogCheckpointTest { @Test public void test_create_wrongBucketIdOrder_throws() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> CommitLogCheckpoint.create( diff --git a/javatests/google/registry/model/ofy/OfyCommitLogTest.java b/javatests/google/registry/model/ofy/OfyCommitLogTest.java index 5e05b64de..e39347f88 100644 --- a/javatests/google/registry/model/ofy/OfyCommitLogTest.java +++ b/javatests/google/registry/model/ofy/OfyCommitLogTest.java @@ -20,7 +20,7 @@ import static com.googlecode.objectify.ObjectifyService.register; import static google.registry.model.common.EntityGroupRoot.getCrossTldKey; import static google.registry.model.ofy.CommitLogBucket.getBucketKey; 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.googlecode.objectify.Key; @@ -161,7 +161,7 @@ public class OfyCommitLogTest { final CommitLogManifest backupsArentAllowedOnMe = CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy().transactNew(() -> ofy().delete().entity(backupsArentAllowedOnMe))); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @NotBackedUp"); @@ -172,7 +172,7 @@ public class OfyCommitLogTest { final CommitLogManifest backupsArentAllowedOnMe = CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy().transactNew(() -> ofy().save().entity(backupsArentAllowedOnMe))); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @NotBackedUp"); @@ -182,7 +182,7 @@ public class OfyCommitLogTest { public void testTransactNew_deleteVirtualEntityKey_throws() throws Exception { final Key virtualEntityKey = TestVirtualObject.createKey("virtual"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy().transactNew(() -> ofy().delete().key(virtualEntityKey))); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity"); @@ -192,7 +192,7 @@ public class OfyCommitLogTest { public void testTransactNew_saveVirtualEntity_throws() throws Exception { final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy().transactNew(() -> ofy().save().entity(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 { final Key virtualEntityKey = TestVirtualObject.createKey("virtual"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy().deleteWithoutBackup().key(virtualEntityKey)); 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 { final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy().saveWithoutBackup().entity(virtualEntity)); assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity"); } @@ -220,7 +220,7 @@ public class OfyCommitLogTest { @Test public void testTransact_twoSavesOnSameKey_throws() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy() @@ -235,7 +235,7 @@ public class OfyCommitLogTest { @Test public void testTransact_saveAndDeleteSameKey_throws() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy() diff --git a/javatests/google/registry/model/ofy/OfyFilterTest.java b/javatests/google/registry/model/ofy/OfyFilterTest.java index 165a8f628..8bdd0d76b 100644 --- a/javatests/google/registry/model/ofy/OfyFilterTest.java +++ b/javatests/google/registry/model/ofy/OfyFilterTest.java @@ -17,7 +17,7 @@ package google.registry.model.ofy; import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ofy.ObjectifyService.initOfy; 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.LocalServiceTestHelper; @@ -72,7 +72,7 @@ public class OfyFilterTest { @Test public void testFilterRegistersTypes() throws Exception { UnregisteredEntity entity = new UnregisteredEntity(5L); - IllegalStateException e = expectThrows(IllegalStateException.class, () -> Key.create(entity)); + IllegalStateException e = assertThrows(IllegalStateException.class, () -> Key.create(entity)); assertThat(e) .hasMessageThat() .isEqualTo( diff --git a/javatests/google/registry/model/ofy/OfyTest.java b/javatests/google/registry/model/ofy/OfyTest.java index 1b6b295f6..96d679bb9 100644 --- a/javatests/google/registry/model/ofy/OfyTest.java +++ b/javatests/google/registry/model/ofy/OfyTest.java @@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.newContactResource; import static google.registry.testing.DatastoreHelper.persistActiveContact; 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.START_OF_TIME; 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. Ofy ofy = new Ofy(new FakeClock(groupTimestamp)); TimestampInversionException thrown = - expectThrows(TimestampInversionException.class, () -> ofy.transact(work)); + assertThrows(TimestampInversionException.class, () -> ofy.transact(work)); assertThat(thrown) .hasMessageThat() .contains( @@ -121,7 +120,7 @@ public class OfyTest { @Test public void testSavingKeyTwice() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy() @@ -139,7 +138,7 @@ public class OfyTest { @Test public void testDeletingKeyTwice() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy() @@ -157,7 +156,7 @@ public class OfyTest { @Test public void testSaveDeleteKey() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy() @@ -175,7 +174,7 @@ public class OfyTest { @Test public void testDeleteSaveKey() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy() @@ -404,7 +403,7 @@ public class OfyTest { @Test public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntity() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> getBaseEntityClassFromEntityOrKey(new SystemClock())); assertThat(thrown).hasMessageThat().contains("SystemClock"); @@ -413,7 +412,7 @@ public class OfyTest { @Test public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntityKey() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> getBaseEntityClassFromEntityOrKey( diff --git a/javatests/google/registry/model/rde/RdeRevisionTest.java b/javatests/google/registry/model/rde/RdeRevisionTest.java index 9a71c37ee..3c7ca1bfe 100644 --- a/javatests/google/registry/model/rde/RdeRevisionTest.java +++ b/javatests/google/registry/model/rde/RdeRevisionTest.java @@ -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.RdeRevision.getNextRevision; 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.googlecode.objectify.VoidWork; @@ -67,7 +67,7 @@ public class RdeRevisionTest { @Test public void testSaveRevision_objectDoesntExist_newRevisionIsOne_throwsVe() throws Exception { VerifyException thrown = - expectThrows( + assertThrows( VerifyException.class, () -> ofy() @@ -85,7 +85,7 @@ public class RdeRevisionTest { public void testSaveRevision_objectExistsAtZero_newRevisionIsZero_throwsVe() throws Exception { save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0); VerifyException thrown = - expectThrows( + assertThrows( VerifyException.class, () -> ofy() @@ -119,7 +119,7 @@ public class RdeRevisionTest { public void testSaveRevision_objectExistsAtZero_newRevisionIsTwo_throwsVe() throws Exception { save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0); VerifyException thrown = - expectThrows( + assertThrows( VerifyException.class, () -> ofy() @@ -136,7 +136,7 @@ public class RdeRevisionTest { @Test public void testSaveRevision_negativeRevision_throwsIae() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> ofy() @@ -153,7 +153,7 @@ public class RdeRevisionTest { @Test public void testSaveRevision_callerNotInTransaction_throwsIse() throws Exception { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> saveRevision("frenzy", DateTime.parse("1984-12-18TZ"), FULL, 1)); assertThat(thrown).hasMessageThat().contains("transaction"); diff --git a/javatests/google/registry/model/registrar/RegistrarTest.java b/javatests/google/registry/model/registrar/RegistrarTest.java index b203adf38..f666b4871 100644 --- a/javatests/google/registry/model/registrar/RegistrarTest.java +++ b/javatests/google/registry/model/registrar/RegistrarTest.java @@ -27,7 +27,6 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.DatastoreHelper.persistSimpleResources; 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.ImmutableMap; @@ -141,7 +140,7 @@ public class RegistrarTest extends EntityTestCase { @Test public void testFailure_passwordNull() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setPassword(null)); assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long."); } @@ -149,7 +148,7 @@ public class RegistrarTest extends EntityTestCase { @Test public void testFailure_passwordTooShort() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setPassword("abcde")); assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long."); } @@ -157,7 +156,7 @@ public class RegistrarTest extends EntityTestCase { @Test public void testFailure_passwordTooLong() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setPassword("abcdefghijklmnopq")); assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long."); @@ -320,7 +319,7 @@ public class RegistrarTest extends EntityTestCase { @Test public void testFailure_missingRegistrarType() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setRegistrarName("blah").build()); assertThat(thrown).hasMessageThat().contains("Registrar type cannot be null"); @@ -329,7 +328,7 @@ public class RegistrarTest extends EntityTestCase { @Test public void testFailure_missingRegistrarName() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder().setClientId("blahid").setType(Registrar.Type.TEST).build()); @@ -339,7 +338,7 @@ public class RegistrarTest extends EntityTestCase { @Test public void testFailure_missingAddress() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registrar.Builder() @@ -438,28 +437,28 @@ public class RegistrarTest extends EntityTestCase { @Test public void testFailure_loadByClientId_clientIdIsNull() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(null)); + assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(null)); assertThat(thrown).hasMessageThat().contains("clientId must be specified"); } @Test public void testFailure_loadByClientId_clientIdIsEmpty() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId("")); + assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId("")); assertThat(thrown).hasMessageThat().contains("clientId must be specified"); } @Test public void testFailure_loadByClientIdCached_clientIdIsNull() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(null)); + assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(null)); assertThat(thrown).hasMessageThat().contains("clientId must be specified"); } @Test public void testFailure_loadByClientIdCached_clientIdIsEmpty() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached("")); + assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached("")); assertThat(thrown).hasMessageThat().contains("clientId must be specified"); } } diff --git a/javatests/google/registry/model/registry/RegistryTest.java b/javatests/google/registry/model/registry/RegistryTest.java index 934f128dd..6d124097c 100644 --- a/javatests/google/registry/model/registry/RegistryTest.java +++ b/javatests/google/registry/model/registry/RegistryTest.java @@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.newRegistry; import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistReservedList; 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.START_OF_TIME; import static org.joda.money.CurrencyUnit.EUR; @@ -196,7 +195,7 @@ public class RegistryTest extends EntityTestCase { "tld-reserved057", "lol,RESERVED_FOR_ANCHOR_TENANT,another_conflict"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> { @SuppressWarnings("unused") @@ -354,21 +353,21 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_tldNeverSet() { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> new Registry.Builder().build()); + assertThrows(IllegalArgumentException.class, () -> new Registry.Builder().build()); assertThat(thrown).hasMessageThat().contains("No registry TLD specified"); } @Test public void testFailure_setTldStr_null() { 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"); } @Test public void testFailure_setTldStr_invalidTld() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(".tld").build()); assertThat(thrown) .hasMessageThat() @@ -378,7 +377,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_setTldStr_nonCanonicalTld() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registry.Builder().setTldStr("TLD").build()); assertThat(thrown) .hasMessageThat() @@ -420,7 +419,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_pricingEngineIsRequired() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> new Registry.Builder().setTldStr("invalid").build()); assertThat(thrown) @@ -431,7 +430,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_negativeRenewBillingCostTransitionValue() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld") @@ -444,7 +443,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_negativeCreateBillingCost() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, -42))); assertThat(thrown).hasMessageThat().contains("createBillingCost cannot be negative"); @@ -453,7 +452,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_negativeRestoreBillingCost() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, -42))); assertThat(thrown).hasMessageThat().contains("restoreBillingCost cannot be negative"); @@ -462,7 +461,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_negativeServerStatusChangeBillingCost() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld") @@ -474,7 +473,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_renewBillingCostTransitionValue_wrongCurrency() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld") @@ -488,7 +487,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_createBillingCost_wrongCurrency() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(EUR, 42)).build()); assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency"); @@ -497,7 +496,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_restoreBillingCost_wrongCurrency() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(EUR, 42)).build()); assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency"); @@ -506,7 +505,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_serverStatusChangeBillingCost_wrongCurrency() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld") @@ -544,7 +543,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_eapFee_wrongCurrency() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld") @@ -557,7 +556,7 @@ public class RegistryTest extends EntityTestCase { @Test public void testFailure_roidSuffixTooLong() { IllegalArgumentException e = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Registry.get("tld").asBuilder().setRoidSuffix("123456789")); assertThat(e).hasMessageThat().isEqualTo("ROID suffix must be in format ^[A-Z0-9_]{1,8}$"); diff --git a/javatests/google/registry/model/registry/label/PremiumListTest.java b/javatests/google/registry/model/registry/label/PremiumListTest.java index d3607139b..a578156c6 100644 --- a/javatests/google/registry/model/registry/label/PremiumListTest.java +++ b/javatests/google/registry/model/registry/label/PremiumListTest.java @@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.google.common.collect.ImmutableList; import google.registry.model.registry.Registry; @@ -82,7 +81,7 @@ public class PremiumListTest { @Test public void testParse_cannotIncludeDuplicateLabels() { IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> PremiumList.get("tld") diff --git a/javatests/google/registry/model/registry/label/PremiumListUtilsTest.java b/javatests/google/registry/model/registry/label/PremiumListUtilsTest.java index 701f2a5a6..214a37a9f 100644 --- a/javatests/google/registry/model/registry/label/PremiumListUtilsTest.java +++ b/javatests/google/registry/model/registry/label/PremiumListUtilsTest.java @@ -34,7 +34,7 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.loadPremiumListEntries; import static google.registry.testing.DatastoreHelper.persistPremiumList; 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 com.google.common.collect.ImmutableList; @@ -112,7 +112,7 @@ public class PremiumListUtilsTest { throws Exception { deletePremiumList(PremiumList.get("tld").get()); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> getPremiumPrice("blah", Registry.get("tld"))); assertThat(thrown).hasMessageThat().contains("Could not load premium list 'tld'"); } diff --git a/javatests/google/registry/model/registry/label/ReservedListTest.java b/javatests/google/registry/model/registry/label/ReservedListTest.java index 9ff854fac..e1b4857ed 100644 --- a/javatests/google/registry/model/registry/label/ReservedListTest.java +++ b/javatests/google/registry/model/registry/label/ReservedListTest.java @@ -34,7 +34,6 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistResource; 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.ImmutableSet; @@ -266,7 +265,7 @@ public class ReservedListTest { assertThat(matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar")).isFalse(); persistReservedList("reserved2", "lol,RESERVED_FOR_ANCHOR_TENANT,bar"); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar")); assertThat(thrown) @@ -469,7 +468,7 @@ public class ReservedListTest { @Test public void testSave_badSyntax() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> persistReservedList("tld", "lol,FULLY_BLOCKED,e,e # yup")); assertThat(thrown).hasMessageThat().contains("Could not parse line in reserved list"); @@ -484,7 +483,7 @@ public class ReservedListTest { @Test public void testSave_additionalRestrictionWithIncompatibleReservationType() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> persistResource( @@ -504,7 +503,7 @@ public class ReservedListTest { @Test public void testSave_badNameservers_invalidSyntax() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> persistReservedList( @@ -517,7 +516,7 @@ public class ReservedListTest { @Test public void testSave_badNameservers_tooFewPartsForHostname() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> persistReservedList( @@ -530,7 +529,7 @@ public class ReservedListTest { @Test public void testSave_noPasswordWithAnchorTenantReservation() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> persistResource( @@ -548,7 +547,7 @@ public class ReservedListTest { @Test public void testSave_noNameserversWithNameserverRestrictedReservation() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> persistResource( @@ -568,7 +567,7 @@ public class ReservedListTest { public void testParse_cannotIncludeDuplicateLabels() { ReservedList rl = new ReservedList.Builder().setName("blah").build(); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> rl.parse( diff --git a/javatests/google/registry/model/server/KmsSecretRevisionTest.java b/javatests/google/registry/model/server/KmsSecretRevisionTest.java index d3c9fa1d6..58c8dbfdd 100644 --- a/javatests/google/registry/model/server/KmsSecretRevisionTest.java +++ b/javatests/google/registry/model/server/KmsSecretRevisionTest.java @@ -17,7 +17,7 @@ package google.registry.model.server; import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ofy.ObjectifyService.ofy; 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 google.registry.testing.AppEngineRule; @@ -47,7 +47,7 @@ public class KmsSecretRevisionTest { @Test public void test_setEncryptedValue_tooLong_throwsException() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> secretRevision = diff --git a/javatests/google/registry/model/server/LockTest.java b/javatests/google/registry/model/server/LockTest.java index 860c42d88..c59a9d7db 100644 --- a/javatests/google/registry/model/server/LockTest.java +++ b/javatests/google/registry/model/server/LockTest.java @@ -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.OWNER_DIED; 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.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -136,7 +136,7 @@ public class LockTest { @Test public void testFailure_emptyResourceName() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Lock.acquire("", "", TWO_MILLIS, requestStatusChecker)); assertThat(thrown).hasMessageThat().contains("resourceName cannot be null or empty"); diff --git a/javatests/google/registry/pricing/PricingEngineProxyTest.java b/javatests/google/registry/pricing/PricingEngineProxyTest.java index 3ceae3292..bf78d043d 100644 --- a/javatests/google/registry/pricing/PricingEngineProxyTest.java +++ b/javatests/google/registry/pricing/PricingEngineProxyTest.java @@ -21,7 +21,7 @@ import static google.registry.pricing.PricingEngineProxy.isDomainPremium; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistPremiumList; 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 org.joda.money.CurrencyUnit.USD; @@ -145,7 +145,7 @@ public class PricingEngineProxyTest { .setPremiumPricingEngine("fake") .build()); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> getDomainCreateCost("bad.example", clock.nowUtc(), 1)); assertThat(thrown) diff --git a/javatests/google/registry/proxy/ProxyModuleTest.java b/javatests/google/registry/proxy/ProxyModuleTest.java index 652389e44..3bbb4373a 100644 --- a/javatests/google/registry/proxy/ProxyModuleTest.java +++ b/javatests/google/registry/proxy/ProxyModuleTest.java @@ -17,7 +17,7 @@ package google.registry.proxy; import static com.google.common.truth.Truth.assertThat; import static google.registry.proxy.ProxyConfig.Environment.TEST; 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 com.beust.jcommander.ParameterException; @@ -94,7 +94,7 @@ public class ProxyModuleTest { @Test public void testFailure_parseArgs_wrongEnvironment() { ParameterException e = - expectThrows( + assertThrows( ParameterException.class, () -> { String[] args = {"--env", "beta"}; diff --git a/javatests/google/registry/proxy/handler/BackendMetricsHandlerTest.java b/javatests/google/registry/proxy/handler/BackendMetricsHandlerTest.java index 01afb4bf3..58a09495a 100644 --- a/javatests/google/registry/proxy/handler/BackendMetricsHandlerTest.java +++ b/javatests/google/registry/proxy/handler/BackendMetricsHandlerTest.java @@ -22,7 +22,7 @@ import static google.registry.proxy.TestUtils.makeHttpPostRequest; import static google.registry.proxy.TestUtils.makeHttpResponse; 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.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -96,7 +96,7 @@ public class BackendMetricsHandlerTest { public void testFailure_outbound_wrongType() { Object request = new Object(); IllegalArgumentException e = - expectThrows(IllegalArgumentException.class, () -> channel.writeOutbound(request)); + assertThrows(IllegalArgumentException.class, () -> channel.writeOutbound(request)); assertThat(e).hasMessageThat().isEqualTo("Outgoing request must be FullHttpRequest."); } @@ -104,7 +104,7 @@ public class BackendMetricsHandlerTest { public void testFailure_inbound_wrongType() { Object response = new Object(); IllegalArgumentException e = - expectThrows(IllegalArgumentException.class, () -> channel.writeInbound(response)); + assertThrows(IllegalArgumentException.class, () -> channel.writeInbound(response)); assertThat(e).hasMessageThat().isEqualTo("Incoming response must be FullHttpResponse."); } @@ -159,7 +159,7 @@ public class BackendMetricsHandlerTest { public void testFailure_responseBeforeRequest() { FullHttpResponse response = makeHttpResponse("phantom response", HttpResponseStatus.OK); IllegalStateException e = - expectThrows(IllegalStateException.class, () -> channel.writeInbound(response)); + assertThrows(IllegalStateException.class, () -> channel.writeInbound(response)); assertThat(e).hasMessageThat().isEqualTo("Response received before request is sent."); } diff --git a/javatests/google/registry/proxy/handler/EppQuotaHandlerTest.java b/javatests/google/registry/proxy/handler/EppQuotaHandlerTest.java index 610a81863..1669df3a0 100644 --- a/javatests/google/registry/proxy/handler/EppQuotaHandlerTest.java +++ b/javatests/google/registry/proxy/handler/EppQuotaHandlerTest.java @@ -17,7 +17,7 @@ package google.registry.proxy.handler; import static com.google.common.truth.Truth.assertThat; import static google.registry.proxy.Protocol.PROTOCOL_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.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -108,7 +108,7 @@ public class EppQuotaHandlerTest { when(quotaManager.acquireQuota(QuotaRequest.create(clientCertHash))) .thenReturn(QuotaResponse.create(false, clientCertHash, now)); OverQuotaException e = - expectThrows(OverQuotaException.class, () -> channel.writeInbound(message)); + assertThrows(OverQuotaException.class, () -> channel.writeInbound(message)); assertThat(e).hasMessageThat().contains(clientCertHash); verify(metrics).registerQuotaRejection("epp", clientCertHash); verifyNoMoreInteractions(metrics); @@ -136,7 +136,7 @@ public class EppQuotaHandlerTest { // Blocks the second user. OverQuotaException e = - expectThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); + assertThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); assertThat(e).hasMessageThat().contains(otherClientCertHash); verify(metrics).registerQuotaRejection("epp", otherClientCertHash); verifyNoMoreInteractions(metrics); @@ -162,7 +162,7 @@ public class EppQuotaHandlerTest { // Blocks the second channel. OverQuotaException e = - expectThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); + assertThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); assertThat(e).hasMessageThat().contains(clientCertHash); verify(metrics).registerQuotaRejection("epp", clientCertHash); verifyNoMoreInteractions(metrics); diff --git a/javatests/google/registry/proxy/handler/WhoisQuotaHandlerTest.java b/javatests/google/registry/proxy/handler/WhoisQuotaHandlerTest.java index d0ccfb69d..e622d928b 100644 --- a/javatests/google/registry/proxy/handler/WhoisQuotaHandlerTest.java +++ b/javatests/google/registry/proxy/handler/WhoisQuotaHandlerTest.java @@ -17,7 +17,7 @@ package google.registry.proxy.handler; import static com.google.common.truth.Truth.assertThat; import static google.registry.proxy.Protocol.PROTOCOL_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.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -103,7 +103,7 @@ public class WhoisQuotaHandlerTest { when(quotaManager.acquireQuota(QuotaRequest.create(remoteAddress))) .thenReturn(QuotaResponse.create(false, remoteAddress, now)); OverQuotaException e = - expectThrows(OverQuotaException.class, () -> channel.writeInbound(message)); + assertThrows(OverQuotaException.class, () -> channel.writeInbound(message)); assertThat(e).hasMessageThat().contains("none"); verify(metrics).registerQuotaRejection("whois", "none"); verifyNoMoreInteractions(metrics); @@ -131,7 +131,7 @@ public class WhoisQuotaHandlerTest { // Blocks the second user. OverQuotaException e = - expectThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); + assertThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); assertThat(e).hasMessageThat().contains("none"); verify(metrics).registerQuotaRejection("whois", "none"); verifyNoMoreInteractions(metrics); @@ -166,7 +166,7 @@ public class WhoisQuotaHandlerTest { // Blocks the second channel. OverQuotaException e = - expectThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); + assertThrows(OverQuotaException.class, () -> otherChannel.writeInbound(message)); assertThat(e).hasMessageThat().contains("none"); verify(metrics).registerQuotaRejection("whois", "none"); diff --git a/javatests/google/registry/proxy/quota/QuotaConfigTest.java b/javatests/google/registry/proxy/quota/QuotaConfigTest.java index 6c6c57f10..66b61a012 100644 --- a/javatests/google/registry/proxy/quota/QuotaConfigTest.java +++ b/javatests/google/registry/proxy/quota/QuotaConfigTest.java @@ -15,7 +15,7 @@ package google.registry.proxy.quota; 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 google.registry.proxy.ProxyConfig.Quota; @@ -76,7 +76,7 @@ public class QuotaConfigTest { quotaConfig = loadQuotaConfig("quota_config_unlimited_tokens.yaml"); assertThat(quotaConfig.hasUnlimitedTokens("some_user")).isTrue(); IllegalStateException e = - expectThrows(IllegalStateException.class, () -> quotaConfig.getTokenAmount("some_user")); + assertThrows(IllegalStateException.class, () -> quotaConfig.getTokenAmount("some_user")); assertThat(e) .hasMessageThat() .contains("User ID some_user is provisioned with unlimited tokens"); @@ -85,7 +85,7 @@ public class QuotaConfigTest { @Test public void testFailure_duplicateUserId() { IllegalArgumentException e = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> loadQuotaConfig("quota_config_duplicate.yaml")); assertThat(e).hasMessageThat().contains("Multiple entries with same key"); } diff --git a/javatests/google/registry/rde/EscrowTaskRunnerTest.java b/javatests/google/registry/rde/EscrowTaskRunnerTest.java index ce02b5a08..909827e39 100644 --- a/javatests/google/registry/rde/EscrowTaskRunnerTest.java +++ b/javatests/google/registry/rde/EscrowTaskRunnerTest.java @@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.testing.DatastoreHelper.createTld; 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.standardSeconds; import static org.mockito.Mockito.mock; @@ -97,7 +97,7 @@ public class EscrowTaskRunnerTest { persistResource( Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-07TZ"), registry)); NoContentException thrown = - expectThrows( + assertThrows( NoContentException.class, () -> runner.lockRunAndRollForward( @@ -112,7 +112,7 @@ public class EscrowTaskRunnerTest { persistResource( Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-06TZ"), registry)); ServiceUnavailableException thrown = - expectThrows( + assertThrows( ServiceUnavailableException.class, () -> { runner.lockHandler = new FakeLockHandler(false); diff --git a/javatests/google/registry/rde/GhostrydeTest.java b/javatests/google/registry/rde/GhostrydeTest.java index 642faf85c..c0373d21b 100644 --- a/javatests/google/registry/rde/GhostrydeTest.java +++ b/javatests/google/registry/rde/GhostrydeTest.java @@ -18,7 +18,6 @@ import static com.google.common.base.Strings.repeat; import static com.google.common.truth.Truth.assertThat; import static google.registry.keyring.api.PgpHelper.KeyRequirement.ENCRYPT; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static java.nio.charset.StandardCharsets.UTF_8; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.is; @@ -193,7 +192,7 @@ public class GhostrydeTest { ByteArrayInputStream bsIn = new ByteArrayInputStream(ciphertext); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> { try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) { @@ -254,7 +253,7 @@ public class GhostrydeTest { ByteArrayInputStream bsIn = new ByteArrayInputStream(bsOut.toByteArray()); PGPException thrown = - expectThrows( + assertThrows( PGPException.class, () -> { try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) { diff --git a/javatests/google/registry/rde/RdeReportActionTest.java b/javatests/google/registry/rde/RdeReportActionTest.java index e45b5ed7e..e49bc93de 100644 --- a/javatests/google/registry/rde/RdeReportActionTest.java +++ b/javatests/google/registry/rde/RdeReportActionTest.java @@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.GcsTestingUtils.writeGcsFile; 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_OK; import static org.joda.time.DateTimeZone.UTC; @@ -173,7 +172,7 @@ public class RdeReportActionTest { when(httpResponse.getContent()).thenReturn(IIRDEA_BAD_XML.read()); when(urlFetchService.fetch(request.capture())).thenReturn(httpResponse); InternalServerErrorException thrown = - expectThrows( + assertThrows( InternalServerErrorException.class, () -> createAction().runWithLock(loadRdeReportCursor())); assertThat(thrown).hasMessageThat().contains("The structure of the report is invalid."); diff --git a/javatests/google/registry/rde/RdeUploadActionTest.java b/javatests/google/registry/rde/RdeUploadActionTest.java index 16d23ce5c..d85ac7400 100644 --- a/javatests/google/registry/rde/RdeUploadActionTest.java +++ b/javatests/google/registry/rde/RdeUploadActionTest.java @@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.GcsTestingUtils.readGcsFile; 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.TaskQueueHelper.assertNoTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; @@ -309,7 +309,7 @@ public class RdeUploadActionTest { RdeUploadAction action = createAction(uploadUrl); action.lazyJsch = Lazies.of(createThrowingJSchSpy(action.lazyJsch.get(), 3)); RuntimeException thrown = - expectThrows(RuntimeException.class, () -> action.runWithLock(uploadCursor)); + assertThrows(RuntimeException.class, () -> action.runWithLock(uploadCursor)); assertThat(thrown).hasMessageThat().contains("The crow flies in square circles."); } @@ -384,7 +384,7 @@ public class RdeUploadActionTest { persistResource( Cursor.create(CursorType.RDE_STAGING, stagingCursor, Registry.get("tld"))); ServiceUnavailableException thrown = - expectThrows( + assertThrows( ServiceUnavailableException.class, () -> createAction(null).runWithLock(uploadCursor)); assertThat(thrown).hasMessageThat().contains("Waiting for RdeStagingAction to complete"); } diff --git a/javatests/google/registry/rde/imports/RdeHostInputTest.java b/javatests/google/registry/rde/imports/RdeHostInputTest.java index de6d0b45e..aa6fd563d 100644 --- a/javatests/google/registry/rde/imports/RdeHostInputTest.java +++ b/javatests/google/registry/rde/imports/RdeHostInputTest.java @@ -16,7 +16,7 @@ package google.registry.rde.imports; import static com.google.common.truth.Truth.assertThat; 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.GcsService; @@ -61,7 +61,7 @@ public class RdeHostInputTest { @Test public void testNegativeShards_throwsIllegalArgumentException() throws Exception { 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"); } @@ -69,7 +69,7 @@ public class RdeHostInputTest { @Test public void testZeroShards_throwsIllegalArgumentException() throws Exception { 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"); } diff --git a/javatests/google/registry/rde/imports/RdeImportUtilsTest.java b/javatests/google/registry/rde/imports/RdeImportUtilsTest.java index bc6d44f64..28f0c1f7c 100644 --- a/javatests/google/registry/rde/imports/RdeImportUtilsTest.java +++ b/javatests/google/registry/rde/imports/RdeImportUtilsTest.java @@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistNewRegistrar; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.time.DateTimeZone.UTC; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; @@ -273,7 +272,7 @@ public class RdeImportUtilsTest extends ShardableTestCase { xmlInput = DEPOSIT_BADTLD_XML.openBufferedStream(); when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); Exception e = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badtld.xml")); 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(); when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); Exception e = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-getld.xml")); assertThat(e) @@ -299,7 +298,7 @@ public class RdeImportUtilsTest extends ShardableTestCase { xmlInput = DEPOSIT_BADREGISTRAR_XML.openBufferedStream(); when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); Exception e = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badregistrar.xml")); assertThat(e).hasMessageThat().isEqualTo("Registrar 'RegistrarY' not found in the registry"); diff --git a/javatests/google/registry/rde/imports/RdeParserTest.java b/javatests/google/registry/rde/imports/RdeParserTest.java index 5c9f5f516..bac4aea6f 100644 --- a/javatests/google/registry/rde/imports/RdeParserTest.java +++ b/javatests/google/registry/rde/imports/RdeParserTest.java @@ -16,7 +16,7 @@ package google.registry.rde.imports; import static com.google.common.truth.Truth.assertThat; 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 google.registry.rde.imports.RdeParser.RdeHeader; @@ -74,7 +74,7 @@ public class RdeParserTest { @Test public void testGetContactNotAtElement_throwsIllegalStateException() throws Exception { try (RdeParser parser = new RdeParser(xml)) { - IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getContact); + IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getContact); assertThat(thrown) .hasMessageThat() .contains("Not at element urn:ietf:params:xml:ns:rdeContact-1.0:contact"); @@ -158,7 +158,7 @@ public class RdeParserTest { @Test public void testGetDomainNotAtElement_throwsIllegalStateException() throws Exception { try (RdeParser parser = new RdeParser(xml)) { - IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getDomain); + IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getDomain); assertThat(thrown) .hasMessageThat() .contains("Not at element urn:ietf:params:xml:ns:rdeDomain-1.0:domain"); @@ -270,7 +270,7 @@ public class RdeParserTest { @Test public void testGetHostNotAtElement_throwsIllegalStateException() throws Exception { try (RdeParser parser = new RdeParser(xml)) { - IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getHost); + IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getHost); assertThat(thrown) .hasMessageThat() .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 { try (RdeParser parser = new RdeParser(xml)) { IllegalStateException thrown = - expectThrows(IllegalStateException.class, parser::getRegistrar); + assertThrows(IllegalStateException.class, parser::getRegistrar); assertThat(thrown) .hasMessageThat() .contains("Not at element urn:ietf:params:xml:ns:rdeRegistrar-1.0:registrar"); @@ -423,7 +423,7 @@ public class RdeParserTest { @Test public void testGetNndnNotAtElement_throwsIllegalStateException() throws Exception { try (RdeParser parser = new RdeParser(xml)) { - IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getNndn); + IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getNndn); assertThat(thrown) .hasMessageThat() .contains("Not at element urn:ietf:params:xml:ns:rdeNNDN-1.0:NNDN"); @@ -461,7 +461,7 @@ public class RdeParserTest { @Test public void testGetIdnNotAtElement_throwsIllegalStateException() throws Exception { try (RdeParser parser = new RdeParser(xml)) { - IllegalStateException thrown = expectThrows(IllegalStateException.class, parser::getIdn); + IllegalStateException thrown = assertThrows(IllegalStateException.class, parser::getIdn); assertThat(thrown) .hasMessageThat() .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 { try (RdeParser parser = new RdeParser(xml)) { IllegalStateException thrown = - expectThrows(IllegalStateException.class, parser::getEppParams); + assertThrows(IllegalStateException.class, parser::getEppParams); assertThat(thrown) .hasMessageThat() .contains("Not at element urn:ietf:params:xml:ns:rdeEppParams-1.0:eppParams"); diff --git a/javatests/google/registry/rde/imports/XjcToDomainResourceConverterTest.java b/javatests/google/registry/rde/imports/XjcToDomainResourceConverterTest.java index ce77d7ca5..b9468d87f 100644 --- a/javatests/google/registry/rde/imports/XjcToDomainResourceConverterTest.java +++ b/javatests/google/registry/rde/imports/XjcToDomainResourceConverterTest.java @@ -26,7 +26,7 @@ import static google.registry.testing.DatastoreHelper.getHistoryEntries; import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistResource; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.END_OF_TIME; import static java.util.Arrays.asList; @@ -214,7 +214,7 @@ public class XjcToDomainResourceConverterTest { persistActiveContact("sh8013"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pendingRestorePeriod.xml"); IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); + assertThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); assertThat(thrown) .hasMessageThat() .contains("Unsupported grace period status: PENDING_RESTORE"); @@ -270,7 +270,7 @@ public class XjcToDomainResourceConverterTest { persistActiveHost("ns2.example.net"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_attrs.xml"); IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); + assertThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); assertThat(thrown).hasMessageThat().contains("Host attributes are not yet supported"); } @@ -281,7 +281,7 @@ public class XjcToDomainResourceConverterTest { persistActiveHost("ns1.example.net"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_objs.xml"); IllegalStateException thrown = - expectThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); + assertThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); assertThat(thrown) .hasMessageThat() .contains("HostResource not found with name 'ns2.example.net'"); @@ -292,7 +292,7 @@ public class XjcToDomainResourceConverterTest { persistActiveContact("sh8013"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); IllegalStateException thrown = - expectThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); + assertThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); assertThat(thrown).hasMessageThat().contains("Registrant not found: 'jd1234'"); } @@ -302,7 +302,7 @@ public class XjcToDomainResourceConverterTest { persistActiveContact("sh8013"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_registrant_missing.xml"); IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); + assertThrows(IllegalArgumentException.class, () -> convertDomainInTransaction(xjcDomain)); assertThat(thrown) .hasMessageThat() .contains("Registrant is missing for domain 'example1.example'"); @@ -313,7 +313,7 @@ public class XjcToDomainResourceConverterTest { persistActiveContact("jd1234"); final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml"); IllegalStateException thrown = - expectThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); + assertThrows(IllegalStateException.class, () -> convertDomainInTransaction(xjcDomain)); assertThat(thrown).hasMessageThat().contains("Contact not found: 'sh8013'"); } diff --git a/javatests/google/registry/reporting/ReportingModuleTest.java b/javatests/google/registry/reporting/ReportingModuleTest.java index 104c2fd4f..2ead79087 100644 --- a/javatests/google/registry/reporting/ReportingModuleTest.java +++ b/javatests/google/registry/reporting/ReportingModuleTest.java @@ -15,7 +15,7 @@ package google.registry.reporting; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -52,7 +52,7 @@ public class ReportingModuleTest { public void testInvalidYearMonthParameter_throwsException() { when(req.getParameter("yearMonth")).thenReturn("201705"); BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> ReportingModule.provideYearMonthOptional(req)); assertThat(thrown) .hasMessageThat() diff --git a/javatests/google/registry/reporting/billing/BillingEmailUtilsTest.java b/javatests/google/registry/reporting/billing/BillingEmailUtilsTest.java index 214c74b79..afadc6537 100644 --- a/javatests/google/registry/reporting/billing/BillingEmailUtilsTest.java +++ b/javatests/google/registry/reporting/billing/BillingEmailUtilsTest.java @@ -16,7 +16,7 @@ package google.registry.reporting.billing; import static com.google.common.truth.Truth.assertThat; 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.Mockito.doThrow; import static org.mockito.Mockito.mock; @@ -144,7 +144,7 @@ public class BillingEmailUtilsTest { } ); RuntimeException thrown = - expectThrows(RuntimeException.class, () -> emailUtils.emailOverallInvoice()); + assertThrows(RuntimeException.class, () -> emailUtils.emailOverallInvoice()); assertThat(thrown).hasMessageThat().isEqualTo("javax.mail.MessagingException: expected"); // Verify we sent an e-mail alert verify(emailService).sendMessage(msgCaptor.capture()); diff --git a/javatests/google/registry/reporting/billing/CopyDetailReportsActionTest.java b/javatests/google/registry/reporting/billing/CopyDetailReportsActionTest.java index 430218513..bcc74f66e 100644 --- a/javatests/google/registry/reporting/billing/CopyDetailReportsActionTest.java +++ b/javatests/google/registry/reporting/billing/CopyDetailReportsActionTest.java @@ -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.persistResource; 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 javax.servlet.http.HttpServletResponse.SC_OK; import static org.mockito.Matchers.any; @@ -169,7 +169,7 @@ public class CopyDetailReportsActionTest { when(driveConnection.createFile(any(), any(), any(), any())) .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"); verify(driveConnection, times(3)) .createFile( diff --git a/javatests/google/registry/reporting/icann/IcannHttpReporterTest.java b/javatests/google/registry/reporting/icann/IcannHttpReporterTest.java index 51d4d903e..0e7c737c0 100644 --- a/javatests/google/registry/reporting/icann/IcannHttpReporterTest.java +++ b/javatests/google/registry/reporting/icann/IcannHttpReporterTest.java @@ -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.truth.Truth.assertThat; 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 com.google.api.client.http.LowLevelHttpRequest; @@ -125,7 +125,7 @@ public class IcannHttpReporterTest { @Test public void testFail_invalidFilename_nonSixDigitYearMonth() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> { IcannHttpReporter reporter = createReporter(); @@ -141,7 +141,7 @@ public class IcannHttpReporterTest { @Test public void testFail_invalidFilename_notActivityOrTransactions() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> { IcannHttpReporter reporter = createReporter(); @@ -156,7 +156,7 @@ public class IcannHttpReporterTest { @Test public void testFail_invalidFilename_invalidTldName() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> { IcannHttpReporter reporter = createReporter(); @@ -172,7 +172,7 @@ public class IcannHttpReporterTest { @Test public void testFail_invalidFilename_tldDoesntExist() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> { IcannHttpReporter reporter = createReporter(); diff --git a/javatests/google/registry/reporting/icann/IcannReportingModuleTest.java b/javatests/google/registry/reporting/icann/IcannReportingModuleTest.java index a67455d51..ca0e14c2d 100644 --- a/javatests/google/registry/reporting/icann/IcannReportingModuleTest.java +++ b/javatests/google/registry/reporting/icann/IcannReportingModuleTest.java @@ -15,7 +15,7 @@ package google.registry.reporting.icann; 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.request.HttpException.BadRequestException; @@ -45,7 +45,7 @@ public class IcannReportingModuleTest { @Test public void testInvalidSubdir_throwsException() { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> IcannReportingModule.provideSubdir(Optional.of("/whoops"), new YearMonth(2017, 6))); diff --git a/javatests/google/registry/reporting/icann/IcannReportingStagingActionTest.java b/javatests/google/registry/reporting/icann/IcannReportingStagingActionTest.java index d676e2766..ff476c2a4 100644 --- a/javatests/google/registry/reporting/icann/IcannReportingStagingActionTest.java +++ b/javatests/google/registry/reporting/icann/IcannReportingStagingActionTest.java @@ -15,7 +15,7 @@ package google.registry.reporting.icann; 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.assertTasksEnqueued; import static org.mockito.Mockito.mock; @@ -134,7 +134,7 @@ public class IcannReportingStagingActionTest { when(stager.stageReports(ReportType.ACTIVITY)) .thenThrow(new BigqueryJobFailureException("Expected failure", null, null, null)); BigqueryJobFailureException thrown = - expectThrows(BigqueryJobFailureException.class, action::run); + assertThrows(BigqueryJobFailureException.class, action::run); assertThat(thrown).hasMessageThat().isEqualTo("Expected failure"); verify(stager, times(3)).stageReports(ReportType.ACTIVITY); verify(emailUtils) diff --git a/javatests/google/registry/reporting/icann/IcannReportingUploadActionTest.java b/javatests/google/registry/reporting/icann/IcannReportingUploadActionTest.java index bba7f02d9..c4799b90b 100644 --- a/javatests/google/registry/reporting/icann/IcannReportingUploadActionTest.java +++ b/javatests/google/registry/reporting/icann/IcannReportingUploadActionTest.java @@ -16,7 +16,7 @@ package google.registry.reporting.icann; import static com.google.common.truth.Truth.assertThat; 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 org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -144,7 +144,7 @@ public class IcannReportingUploadActionTest { public void testFail_FileNotFound() throws Exception { IcannReportingUploadAction action = createAction(); action.subdir = "somewhere/else"; - IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, action::run); + IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, action::run); assertThat(thrown) .hasMessageThat() .isEqualTo("Object MANIFEST.txt in bucket basin/somewhere/else not found"); diff --git a/javatests/google/registry/request/RequestModuleTest.java b/javatests/google/registry/request/RequestModuleTest.java index 69bdc30c2..fd06c5c0b 100644 --- a/javatests/google/registry/request/RequestModuleTest.java +++ b/javatests/google/registry/request/RequestModuleTest.java @@ -17,7 +17,6 @@ package google.registry.request; import static com.google.common.truth.Truth.assertThat; import static google.registry.request.RequestModule.provideJsonPayload; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.google.common.net.MediaType; import google.registry.request.HttpException.BadRequestException; @@ -44,7 +43,7 @@ public final class RequestModuleTest { @Test public void testProvideJsonPayload_malformedInput_throws500() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> provideJsonPayload(MediaType.JSON_UTF_8, "{\"k\":")); assertThat(thrown).hasMessageThat().contains("Malformed JSON"); } @@ -52,7 +51,7 @@ public final class RequestModuleTest { @Test public void testProvideJsonPayload_emptyInput_throws500() throws Exception { BadRequestException thrown = - expectThrows(BadRequestException.class, () -> provideJsonPayload(MediaType.JSON_UTF_8, "")); + assertThrows(BadRequestException.class, () -> provideJsonPayload(MediaType.JSON_UTF_8, "")); assertThat(thrown).hasMessageThat().contains("Malformed JSON"); } diff --git a/javatests/google/registry/request/RequestParametersTest.java b/javatests/google/registry/request/RequestParametersTest.java index 2c9395d0e..faca72d30 100644 --- a/javatests/google/registry/request/RequestParametersTest.java +++ b/javatests/google/registry/request/RequestParametersTest.java @@ -23,7 +23,7 @@ import static google.registry.request.RequestParameters.extractOptionalEnumParam import static google.registry.request.RequestParameters.extractOptionalParameter; import static google.registry.request.RequestParameters.extractRequiredDatetimeParameter; import static google.registry.request.RequestParameters.extractRequiredParameter; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -49,7 +49,7 @@ public class RequestParametersTest { @Test public void testExtractRequiredParameter_notPresent_throwsBadRequest() throws Exception { BadRequestException thrown = - expectThrows(BadRequestException.class, () -> extractRequiredParameter(req, "spin")); + assertThrows(BadRequestException.class, () -> extractRequiredParameter(req, "spin")); assertThat(thrown).hasMessageThat().contains("spin"); } @@ -57,7 +57,7 @@ public class RequestParametersTest { public void testExtractRequiredParameter_empty_throwsBadRequest() throws Exception { when(req.getParameter("spin")).thenReturn(""); BadRequestException thrown = - expectThrows(BadRequestException.class, () -> extractRequiredParameter(req, "spin")); + assertThrows(BadRequestException.class, () -> extractRequiredParameter(req, "spin")); assertThat(thrown).hasMessageThat().contains("spin"); } @@ -142,7 +142,7 @@ public class RequestParametersTest { public void testExtractEnumValue_nonExistentValue_throwsBadRequest() throws Exception { when(req.getParameter("spin")).thenReturn("sing"); BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> extractEnumParameter(req, Club.class, "spin")); assertThat(thrown).hasMessageThat().contains("spin"); } @@ -163,7 +163,7 @@ public class RequestParametersTest { public void testOptionalExtractEnumValue_nonExistentValue_throwsBadRequest() throws Exception { when(req.getParameter("spin")).thenReturn("sing"); BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> extractOptionalEnumParameter(req, Club.class, "spin")); assertThat(thrown).hasMessageThat().contains("spin"); } @@ -179,7 +179,7 @@ public class RequestParametersTest { public void testExtractRequiredDatetimeParameter_badValue_throwsBadRequest() throws Exception { when(req.getParameter("timeParam")).thenReturn("Tuesday at three o'clock"); BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> extractRequiredDatetimeParameter(req, "timeParam")); assertThat(thrown).hasMessageThat().contains("timeParam"); } @@ -195,7 +195,7 @@ public class RequestParametersTest { public void testExtractOptionalDatetimeParameter_badValue_throwsBadRequest() throws Exception { when(req.getParameter("timeParam")).thenReturn("Tuesday at three o'clock"); BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> extractOptionalDatetimeParameter(req, "timeParam")); assertThat(thrown).hasMessageThat().contains("timeParam"); } @@ -209,7 +209,7 @@ public class RequestParametersTest { @Test public void testExtractRequiredDatetimeParameter_noValue_throwsBadRequest() throws Exception { BadRequestException thrown = - expectThrows( + assertThrows( BadRequestException.class, () -> extractRequiredDatetimeParameter(req, "timeParam")); assertThat(thrown).hasMessageThat().contains("timeParam"); } diff --git a/javatests/google/registry/request/RouterTest.java b/javatests/google/registry/request/RouterTest.java index 8111ac3ba..0cf3620fa 100644 --- a/javatests/google/registry/request/RouterTest.java +++ b/javatests/google/registry/request/RouterTest.java @@ -17,7 +17,7 @@ package google.registry.request; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; import static google.registry.request.auth.Auth.AUTH_INTERNAL_ONLY; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import java.util.Optional; import java.util.concurrent.Callable; @@ -37,7 +37,7 @@ public final class RouterTest { @Test public void testRoute_noRoutes_throws() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> Router.create(Empty.class)); + assertThrows(IllegalArgumentException.class, () -> Router.create(Empty.class)); assertThat(thrown) .hasMessageThat() .contains("No routes found for class: google.registry.request.RouterTest.Empty"); @@ -143,7 +143,7 @@ public final class RouterTest { @Test public void testRoute_methodsInComponentAreIgnored_throws() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> Router.create(WeirdMethodsComponent.class)); assertThat(thrown) .hasMessageThat() @@ -173,7 +173,7 @@ public final class RouterTest { @Test public void testCreate_twoTasksWithSameMethodAndPath_resultsInError() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> Router.create(DuplicateComponent.class)); + assertThrows(IllegalArgumentException.class, () -> Router.create(DuplicateComponent.class)); assertThat(thrown).hasMessageThat().contains("Multiple entries with same key"); } } diff --git a/javatests/google/registry/request/auth/RequestAuthenticatorTest.java b/javatests/google/registry/request/auth/RequestAuthenticatorTest.java index 1a437f0e6..399d33628 100644 --- a/javatests/google/registry/request/auth/RequestAuthenticatorTest.java +++ b/javatests/google/registry/request/auth/RequestAuthenticatorTest.java @@ -17,7 +17,7 @@ package google.registry.request.auth; import static com.google.common.net.HttpHeaders.AUTHORIZATION; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.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.verifyZeroInteractions; import static org.mockito.Mockito.when; @@ -388,7 +388,7 @@ public class RequestAuthenticatorTest { @Test public void testCheckAuthConfig_NoMethods_failure() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> RequestAuthenticator.checkAuthConfig(AUTH_NO_METHODS)); assertThat(thrown).hasMessageThat().contains("Must specify at least one auth method"); @@ -397,7 +397,7 @@ public class RequestAuthenticatorTest { @Test public void testCheckAuthConfig_WrongMethodOrdering_failure() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> RequestAuthenticator.checkAuthConfig(AUTH_WRONG_METHOD_ORDERING)); assertThat(thrown) @@ -408,7 +408,7 @@ public class RequestAuthenticatorTest { @Test public void testCheckAuthConfig_DuplicateMethods_failure() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> RequestAuthenticator.checkAuthConfig(AUTH_DUPLICATE_METHODS)); assertThat(thrown) @@ -419,7 +419,7 @@ public class RequestAuthenticatorTest { @Test public void testCheckAuthConfig_InternalWithUser_failure() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> RequestAuthenticator.checkAuthConfig(AUTH_INTERNAL_WITH_USER)); assertThat(thrown) @@ -430,7 +430,7 @@ public class RequestAuthenticatorTest { @Test public void testCheckAuthConfig_WronglyIgnoringUser_failure() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> RequestAuthenticator.checkAuthConfig(AUTH_WRONGLY_IGNORING_USER)); assertThat(thrown) diff --git a/javatests/google/registry/request/lock/LockHandlerImplTest.java b/javatests/google/registry/request/lock/LockHandlerImplTest.java index b99939fd5..bd895da69 100644 --- a/javatests/google/registry/request/lock/LockHandlerImplTest.java +++ b/javatests/google/registry/request/lock/LockHandlerImplTest.java @@ -15,7 +15,7 @@ package google.registry.request.lock; 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.times; import static org.mockito.Mockito.verify; @@ -97,7 +97,7 @@ public final class LockHandlerImplTest { Lock lock = mock(Lock.class); Exception expectedException = new RuntimeException("test"); RuntimeException exception = - expectThrows( + assertThrows( RuntimeException.class, () -> executeWithLocks(new ThrowingCallable(expectedException), lock)); assertThat(exception).isSameAs(expectedException); @@ -109,7 +109,7 @@ public final class LockHandlerImplTest { Lock lock = mock(Lock.class); Exception expectedException = new Exception("test"); RuntimeException exception = - expectThrows( + assertThrows( RuntimeException.class, () -> executeWithLocks(new ThrowingCallable(expectedException), lock)); assertThat(exception).hasCauseThat().isSameAs(expectedException); diff --git a/javatests/google/registry/storage/drive/DriveConnectionTest.java b/javatests/google/registry/storage/drive/DriveConnectionTest.java index 09c88155f..01bc0a4dc 100644 --- a/javatests/google/registry/storage/drive/DriveConnectionTest.java +++ b/javatests/google/registry/storage/drive/DriveConnectionTest.java @@ -16,7 +16,7 @@ package google.registry.storage.drive; import static com.google.common.io.ByteStreams.toByteArray; 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.Matchers.anyString; import static org.mockito.Matchers.argThat; import static org.mockito.Matchers.eq; @@ -209,7 +209,7 @@ public class DriveConnectionTest { .setNextPageToken(null); when(childrenList.execute()).thenReturn(childList); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> driveConnection.createOrUpdateFile( diff --git a/javatests/google/registry/tldconfig/idn/IdnTableTest.java b/javatests/google/registry/tldconfig/idn/IdnTableTest.java index d1350c09d..aafd8f5a1 100644 --- a/javatests/google/registry/tldconfig/idn/IdnTableTest.java +++ b/javatests/google/registry/tldconfig/idn/IdnTableTest.java @@ -15,7 +15,7 @@ package google.registry.tldconfig.idn; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableList; import java.net.URI; @@ -107,7 +107,7 @@ public class IdnTableTest { public void testMissingUrl_throwsNpe() { ImmutableList of = ImmutableList.of("# Policy: https://love.example/policy.html"); NullPointerException thrown = - expectThrows( + assertThrows( NullPointerException.class, () -> IdnTable.createFrom("sloth", of, Optional.empty())); assertThat(thrown).hasMessageThat().contains("sloth missing '# URL:"); } @@ -116,7 +116,7 @@ public class IdnTableTest { public void testMissingPolicy_throwsNpe() { ImmutableList of = ImmutableList.of("# URL: https://love.example/sloth.txt"); NullPointerException thrown = - expectThrows( + assertThrows( NullPointerException.class, () -> IdnTable.createFrom("sloth", of, Optional.empty())); assertThat(thrown).hasMessageThat().contains("sloth missing '# Policy:"); } diff --git a/javatests/google/registry/tmch/LordnTaskTest.java b/javatests/google/registry/tmch/LordnTaskTest.java index 8040d7e62..bb19c3dee 100644 --- a/javatests/google/registry/tmch/LordnTaskTest.java +++ b/javatests/google/registry/tmch/LordnTaskTest.java @@ -21,7 +21,6 @@ import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistDomainAndEnqueueLordn; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; @@ -165,7 +164,7 @@ public class LordnTaskTest { .setCreationClientId("nonexistentRegistrar") .build(); IllegalStateException thrown = - expectThrows(IllegalStateException.class, () -> persistDomainAndEnqueueLordn(domain)); + assertThrows(IllegalStateException.class, () -> persistDomainAndEnqueueLordn(domain)); assertThat(thrown) .hasMessageThat() .contains("No registrar found for client id: nonexistentRegistrar"); @@ -204,7 +203,7 @@ public class LordnTaskTest { Queue queue = mock(Queue.class); when(queue.leaseTasks(any(LeaseOptions.class))).thenThrow(TransientFailureException.class); RuntimeException thrown = - expectThrows(RuntimeException.class, () -> LordnTask.loadAllTasks(queue, "tld")); + assertThrows(RuntimeException.class, () -> LordnTask.loadAllTasks(queue, "tld")); assertThat(thrown).hasMessageThat().contains("Error leasing tasks"); } diff --git a/javatests/google/registry/tmch/NordnUploadActionTest.java b/javatests/google/registry/tmch/NordnUploadActionTest.java index 8c80dfc00..e80d14a02 100644 --- a/javatests/google/registry/tmch/NordnUploadActionTest.java +++ b/javatests/google/registry/tmch/NordnUploadActionTest.java @@ -26,7 +26,6 @@ import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.persistDomainAndEnqueueLordn; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.util.UrlFetchUtils.getHeaderFirst; import static java.nio.charset.StandardCharsets.UTF_8; @@ -199,7 +198,7 @@ public class NordnUploadActionTest { public void testFailure_nullRegistryUser() throws Exception { persistClaimsModeDomain(); persistResource(Registry.get("tld").asBuilder().setLordnUsername(null).build()); - VerifyException thrown = expectThrows(VerifyException.class, action::run); + VerifyException thrown = assertThrows(VerifyException.class, action::run); assertThat(thrown).hasMessageThat().contains("lordnUsername is not set for tld."); } diff --git a/javatests/google/registry/tmch/NordnVerifyActionTest.java b/javatests/google/registry/tmch/NordnVerifyActionTest.java index 87b86cb1c..f8137ce75 100644 --- a/javatests/google/registry/tmch/NordnVerifyActionTest.java +++ b/javatests/google/registry/tmch/NordnVerifyActionTest.java @@ -20,7 +20,6 @@ import static com.google.common.truth.Truth8.assertThat; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.util.UrlFetchUtils.getHeaderFirst; import static java.nio.charset.StandardCharsets.UTF_8; import static javax.servlet.http.HttpServletResponse.SC_NO_CONTENT; @@ -171,7 +170,7 @@ public class NordnVerifyActionTest { @Test public void failureVerifyNotReady() throws Exception { when(httpResponse.getResponseCode()).thenReturn(SC_NO_CONTENT); - ConflictException thrown = expectThrows(ConflictException.class, action::run); + ConflictException thrown = assertThrows(ConflictException.class, action::run); assertThat(thrown).hasMessageThat().contains("Not ready"); } } diff --git a/javatests/google/registry/tmch/SmdrlCsvParserTest.java b/javatests/google/registry/tmch/SmdrlCsvParserTest.java index 6b4bbb6fd..d4fdb07bd 100644 --- a/javatests/google/registry/tmch/SmdrlCsvParserTest.java +++ b/javatests/google/registry/tmch/SmdrlCsvParserTest.java @@ -15,7 +15,7 @@ package google.registry.tmch; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static java.nio.charset.StandardCharsets.US_ASCII; import static org.joda.time.Duration.millis; import static org.joda.time.Duration.standardDays; @@ -107,7 +107,7 @@ public class SmdrlCsvParserTest { @Test public void testFail_badVersion() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SmdrlCsvParser.parse( @@ -121,7 +121,7 @@ public class SmdrlCsvParserTest { @Test public void testFail_badHeader() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SmdrlCsvParser.parse( @@ -135,7 +135,7 @@ public class SmdrlCsvParserTest { @Test public void testFail_tooManyColumns() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SmdrlCsvParser.parse( diff --git a/javatests/google/registry/tmch/TmchCertificateAuthorityTest.java b/javatests/google/registry/tmch/TmchCertificateAuthorityTest.java index 09f62a101..ac11513b8 100644 --- a/javatests/google/registry/tmch/TmchCertificateAuthorityTest.java +++ b/javatests/google/registry/tmch/TmchCertificateAuthorityTest.java @@ -17,7 +17,7 @@ package google.registry.tmch; import static com.google.common.truth.Truth.assertThat; import static google.registry.config.RegistryConfig.ConfigModule.TmchCaMode.PILOT; import static google.registry.config.RegistryConfig.ConfigModule.TmchCaMode.PRODUCTION; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.tmch.TmchTestData.loadFile; import static google.registry.util.ResourceUtils.readResourceUtf8; import static google.registry.util.X509Utils.loadCertificate; @@ -63,7 +63,7 @@ public class TmchCertificateAuthorityTest { TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PRODUCTION); clock.setTo(DateTime.parse("2024-01-01T00:00:00Z")); CertificateExpiredException e = - expectThrows(CertificateExpiredException.class, tmchCertificateAuthority::getRoot); + assertThrows(CertificateExpiredException.class, tmchCertificateAuthority::getRoot); assertThat(e).hasMessageThat().containsMatch("NotAfter: Sun Jul 23 23:59:59 UTC 2023"); } @@ -72,7 +72,7 @@ public class TmchCertificateAuthorityTest { TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PRODUCTION); clock.setTo(DateTime.parse("2000-01-01T00:00:00Z")); CertificateNotYetValidException e = - expectThrows(CertificateNotYetValidException.class, tmchCertificateAuthority::getRoot); + assertThrows(CertificateNotYetValidException.class, tmchCertificateAuthority::getRoot); assertThat(e).hasMessageThat().containsMatch("NotBefore: Wed Jul 24 00:00:00 UTC 2013"); } @@ -83,7 +83,7 @@ public class TmchCertificateAuthorityTest { TmchCrl.set( readResourceUtf8(TmchCertificateAuthority.class, "icann-tmch.crl"), "http://cert.crl"); SignatureException e = - expectThrows( + assertThrows( SignatureException.class, () -> tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE))); assertThat(e).hasMessageThat().contains("Signature does not match"); @@ -99,7 +99,7 @@ public class TmchCertificateAuthorityTest { public void testFailure_verifySignatureDoesntMatch() throws Exception { TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PRODUCTION); SignatureException e = - expectThrows( + assertThrows( SignatureException.class, () -> tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE))); assertThat(e).hasMessageThat().contains("Signature does not match"); @@ -109,7 +109,7 @@ public class TmchCertificateAuthorityTest { public void testFailure_verifyRevoked() throws Exception { TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PILOT); CertificateRevokedException thrown = - expectThrows( + assertThrows( CertificateRevokedException.class, () -> tmchCertificateAuthority.verify(loadCertificate(REVOKED_TEST_CERTIFICATE))); assertThat(thrown).hasMessageThat().contains("revoked, reason: KEY_COMPROMISE"); diff --git a/javatests/google/registry/tmch/TmchCrlActionTest.java b/javatests/google/registry/tmch/TmchCrlActionTest.java index 0428d6d59..fb4d58d1e 100644 --- a/javatests/google/registry/tmch/TmchCrlActionTest.java +++ b/javatests/google/registry/tmch/TmchCrlActionTest.java @@ -15,7 +15,7 @@ package google.registry.tmch; 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.readResourceBytes; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -61,7 +61,7 @@ public class TmchCrlActionTest extends TmchActionTestCase { // doesn't matter that the wrong CRT would be used to verify it because that check happens after // the age check. TmchCrlAction action = newTmchCrlAction(TmchCaMode.PRODUCTION); - Exception e = expectThrows(Exception.class, action::run); + Exception e = assertThrows(Exception.class, action::run); assertThat(e).hasCauseThat().isInstanceOf(CRLException.class); assertThat(e) .hasCauseThat() @@ -74,7 +74,7 @@ public class TmchCrlActionTest extends TmchActionTestCase { clock.setTo(DateTime.parse("2013-07-24TZ")); when(httpResponse.getContent()) .thenReturn(readResourceBytes(TmchCertificateAuthority.class, "icann-tmch.crl").read()); - Exception e = expectThrows(Exception.class, newTmchCrlAction(TmchCaMode.PILOT)::run); + Exception e = assertThrows(Exception.class, newTmchCrlAction(TmchCaMode.PILOT)::run); assertThat(e).hasCauseThat().isInstanceOf(SignatureException.class); assertThat(e).hasCauseThat().hasMessageThat().isEqualTo("Signature does not match."); } @@ -84,7 +84,7 @@ public class TmchCrlActionTest extends TmchActionTestCase { clock.setTo(DateTime.parse("1984-01-01TZ")); when(httpResponse.getContent()).thenReturn( readResourceBytes(TmchCertificateAuthority.class, "icann-tmch-pilot.crl").read()); - Exception e = expectThrows(Exception.class, newTmchCrlAction(TmchCaMode.PILOT)::run); + Exception e = assertThrows(Exception.class, newTmchCrlAction(TmchCaMode.PILOT)::run); assertThat(e).hasCauseThat().isInstanceOf(CertificateNotYetValidException.class); } } diff --git a/javatests/google/registry/tmch/TmchXmlSignatureTest.java b/javatests/google/registry/tmch/TmchXmlSignatureTest.java index 5863c353e..5c4fe1d93 100644 --- a/javatests/google/registry/tmch/TmchXmlSignatureTest.java +++ b/javatests/google/registry/tmch/TmchXmlSignatureTest.java @@ -16,7 +16,6 @@ package google.registry.tmch; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.tmch.TmchTestData.loadSmd; import google.registry.config.RegistryConfig.ConfigModule.TmchCaMode; @@ -86,7 +85,7 @@ public class TmchXmlSignatureTest { tmchXmlSignature = new TmchXmlSignature(new TmchCertificateAuthority(TmchCaMode.PRODUCTION)); smdData = loadSmd("active/Court-Agent-Arabic-Active.smd"); CertificateSignatureException e = - expectThrows(CertificateSignatureException.class, () -> tmchXmlSignature.verify(smdData)); + assertThrows(CertificateSignatureException.class, () -> tmchXmlSignature.verify(smdData)); assertThat(e).hasMessageThat().contains("Signature does not match"); } @@ -318,7 +317,7 @@ public class TmchXmlSignatureTest { public void testRevokedTmvTmvrevokedCourtAgentFrenchActive() throws Exception { smdData = loadSmd("revoked/tmv/TMVRevoked-Court-Agent-French-Active.smd"); CertificateRevokedException e = - expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); + assertThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); assertThat(e).hasMessageThat().contains("KEY_COMPROMISE"); } @@ -326,7 +325,7 @@ public class TmchXmlSignatureTest { public void testRevokedTmvTmvrevokedTrademarkAgentEnglishActive() throws Exception { smdData = loadSmd("revoked/tmv/TMVRevoked-Trademark-Agent-English-Active.smd"); CertificateRevokedException e = - expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); + assertThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); assertThat(e).hasMessageThat().contains("KEY_COMPROMISE"); } @@ -334,7 +333,7 @@ public class TmchXmlSignatureTest { public void testRevokedTmvTmvrevokedTrademarkAgentRussianActive() throws Exception { smdData = loadSmd("revoked/tmv/TMVRevoked-Trademark-Agent-Russian-Active.smd"); CertificateRevokedException e = - expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); + assertThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); assertThat(e).hasMessageThat().contains("KEY_COMPROMISE"); } @@ -342,7 +341,7 @@ public class TmchXmlSignatureTest { public void testRevokedTmvTmvrevokedTreatystatuteAgentChineseActive() throws Exception { smdData = loadSmd("revoked/tmv/TMVRevoked-TreatyStatute-Agent-Chinese-Active.smd"); CertificateRevokedException e = - expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); + assertThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); assertThat(e).hasMessageThat().contains("KEY_COMPROMISE"); } @@ -350,7 +349,7 @@ public class TmchXmlSignatureTest { public void testRevokedTmvTmvrevokedTreatystatuteAgentEnglishActive() throws Throwable { smdData = loadSmd("revoked/tmv/TMVRevoked-TreatyStatute-Agent-English-Active.smd"); CertificateRevokedException e = - expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); + assertThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData)); assertThat(e).hasMessageThat().contains("KEY_COMPROMISE"); } } diff --git a/javatests/google/registry/tools/CreateCreditBalanceCommandTest.java b/javatests/google/registry/tools/CreateCreditBalanceCommandTest.java index 8305c6432..1dc84034c 100644 --- a/javatests/google/registry/tools/CreateCreditBalanceCommandTest.java +++ b/javatests/google/registry/tools/CreateCreditBalanceCommandTest.java @@ -20,7 +20,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.loadRegistrar; 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.USD; import static org.joda.time.DateTimeZone.UTC; @@ -82,7 +82,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase runCommandForced( @@ -97,7 +97,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase runCommandForced( @@ -111,7 +111,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase runCommandForced( @@ -125,7 +125,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase runCommandForced( @@ -138,7 +138,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase runCommandForced( @@ -151,7 +151,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase runCommandForced( @@ -164,7 +164,7 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase runCommandForced( diff --git a/javatests/google/registry/tools/CreateCreditCommandTest.java b/javatests/google/registry/tools/CreateCreditCommandTest.java index efd1299fe..b782f7fbf 100644 --- a/javatests/google/registry/tools/CreateCreditCommandTest.java +++ b/javatests/google/registry/tools/CreateCreditCommandTest.java @@ -19,7 +19,7 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.loadRegistrar; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static org.joda.money.CurrencyUnit.USD; import static org.joda.time.DateTimeZone.UTC; @@ -95,7 +95,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( @@ -110,7 +110,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( @@ -125,7 +125,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( @@ -140,7 +140,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( @@ -155,7 +155,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( @@ -169,7 +169,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( @@ -183,7 +183,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( @@ -197,7 +197,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( @@ -211,7 +211,7 @@ public class CreateCreditCommandTest extends CommandTestCase runCommandForced( diff --git a/javatests/google/registry/tools/CreateDomainCommandTest.java b/javatests/google/registry/tools/CreateDomainCommandTest.java index 8ef70be48..5aae9d23b 100644 --- a/javatests/google/registry/tools/CreateDomainCommandTest.java +++ b/javatests/google/registry/tools/CreateDomainCommandTest.java @@ -15,7 +15,7 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.beust.jcommander.ParameterException; import google.registry.testing.DeterministicStringGenerator; @@ -75,7 +75,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -91,7 +91,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -105,7 +105,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -119,7 +119,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -133,7 +133,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -147,7 +147,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -161,7 +161,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -180,7 +180,7 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -196,96 +196,96 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase - runCommandForced( - "--client=NewRegistrar", - "--registrant=crr-admin", - "--admins=crr-admin", - "--techs=crr-tech", - "--ds_records=1 2 3 ab cd", - "example.tld")); + runCommandForced( + "--client=NewRegistrar", + "--registrant=crr-admin", + "--admins=crr-admin", + "--techs=crr-tech", + "--ds_records=1 2 3 ab cd", + "example.tld")); assertThat(thrown).hasMessageThat().contains("should have 4 parts, but has 5"); } @Test public void testFailure_keyTagNotNumber() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> - runCommandForced( - "--client=NewRegistrar", - "--registrant=crr-admin", - "--admins=crr-admin", - "--techs=crr-tech", - "--ds_records=x 2 3 abcd", - "example.tld")); + runCommandForced( + "--client=NewRegistrar", + "--registrant=crr-admin", + "--admins=crr-admin", + "--techs=crr-tech", + "--ds_records=x 2 3 abcd", + "example.tld")); assertThat(thrown).hasMessageThat().contains("\"x\""); } @Test public void testFailure_algNotNumber() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> - runCommandForced( - "--client=NewRegistrar", - "--registrant=crr-admin", - "--admins=crr-admin", - "--techs=crr-tech", - "--ds_records=1 x 3 abcd", - "example.tld")); + runCommandForced( + "--client=NewRegistrar", + "--registrant=crr-admin", + "--admins=crr-admin", + "--techs=crr-tech", + "--ds_records=1 x 3 abcd", + "example.tld")); assertThat(thrown).hasMessageThat().contains("\"x\""); } @Test public void testFailure_digestTypeNotNumber() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> - runCommandForced( - "--client=NewRegistrar", - "--registrant=crr-admin", - "--admins=crr-admin", - "--techs=crr-tech", - "--ds_records=1 2 x abcd", - "example.tld")); + runCommandForced( + "--client=NewRegistrar", + "--registrant=crr-admin", + "--admins=crr-admin", + "--techs=crr-tech", + "--ds_records=1 2 x abcd", + "example.tld")); assertThat(thrown).hasMessageThat().contains("\"x\""); } @Test public void testFailure_digestNotHex() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> - runCommandForced( - "--client=NewRegistrar", - "--registrant=crr-admin", - "--admins=crr-admin", - "--techs=crr-tech", - "--ds_records=1 2 3 xbcd", - "example.tld")); + runCommandForced( + "--client=NewRegistrar", + "--registrant=crr-admin", + "--admins=crr-admin", + "--techs=crr-tech", + "--ds_records=1 2 3 xbcd", + "example.tld")); assertThat(thrown).hasMessageThat().contains("XBCD"); } @Test public void testFailure_digestNotEvenLengthed() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> - runCommandForced( - "--client=NewRegistrar", - "--registrant=crr-admin", - "--admins=crr-admin", - "--techs=crr-tech", - "--ds_records=1 2 3 abcde", - "example.tld")); + runCommandForced( + "--client=NewRegistrar", + "--registrant=crr-admin", + "--admins=crr-admin", + "--techs=crr-tech", + "--ds_records=1 2 3 abcde", + "example.tld")); assertThat(thrown).hasMessageThat().contains("length 5"); } } diff --git a/javatests/google/registry/tools/CreateHostCommandTest.java b/javatests/google/registry/tools/CreateHostCommandTest.java index e387a799a..2909760e2 100644 --- a/javatests/google/registry/tools/CreateHostCommandTest.java +++ b/javatests/google/registry/tools/CreateHostCommandTest.java @@ -17,7 +17,6 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.beust.jcommander.ParameterException; import org.junit.Test; @@ -53,7 +52,7 @@ public class CreateHostCommandTest extends EppToolCommandTestCase runCommandForced( diff --git a/javatests/google/registry/tools/CreateLrpTokensCommandTest.java b/javatests/google/registry/tools/CreateLrpTokensCommandTest.java index 12e87ff74..f7a7f83dd 100644 --- a/javatests/google/registry/tools/CreateLrpTokensCommandTest.java +++ b/javatests/google/registry/tools/CreateLrpTokensCommandTest.java @@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.testing.DatastoreHelper.createTld; 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 org.mockito.Mockito.doThrow; import static org.mockito.Mockito.spy; @@ -228,7 +228,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase runCommand("--tlds=tld")); + assertThrows(IllegalArgumentException.class, () -> runCommand("--tlds=tld")); assertThat(thrown) .hasMessageThat() .contains("Exactly one of either assignee or filename must be specified."); @@ -237,7 +237,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase runCommand("--assignee=domain.tld", "--tlds=tld", "--input=" + assigneeFilePath)); assertThat(thrown) @@ -248,7 +248,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase runCommand("--tlds=tld", "--input=" + assigneeFilePath, "--metadata=key=foo")); assertThat(thrown) @@ -259,7 +259,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase runCommand("--assignee=domain.tld", "--tlds=tld", "--metadata_columns=foo=1")); assertThat(thrown) @@ -270,7 +270,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase runCommand("--assignee=domain.tld", "--tlds=foo")); assertThat(thrown).hasMessageThat().contains("TLDs do not exist: foo"); @@ -280,7 +280,7 @@ public class CreateLrpTokensCommandTest extends CommandTestCase runCommand( diff --git a/javatests/google/registry/tools/CreatePremiumListCommandTest.java b/javatests/google/registry/tools/CreatePremiumListCommandTest.java index 3c511deae..0cbf1df07 100644 --- a/javatests/google/registry/tools/CreatePremiumListCommandTest.java +++ b/javatests/google/registry/tools/CreatePremiumListCommandTest.java @@ -16,7 +16,7 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; import static google.registry.request.JsonResponse.JSON_SAFETY_PREFIX; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.ResourceUtils.readResourceUtf8; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyMapOf; @@ -95,14 +95,14 @@ public class CreatePremiumListCommandTest .thenReturn( JSON_SAFETY_PREFIX + "{\"status\":\"error\",\"error\":\"foo already exists\"}"); VerifyException thrown = - expectThrows( + assertThrows( VerifyException.class, () -> runCommandForced("-i=" + premiumTermsPath, "-n=foo")); assertThat(thrown).hasMessageThat().contains("Server error:"); } @Test public void testRun_noInputFileSpecified_throwsException() throws Exception { - ParameterException thrown = expectThrows(ParameterException.class, this::runCommand); + ParameterException thrown = assertThrows(ParameterException.class, this::runCommand); assertThat(thrown).hasMessageThat().contains("The following option is required"); } @@ -113,7 +113,7 @@ public class CreatePremiumListCommandTest readResourceUtf8( CreatePremiumListCommandTest.class, "testdata/example_invalid_premium_terms.csv")); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("-i=" + premiumTermsPath, "-n=foo")); assertThat(thrown).hasMessageThat().contains("Could not parse line in premium list"); diff --git a/javatests/google/registry/tools/CreateRegistrarCommandTest.java b/javatests/google/registry/tools/CreateRegistrarCommandTest.java index f3b7d54ba..a5bfdb8ab 100644 --- a/javatests/google/registry/tools/CreateRegistrarCommandTest.java +++ b/javatests/google/registry/tools/CreateRegistrarCommandTest.java @@ -22,7 +22,6 @@ import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH; import static google.registry.testing.DatastoreHelper.createTlds; import static google.registry.testing.DatastoreHelper.persistNewRegistrar; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.time.DateTimeZone.UTC; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.verify; @@ -445,7 +444,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -702,7 +701,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -725,7 +724,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -792,7 +791,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -978,7 +977,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1001,7 +1000,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1024,7 +1023,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1045,7 +1044,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1066,7 +1065,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1437,7 +1436,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1561,7 +1560,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1585,7 +1584,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1611,7 +1610,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( @@ -1637,7 +1636,7 @@ public class CreateRegistrarCommandTest extends CommandTestCase runCommandForced( diff --git a/javatests/google/registry/tools/CreateRegistrarGroupsCommandTest.java b/javatests/google/registry/tools/CreateRegistrarGroupsCommandTest.java index 0949fa0c6..15c9f9eb6 100644 --- a/javatests/google/registry/tools/CreateRegistrarGroupsCommandTest.java +++ b/javatests/google/registry/tools/CreateRegistrarGroupsCommandTest.java @@ -15,7 +15,7 @@ package google.registry.tools; 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.Matchers.eq; import static org.mockito.Mockito.verify; @@ -57,7 +57,7 @@ public class CreateRegistrarGroupsCommandTest extends @Test public void test_throwsExceptionForNonExistentRegistrar() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("FakeRegistrarThatDefinitelyDoesNotExist")); assertThat(thrown) diff --git a/javatests/google/registry/tools/CreateReservedListCommandTest.java b/javatests/google/registry/tools/CreateReservedListCommandTest.java index ce8445c98..591e820c7 100644 --- a/javatests/google/registry/tools/CreateReservedListCommandTest.java +++ b/javatests/google/registry/tools/CreateReservedListCommandTest.java @@ -20,7 +20,7 @@ import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED import static google.registry.testing.DatastoreHelper.createTlds; import static google.registry.testing.DatastoreHelper.persistReservedList; 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.tools.CreateReservedListCommand.INVALID_FORMAT_ERROR_MESSAGE; import static org.joda.time.DateTimeZone.UTC; @@ -91,7 +91,7 @@ public class CreateReservedListCommandTest extends ReservedList rl = persistReservedList("xn--q9jyb4c_foo", "jones,FULLY_BLOCKED"); persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(rl).build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--name=xn--q9jyb4c_foo", "--input=" + reservedTermsPath)); assertThat(thrown).hasMessageThat().contains("A reserved list already exists by this name"); @@ -175,7 +175,7 @@ public class CreateReservedListCommandTest extends private void runNameTestExpectedFailure(String name, String expectedErrorMsg) throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--name=" + name, "--input=" + reservedTermsPath)); assertThat(ReservedList.get(name)).isEmpty(); diff --git a/javatests/google/registry/tools/CreateTldCommandTest.java b/javatests/google/registry/tools/CreateTldCommandTest.java index aca1d2e17..9adcb0fae 100644 --- a/javatests/google/registry/tools/CreateTldCommandTest.java +++ b/javatests/google/registry/tools/CreateTldCommandTest.java @@ -19,7 +19,7 @@ import static com.google.common.truth.Truth8.assertThat; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistReservedList; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.START_OF_TIME; import static org.joda.money.CurrencyUnit.JPY; import static org.joda.money.CurrencyUnit.USD; @@ -79,7 +79,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_multipleArguments() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -90,7 +90,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_multipleDuplicateArguments() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -312,7 +312,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidAddGracePeriod() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -325,21 +325,22 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidSunrushAddGracePeriod() throws Exception { - Exception e = expectThrows( - IllegalArgumentException.class, - () -> - runCommandForced( - "--sunrush_add_grace_period=5d", - "--roid_suffix=Q9JYB4C", - "--dns_writers=VoidDnsWriter", - "xn--q9jyb4c")); + Exception e = + assertThrows( + IllegalArgumentException.class, + () -> + runCommandForced( + "--sunrush_add_grace_period=5d", + "--roid_suffix=Q9JYB4C", + "--dns_writers=VoidDnsWriter", + "xn--q9jyb4c")); assertThat(e).hasMessageThat().isEqualTo("Invalid format: \"5d\""); } @Test public void testFailure_invalidRedemptionGracePeriod() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -353,7 +354,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidPendingDeleteLength() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -367,7 +368,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidTldState() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -382,7 +383,7 @@ public class CreateTldCommandTest extends CommandTestCase { public void testFailure_bothTldStateFlags() throws Exception { DateTime now = DateTime.now(UTC); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -400,7 +401,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_negativeInitialRenewBillingCost() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -414,7 +415,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidEapCurrency() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -429,7 +430,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_noTldName() throws Exception { - ParameterException thrown = expectThrows(ParameterException.class, this::runCommandForced); + ParameterException thrown = assertThrows(ParameterException.class, this::runCommandForced); assertThat(thrown) .hasMessageThat() .contains("Main parameters are required (\"Names of the TLDs\")"); @@ -438,7 +439,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_noDnsWriter() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C")); assertThat(thrown).hasMessageThat().contains("At least one DNS writer must be specified"); @@ -448,7 +449,7 @@ public class CreateTldCommandTest extends CommandTestCase { public void testFailure_alreadyExists() throws Exception { createTld("xn--q9jyb4c"); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> runCommandForced( @@ -459,7 +460,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_tldStartsWithDigit() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("1foo", "--roid_suffix=1FOO", "--dns_writers=VoidDnsWriter")); assertThat(thrown).hasMessageThat().contains("TLDs cannot begin with a number"); @@ -598,7 +599,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_setPremiumListThatDoesntExist() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -612,7 +613,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_addLrpPeriod_backwardsInterval() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -629,7 +630,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_addLrpPeriod_badInterval() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -643,7 +644,7 @@ public class CreateTldCommandTest extends CommandTestCase { @Test public void testFailure_specifiedDnsWriters_dontExist() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -676,7 +677,7 @@ public class CreateTldCommandTest extends CommandTestCase { String reservedLists, Class errorClass, String errorMsg) throws Exception { Exception e = - expectThrows( + assertThrows( errorClass, () -> runCommandForced( diff --git a/javatests/google/registry/tools/DeleteCreditCommandTest.java b/javatests/google/registry/tools/DeleteCreditCommandTest.java index aa23eb689..5400b8859 100644 --- a/javatests/google/registry/tools/DeleteCreditCommandTest.java +++ b/javatests/google/registry/tools/DeleteCreditCommandTest.java @@ -20,7 +20,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.loadRegistrar; 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.USD; import com.beust.jcommander.ParameterException; @@ -113,7 +113,7 @@ public class DeleteCreditCommandTest extends CommandTestCase runCommandForced("--registrar=FakeRegistrar", "--credit_id=" + creditAId)); assertThat(thrown).hasMessageThat().contains("Registrar FakeRegistrar not found"); @@ -123,7 +123,7 @@ public class DeleteCreditCommandTest extends CommandTestCase runCommandForced("--registrar=TheRegistrar", "--credit_id=" + badId)); assertThat(thrown).hasMessageThat().contains("ID " + badId); @@ -132,14 +132,14 @@ public class DeleteCreditCommandTest extends CommandTestCase runCommandForced("--credit_id=" + creditAId)); + assertThrows(ParameterException.class, () -> runCommandForced("--credit_id=" + creditAId)); assertThat(thrown).hasMessageThat().contains("--registrar"); } @Test public void testFailure_noCreditId() throws Exception { ParameterException thrown = - expectThrows(ParameterException.class, () -> runCommandForced("--registrar=TheRegistrar")); + assertThrows(ParameterException.class, () -> runCommandForced("--registrar=TheRegistrar")); assertThat(thrown).hasMessageThat().contains("--credit_id"); } } diff --git a/javatests/google/registry/tools/DeletePremiumListCommandTest.java b/javatests/google/registry/tools/DeletePremiumListCommandTest.java index cb747fb29..ca402f621 100644 --- a/javatests/google/registry/tools/DeletePremiumListCommandTest.java +++ b/javatests/google/registry/tools/DeletePremiumListCommandTest.java @@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.loadPremiumListEntries; import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistResource; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.model.registry.Registry; import google.registry.model.registry.label.PremiumList; @@ -49,7 +49,7 @@ public class DeletePremiumListCommandTest extends CommandTestCase runCommandForced("--name=foo")); + assertThrows(IllegalArgumentException.class, () -> runCommandForced("--name=foo")); assertThat(thrown) .hasMessageThat() .contains("Cannot delete the premium list foo because it doesn't exist."); @@ -61,7 +61,7 @@ public class DeletePremiumListCommandTest extends CommandTestCase runCommandForced("--name=" + premiumList.getName())); assertThat(PremiumList.get(premiumList.getName())).isPresent(); diff --git a/javatests/google/registry/tools/DeleteReservedListCommandTest.java b/javatests/google/registry/tools/DeleteReservedListCommandTest.java index 00d38c1fa..1005ae245 100644 --- a/javatests/google/registry/tools/DeleteReservedListCommandTest.java +++ b/javatests/google/registry/tools/DeleteReservedListCommandTest.java @@ -19,7 +19,7 @@ import static com.google.common.truth.Truth8.assertThat; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistResource; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import google.registry.model.registry.Registry; import google.registry.model.registry.label.ReservedList; @@ -48,7 +48,7 @@ public class DeleteReservedListCommandTest extends CommandTestCase runCommandForced("--name=doesntExistReservedList")); assertThat(thrown).hasMessageThat().contains(expectedError); @@ -59,7 +59,7 @@ public class DeleteReservedListCommandTest extends CommandTestCase runCommandForced("--name=" + reservedList.getName())); assertThat(ReservedList.get(reservedList.getName())).isPresent(); diff --git a/javatests/google/registry/tools/EppToolCommandTest.java b/javatests/google/registry/tools/EppToolCommandTest.java index 931c7f4eb..1d8162195 100644 --- a/javatests/google/registry/tools/EppToolCommandTest.java +++ b/javatests/google/registry/tools/EppToolCommandTest.java @@ -15,7 +15,7 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; @@ -75,7 +75,7 @@ public class EppToolCommandTest extends EppToolCommandTestCase { @Test public void testFailure_nonexistentClientId() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--client=fakeclient", "fake-xml")); assertThat(thrown).hasMessageThat().contains("fakeclient"); diff --git a/javatests/google/registry/tools/GenerateAllocationTokensCommandTest.java b/javatests/google/registry/tools/GenerateAllocationTokensCommandTest.java index 134a10f76..9ba570e92 100644 --- a/javatests/google/registry/tools/GenerateAllocationTokensCommandTest.java +++ b/javatests/google/registry/tools/GenerateAllocationTokensCommandTest.java @@ -17,7 +17,7 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; import static google.registry.model.ofy.ObjectifyService.ofy; 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.spy; @@ -119,7 +119,7 @@ public class GenerateAllocationTokensCommandTest @Test public void testFailure_mustSpecifyNumberOfTokens() throws Exception { ParameterException thrown = - expectThrows(ParameterException.class, () -> runCommand("--prefix", "FEET")); + assertThrows(ParameterException.class, () -> runCommand("--prefix", "FEET")); assertThat(thrown).hasMessageThat().contains("The following option is required: -n, --number"); } diff --git a/javatests/google/registry/tools/GenerateEscrowDepositCommandTest.java b/javatests/google/registry/tools/GenerateEscrowDepositCommandTest.java index 60c7a8183..13b102aec 100644 --- a/javatests/google/registry/tools/GenerateEscrowDepositCommandTest.java +++ b/javatests/google/registry/tools/GenerateEscrowDepositCommandTest.java @@ -17,7 +17,7 @@ package google.registry.tools; import static com.google.appengine.api.taskqueue.QueueFactory.getQueue; import static com.google.common.truth.Truth.assertThat; 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.assertTasksEnqueued; import static org.mockito.Mockito.when; @@ -54,7 +54,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_missingTld() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommand("--watermark=2017-01-01T00:00:00Z", "--mode=thin", "-r 42", "-o test")); @@ -64,7 +64,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_emptyTld() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommand( @@ -79,7 +79,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_invalidTld() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommand( @@ -94,7 +94,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_missingWatermark() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommand("--tld=tld", "--mode=full", "-r 42", "-o test")); assertThat(thrown) @@ -105,7 +105,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_emptyWatermark() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommand("--tld=tld", "--watermark=", "--mode=full", "-r 42", "-o test")); assertThat(thrown).hasMessageThat().contains("Invalid format: \"\""); @@ -114,7 +114,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_missingOutdir() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommand( @@ -125,7 +125,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_emptyOutdir() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommand( @@ -140,7 +140,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_invalidWatermark() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommand( @@ -155,7 +155,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_invalidMode() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommand( @@ -172,7 +172,7 @@ public class GenerateEscrowDepositCommandTest @Test public void testCommand_invalidRevision() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommand( diff --git a/javatests/google/registry/tools/GetApplicationIdsCommandTest.java b/javatests/google/registry/tools/GetApplicationIdsCommandTest.java index 5b5b18408..d364a0caf 100644 --- a/javatests/google/registry/tools/GetApplicationIdsCommandTest.java +++ b/javatests/google/registry/tools/GetApplicationIdsCommandTest.java @@ -20,7 +20,6 @@ import static google.registry.testing.DatastoreHelper.newDomainApplication; import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.time.DateTimeZone.UTC; import com.beust.jcommander.ParameterException; @@ -64,7 +63,7 @@ public class GetApplicationIdsCommandTest extends CommandTestCase runCommand("example.foo")); + assertThrows(IllegalArgumentException.class, () -> runCommand("example.foo")); assertThat(thrown).hasMessageThat().contains("Domain name is not under a recognized TLD"); } diff --git a/javatests/google/registry/tools/GetLrpTokenCommandTest.java b/javatests/google/registry/tools/GetLrpTokenCommandTest.java index 89d67ff32..f17b3ce66 100644 --- a/javatests/google/registry/tools/GetLrpTokenCommandTest.java +++ b/javatests/google/registry/tools/GetLrpTokenCommandTest.java @@ -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.persistActiveDomainApplication; 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 google.registry.model.domain.DomainApplication; @@ -82,7 +82,7 @@ public class GetLrpTokenCommandTest extends CommandTestCase @Test public void testFailure_noArgs() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, this::runCommand); + assertThrows(IllegalArgumentException.class, this::runCommand); assertThat(thrown) .hasMessageThat() .contains("Exactly one of either token or assignee must be specified."); diff --git a/javatests/google/registry/tools/GetRegistrarCommandTest.java b/javatests/google/registry/tools/GetRegistrarCommandTest.java index 7e26e9259..594b00dc8 100644 --- a/javatests/google/registry/tools/GetRegistrarCommandTest.java +++ b/javatests/google/registry/tools/GetRegistrarCommandTest.java @@ -16,7 +16,6 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.beust.jcommander.ParameterException; import org.junit.Test; @@ -39,7 +38,7 @@ public class GetRegistrarCommandTest extends CommandTestCase runCommand("ClientZ")); + assertThrows(IllegalArgumentException.class, () -> runCommand("ClientZ")); assertThat(thrown).hasMessageThat().contains("Registrar with id ClientZ does not exist"); } @@ -51,7 +50,7 @@ public class GetRegistrarCommandTest extends CommandTestCase runCommand("NewRegistrar", "ClientZ")); + assertThrows(IllegalArgumentException.class, () -> runCommand("NewRegistrar", "ClientZ")); assertThat(thrown).hasMessageThat().contains("Registrar with id ClientZ does not exist"); } } diff --git a/javatests/google/registry/tools/GetResourceByKeyCommandTest.java b/javatests/google/registry/tools/GetResourceByKeyCommandTest.java index 6cba7581c..a1a88adea 100644 --- a/javatests/google/registry/tools/GetResourceByKeyCommandTest.java +++ b/javatests/google/registry/tools/GetResourceByKeyCommandTest.java @@ -23,7 +23,6 @@ import static google.registry.testing.DatastoreHelper.persistDeletedContact; import static google.registry.testing.DatastoreHelper.persistDeletedDomain; import static google.registry.testing.DatastoreHelper.persistDeletedHost; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.time.DateTimeZone.UTC; import com.beust.jcommander.ParameterException; @@ -72,7 +71,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase runCommand( @@ -121,7 +120,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase runCommand( @@ -170,7 +169,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase runCommand( @@ -206,7 +205,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase runCommand("agR0ZXN0chULEgpEb21haW5CYXNlIgUyLVRMRAw")); assertThat(thrown) @@ -217,7 +216,7 @@ public class GetResourceByKeyCommandTest extends CommandTestCase runCommand("agR0ZXN0chULEgpEb21haW5CYXN")); assertThat(thrown).hasMessageThat().contains("Could not parse Reference"); } diff --git a/javatests/google/registry/tools/ListCursorsCommandTest.java b/javatests/google/registry/tools/ListCursorsCommandTest.java index be5320e22..7c0154bbb 100644 --- a/javatests/google/registry/tools/ListCursorsCommandTest.java +++ b/javatests/google/registry/tools/ListCursorsCommandTest.java @@ -17,7 +17,7 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatastoreHelper.createTlds; import static google.registry.testing.DatastoreHelper.persistResource; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.beust.jcommander.ParameterException; import google.registry.model.common.Cursor; @@ -51,7 +51,7 @@ public class ListCursorsCommandTest extends CommandTestCase @Test public void testListCursors_badCursor_throwsIae() throws Exception { ParameterException thrown = - expectThrows(ParameterException.class, () -> runCommand("--type=love")); + assertThrows(ParameterException.class, () -> runCommand("--type=love")); assertThat(thrown).hasMessageThat().contains("Invalid value for --type parameter."); } diff --git a/javatests/google/registry/tools/ListDomainsCommandTest.java b/javatests/google/registry/tools/ListDomainsCommandTest.java index a63ddcd7f..91c66848e 100644 --- a/javatests/google/registry/tools/ListDomainsCommandTest.java +++ b/javatests/google/registry/tools/ListDomainsCommandTest.java @@ -15,7 +15,7 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; @@ -47,7 +47,7 @@ public class ListDomainsCommandTest extends ListObjectsCommandTestCase runCommand(tldsParam)); + assertThrows(IllegalArgumentException.class, () -> runCommand(tldsParam)); assertThat(thrown) .hasMessageThat() .contains("Total length of TLDs is too long for URL parameter"); diff --git a/javatests/google/registry/tools/LockDomainCommandTest.java b/javatests/google/registry/tools/LockDomainCommandTest.java index 7e556995a..53c614939 100644 --- a/javatests/google/registry/tools/LockDomainCommandTest.java +++ b/javatests/google/registry/tools/LockDomainCommandTest.java @@ -19,7 +19,7 @@ import static google.registry.model.eppcommon.StatusValue.SERVER_TRANSFER_PROHIB import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.persistActiveDomain; 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.tools.LockOrUnlockDomainCommand.REGISTRY_LOCK_STATUSES; import com.google.common.collect.ImmutableList; @@ -75,7 +75,7 @@ public class LockDomainCommandTest extends EppToolCommandTestCase runCommandForced("--client=NewRegistrar", "missing.tld")); assertThat(e).hasMessageThat().isEqualTo("Domain 'missing.tld' does not exist"); @@ -94,7 +94,7 @@ public class LockDomainCommandTest extends EppToolCommandTestCase runCommandForced("--client=NewRegistrar", "dupe.tld", "dupe.tld")); assertThat(e).hasMessageThat().isEqualTo("Duplicate domain arguments found: 'dupe.tld'"); diff --git a/javatests/google/registry/tools/MutatingCommandTest.java b/javatests/google/registry/tools/MutatingCommandTest.java index d46c9071a..efb84d990 100644 --- a/javatests/google/registry/tools/MutatingCommandTest.java +++ b/javatests/google/registry/tools/MutatingCommandTest.java @@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistNewRegistrar; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.time.DateTimeZone.UTC; import google.registry.model.host.HostResource; @@ -273,7 +272,7 @@ public class MutatingCommandTest { + "Update Registrar@Registrar2\n" + "blockPremiumNames: false -> true\n"); - IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute); + IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute); assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called."); assertThat(ofy().load().entity(host1).now()).isNull(); assertThat(ofy().load().entity(host2).now()).isEqualTo(newHost2); @@ -304,7 +303,7 @@ public class MutatingCommandTest { host1, host1.asBuilder().setLastEppUpdateTime(DateTime.now(UTC)).build()); } }; - IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, command::init); + IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::init); assertThat(thrown) .hasMessageThat() .contains("Cannot apply multiple changes for the same entity"); @@ -318,7 +317,7 @@ public class MutatingCommandTest { stageEntityChange(host1, host2); } }; - IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, command::init); + IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::init); assertThat(thrown) .hasMessageThat() .contains("Both entity versions in an update must have the same Key."); @@ -333,7 +332,7 @@ public class MutatingCommandTest { stageEntityChange(registrar1, registrar2); } }; - IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, command::init); + IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::init); assertThat(thrown) .hasMessageThat() .contains("Both entity versions in an update must have the same Key."); @@ -348,7 +347,7 @@ public class MutatingCommandTest { stageEntityChange(host1, registrar1); } }; - IllegalArgumentException thrown = expectThrows(IllegalArgumentException.class, command::init); + IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, command::init); assertThat(thrown) .hasMessageThat() .contains("Both entity versions in an update must have the same Key."); @@ -365,7 +364,7 @@ public class MutatingCommandTest { }; command.init(); persistResource(newHost1); - IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute); + IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute); assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called."); } @@ -380,7 +379,7 @@ public class MutatingCommandTest { }; command.init(); persistResource(newHost1); - IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute); + IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute); assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called."); } @@ -395,7 +394,7 @@ public class MutatingCommandTest { }; command.init(); persistResource(newHost1); - IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute); + IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute); assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called."); } @@ -410,7 +409,7 @@ public class MutatingCommandTest { }; command.init(); deleteResource(host1); - IllegalStateException thrown = expectThrows(IllegalStateException.class, command::execute); + IllegalStateException thrown = assertThrows(IllegalStateException.class, command::execute); assertThat(thrown).hasMessageThat().contains("Entity changed since init() was called."); } } diff --git a/javatests/google/registry/tools/RegistrarContactCommandTest.java b/javatests/google/registry/tools/RegistrarContactCommandTest.java index 056d38bbf..9eb4846d5 100644 --- a/javatests/google/registry/tools/RegistrarContactCommandTest.java +++ b/javatests/google/registry/tools/RegistrarContactCommandTest.java @@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistSimpleResource; import static google.registry.testing.DatastoreHelper.persistSimpleResources; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.collect.ImmutableList; @@ -193,7 +193,7 @@ public class RegistrarContactCommandTest extends CommandTestCase runCommandForced( @@ -326,7 +326,7 @@ public class RegistrarContactCommandTest extends CommandTestCase runCommandForced( diff --git a/javatests/google/registry/tools/SetupOteCommandTest.java b/javatests/google/registry/tools/SetupOteCommandTest.java index 83f5630ae..efc1f13eb 100644 --- a/javatests/google/registry/tools/SetupOteCommandTest.java +++ b/javatests/google/registry/tools/SetupOteCommandTest.java @@ -22,7 +22,7 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.persistPremiumList; 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.DateTimeZone.UTC; import com.beust.jcommander.ParameterException; @@ -205,7 +205,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_missingIpWhitelist() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -218,7 +218,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_missingRegistrar() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -231,7 +231,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_missingCertificateFile() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -242,7 +242,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_missingDnsWriter() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -255,7 +255,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_invalidCert() throws Exception { CertificateParsingException thrown = - expectThrows( + assertThrows( CertificateParsingException.class, () -> runCommandForced( @@ -269,7 +269,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_invalidRegistrar() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -283,7 +283,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_invalidDnsWriter() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -299,7 +299,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_registrarTooShort() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -313,7 +313,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_registrarTooLong() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -327,7 +327,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_registrarInvalidCharacter() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -341,7 +341,7 @@ public class SetupOteCommandTest extends CommandTestCase { @Test public void testFailure_invalidPremiumList() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -357,7 +357,7 @@ public class SetupOteCommandTest extends CommandTestCase { public void testFailure_tldExists() throws Exception { createTld("blobio-sunrise"); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> runCommandForced( @@ -376,7 +376,7 @@ public class SetupOteCommandTest extends CommandTestCase { .build(); persistResource(registrar); IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> runCommandForced( diff --git a/javatests/google/registry/tools/UniformRapidSuspensionCommandTest.java b/javatests/google/registry/tools/UniformRapidSuspensionCommandTest.java index c3c649872..5d5f56160 100644 --- a/javatests/google/registry/tools/UniformRapidSuspensionCommandTest.java +++ b/javatests/google/registry/tools/UniformRapidSuspensionCommandTest.java @@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistResource; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.beust.jcommander.ParameterException; import com.google.common.collect.ImmutableSet; @@ -153,7 +153,7 @@ public class UniformRapidSuspensionCommandTest public void testFailure_locksToPreserveWithoutUndo() throws Exception { persistActiveDomain("evil.tld"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -165,7 +165,7 @@ public class UniformRapidSuspensionCommandTest public void testFailure_domainNameRequired() throws Exception { persistActiveDomain("evil.tld"); ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced("--hosts=urs1.example.com,urs2.example.com")); assertThat(thrown).hasMessageThat().contains("--domain_name"); @@ -175,7 +175,7 @@ public class UniformRapidSuspensionCommandTest public void testFailure_extraFieldInDsData() throws Exception { persistActiveDomain("evil.tld"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -188,7 +188,7 @@ public class UniformRapidSuspensionCommandTest public void testFailure_missingFieldInDsData() throws Exception { persistActiveDomain("evil.tld"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -201,7 +201,7 @@ public class UniformRapidSuspensionCommandTest public void testFailure_malformedDsData() throws Exception { persistActiveDomain("evil.tld"); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--domain_name=evil.tld", "--dsdata=[1,2,3]")); assertThat(thrown).hasMessageThat().contains("Invalid --dsdata JSON"); diff --git a/javatests/google/registry/tools/UnlockDomainCommandTest.java b/javatests/google/registry/tools/UnlockDomainCommandTest.java index f1e8cb43d..b52a2673d 100644 --- a/javatests/google/registry/tools/UnlockDomainCommandTest.java +++ b/javatests/google/registry/tools/UnlockDomainCommandTest.java @@ -21,7 +21,7 @@ import static google.registry.model.eppcommon.StatusValue.SERVER_UPDATE_PROHIBIT import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.persistActiveDomain; 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.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -87,7 +87,7 @@ public class UnlockDomainCommandTest extends EppToolCommandTestCase runCommandForced("--client=NewRegistrar", "missing.tld")); assertThat(e).hasMessageThat().isEqualTo("Domain 'missing.tld' does not exist"); @@ -102,7 +102,7 @@ public class UnlockDomainCommandTest extends EppToolCommandTestCase runCommandForced("--client=NewRegistrar", "dupe.tld", "dupe.tld")); assertThat(e).hasMessageThat().isEqualTo("Duplicate domain arguments found: 'dupe.tld'"); diff --git a/javatests/google/registry/tools/UpdateApplicationStatusCommandTest.java b/javatests/google/registry/tools/UpdateApplicationStatusCommandTest.java index 6b3d460e5..32eba7f81 100644 --- a/javatests/google/registry/tools/UpdateApplicationStatusCommandTest.java +++ b/javatests/google/registry/tools/UpdateApplicationStatusCommandTest.java @@ -28,7 +28,6 @@ import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainApplicationSubject.assertAboutApplications; import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.time.DateTimeZone.UTC; import google.registry.model.domain.DomainApplication; @@ -256,7 +255,7 @@ public class UpdateApplicationStatusCommandTest .build()); IllegalStateException e = - expectThrows( + assertThrows( IllegalStateException.class, () -> runCommandForced( @@ -281,7 +280,7 @@ public class UpdateApplicationStatusCommandTest @Test public void testFailure_historyClientIdDoesNotExist() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( diff --git a/javatests/google/registry/tools/UpdateClaimsNoticeCommandTest.java b/javatests/google/registry/tools/UpdateClaimsNoticeCommandTest.java index 0e44c1765..d86a09875 100644 --- a/javatests/google/registry/tools/UpdateClaimsNoticeCommandTest.java +++ b/javatests/google/registry/tools/UpdateClaimsNoticeCommandTest.java @@ -21,7 +21,6 @@ import static google.registry.testing.DatastoreHelper.newDomainApplication; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainApplicationSubject.assertAboutApplications; 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.START_OF_TIME; import static org.joda.time.DateTimeZone.UTC; @@ -146,7 +145,7 @@ public class UpdateClaimsNoticeCommandTest extends CommandTestCase runCommand( diff --git a/javatests/google/registry/tools/UpdateCursorsCommandTest.java b/javatests/google/registry/tools/UpdateCursorsCommandTest.java index 7f2ea047d..0aeaf1c46 100644 --- a/javatests/google/registry/tools/UpdateCursorsCommandTest.java +++ b/javatests/google/registry/tools/UpdateCursorsCommandTest.java @@ -19,7 +19,6 @@ import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.beust.jcommander.ParameterException; import google.registry.model.common.Cursor; @@ -120,7 +119,7 @@ public class UpdateCursorsCommandTest extends CommandTestCase runCommandForced("--type=rbda", "--timestamp=1984-12-18T00:00:00Z", "foo")); assertThat(thrown).hasMessageThat().contains("Invalid value for --type parameter"); diff --git a/javatests/google/registry/tools/UpdateDomainCommandTest.java b/javatests/google/registry/tools/UpdateDomainCommandTest.java index 2c9fcdaf6..587cdb61b 100644 --- a/javatests/google/registry/tools/UpdateDomainCommandTest.java +++ b/javatests/google/registry/tools/UpdateDomainCommandTest.java @@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.newContactResource; import static google.registry.testing.DatastoreHelper.newDomainResource; import static google.registry.testing.DatastoreHelper.persistActiveHost; import static google.registry.testing.DatastoreHelper.persistResource; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.beust.jcommander.ParameterException; import com.google.common.collect.ImmutableSet; @@ -209,7 +209,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -225,7 +225,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -240,7 +240,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -251,7 +251,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced("--registrant=crr-admin", "--password=2fooBAR", "example.tld")); assertThat(thrown).hasMessageThat().contains("--client"); @@ -260,7 +260,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -279,7 +279,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -297,7 +297,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -315,7 +315,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -333,7 +333,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -351,7 +351,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -368,7 +368,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -385,7 +385,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -403,7 +403,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -421,7 +421,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -439,7 +439,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -457,7 +457,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( @@ -475,7 +475,7 @@ public class UpdateDomainCommandTest extends EppToolCommandTestCase runCommandForced( diff --git a/javatests/google/registry/tools/UpdateRegistrarCommandTest.java b/javatests/google/registry/tools/UpdateRegistrarCommandTest.java index 7eccae86d..fe0f1f162 100644 --- a/javatests/google/registry/tools/UpdateRegistrarCommandTest.java +++ b/javatests/google/registry/tools/UpdateRegistrarCommandTest.java @@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.createTlds; import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.time.DateTimeZone.UTC; import com.beust.jcommander.ParameterException; @@ -73,7 +72,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase runCommand("--registrar_type=REAL", "--iana_id=1000", "--force", "NewRegistrar")); assertThat(thrown).hasMessageThat().contains("--passcode is required for REAL registrars."); @@ -222,7 +221,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase runCommand( @@ -284,7 +283,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase runCommand("--billing_method=braintree", "--force", "NewRegistrar")); assertThat(thrown) @@ -723,7 +722,7 @@ public class UpdateRegistrarCommandTest extends CommandTestCase runCommand("--force", "ClientZ")); + assertThrows(IllegalArgumentException.class, () -> runCommand("--force", "ClientZ")); assertThat(thrown).hasMessageThat().contains("Registrar ClientZ not found"); } diff --git a/javatests/google/registry/tools/UpdateReservedListCommandTest.java b/javatests/google/registry/tools/UpdateReservedListCommandTest.java index 961895b29..1fbb27eec 100644 --- a/javatests/google/registry/tools/UpdateReservedListCommandTest.java +++ b/javatests/google/registry/tools/UpdateReservedListCommandTest.java @@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; import static google.registry.model.registry.label.ReservationType.FULLY_BLOCKED; 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 com.google.common.collect.ImmutableList; @@ -94,7 +94,7 @@ public class UpdateReservedListCommandTest extends String errorMessage = "Could not update reserved list xn--q9jyb4c_poobah because it doesn't exist."; IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommand("--force", "--name=xn--q9jyb4c_poobah", "--input=" + reservedTermsPath)); diff --git a/javatests/google/registry/tools/UpdateSmdCommandTest.java b/javatests/google/registry/tools/UpdateSmdCommandTest.java index 2e02ea85d..014a9dff0 100644 --- a/javatests/google/registry/tools/UpdateSmdCommandTest.java +++ b/javatests/google/registry/tools/UpdateSmdCommandTest.java @@ -23,7 +23,6 @@ import static google.registry.testing.DatastoreHelper.newDomainApplication; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DomainApplicationSubject.assertAboutApplications; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static google.registry.util.ResourceUtils.readResourceUtf8; import static java.nio.charset.StandardCharsets.UTF_8; @@ -116,7 +115,7 @@ public class UpdateSmdCommandTest extends CommandTestCase { public void testFailure_invalidSmd() throws Exception { String smdFile = writeToTmpFile(INVALID_SMD); Exception e = - expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); + assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); assertThat(e).hasCauseThat().isInstanceOf(ParameterValuePolicyErrorException.class); } @@ -127,7 +126,7 @@ public class UpdateSmdCommandTest extends CommandTestCase { SignedMarkRevocationList.create(now, ImmutableMap.of(ACTIVE_SMD_ID, now)).save(); String smdFile = writeToTmpFile(ACTIVE_SMD); Exception e = - expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); + assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); assertThat(e).hasCauseThat().isInstanceOf(ParameterValuePolicyErrorException.class); } @@ -135,7 +134,7 @@ public class UpdateSmdCommandTest extends CommandTestCase { public void testFailure_revokedTmv() throws Exception { String smdFile = writeToTmpFile(REVOKED_TMV_SMD); Exception e = - expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); + assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); assertThat(e).hasCauseThat().isInstanceOf(ParameterValuePolicyErrorException.class); } @@ -143,7 +142,7 @@ public class UpdateSmdCommandTest extends CommandTestCase { public void testFailure_unparseableXml() throws Exception { String smdFile = writeToTmpFile(base64().encode("This is not XML!".getBytes(UTF_8))); Exception e = - expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); + assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); assertThat(e).hasCauseThat().isInstanceOf(ParameterValueSyntaxErrorException.class); } @@ -151,7 +150,7 @@ public class UpdateSmdCommandTest extends CommandTestCase { public void testFailure_badlyEncodedData() throws Exception { String smdFile = writeToTmpFile("Bad base64 data ~!@#$#@%%$#^$%^&^**&^)(*)(_".getBytes(UTF_8)); Exception e = - expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); + assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); assertThat(e).hasCauseThat().isInstanceOf(ParameterValueSyntaxErrorException.class); } @@ -159,7 +158,7 @@ public class UpdateSmdCommandTest extends CommandTestCase { public void testFailure_wrongLabel() throws Exception { String smdFile = writeToTmpFile(DIFFERENT_LABEL_SMD); Exception e = - expectThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); + assertThrows(Exception.class, () -> runCommand("--id=2-Q9JYB4C", "--smd=" + smdFile)); assertThat(e).hasCauseThat().isInstanceOf(RequiredParameterMissingException.class); } diff --git a/javatests/google/registry/tools/UpdateTldCommandTest.java b/javatests/google/registry/tools/UpdateTldCommandTest.java index 405a317a0..66257c020 100644 --- a/javatests/google/registry/tools/UpdateTldCommandTest.java +++ b/javatests/google/registry/tools/UpdateTldCommandTest.java @@ -20,7 +20,7 @@ import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.persistPremiumList; import static google.registry.testing.DatastoreHelper.persistReservedList; import static google.registry.testing.DatastoreHelper.persistResource; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME; import static org.joda.money.CurrencyUnit.JPY; @@ -465,7 +465,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidAddGracePeriod() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--add_grace_period=5m", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("Invalid format: \"5m\""); @@ -474,7 +474,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidRedemptionGracePeriod() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--redemption_grace_period=5m", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("Invalid format: \"5m\""); @@ -483,7 +483,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidPendingDeleteLength() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--pending_delete_length=5m", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("Invalid format: \"5m\""); @@ -492,7 +492,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidTldState() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -505,7 +505,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidTldStateTransitionTime() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced("--tld_state_transitions=tomorrow=INVALID_STATE", "xn--q9jyb4c")); @@ -517,7 +517,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_tldStatesOutOfOrder() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -531,7 +531,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_duplicateTldStateTransitions() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -544,7 +544,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_duplicateTldStateTransitionTimes() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -558,7 +558,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_outOfOrderTldStateTransitionTimes() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -574,7 +574,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_bothTldStateFlags() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -598,7 +598,7 @@ public class UpdateTldCommandTest extends CommandTestCase { now.minusMonths(1), TldState.GENERAL_AVAILABILITY)) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--set_current_tld_state=SUNRISE", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("The TLD states are chronologically out of order"); @@ -614,7 +614,7 @@ public class UpdateTldCommandTest extends CommandTestCase { now.plusMonths(1), TldState.GENERAL_AVAILABILITY)) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--set_current_tld_state=SUNRISE", "xn--q9jyb4c")); assertThat(thrown) @@ -632,7 +632,7 @@ public class UpdateTldCommandTest extends CommandTestCase { now.minusMonths(1), TldState.GENERAL_AVAILABILITY)) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandInEnvironment( @@ -648,7 +648,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidRenewBillingCost() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -662,7 +662,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_negativeRenewBillingCost() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -674,7 +674,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_invalidRenewCostTransitionTime() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced("--renew_billing_cost_transitions=tomorrow=USD 1", "xn--q9jyb4c")); @@ -686,7 +686,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_duplicateRenewCostTransitionTimes() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -701,7 +701,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_outOfOrderRenewCostTransitionTimes() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -716,7 +716,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_noTldName() throws Exception { - ParameterException thrown = expectThrows(ParameterException.class, this::runCommandForced); + ParameterException thrown = assertThrows(ParameterException.class, this::runCommandForced); assertThat(thrown) .hasMessageThat() .contains("Main parameters are required (\"Names of the TLDs\")"); @@ -725,14 +725,14 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_oneTldDoesNotExist() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> runCommandForced("foo", "xn--q9jyb4c")); + assertThrows(IllegalArgumentException.class, () -> runCommandForced("foo", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("TLD foo does not exist"); } @Test public void testFailure_duplicateArguments() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("xn--q9jyb4c", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("Duplicate arguments found: 'xn--q9jyb4c'"); } @@ -740,14 +740,14 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_tldDoesNotExist() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> runCommandForced("foobarbaz")); + assertThrows(IllegalArgumentException.class, () -> runCommandForced("foobarbaz")); assertThat(thrown).hasMessageThat().contains("TLD foobarbaz does not exist"); } @Test public void testFailure_specifiedDnsWriter_doesntExist() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("xn--q9jyb4c", "--dns_writers=InvalidDnsWriter")); assertThat(thrown) @@ -758,7 +758,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_setNonExistentReservedLists() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--reserved_lists", "xn--q9jyb4c_ZZZ", "xn--q9jyb4c")); assertThat(thrown) @@ -772,7 +772,7 @@ public class UpdateTldCommandTest extends CommandTestCase { .setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2")) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--add_reserved_lists=xn--q9jyb4c_r1", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("xn--q9jyb4c_r1"); @@ -784,7 +784,7 @@ public class UpdateTldCommandTest extends CommandTestCase { .setReservedListsByName(ImmutableSet.of("xn--q9jyb4c_r1", "xn--q9jyb4c_r2")) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--remove_reserved_lists=xn--q9jyb4c_Z", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("xn--q9jyb4c_Z"); @@ -793,7 +793,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_cantAddAndRemoveSameReservedListSimultaneously() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -810,7 +810,7 @@ public class UpdateTldCommandTest extends CommandTestCase { .setAllowedRegistrantContactIds(ImmutableSet.of("alice", "bob")) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--add_allowed_registrants=alice", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("alice"); @@ -823,7 +823,7 @@ public class UpdateTldCommandTest extends CommandTestCase { .setAllowedRegistrantContactIds(ImmutableSet.of("alice")) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--remove_allowed_registrants=bob", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("bob"); @@ -832,7 +832,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_cantAddAndRemoveSameAllowedRegistrantsSimultaneously() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -850,7 +850,7 @@ public class UpdateTldCommandTest extends CommandTestCase { ImmutableSet.of("ns1.example.com", "ns2.example.com")) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--add_allowed_nameservers=ns1.example.com", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("ns1.example.com"); @@ -864,7 +864,7 @@ public class UpdateTldCommandTest extends CommandTestCase { ImmutableSet.of("ns1.example.com")) .build()); IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--remove_allowed_nameservers=ns2.example.com", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("ns2.example.com"); @@ -873,7 +873,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_cantAddAndRemoveSameAllowedNameserversSimultaneously() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced( @@ -1002,7 +1002,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_setPremiumListThatDoesntExist() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> runCommandForced("--premium_list=phonies", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("The premium list 'phonies' doesn't exist"); @@ -1019,7 +1019,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_updateLrpPeriod_backwardsInterval() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced( @@ -1033,7 +1033,7 @@ public class UpdateTldCommandTest extends CommandTestCase { @Test public void testFailure_updateLrpPeriod_badInterval() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> runCommandForced("--lrp_period=foobar", "xn--q9jyb4c")); assertThat(thrown).hasMessageThat().contains("--lrp_period=foobar not an ISO-8601 interval"); } @@ -1053,7 +1053,7 @@ public class UpdateTldCommandTest extends CommandTestCase { String reservedLists, Class errorClass, String errorMsg) throws Exception { Exception e = - expectThrows( + assertThrows( errorClass, () -> runCommandForced("--reserved_lists", reservedLists, "xn--q9jyb4c")); assertThat(e).hasMessageThat().isEqualTo(errorMsg); } diff --git a/javatests/google/registry/tools/ValidateEscrowDepositCommandTest.java b/javatests/google/registry/tools/ValidateEscrowDepositCommandTest.java index f1acbbc54..295157506 100644 --- a/javatests/google/registry/tools/ValidateEscrowDepositCommandTest.java +++ b/javatests/google/registry/tools/ValidateEscrowDepositCommandTest.java @@ -15,7 +15,7 @@ package google.registry.tools; 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.rde.RdeTestData; import google.registry.xml.XmlException; @@ -102,7 +102,7 @@ public class ValidateEscrowDepositCommandTest @Test public void testRun_badXml() throws Exception { String file = writeToTmpFile(RdeTestData.loadFile("deposit_full.xml").substring(0, 2000)); - XmlException thrown = expectThrows(XmlException.class, () -> runCommand("--input=" + file)); + XmlException thrown = assertThrows(XmlException.class, () -> runCommand("--input=" + file)); assertThat(thrown) .hasMessageThat() .contains( diff --git a/javatests/google/registry/tools/ValidateLoginCredentialsCommandTest.java b/javatests/google/registry/tools/ValidateLoginCredentialsCommandTest.java index 6a4bc9a12..3119da453 100644 --- a/javatests/google/registry/tools/ValidateLoginCredentialsCommandTest.java +++ b/javatests/google/registry/tools/ValidateLoginCredentialsCommandTest.java @@ -20,7 +20,6 @@ import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.beust.jcommander.ParameterException; import com.google.common.collect.ImmutableList; @@ -66,7 +65,7 @@ public class ValidateLoginCredentialsCommandTest @Test public void testFailure_loginWithBadPassword() throws Exception { EppException thrown = - expectThrows( + assertThrows( BadRegistrarPasswordException.class, () -> runCommand( @@ -80,7 +79,7 @@ public class ValidateLoginCredentialsCommandTest @Test public void testFailure_loginWithBadCertificateHash() throws Exception { EppException thrown = - expectThrows( + assertThrows( EppException.class, () -> runCommand( @@ -94,7 +93,7 @@ public class ValidateLoginCredentialsCommandTest @Test public void testFailure_loginWithBadIp() throws Exception { EppException thrown = - expectThrows( + assertThrows( EppException.class, () -> runCommand( diff --git a/javatests/google/registry/tools/VerifyOteCommandTest.java b/javatests/google/registry/tools/VerifyOteCommandTest.java index 0fafe7f64..2d16b3468 100644 --- a/javatests/google/registry/tools/VerifyOteCommandTest.java +++ b/javatests/google/registry/tools/VerifyOteCommandTest.java @@ -17,7 +17,7 @@ package google.registry.tools; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.DatastoreHelper.loadRegistrar; 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.anyMapOf; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; @@ -68,14 +68,14 @@ public class VerifyOteCommandTest extends CommandTestCase { @Test public void testFailure_registrarDoesntExist() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> runCommand("blobio")); + assertThrows(IllegalArgumentException.class, () -> runCommand("blobio")); assertThat(thrown).hasMessageThat().contains("Registrar blobio does not exist."); } @Test public void testFailure_noRegistrarsNoCheckAll() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> runCommand("")); + assertThrows(IllegalArgumentException.class, () -> runCommand("")); assertThat(thrown) .hasMessageThat() .contains("Must provide at least one registrar name, or supply --check-all with no names."); diff --git a/javatests/google/registry/tools/params/DateTimeParameterTest.java b/javatests/google/registry/tools/params/DateTimeParameterTest.java index 83b31510d..1a68356e7 100644 --- a/javatests/google/registry/tools/params/DateTimeParameterTest.java +++ b/javatests/google/registry/tools/params/DateTimeParameterTest.java @@ -16,7 +16,6 @@ package google.registry.tools.params; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.joda.time.DateTimeZone.UTC; import com.beust.jcommander.ParameterException; @@ -107,7 +106,7 @@ public class DateTimeParameterTest { @Test public void testValidate_sillyString_throwsParameterException() throws Exception { ParameterException thrown = - expectThrows(ParameterException.class, () -> instance.validate("--time", "foo")); + assertThrows(ParameterException.class, () -> instance.validate("--time", "foo")); assertThat(thrown).hasMessageThat().contains("--time=foo not an ISO"); } diff --git a/javatests/google/registry/tools/params/DurationParameterTest.java b/javatests/google/registry/tools/params/DurationParameterTest.java index 0902e94ae..b3c7651f5 100644 --- a/javatests/google/registry/tools/params/DurationParameterTest.java +++ b/javatests/google/registry/tools/params/DurationParameterTest.java @@ -16,7 +16,6 @@ package google.registry.tools.params; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.beust.jcommander.ParameterException; import org.joda.time.Duration; @@ -83,7 +82,7 @@ public class DurationParameterTest { @Test public void testValidate_sillyString_throws() throws Exception { ParameterException thrown = - expectThrows(ParameterException.class, () -> instance.validate("--time", "foo")); + assertThrows(ParameterException.class, () -> instance.validate("--time", "foo")); assertThat(thrown).hasMessageThat().contains("--time=foo not an"); } } diff --git a/javatests/google/registry/tools/params/EnumParameterTest.java b/javatests/google/registry/tools/params/EnumParameterTest.java index 91858e196..6eb5f806f 100644 --- a/javatests/google/registry/tools/params/EnumParameterTest.java +++ b/javatests/google/registry/tools/params/EnumParameterTest.java @@ -15,7 +15,7 @@ package google.registry.tools.params; 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.model.registry.Registry.TldState; import org.junit.Test; @@ -38,7 +38,7 @@ public class EnumParameterTest { @Test public void testFailure_badValue() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> instance.convert("GENERAL_SUNRUSH")); + assertThrows(IllegalArgumentException.class, () -> instance.convert("GENERAL_SUNRUSH")); assertThat(thrown) .hasMessageThat() .contains( diff --git a/javatests/google/registry/tools/params/IntervalParameterTest.java b/javatests/google/registry/tools/params/IntervalParameterTest.java index abf8263aa..41a6f9d29 100644 --- a/javatests/google/registry/tools/params/IntervalParameterTest.java +++ b/javatests/google/registry/tools/params/IntervalParameterTest.java @@ -16,7 +16,6 @@ package google.registry.tools.params; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.beust.jcommander.ParameterException; import org.joda.time.DateTime; @@ -68,7 +67,7 @@ public class IntervalParameterTest { @Test public void testValidate_sillyString_throws() throws Exception { ParameterException thrown = - expectThrows(ParameterException.class, () -> instance.validate("--time", "foo")); + assertThrows(ParameterException.class, () -> instance.validate("--time", "foo")); assertThat(thrown).hasMessageThat().contains("--time=foo not an"); } } diff --git a/javatests/google/registry/tools/params/KeyValueMapParameterTest.java b/javatests/google/registry/tools/params/KeyValueMapParameterTest.java index 470427e2e..d5b8d766f 100644 --- a/javatests/google/registry/tools/params/KeyValueMapParameterTest.java +++ b/javatests/google/registry/tools/params/KeyValueMapParameterTest.java @@ -16,7 +16,6 @@ package google.registry.tools.params; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.google.common.collect.ImmutableMap; import google.registry.tools.params.KeyValueMapParameter.CurrencyUnitToStringMap; @@ -95,7 +94,7 @@ public class KeyValueMapParameterTest { @Test public void testFailure_convertCurrencyUnitToString_badType() throws Exception { IllegalCurrencyException thrown = - expectThrows( + assertThrows( IllegalCurrencyException.class, () -> currencyUnitToStringMap.convert("USD=123abc,XYZ=xyz789")); assertThat(thrown).hasMessageThat().contains("XYZ"); diff --git a/javatests/google/registry/tools/params/MoneyParameterTest.java b/javatests/google/registry/tools/params/MoneyParameterTest.java index f84829358..b1e04e709 100644 --- a/javatests/google/registry/tools/params/MoneyParameterTest.java +++ b/javatests/google/registry/tools/params/MoneyParameterTest.java @@ -16,7 +16,6 @@ package google.registry.tools.params; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.beust.jcommander.ParameterException; import org.joda.money.Money; @@ -72,7 +71,7 @@ public class MoneyParameterTest { @Test public void testValidate_sillyString_throws() throws Exception { ParameterException thrown = - expectThrows(ParameterException.class, () -> instance.validate("--money", "foo")); + assertThrows(ParameterException.class, () -> instance.validate("--money", "foo")); assertThat(thrown).hasMessageThat().contains("--money=foo not valid"); } diff --git a/javatests/google/registry/tools/params/PathParameterTest.java b/javatests/google/registry/tools/params/PathParameterTest.java index 71cb5956a..92f7ec5ab 100644 --- a/javatests/google/registry/tools/params/PathParameterTest.java +++ b/javatests/google/registry/tools/params/PathParameterTest.java @@ -16,7 +16,6 @@ package google.registry.tools.params; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; @@ -96,7 +95,7 @@ public class PathParameterTest { @Test public void testInputFileValidate_missingFile_throws() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> inputFile.validate("input", new File(folder.getRoot(), "foo").toString())); assertThat(thrown).hasMessageThat().contains("not found"); @@ -105,7 +104,7 @@ public class PathParameterTest { @Test public void testInputFileValidate_directory_throws() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> inputFile.validate("input", folder.getRoot().toString())); assertThat(thrown).hasMessageThat().contains("is a directory"); @@ -116,7 +115,7 @@ public class PathParameterTest { Path file = Paths.get(folder.newFile().toString()); Files.setPosixFilePermissions(file, PosixFilePermissions.fromString("-w-------")); ParameterException thrown = - expectThrows(ParameterException.class, () -> inputFile.validate("input", file.toString())); + assertThrows(ParameterException.class, () -> inputFile.validate("input", file.toString())); assertThat(thrown).hasMessageThat().contains("not readable"); } @@ -143,7 +142,7 @@ public class PathParameterTest { @Test public void testOutputFileValidate_directory_throws() throws Exception { ParameterException thrown = - expectThrows( + assertThrows( ParameterException.class, () -> outputFile.validate("input", folder.getRoot().toString())); assertThat(thrown).hasMessageThat().contains("is a directory"); @@ -154,7 +153,7 @@ public class PathParameterTest { Path file = Paths.get(folder.newFile().toString()); Files.setPosixFilePermissions(file, PosixFilePermissions.fromString("r--------")); ParameterException thrown = - expectThrows(ParameterException.class, () -> outputFile.validate("input", file.toString())); + assertThrows(ParameterException.class, () -> outputFile.validate("input", file.toString())); assertThat(thrown).hasMessageThat().contains("not writable"); } @@ -162,7 +161,7 @@ public class PathParameterTest { public void testOutputFileValidate_parentDirMissing_throws() throws Exception { Path file = Paths.get(folder.getRoot().toString(), "MISSINGNO", "foo.txt"); ParameterException thrown = - expectThrows(ParameterException.class, () -> outputFile.validate("input", file.toString())); + assertThrows(ParameterException.class, () -> outputFile.validate("input", file.toString())); assertThat(thrown).hasMessageThat().contains("parent dir doesn't exist"); } @@ -170,7 +169,7 @@ public class PathParameterTest { public void testOutputFileValidate_parentDirIsFile_throws() throws Exception { Path file = Paths.get(folder.newFile().toString(), "foo.txt"); ParameterException thrown = - expectThrows(ParameterException.class, () -> outputFile.validate("input", file.toString())); + assertThrows(ParameterException.class, () -> outputFile.validate("input", file.toString())); assertThat(thrown).hasMessageThat().contains("parent is non-directory"); } } diff --git a/javatests/google/registry/tools/params/YearMonthParameterTest.java b/javatests/google/registry/tools/params/YearMonthParameterTest.java index dc298dcad..8c515166c 100644 --- a/javatests/google/registry/tools/params/YearMonthParameterTest.java +++ b/javatests/google/registry/tools/params/YearMonthParameterTest.java @@ -16,7 +16,6 @@ package google.registry.tools.params; import static com.google.common.truth.Truth.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import com.beust.jcommander.ParameterException; import org.joda.time.YearMonth; @@ -62,7 +61,7 @@ public class YearMonthParameterTest { @Test public void testValidate_sillyString_throwsParameterException() throws Exception { ParameterException thrown = - expectThrows(ParameterException.class, () -> instance.validate("--time", "foo")); + assertThrows(ParameterException.class, () -> instance.validate("--time", "foo")); assertThat(thrown).hasMessageThat().contains("--time=foo not a valid"); } diff --git a/javatests/google/registry/tools/server/CreateGroupsActionTest.java b/javatests/google/registry/tools/server/CreateGroupsActionTest.java index 64ce15968..8cbbd9173 100644 --- a/javatests/google/registry/tools/server/CreateGroupsActionTest.java +++ b/javatests/google/registry/tools/server/CreateGroupsActionTest.java @@ -15,7 +15,7 @@ package google.registry.tools.server; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static javax.servlet.http.HttpServletResponse.SC_OK; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; @@ -62,7 +62,7 @@ public class CreateGroupsActionTest { @Test public void test_invalidRequest_missingClientId() throws Exception { - BadRequestException thrown = expectThrows(BadRequestException.class, () -> runAction(null)); + BadRequestException thrown = assertThrows(BadRequestException.class, () -> runAction(null)); assertThat(thrown) .hasMessageThat() .contains("Error creating Google Groups, missing parameter: clientId"); @@ -71,7 +71,7 @@ public class CreateGroupsActionTest { @Test public void test_invalidRequest_invalidClientId() throws Exception { BadRequestException thrown = - expectThrows(BadRequestException.class, () -> runAction("completelyMadeUpClientId")); + assertThrows(BadRequestException.class, () -> runAction("completelyMadeUpClientId")); assertThat(thrown) .hasMessageThat() .contains( @@ -99,7 +99,7 @@ public class CreateGroupsActionTest { "newregistrar-technical-contacts@domain-registry.example", Role.MEMBER); InternalServerErrorException e = - expectThrows(InternalServerErrorException.class, () -> runAction("NewRegistrar")); + assertThrows(InternalServerErrorException.class, () -> runAction("NewRegistrar")); String responseString = e.toString(); assertThat(responseString).contains("abuse => Success"); assertThat(responseString).contains("billing => Success"); diff --git a/javatests/google/registry/tools/server/DeleteEntityActionTest.java b/javatests/google/registry/tools/server/DeleteEntityActionTest.java index 8de728336..9ebf44a0b 100644 --- a/javatests/google/registry/tools/server/DeleteEntityActionTest.java +++ b/javatests/google/registry/tools/server/DeleteEntityActionTest.java @@ -18,7 +18,7 @@ import static com.google.appengine.api.datastore.DatastoreServiceFactory.getData import static com.google.common.truth.Truth.assertThat; import static com.googlecode.objectify.Key.create; 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.appengine.api.datastore.Entity; import com.google.appengine.api.datastore.KeyFactory; @@ -85,7 +85,7 @@ public class DeleteEntityActionTest { Entity entity = new Entity("not", "here"); String rawKey = KeyFactory.keyToString(entity.getKey()); action.rawKeys = rawKey; - BadRequestException thrown = expectThrows(BadRequestException.class, action::run); + BadRequestException thrown = assertThrows(BadRequestException.class, action::run); assertThat(thrown).hasMessageThat().contains("Could not find entity with key " + rawKey); } @@ -97,7 +97,7 @@ public class DeleteEntityActionTest { Entity entity = new Entity("non", "existent"); String rawKey = KeyFactory.keyToString(entity.getKey()); action.rawKeys = String.format("%s,%s", ofyKey, rawKey); - BadRequestException thrown = expectThrows(BadRequestException.class, action::run); + BadRequestException thrown = assertThrows(BadRequestException.class, action::run); assertThat(thrown).hasMessageThat().contains("Could not find entity with key " + rawKey); } } diff --git a/javatests/google/registry/ui/forms/FormFieldTest.java b/javatests/google/registry/ui/forms/FormFieldTest.java index 7b3112f6a..897a20c92 100644 --- a/javatests/google/registry/ui/forms/FormFieldTest.java +++ b/javatests/google/registry/ui/forms/FormFieldTest.java @@ -20,7 +20,6 @@ import static com.google.common.collect.Range.closed; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; import static google.registry.testing.JUnitBackports.assertThrows; -import static google.registry.testing.JUnitBackports.expectThrows; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @@ -75,7 +74,7 @@ public class FormFieldTest { @Test public void testEmptyToNullRequired_emptyString_throwsFfe() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormField.named("lol").emptyToNull().required().build().convert("")); assertThat(thrown, equalTo(new FormFieldException("This field is required.").propagate("lol"))); @@ -130,7 +129,7 @@ public class FormFieldTest { FormField field = FormField.named("lol") .in(ImmutableSet.of("foo", "bar")) .build(); - FormFieldException thrown = expectThrows(FormFieldException.class, () -> field.convert("omfg")); + FormFieldException thrown = assertThrows(FormFieldException.class, () -> field.convert("omfg")); assertThat(thrown, equalTo(new FormFieldException("Unrecognized value.").propagate("lol"))); } @@ -147,7 +146,7 @@ public class FormFieldTest { @Test public void testRange_minimum_stringLengthShorterThanMinimum_throwsFfe() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormField.named("lol").range(atLeast(4)).build().convert("lol")); assertThat(thrown).hasMessageThat().contains("Number of characters (3) not in range [4"); @@ -166,7 +165,7 @@ public class FormFieldTest { @Test public void testRange_maximum_stringLengthShorterThanMaximum_throwsFfe() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormField.named("lol").range(atMost(5)).build().convert("omgomg")); assertThat(thrown).hasMessageThat().contains("Number of characters (6) not in range"); @@ -197,7 +196,7 @@ public class FormFieldTest { @Test public void testMatches_mismatch_throwsFfeAndShowsDefaultErrorMessageWithPattern() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormField.named("lol") @@ -260,7 +259,7 @@ public class FormFieldTest { @Test public void testAsListEmptyToNullRequired_empty_throwsFfe() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormField.named("lol") @@ -306,7 +305,7 @@ public class FormFieldTest { .asEnum(ICanHazEnum.class) .build(); FormFieldException thrown = - expectThrows(FormFieldException.class, () -> omgField.convert("helo")); + assertThrows(FormFieldException.class, () -> omgField.convert("helo")); assertThat( thrown, equalTo( @@ -373,7 +372,7 @@ public class FormFieldTest { @Test public void testAsListRequiredElements_nullElement_throwsFfeWithIndex() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormField.named("lol") @@ -390,7 +389,7 @@ public class FormFieldTest { @Test public void testMapAsListRequiredElements_nullElement_throwsFfeWithIndexAndKey() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormField.mapNamed("lol") diff --git a/javatests/google/registry/ui/forms/FormFieldsTest.java b/javatests/google/registry/ui/forms/FormFieldsTest.java index be0d77eee..ec0408e70 100644 --- a/javatests/google/registry/ui/forms/FormFieldsTest.java +++ b/javatests/google/registry/ui/forms/FormFieldsTest.java @@ -16,7 +16,7 @@ package google.registry.ui.forms; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth8.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @@ -47,7 +47,7 @@ public class FormFieldsTest { @Test public void testXsNormalizedString_containsNonSpaceWhitespace_fails() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormFields.XS_NORMALIZED_STRING.convert(" hello \r\n\t there\n")); assertThat( @@ -71,7 +71,7 @@ public class FormFieldsTest { @Test public void testXsEppE164PhoneNumber_localizedNumber_fails() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> FormFields.PHONE_NUMBER.convert("(212) 565-0000")); assertThat(thrown) .hasMessageThat() @@ -96,7 +96,7 @@ public class FormFieldsTest { @Test public void testXsEppRoid_missingHyphen_fails() { FormFieldException thrown = - expectThrows(FormFieldException.class, () -> FormFields.ROID.convert("SH8013REP")); + assertThrows(FormFieldException.class, () -> FormFields.ROID.convert("SH8013REP")); assertThat(thrown).hasMessageThat().contains("Please enter a valid EPP ROID, e.g. SH8013-REP"); } diff --git a/javatests/google/registry/ui/server/RegistrarFormFieldsTest.java b/javatests/google/registry/ui/server/RegistrarFormFieldsTest.java index cd290a5cf..2406591ad 100644 --- a/javatests/google/registry/ui/server/RegistrarFormFieldsTest.java +++ b/javatests/google/registry/ui/server/RegistrarFormFieldsTest.java @@ -15,7 +15,7 @@ package google.registry.ui.server; import static com.google.common.truth.Truth8.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; @@ -37,7 +37,7 @@ public class RegistrarFormFieldsTest { @Test public void testBadCertificate_throwsFfe() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> RegistrarFormFields.CLIENT_CERTIFICATE_FIELD.convert("palfun")); assertThat( @@ -58,7 +58,7 @@ public class RegistrarFormFieldsTest { @Test public void testBadCertificateHash_throwsFfe() { FormFieldException thrown = - expectThrows( + assertThrows( FormFieldException.class, () -> RegistrarFormFields.CLIENT_CERTIFICATE_HASH_FIELD.convert("~~~")); assertThat( diff --git a/javatests/google/registry/util/ConcurrentTest.java b/javatests/google/registry/util/ConcurrentTest.java index 681b6827b..d4ee9a2ff 100644 --- a/javatests/google/registry/util/ConcurrentTest.java +++ b/javatests/google/registry/util/ConcurrentTest.java @@ -15,7 +15,7 @@ package google.registry.util; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import com.google.common.collect.ImmutableList; import com.google.common.testing.NullPointerTester; @@ -51,7 +51,7 @@ public class ConcurrentTest { @Test public void testTransform_throwsException_isSinglyWrappedByUee() throws Exception { UncheckedExecutionException e = - expectThrows( + assertThrows( UncheckedExecutionException.class, () -> Concurrent.transform( diff --git a/javatests/google/registry/util/PosixTarHeaderTest.java b/javatests/google/registry/util/PosixTarHeaderTest.java index 716c61f44..7dd07ad61 100644 --- a/javatests/google/registry/util/PosixTarHeaderTest.java +++ b/javatests/google/registry/util/PosixTarHeaderTest.java @@ -17,7 +17,7 @@ package google.registry.util; import static com.google.common.io.BaseEncoding.base64; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.testing.EqualsTester; @@ -202,7 +202,7 @@ public class PosixTarHeaderTest { bytes[150] = '0'; bytes[151] = '0'; IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> PosixTarHeader.from(bytes)); + assertThrows(IllegalArgumentException.class, () -> PosixTarHeader.from(bytes)); assertThat(thrown).hasMessageThat().contains("chksum invalid"); } diff --git a/javatests/google/registry/util/RetrierTest.java b/javatests/google/registry/util/RetrierTest.java index 5baf2f592..2e44d02ea 100644 --- a/javatests/google/registry/util/RetrierTest.java +++ b/javatests/google/registry/util/RetrierTest.java @@ -15,7 +15,7 @@ package google.registry.util; 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.testing.FakeClock; import google.registry.testing.FakeSleeper; @@ -83,7 +83,7 @@ public class RetrierTest { @Test public void testRetryableException() throws Exception { CountingException thrown = - expectThrows( + assertThrows( CountingException.class, () -> retrier.callWithRetry(new CountingThrower(3), CountingException.class)); assertThat(thrown).hasMessageThat().contains("3"); @@ -92,7 +92,7 @@ public class RetrierTest { @Test public void testUnretryableException() throws Exception { CountingException thrown = - expectThrows( + assertThrows( CountingException.class, () -> retrier.callWithRetry(new CountingThrower(5), IllegalArgumentException.class)); assertThat(thrown).hasMessageThat().contains("1"); @@ -107,7 +107,7 @@ public class RetrierTest { @Test public void testRetryFailed_withReporter() throws Exception { CountingException thrown = - expectThrows( + assertThrows( CountingException.class, () -> { TestReporter reporter = new TestReporter(); diff --git a/javatests/google/registry/util/SerializeUtilsTest.java b/javatests/google/registry/util/SerializeUtilsTest.java index 63227abfd..5213f12c5 100644 --- a/javatests/google/registry/util/SerializeUtilsTest.java +++ b/javatests/google/registry/util/SerializeUtilsTest.java @@ -15,7 +15,7 @@ package google.registry.util; 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.SerializeUtils.deserialize; import static google.registry.util.SerializeUtils.serialize; @@ -51,14 +51,14 @@ public class SerializeUtilsTest { @Test public void testSerialize_objectDoesntImplementSerialize_hasInformativeError() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> serialize(new Lol())); + assertThrows(IllegalArgumentException.class, () -> serialize(new Lol())); assertThat(thrown).hasMessageThat().contains("Unable to serialize: LOL_VALUE"); } @Test public void testDeserialize_badValue_hasInformativeError() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> deserialize(String.class, new byte[] {(byte) 0xff})); assertThat(thrown).hasMessageThat().contains("Unable to deserialize: objectBytes=FF"); diff --git a/javatests/google/registry/util/SqlTemplateTest.java b/javatests/google/registry/util/SqlTemplateTest.java index b2f217231..959596a21 100644 --- a/javatests/google/registry/util/SqlTemplateTest.java +++ b/javatests/google/registry/util/SqlTemplateTest.java @@ -15,7 +15,7 @@ package google.registry.util; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import org.junit.Test; import org.junit.runner.RunWith; @@ -49,7 +49,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_substitutionButNoVariables() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("").put("ONE", "1").build()); assertThat(thrown).hasMessageThat().contains("Not found in template: ONE"); } @@ -57,7 +57,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_substitutionButMissingVariables() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("%ONE%").put("ONE", "1").put("TWO", "2").build()); assertThat(thrown).hasMessageThat().contains("Not found in template: TWO"); @@ -66,7 +66,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_sameKeyTwice_failsEarly() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("%ONE%").put("ONE", "1").put("ONE", "2")); assertThat(thrown).hasMessageThat().contains(""); @@ -75,7 +75,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_variablesButNotEnoughSubstitutions() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("%ONE% %TWO%").put("ONE", "1").build()); assertThat(thrown).hasMessageThat().contains("%TWO% found in template but no substitution"); @@ -84,7 +84,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_mismatchedVariableAndSubstitution() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("%TWO%").put("TOO", "2").build()); assertThat(thrown).hasMessageThat().contains("%TWO% found in template but no substitution"); @@ -93,14 +93,14 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_missingKeyVals_whatsThePoint() throws Exception { IllegalArgumentException thrown = - expectThrows(IllegalArgumentException.class, () -> SqlTemplate.create("%TWO%").build()); + assertThrows(IllegalArgumentException.class, () -> SqlTemplate.create("%TWO%").build()); assertThat(thrown).hasMessageThat().contains("%TWO% found in template but no substitution"); } @Test public void testFillSqlTemplate_lowercaseKey_notAllowed() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("%test%").put("test", "hello world").build()); assertThat(thrown).hasMessageThat().contains("Bad substitution key: test"); @@ -109,7 +109,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_substitution_disallowsSingleQuotes() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("The words are '%LOS%' and baz").put("LOS", "foo'bar")); assertThat(thrown).hasMessageThat().contains("Illegal characters in foo'bar"); @@ -118,7 +118,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_substitution_disallowsDoubleQuotes() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("The words are '%LOS%' and baz").put("LOS", "foo\"bar")); assertThat(thrown).hasMessageThat().contains("Illegal characters in foo\"bar"); @@ -127,7 +127,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_quoteMismatch_throwsError() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("The words are \"%LOS%' and baz").put("LOS", "foobar").build()); @@ -137,7 +137,7 @@ public class SqlTemplateTest { @Test public void testFillSqlTemplate_extendedQuote_throwsError() throws Exception { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> SqlTemplate.create("The words are '%LOS%-lol' and baz").put("LOS", "roid").build()); diff --git a/javatests/google/registry/util/TaskEnqueuerTest.java b/javatests/google/registry/util/TaskEnqueuerTest.java index e9c6b527a..91bcc9cb9 100644 --- a/javatests/google/registry/util/TaskEnqueuerTest.java +++ b/javatests/google/registry/util/TaskEnqueuerTest.java @@ -17,7 +17,6 @@ package google.registry.util; import static com.google.appengine.api.taskqueue.TaskOptions.Builder.withUrl; import static com.google.common.truth.Truth.assertThat; 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.times; import static org.mockito.Mockito.verify; @@ -93,7 +92,7 @@ public final class TaskEnqueuerTest { .thenThrow(new TransientFailureException("three")) .thenThrow(new TransientFailureException("four")); TransientFailureException thrown = - expectThrows(TransientFailureException.class, () -> taskEnqueuer.enqueue(queue, task)); + assertThrows(TransientFailureException.class, () -> taskEnqueuer.enqueue(queue, task)); assertThat(thrown).hasMessageThat().contains("three"); } diff --git a/javatests/google/registry/util/TeeOutputStreamTest.java b/javatests/google/registry/util/TeeOutputStreamTest.java index 89cc74f62..5551cc12c 100644 --- a/javatests/google/registry/util/TeeOutputStreamTest.java +++ b/javatests/google/registry/util/TeeOutputStreamTest.java @@ -16,7 +16,6 @@ package google.registry.util; import static com.google.common.truth.Truth.assertThat; 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.util.Arrays.asList; @@ -63,7 +62,7 @@ public class TeeOutputStreamTest { public void testWriteInteger_failsAfterClose() throws Exception { OutputStream tee = new TeeOutputStream(asList(outputA)); tee.close(); - IllegalStateException thrown = expectThrows(IllegalStateException.class, () -> tee.write(1)); + IllegalStateException thrown = assertThrows(IllegalStateException.class, () -> tee.write(1)); assertThat(thrown).hasMessageThat().contains("outputstream closed"); } @@ -72,7 +71,7 @@ public class TeeOutputStreamTest { OutputStream tee = new TeeOutputStream(asList(outputA)); tee.close(); IllegalStateException thrown = - expectThrows(IllegalStateException.class, () -> tee.write("hello".getBytes(UTF_8))); + assertThrows(IllegalStateException.class, () -> tee.write("hello".getBytes(UTF_8))); assertThat(thrown).hasMessageThat().contains("outputstream closed"); } @@ -81,7 +80,7 @@ public class TeeOutputStreamTest { OutputStream tee = new TeeOutputStream(asList(outputA)); tee.close(); IllegalStateException thrown = - expectThrows(IllegalStateException.class, () -> tee.write("hello".getBytes(UTF_8), 1, 3)); + assertThrows(IllegalStateException.class, () -> tee.write("hello".getBytes(UTF_8), 1, 3)); assertThat(thrown).hasMessageThat().contains("outputstream closed"); } } diff --git a/javatests/google/registry/util/TypeUtilsTest.java b/javatests/google/registry/util/TypeUtilsTest.java index 001db1f4e..6d2b310af 100644 --- a/javatests/google/registry/util/TypeUtilsTest.java +++ b/javatests/google/registry/util/TypeUtilsTest.java @@ -15,7 +15,7 @@ package google.registry.util; import static com.google.common.truth.Truth.assertThat; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import java.io.Serializable; import java.util.ArrayList; @@ -36,7 +36,7 @@ public class TypeUtilsTest { @Test public void test_getClassFromString_notAssignableFrom() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> TypeUtils.getClassFromString("java.util.ArrayList", Integer.class)); assertThat(thrown).hasMessageThat().contains("ArrayList does not implement/extend Integer"); @@ -45,7 +45,7 @@ public class TypeUtilsTest { @Test public void test_getClassFromString_unknownClass() { IllegalArgumentException thrown = - expectThrows( + assertThrows( IllegalArgumentException.class, () -> TypeUtils.getClassFromString("com.fake.company.nonexistent.Class", Object.class)); assertThat(thrown) diff --git a/javatests/google/registry/util/UrlFetchUtilsTest.java b/javatests/google/registry/util/UrlFetchUtilsTest.java index 64bcfb10d..179d6755f 100644 --- a/javatests/google/registry/util/UrlFetchUtilsTest.java +++ b/javatests/google/registry/util/UrlFetchUtilsTest.java @@ -18,7 +18,7 @@ import static com.google.common.net.HttpHeaders.CONTENT_LENGTH; import static com.google.common.net.HttpHeaders.CONTENT_TYPE; import static com.google.common.net.MediaType.CSV_UTF_8; 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.UrlFetchUtils.setPayloadMultipart; import static java.nio.charset.StandardCharsets.UTF_8; import static org.mockito.Matchers.any; @@ -95,7 +95,7 @@ public class UrlFetchUtilsTest { HTTPRequest request = mock(HTTPRequest.class); String payload = "I screamed------------------------------AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHH"; IllegalStateException thrown = - expectThrows( + assertThrows( IllegalStateException.class, () -> setPayloadMultipart(request, "lol", "cat", CSV_UTF_8, payload)); assertThat(thrown) diff --git a/javatests/google/registry/whois/WhoisHttpServerTest.java b/javatests/google/registry/whois/WhoisHttpServerTest.java index 31d820d72..595a2d58c 100644 --- a/javatests/google/registry/whois/WhoisHttpServerTest.java +++ b/javatests/google/registry/whois/WhoisHttpServerTest.java @@ -24,7 +24,7 @@ import static google.registry.testing.FullFieldsTestEntityHelper.makeDomainResou import static google.registry.testing.FullFieldsTestEntityHelper.makeHostResource; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrar; import static google.registry.testing.FullFieldsTestEntityHelper.makeRegistrarContacts; -import static google.registry.testing.JUnitBackports.expectThrows; +import static google.registry.testing.JUnitBackports.assertThrows; import static google.registry.whois.WhoisTestData.loadFile; import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST; import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; @@ -379,7 +379,7 @@ public class WhoisHttpServerTest { .thenThrow(new IOException("missing cat interface")); server.whoisMetrics = mock(WhoisMetrics.class); - RuntimeException thrown = expectThrows(RuntimeException.class, server::run); + RuntimeException thrown = assertThrows(RuntimeException.class, server::run); assertThat(thrown).hasCauseThat().hasMessageThat().isEqualTo("missing cat interface"); WhoisMetric expected = WhoisMetric.builderForRequest(clock) diff --git a/javatests/google/registry/xjc/XjcObjectTest.java b/javatests/google/registry/xjc/XjcObjectTest.java index c2f61ab3c..ffd34eae0 100644 --- a/javatests/google/registry/xjc/XjcObjectTest.java +++ b/javatests/google/registry/xjc/XjcObjectTest.java @@ -16,7 +16,7 @@ package google.registry.xjc; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; -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.xjc.XjcXmlTransformer.unmarshal; import static java.nio.charset.StandardCharsets.UTF_16; @@ -65,7 +65,7 @@ public class XjcObjectTest { XjcRdeDeposit deposit = unmarshalFullDeposit(); deposit.setId(""); Throwable thrown = - expectThrows(Throwable.class, () -> deposit.marshal(new ByteArrayOutputStream(), UTF_8)); + assertThrows(Throwable.class, () -> deposit.marshal(new ByteArrayOutputStream(), UTF_8)); assertThat(thrown).hasMessageThat().contains("pattern '\\w{1,13}' for type 'depositIdType'"); } @@ -89,7 +89,7 @@ public class XjcObjectTest { @Test public void testUnmarshalValidation() throws Exception { Throwable thrown = - expectThrows( + assertThrows( Throwable.class, () -> unmarshal( diff --git a/javatests/google/registry/xjc/XmlTestdataTest.java b/javatests/google/registry/xjc/XmlTestdataTest.java index fcb50ccaa..2beb7cd29 100644 --- a/javatests/google/registry/xjc/XmlTestdataTest.java +++ b/javatests/google/registry/xjc/XmlTestdataTest.java @@ -15,7 +15,7 @@ package google.registry.xjc; 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.xjc.XjcXmlTransformer.unmarshal; import static java.nio.charset.StandardCharsets.UTF_8; @@ -146,7 +146,7 @@ public class XmlTestdataTest { @Theory public void testInvalid(Evil v) throws Exception { - Throwable thrown = expectThrows(Throwable.class, () -> unmarshal(XjcObject.class, v.xmlStream)); + Throwable thrown = assertThrows(Throwable.class, () -> unmarshal(XjcObject.class, v.xmlStream)); assertThat(thrown).hasMessageThat().contains(v.error); } } diff --git a/third_party/junit/google/registry/testing/JUnitBackports.java b/third_party/junit/google/registry/testing/JUnitBackports.java index 0b08efe96..06f67f879 100644 --- a/third_party/junit/google/registry/testing/JUnitBackports.java +++ b/third_party/junit/google/registry/testing/JUnitBackports.java @@ -10,8 +10,8 @@ public class JUnitBackports { // TODO(b/68257761): Delete these and switch over to JUnit 4.13 methods upon release. /** - * This interface facilitates the use of expectThrows from Java 8. It allows method references to - * void methods (that declare checked exceptions) to be passed directly into expectThrows without + * This interface facilitates the use of assertThrows from Java 8. It allows method references to + * void methods (that declare checked exceptions) to be passed directly into assertThrows without * wrapping. It is not meant to be implemented directly. * * @since 4.13 @@ -20,21 +20,6 @@ public class JUnitBackports { void run() throws Throwable; } - /** - * Asserts that {@code runnable} throws an exception of type {@code expectedThrowable} when - * executed. If it does not throw an exception, an {@link AssertionError} is thrown. If it throws - * the wrong type of exception, an {@code AssertionError} is thrown describing the mismatch; the - * exception that was actually thrown can be obtained by calling {@link AssertionError#getCause}. - * - * @param expectedThrowable the expected type of the exception - * @param runnable a function that is expected to throw an exception when executed - * @since 4.13 - */ - public static void assertThrows( - Class expectedThrowable, ThrowingRunnable runnable) { - expectThrows(expectedThrowable, runnable); - } - /** * Asserts that {@code runnable} throws an exception of type {@code expectedThrowable} when * executed. If it does, the exception object is returned. If it does not throw an exception, an @@ -47,7 +32,7 @@ public class JUnitBackports { * @return the exception thrown by {@code runnable} * @since 4.13 */ - public static T expectThrows( + public static T assertThrows( Class expectedThrowable, ThrowingRunnable runnable) { try { runnable.run();