diff --git a/core/src/main/java/google/registry/model/contact/ContactBase.java b/core/src/main/java/google/registry/model/contact/ContactBase.java index 5f8d70180..3949611c5 100644 --- a/core/src/main/java/google/registry/model/contact/ContactBase.java +++ b/core/src/main/java/google/registry/model/contact/ContactBase.java @@ -70,24 +70,24 @@ public class ContactBase extends EppResource implements ResourceWithTransferData @IgnoreSave(IfNull.class) @Embedded @AttributeOverrides({ - @AttributeOverride(name = "name", column = @Column(name = "addr_local_name")), - @AttributeOverride(name = "org", column = @Column(name = "addr_local_org")), - @AttributeOverride(name = "type", column = @Column(name = "addr_local_type")), - @AttributeOverride( - name = "address.streetLine1", - column = @Column(name = "addr_local_street_line1")), - @AttributeOverride( - name = "address.streetLine2", - column = @Column(name = "addr_local_street_line2")), - @AttributeOverride( - name = "address.streetLine3", - column = @Column(name = "addr_local_street_line3")), - @AttributeOverride(name = "address.city", column = @Column(name = "addr_local_city")), - @AttributeOverride(name = "address.state", column = @Column(name = "addr_local_state")), - @AttributeOverride(name = "address.zip", column = @Column(name = "addr_local_zip")), - @AttributeOverride( - name = "address.countryCode", - column = @Column(name = "addr_local_country_code")) + @AttributeOverride(name = "name", column = @Column(name = "addr_local_name")), + @AttributeOverride(name = "org", column = @Column(name = "addr_local_org")), + @AttributeOverride(name = "type", column = @Column(name = "addr_local_type")), + @AttributeOverride( + name = "address.streetLine1", + column = @Column(name = "addr_local_street_line1")), + @AttributeOverride( + name = "address.streetLine2", + column = @Column(name = "addr_local_street_line2")), + @AttributeOverride( + name = "address.streetLine3", + column = @Column(name = "addr_local_street_line3")), + @AttributeOverride(name = "address.city", column = @Column(name = "addr_local_city")), + @AttributeOverride(name = "address.state", column = @Column(name = "addr_local_state")), + @AttributeOverride(name = "address.zip", column = @Column(name = "addr_local_zip")), + @AttributeOverride( + name = "address.countryCode", + column = @Column(name = "addr_local_country_code")) }) PostalInfo localizedPostalInfo; @@ -98,24 +98,24 @@ public class ContactBase extends EppResource implements ResourceWithTransferData @IgnoreSave(IfNull.class) @Embedded @AttributeOverrides({ - @AttributeOverride(name = "name", column = @Column(name = "addr_i18n_name")), - @AttributeOverride(name = "org", column = @Column(name = "addr_i18n_org")), - @AttributeOverride(name = "type", column = @Column(name = "addr_i18n_type")), - @AttributeOverride( - name = "address.streetLine1", - column = @Column(name = "addr_i18n_street_line1")), - @AttributeOverride( - name = "address.streetLine2", - column = @Column(name = "addr_i18n_street_line2")), - @AttributeOverride( - name = "address.streetLine3", - column = @Column(name = "addr_i18n_street_line3")), - @AttributeOverride(name = "address.city", column = @Column(name = "addr_i18n_city")), - @AttributeOverride(name = "address.state", column = @Column(name = "addr_i18n_state")), - @AttributeOverride(name = "address.zip", column = @Column(name = "addr_i18n_zip")), - @AttributeOverride( - name = "address.countryCode", - column = @Column(name = "addr_i18n_country_code")) + @AttributeOverride(name = "name", column = @Column(name = "addr_i18n_name")), + @AttributeOverride(name = "org", column = @Column(name = "addr_i18n_org")), + @AttributeOverride(name = "type", column = @Column(name = "addr_i18n_type")), + @AttributeOverride( + name = "address.streetLine1", + column = @Column(name = "addr_i18n_street_line1")), + @AttributeOverride( + name = "address.streetLine2", + column = @Column(name = "addr_i18n_street_line2")), + @AttributeOverride( + name = "address.streetLine3", + column = @Column(name = "addr_i18n_street_line3")), + @AttributeOverride(name = "address.city", column = @Column(name = "addr_i18n_city")), + @AttributeOverride(name = "address.state", column = @Column(name = "addr_i18n_state")), + @AttributeOverride(name = "address.zip", column = @Column(name = "addr_i18n_zip")), + @AttributeOverride( + name = "address.countryCode", + column = @Column(name = "addr_i18n_country_code")) }) PostalInfo internationalizedPostalInfo; @@ -130,8 +130,8 @@ public class ContactBase extends EppResource implements ResourceWithTransferData @IgnoreSave(IfNull.class) @Embedded @AttributeOverrides({ - @AttributeOverride(name = "phoneNumber", column = @Column(name = "voice_phone_number")), - @AttributeOverride(name = "extension", column = @Column(name = "voice_phone_extension")), + @AttributeOverride(name = "phoneNumber", column = @Column(name = "voice_phone_number")), + @AttributeOverride(name = "extension", column = @Column(name = "voice_phone_extension")), }) ContactPhoneNumber voice; @@ -139,8 +139,8 @@ public class ContactBase extends EppResource implements ResourceWithTransferData @IgnoreSave(IfNull.class) @Embedded @AttributeOverrides({ - @AttributeOverride(name = "phoneNumber", column = @Column(name = "fax_phone_number")), - @AttributeOverride(name = "extension", column = @Column(name = "fax_phone_extension")), + @AttributeOverride(name = "phoneNumber", column = @Column(name = "fax_phone_number")), + @AttributeOverride(name = "extension", column = @Column(name = "fax_phone_extension")), }) ContactPhoneNumber fax; @@ -151,8 +151,8 @@ public class ContactBase extends EppResource implements ResourceWithTransferData /** Authorization info (aka transfer secret) of the contact. */ @Embedded @AttributeOverrides({ - @AttributeOverride(name = "pw.value", column = @Column(name = "auth_info_value")), - @AttributeOverride(name = "pw.repoId", column = @Column(name = "auth_info_repo_id")), + @AttributeOverride(name = "pw.value", column = @Column(name = "auth_info_value")), + @AttributeOverride(name = "pw.repoId", column = @Column(name = "auth_info_repo_id")), }) ContactAuthInfo authInfo; @@ -172,13 +172,13 @@ public class ContactBase extends EppResource implements ResourceWithTransferData /** Disclosure policy. */ @Embedded @AttributeOverrides({ - @AttributeOverride(name = "name", column = @Column(name = "disclose_types_name")), - @AttributeOverride(name = "org", column = @Column(name = "disclose_types_org")), - @AttributeOverride(name = "addr", column = @Column(name = "disclose_types_addr")), - @AttributeOverride(name = "flag", column = @Column(name = "disclose_mode_flag")), - @AttributeOverride(name = "voice.marked", column = @Column(name = "disclose_show_voice")), - @AttributeOverride(name = "fax.marked", column = @Column(name = "disclose_show_fax")), - @AttributeOverride(name = "email.marked", column = @Column(name = "disclose_show_email")) + @AttributeOverride(name = "name", column = @Column(name = "disclose_types_name")), + @AttributeOverride(name = "org", column = @Column(name = "disclose_types_org")), + @AttributeOverride(name = "addr", column = @Column(name = "disclose_types_addr")), + @AttributeOverride(name = "flag", column = @Column(name = "disclose_mode_flag")), + @AttributeOverride(name = "voice.marked", column = @Column(name = "disclose_show_voice")), + @AttributeOverride(name = "fax.marked", column = @Column(name = "disclose_show_fax")), + @AttributeOverride(name = "email.marked", column = @Column(name = "disclose_show_email")) }) Disclose disclose; diff --git a/core/src/main/java/google/registry/model/contact/ContactResource.java b/core/src/main/java/google/registry/model/contact/ContactResource.java index bd13f8139..ec33fe886 100644 --- a/core/src/main/java/google/registry/model/contact/ContactResource.java +++ b/core/src/main/java/google/registry/model/contact/ContactResource.java @@ -37,11 +37,11 @@ import org.joda.time.DateTime; @javax.persistence.Table( name = "Contact", indexes = { - @javax.persistence.Index(columnList = "creationTime"), - @javax.persistence.Index(columnList = "currentSponsorRegistrarId"), - @javax.persistence.Index(columnList = "deletionTime"), - @javax.persistence.Index(columnList = "contactId", unique = true), - @javax.persistence.Index(columnList = "searchName") + @javax.persistence.Index(columnList = "creationTime"), + @javax.persistence.Index(columnList = "currentSponsorRegistrarId"), + @javax.persistence.Index(columnList = "deletionTime"), + @javax.persistence.Index(columnList = "contactId", unique = true), + @javax.persistence.Index(columnList = "searchName") }) @ExternalMessagingName("contact") @WithStringVKey diff --git a/core/src/test/java/google/registry/batch/AsyncTaskEnqueuerTest.java b/core/src/test/java/google/registry/batch/AsyncTaskEnqueuerTest.java index 5f5d26c9b..57cc8ab02 100644 --- a/core/src/test/java/google/registry/batch/AsyncTaskEnqueuerTest.java +++ b/core/src/test/java/google/registry/batch/AsyncTaskEnqueuerTest.java @@ -43,7 +43,6 @@ import google.registry.testing.AppEngineRule; import google.registry.testing.FakeClock; import google.registry.testing.FakeSleeper; import google.registry.testing.InjectRule; -import google.registry.testing.ShardableTestCase; import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.util.AppEngineServiceUtils; import google.registry.util.CapturingLogHandler; @@ -62,7 +61,7 @@ import org.mockito.junit.MockitoRule; /** Unit tests for {@link AsyncTaskEnqueuer}. */ @RunWith(JUnit4.class) -public class AsyncTaskEnqueuerTest extends ShardableTestCase { +public class AsyncTaskEnqueuerTest { @Rule public final AppEngineRule appEngine = diff --git a/core/src/test/java/google/registry/batch/AsyncTaskMetricsTest.java b/core/src/test/java/google/registry/batch/AsyncTaskMetricsTest.java index 1ef7553b5..79a55fb36 100644 --- a/core/src/test/java/google/registry/batch/AsyncTaskMetricsTest.java +++ b/core/src/test/java/google/registry/batch/AsyncTaskMetricsTest.java @@ -21,14 +21,13 @@ import static google.registry.batch.AsyncTaskMetrics.OperationType.CONTACT_AND_H import com.google.common.collect.ImmutableSet; import google.registry.testing.FakeClock; -import google.registry.testing.ShardableTestCase; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Unit tests for {@link AsyncTaskMetrics}. */ @RunWith(JUnit4.class) -public class AsyncTaskMetricsTest extends ShardableTestCase { +public class AsyncTaskMetricsTest { private final FakeClock clock = new FakeClock(); private final AsyncTaskMetrics asyncTaskMetrics = new AsyncTaskMetrics(clock); diff --git a/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java b/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java index 4804684f0..a7bc82853 100644 --- a/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java +++ b/core/src/test/java/google/registry/batch/ResaveEntityActionTest.java @@ -45,7 +45,6 @@ import google.registry.request.Response; import google.registry.testing.AppEngineRule; import google.registry.testing.FakeClock; import google.registry.testing.InjectRule; -import google.registry.testing.ShardableTestCase; import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.util.AppEngineServiceUtils; import org.joda.time.DateTime; @@ -61,7 +60,7 @@ import org.mockito.junit.MockitoRule; /** Unit tests for {@link ResaveEntityAction}. */ @RunWith(JUnit4.class) -public class ResaveEntityActionTest extends ShardableTestCase { +public class ResaveEntityActionTest { @Rule public final AppEngineRule appEngine = diff --git a/core/src/test/java/google/registry/beam/invoicing/BillingEventTest.java b/core/src/test/java/google/registry/beam/invoicing/BillingEventTest.java index f647dc1c1..a351d1f95 100644 --- a/core/src/test/java/google/registry/beam/invoicing/BillingEventTest.java +++ b/core/src/test/java/google/registry/beam/invoicing/BillingEventTest.java @@ -132,8 +132,9 @@ public class BillingEventTest { public void testConvertBillingEvent_toCsv() { BillingEvent event = BillingEvent.parseFromRecord(schemaAndRecord); assertThat(event.toCsv()) - .isEqualTo("1,2017-10-24 09:06:03 UTC,2017-01-19 23:59:43 UTC,myRegistrar," - + "12345-CRRHELLO,,test,RENEW,example.test,123456,5,USD,20.50,AUTO_RENEW"); + .isEqualTo( + "1,2017-10-24 09:06:03 UTC,2017-01-19 23:59:43 UTC,myRegistrar," + + "12345-CRRHELLO,,test,RENEW,example.test,123456,5,USD,20.50,AUTO_RENEW"); } @Test @@ -142,8 +143,9 @@ public class BillingEventTest { record.put("poNumber", "905610"); BillingEvent event = BillingEvent.parseFromRecord(new SchemaAndRecord(record, null)); assertThat(event.toCsv()) - .isEqualTo("1,2017-10-24 09:06:03 UTC,2017-01-19 23:59:43 UTC,myRegistrar," - + "12345-CRRHELLO,905610,test,RENEW,example.test,123456,5,USD,20.50,AUTO_RENEW"); + .isEqualTo( + "1,2017-10-24 09:06:03 UTC,2017-01-19 23:59:43 UTC,myRegistrar," + + "12345-CRRHELLO,905610,test,RENEW,example.test,123456,5,USD,20.50,AUTO_RENEW"); } @Test diff --git a/core/src/test/java/google/registry/flows/EppCommitLogsTest.java b/core/src/test/java/google/registry/flows/EppCommitLogsTest.java index a1689a59b..112c158bd 100644 --- a/core/src/test/java/google/registry/flows/EppCommitLogsTest.java +++ b/core/src/test/java/google/registry/flows/EppCommitLogsTest.java @@ -35,7 +35,6 @@ import google.registry.testing.EppLoader; import google.registry.testing.FakeClock; import google.registry.testing.FakeHttpSession; import google.registry.testing.InjectRule; -import google.registry.testing.ShardableTestCase; import org.joda.time.DateTime; import org.junit.Before; import org.junit.Rule; @@ -45,7 +44,7 @@ import org.junit.runners.JUnit4; /** Test that domain flows create the commit logs needed to reload at points in the past. */ @RunWith(JUnit4.class) -public class EppCommitLogsTest extends ShardableTestCase { +public class EppCommitLogsTest { @Rule public final AppEngineRule appEngine = diff --git a/core/src/test/java/google/registry/flows/EppControllerTest.java b/core/src/test/java/google/registry/flows/EppControllerTest.java index 03a313241..dae08eafb 100644 --- a/core/src/test/java/google/registry/flows/EppControllerTest.java +++ b/core/src/test/java/google/registry/flows/EppControllerTest.java @@ -42,7 +42,6 @@ import google.registry.model.eppoutput.Result.Code; import google.registry.monitoring.whitebox.EppMetric; import google.registry.testing.AppEngineRule; import google.registry.testing.FakeClock; -import google.registry.testing.ShardableTestCase; import google.registry.util.Clock; import google.registry.xml.ValidationMode; import java.util.List; @@ -64,7 +63,7 @@ import org.mockito.junit.MockitoRule; /** Unit tests for {@link EppController}. */ @RunWith(JUnit4.class) -public class EppControllerTest extends ShardableTestCase { +public class EppControllerTest { @Rule public AppEngineRule appEngineRule = diff --git a/core/src/test/java/google/registry/flows/EppTestCase.java b/core/src/test/java/google/registry/flows/EppTestCase.java index 0851fca90..96813485c 100644 --- a/core/src/test/java/google/registry/flows/EppTestCase.java +++ b/core/src/test/java/google/registry/flows/EppTestCase.java @@ -46,7 +46,6 @@ import google.registry.testing.FakeClock; import google.registry.testing.FakeHttpSession; import google.registry.testing.FakeResponse; import google.registry.testing.InjectRule; -import google.registry.testing.ShardableTestCase; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -56,7 +55,7 @@ import org.joda.time.DateTime; import org.junit.Before; import org.junit.Rule; -public class EppTestCase extends ShardableTestCase { +public class EppTestCase { private static final MediaType APPLICATION_EPP_XML_UTF8 = MediaType.create("application", "epp+xml").withCharset(UTF_8); diff --git a/core/src/test/java/google/registry/flows/EppTlsActionTest.java b/core/src/test/java/google/registry/flows/EppTlsActionTest.java index 999fab271..c9c469bca 100644 --- a/core/src/test/java/google/registry/flows/EppTlsActionTest.java +++ b/core/src/test/java/google/registry/flows/EppTlsActionTest.java @@ -23,7 +23,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import google.registry.testing.FakeHttpSession; -import google.registry.testing.ShardableTestCase; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -31,7 +30,7 @@ import org.mockito.ArgumentCaptor; /** Tests for {@link EppTlsAction}. */ @RunWith(JUnit4.class) -public class EppTlsActionTest extends ShardableTestCase { +public class EppTlsActionTest { private static final byte[] INPUT_XML_BYTES = "".getBytes(UTF_8); diff --git a/core/src/test/java/google/registry/flows/FlowReporterTest.java b/core/src/test/java/google/registry/flows/FlowReporterTest.java index e1127fa01..43b7fb90f 100644 --- a/core/src/test/java/google/registry/flows/FlowReporterTest.java +++ b/core/src/test/java/google/registry/flows/FlowReporterTest.java @@ -29,7 +29,6 @@ import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppOutput.ResponseOrGreeting; import google.registry.model.eppoutput.EppResponse; import google.registry.model.reporting.IcannReportingTypes.ActivityReportField; -import google.registry.testing.ShardableTestCase; import java.util.Map; import java.util.Optional; import org.json.simple.JSONValue; @@ -40,7 +39,7 @@ import org.junit.runners.JUnit4; /** Unit tests for {@link FlowReporter}. */ @RunWith(JUnit4.class) -public class FlowReporterTest extends ShardableTestCase { +public class FlowReporterTest { static class TestCommandFlow implements Flow { @Override diff --git a/core/src/test/java/google/registry/flows/FlowRunnerTest.java b/core/src/test/java/google/registry/flows/FlowRunnerTest.java index 95696c8c3..52bfd6871 100644 --- a/core/src/test/java/google/registry/flows/FlowRunnerTest.java +++ b/core/src/test/java/google/registry/flows/FlowRunnerTest.java @@ -36,7 +36,6 @@ import google.registry.monitoring.whitebox.EppMetric; import google.registry.testing.AppEngineRule; import google.registry.testing.FakeClock; import google.registry.testing.FakeHttpSession; -import google.registry.testing.ShardableTestCase; import java.util.List; import java.util.Optional; import org.junit.Before; @@ -48,7 +47,7 @@ import org.mockito.Mockito; /** Unit tests for {@link FlowRunner}. */ @RunWith(JUnit4.class) -public class FlowRunnerTest extends ShardableTestCase { +public class FlowRunnerTest { @Rule public final AppEngineRule appEngineRule = new AppEngineRule.Builder().build(); diff --git a/core/src/test/java/google/registry/flows/FlowTestCase.java b/core/src/test/java/google/registry/flows/FlowTestCase.java index 249ef768d..4e6776e9c 100644 --- a/core/src/test/java/google/registry/flows/FlowTestCase.java +++ b/core/src/test/java/google/registry/flows/FlowTestCase.java @@ -52,7 +52,6 @@ import google.registry.testing.EppLoader; import google.registry.testing.FakeClock; import google.registry.testing.FakeHttpSession; import google.registry.testing.InjectRule; -import google.registry.testing.ShardableTestCase; import google.registry.testing.TestDataHelper; import google.registry.tmch.TmchCertificateAuthority; import google.registry.tmch.TmchXmlSignature; @@ -63,18 +62,15 @@ import java.util.List; import java.util.Map; import javax.annotation.Nullable; import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Rule; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.RegisterExtension; /** * Base class for resource flow unit tests. * * @param the flow type */ -@RunWith(JUnit4.class) -public abstract class FlowTestCase extends ShardableTestCase { +public abstract class FlowTestCase { /** Whether to actually write to Datastore or just simulate. */ public enum CommitMode { LIVE, DRY_RUN } @@ -82,23 +78,22 @@ public abstract class FlowTestCase extends ShardableTestCase { /** Whether to run in normal or superuser mode. */ public enum UserPrivileges { NORMAL, SUPERUSER } - @Rule + @RegisterExtension public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().withTaskQueue().build(); - @Rule - public final InjectRule inject = new InjectRule(); + @RegisterExtension public final InjectRule inject = new InjectRule(); protected EppLoader eppLoader; protected SessionMetadata sessionMetadata; protected FakeClock clock = new FakeClock(DateTime.now(UTC)); protected TransportCredentials credentials = new PasswordOnlyTransportCredentials(); protected EppRequestSource eppRequestSource = EppRequestSource.UNIT_TEST; - protected TmchXmlSignature testTmchXmlSignature = null; + private TmchXmlSignature testTmchXmlSignature = null; private EppMetric.Builder eppMetricBuilder; - @Before + @BeforeEach public void init() { sessionMetadata = new HttpSessionMetadata(new FakeHttpSession()); sessionMetadata.setClientId("TheRegistrar"); @@ -204,29 +199,26 @@ public abstract class FlowTestCase extends ShardableTestCase { } /** - * Assert that the actual grace periods and the corresponding billing events referenced from - * their keys match the expected map of grace periods to billing events. For the expected map, - * the keys on the grace periods and IDs on the billing events are ignored. + * Assert that the actual grace periods and the corresponding billing events referenced from their + * keys match the expected map of grace periods to billing events. For the expected map, the keys + * on the grace periods and IDs on the billing events are ignored. */ - public void assertGracePeriods( - Iterable actual, - ImmutableMap expected) { + protected void assertGracePeriods( + Iterable actual, ImmutableMap expected) { assertThat(canonicalizeGracePeriods(Maps.toMap(actual, FlowTestCase::expandGracePeriod))) .isEqualTo(canonicalizeGracePeriods(expected)); } - public void assertPollMessages( - String clientId, - PollMessage... expected) { + protected void assertPollMessages(String clientId, PollMessage... expected) { assertPollMessagesHelper(getPollMessages(clientId), expected); } - public void assertPollMessages(PollMessage... expected) { + protected void assertPollMessages(PollMessage... expected) { assertPollMessagesHelper(getPollMessages(), expected); } /** Assert that the list matches all the poll messages in the fake Datastore. */ - public void assertPollMessagesHelper( + private void assertPollMessagesHelper( Iterable pollMessages, PollMessage... expected) { // Ordering is irrelevant but duplicates should be considered independently. assertThat( @@ -279,7 +271,7 @@ public abstract class FlowTestCase extends ShardableTestCase { } /** Shortcut to call {@link #runFlow(CommitMode, UserPrivileges)} as super user and live run. */ - public EppOutput runFlowAsSuperuser() throws Exception { + protected EppOutput runFlowAsSuperuser() throws Exception { return runFlow(CommitMode.LIVE, UserPrivileges.SUPERUSER); } diff --git a/core/src/test/java/google/registry/flows/ResourceFlowTestCase.java b/core/src/test/java/google/registry/flows/ResourceFlowTestCase.java index 37116764a..213c2bc72 100644 --- a/core/src/test/java/google/registry/flows/ResourceFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/ResourceFlowTestCase.java @@ -46,8 +46,8 @@ import javax.annotation.Nullable; import org.joda.time.DateTime; import org.joda.time.Duration; import org.json.simple.JSONValue; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * Base class for resource flow unit tests. @@ -60,8 +60,8 @@ public abstract class ResourceFlowTestCase getResourceClass() { + private Class getResourceClass() { return new TypeInstantiator(getClass()){}.getExactType(); } @@ -119,7 +119,7 @@ public abstract class ResourceFlowTestCase { +class ContactCheckFlowTest extends ResourceCheckFlowTestCase { - public ContactCheckFlowTest() { + ContactCheckFlowTest() { setEppInput("contact_check.xml"); } @Test - public void testNothingExists() throws Exception { + void testNothingExists() throws Exception { // These ids come from the check xml. doCheckTest( create(true, "sh8013", null), @@ -44,7 +43,7 @@ public class ContactCheckFlowTest } @Test - public void testOneExists() throws Exception { + void testOneExists() throws Exception { persistActiveContact("sh8013"); // These ids come from the check xml. doCheckTest( @@ -54,7 +53,7 @@ public class ContactCheckFlowTest } @Test - public void testOneExistsButWasDeleted() throws Exception { + void testOneExistsButWasDeleted() throws Exception { persistDeletedContact("sh8013", clock.nowUtc().minusDays(1)); // These ids come from the check xml. doCheckTest( @@ -64,27 +63,27 @@ public class ContactCheckFlowTest } @Test - public void testXmlMatches() throws Exception { + void testXmlMatches() throws Exception { persistActiveContact("sah8013"); runFlowAssertResponse(loadFile("contact_check_response.xml")); } @Test - public void test50IdsAllowed() throws Exception { + void test50IdsAllowed() throws Exception { // Make sure we don't have a regression that reduces the number of allowed checks. setEppInput("contact_check_50.xml"); runFlow(); } @Test - public void testTooManyIds() { + void testTooManyIds() { setEppInput("contact_check_51.xml"); EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-cont-check"); } diff --git a/core/src/test/java/google/registry/flows/contact/ContactCreateFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactCreateFlowTest.java index ce5477091..2bfbbbf33 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactCreateFlowTest.java @@ -32,13 +32,12 @@ import google.registry.flows.exceptions.ResourceAlreadyExistsForThisClientExcept import google.registry.flows.exceptions.ResourceCreateContentionException; import google.registry.model.contact.ContactResource; import org.joda.time.DateTime; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** Unit tests for {@link ContactCreateFlow}. */ -public class ContactCreateFlowTest - extends ResourceFlowTestCase { +class ContactCreateFlowTest extends ResourceFlowTestCase { - public ContactCreateFlowTest() { + ContactCreateFlowTest() { setEppInput("contact_create.xml"); clock.setTo(DateTime.parse("1999-04-03T22:00:00.0Z")); } @@ -56,24 +55,24 @@ public class ContactCreateFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { dryRunFlowAssertResponse(loadFile("contact_create_response.xml")); } @Test - public void testSuccess_neverExisted() throws Exception { + void testSuccess_neverExisted() throws Exception { doSuccessfulTest(); } @Test - public void testSuccess_existedButWasDeleted() throws Exception { + void testSuccess_existedButWasDeleted() throws Exception { persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); clock.advanceOneMilli(); doSuccessfulTest(); } @Test - public void testFailure_alreadyExists() throws Exception { + void testFailure_alreadyExists() throws Exception { persistActiveContact(getUniqueIdFromCommand()); ResourceAlreadyExistsForThisClientException thrown = assertThrows(ResourceAlreadyExistsForThisClientException.class, this::runFlow); @@ -85,7 +84,7 @@ public class ContactCreateFlowTest } @Test - public void testFailure_resourceContention() throws Exception { + void testFailure_resourceContention() throws Exception { String targetId = getUniqueIdFromCommand(); persistResource( newContactResource(targetId) @@ -101,13 +100,13 @@ public class ContactCreateFlowTest } @Test - public void testSuccess_nonAsciiInLocAddress() throws Exception { + void testSuccess_nonAsciiInLocAddress() throws Exception { setEppInput("contact_create_hebrew_loc.xml"); doSuccessfulTest(); } @Test - public void testFailure_nonAsciiInIntAddress() { + void testFailure_nonAsciiInIntAddress() { setEppInput("contact_create_hebrew_int.xml"); EppException thrown = assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow); @@ -115,7 +114,7 @@ public class ContactCreateFlowTest } @Test - public void testFailure_declineDisclosure() { + void testFailure_declineDisclosure() { setEppInput("contact_create_decline_disclosure.xml"); EppException thrown = assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow); @@ -123,7 +122,7 @@ public class ContactCreateFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-cont-create"); } diff --git a/core/src/test/java/google/registry/flows/contact/ContactDeleteFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactDeleteFlowTest.java index 754a2a9c3..b880385cf 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactDeleteFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactDeleteFlowTest.java @@ -37,26 +37,25 @@ import google.registry.model.contact.ContactResource; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.Trid; import google.registry.model.reporting.HistoryEntry; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link ContactDeleteFlow}. */ -public class ContactDeleteFlowTest - extends ResourceFlowTestCase { +class ContactDeleteFlowTest extends ResourceFlowTestCase { - @Before - public void initFlowTest() { + @BeforeEach + void initFlowTest() { setEppInput("contact_delete.xml"); } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { persistActiveContact(getUniqueIdFromCommand()); dryRunFlowAssertResponse(loadFile("contact_delete_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { persistActiveContact(getUniqueIdFromCommand()); clock.advanceOneMilli(); assertTransactionalFlow(true); @@ -73,7 +72,7 @@ public class ContactDeleteFlowTest } @Test - public void testSuccess_clTridNotSpecified() throws Exception { + void testSuccess_clTridNotSpecified() throws Exception { setEppInput("contact_delete_no_cltrid.xml"); persistActiveContact(getUniqueIdFromCommand()); clock.advanceOneMilli(); @@ -91,7 +90,7 @@ public class ContactDeleteFlowTest } @Test - public void testFailure_neverExisted() throws Exception { + void testFailure_neverExisted() throws Exception { ResourceDoesNotExistException thrown = assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -99,7 +98,7 @@ public class ContactDeleteFlowTest } @Test - public void testFailure_existedButWasDeleted() throws Exception { + void testFailure_existedButWasDeleted() throws Exception { persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); ResourceDoesNotExistException thrown = assertThrows(ResourceDoesNotExistException.class, this::runFlow); @@ -108,19 +107,19 @@ public class ContactDeleteFlowTest } @Test - public void testFailure_existedButWasClientDeleteProhibited() throws Exception { + void testFailure_existedButWasClientDeleteProhibited() throws Exception { doFailingStatusTest( StatusValue.CLIENT_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class); } @Test - public void testFailure_existedButWasServerDeleteProhibited() throws Exception { + void testFailure_existedButWasServerDeleteProhibited() throws Exception { doFailingStatusTest( StatusValue.SERVER_DELETE_PROHIBITED, ResourceStatusProhibitsOperationException.class); } @Test - public void testFailure_existedButWasPendingDelete() throws Exception { + void testFailure_existedButWasPendingDelete() throws Exception { doFailingStatusTest( StatusValue.PENDING_DELETE, ResourceStatusProhibitsOperationException.class); } @@ -137,7 +136,7 @@ public class ContactDeleteFlowTest } @Test - public void testFailure_unauthorizedClient() throws Exception { + void testFailure_unauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistActiveContact(getUniqueIdFromCommand()); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); @@ -145,7 +144,7 @@ public class ContactDeleteFlowTest } @Test - public void testSuccess_superuserUnauthorizedClient() throws Exception { + void testSuccess_superuserUnauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistActiveContact(getUniqueIdFromCommand()); clock.advanceOneMilli(); @@ -163,7 +162,7 @@ public class ContactDeleteFlowTest } @Test - public void testFailure_failfastWhenLinkedToDomain() throws Exception { + void testFailure_failfastWhenLinkedToDomain() throws Exception { createTld("tld"); persistResource( newDomainBase("example.tld", persistActiveContact(getUniqueIdFromCommand()))); @@ -172,7 +171,7 @@ public class ContactDeleteFlowTest } @Test - public void testFailure_failfastWhenLinkedToApplication() throws Exception { + void testFailure_failfastWhenLinkedToApplication() throws Exception { createTld("tld"); persistResource( newDomainBase("example.tld", persistActiveContact(getUniqueIdFromCommand()))); @@ -181,7 +180,7 @@ public class ContactDeleteFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { persistActiveContact(getUniqueIdFromCommand()); clock.advanceOneMilli(); runFlow(); diff --git a/core/src/test/java/google/registry/flows/contact/ContactInfoFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactInfoFlowTest.java index 29695cd62..6bfb9f14f 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactInfoFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactInfoFlowTest.java @@ -39,12 +39,12 @@ import google.registry.model.eppcommon.AuthInfo.PasswordAuth; import google.registry.model.eppcommon.PresenceMarker; import google.registry.model.eppcommon.StatusValue; import org.joda.time.DateTime; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** Unit tests for {@link ContactInfoFlow}. */ -public class ContactInfoFlowTest extends ResourceFlowTestCase { +class ContactInfoFlowTest extends ResourceFlowTestCase { - public ContactInfoFlowTest() { + ContactInfoFlowTest() { setEppInput("contact_info.xml"); } @@ -95,7 +95,7 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase { - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("contact_transfer_approve.xml"); setClientIdForFlow("TheRegistrar"); setupContactWithPendingTransfer(); @@ -122,24 +122,24 @@ public class ContactTransferApproveFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setEppInput("contact_transfer_approve.xml"); dryRunFlowAssertResponse(loadFile("contact_transfer_approve_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("contact_transfer_approve.xml", "contact_transfer_approve_response.xml"); } @Test - public void testSuccess_withAuthinfo() throws Exception { + void testSuccess_withAuthinfo() throws Exception { doSuccessfulTest("contact_transfer_approve_with_authinfo.xml", "contact_transfer_approve_response.xml"); } @Test - public void testFailure_badContactPassword() { + void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( contact.asBuilder() @@ -153,7 +153,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_neverBeenTransferred() { + void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -162,7 +162,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_clientApproved() { + void testFailure_clientApproved() { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = assertThrows( @@ -171,7 +171,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_clientRejected() { + void testFailure_clientRejected() { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = assertThrows( @@ -180,7 +180,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_clientCancelled() { + void testFailure_clientCancelled() { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = assertThrows( @@ -189,7 +189,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_serverApproved() { + void testFailure_serverApproved() { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = assertThrows( @@ -198,7 +198,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_serverCancelled() { + void testFailure_serverCancelled() { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = assertThrows( @@ -207,7 +207,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_gainingClient() { + void testFailure_gainingClient() { setClientIdForFlow("NewRegistrar"); EppException thrown = assertThrows( @@ -216,7 +216,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_unrelatedClient() { + void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( @@ -225,7 +225,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_deletedContact() throws Exception { + void testFailure_deletedContact() throws Exception { contact = persistResource( contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = @@ -237,7 +237,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testFailure_nonexistentContact() throws Exception { + void testFailure_nonexistentContact() throws Exception { deleteResource(contact); contact = persistResource( contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); @@ -250,7 +250,7 @@ public class ContactTransferApproveFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-cont-transfer-approve"); } diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferCancelFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactTransferCancelFlowTest.java index 499318e74..ffc810770 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferCancelFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferCancelFlowTest.java @@ -38,15 +38,15 @@ import google.registry.model.reporting.HistoryEntry; import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferStatus; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link ContactTransferCancelFlow}. */ -public class ContactTransferCancelFlowTest +class ContactTransferCancelFlowTest extends ContactTransferFlowTestCase { - @Before - public void setUp() { + @BeforeEach + void setUp() { this.setEppInput("contact_transfer_cancel.xml"); setClientIdForFlow("NewRegistrar"); setupContactWithPendingTransfer(); @@ -106,24 +106,24 @@ public class ContactTransferCancelFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setEppInput("contact_transfer_cancel.xml"); dryRunFlowAssertResponse(loadFile("contact_transfer_cancel_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("contact_transfer_cancel.xml", "contact_transfer_cancel_response.xml"); } @Test - public void testSuccess_withAuthinfo() throws Exception { + void testSuccess_withAuthinfo() throws Exception { doSuccessfulTest("contact_transfer_cancel_with_authinfo.xml", "contact_transfer_cancel_response.xml"); } @Test - public void testFailure_badContactPassword() { + void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -139,7 +139,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_neverBeenTransferred() { + void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -148,7 +148,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_clientApproved() { + void testFailure_clientApproved() { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = assertThrows( @@ -157,7 +157,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_clientRejected() { + void testFailure_clientRejected() { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = assertThrows( @@ -166,7 +166,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_clientCancelled() { + void testFailure_clientCancelled() { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = assertThrows( @@ -175,7 +175,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_serverApproved() { + void testFailure_serverApproved() { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = assertThrows( @@ -184,7 +184,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_serverCancelled() { + void testFailure_serverCancelled() { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = assertThrows( @@ -193,7 +193,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_sponsoringClient() { + void testFailure_sponsoringClient() { setClientIdForFlow("TheRegistrar"); EppException thrown = assertThrows( @@ -203,7 +203,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_unrelatedClient() { + void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( @@ -213,7 +213,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_deletedContact() throws Exception { + void testFailure_deletedContact() throws Exception { contact = persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = @@ -225,7 +225,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testFailure_nonexistentContact() throws Exception { + void testFailure_nonexistentContact() throws Exception { deleteResource(contact); ResourceDoesNotExistException thrown = assertThrows( @@ -236,7 +236,7 @@ public class ContactTransferCancelFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-cont-transfer-cancel"); } diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferFlowTestCase.java b/core/src/test/java/google/registry/flows/contact/ContactTransferFlowTestCase.java index a5df75f24..cd4f7446b 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferFlowTestCase.java @@ -28,7 +28,7 @@ import google.registry.model.transfer.TransferStatus; import google.registry.testing.AppEngineRule; import org.joda.time.DateTime; import org.joda.time.Duration; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; /** * Base class for contact transfer flow unit tests. @@ -49,13 +49,13 @@ public class ContactTransferFlowTestCase protected ContactResource contact; - public ContactTransferFlowTestCase() { + ContactTransferFlowTestCase() { checkState(!Registry.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST)); clock.setTo(TRANSFER_REQUEST_TIME.plus(TIME_SINCE_REQUEST)); } - @Before - public void initContactTest() { + @BeforeEach + void initContactTest() { // Registrar ClientZ is used in tests that need another registrar that definitely doesn't own // the resources in question. persistResource( @@ -63,7 +63,7 @@ public class ContactTransferFlowTestCase } /** Adds a contact that has a pending transfer on it from TheRegistrar to NewRegistrar. */ - protected void setupContactWithPendingTransfer() { + void setupContactWithPendingTransfer() { contact = persistContactWithPendingTransfer( newContactResource("sh8013"), TRANSFER_REQUEST_TIME, diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferQueryFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactTransferQueryFlowTest.java index b8d30510f..1b5f7eec7 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferQueryFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferQueryFlowTest.java @@ -33,15 +33,15 @@ import google.registry.model.eppcommon.AuthInfo.PasswordAuth; import google.registry.model.reporting.HistoryEntry; import google.registry.model.transfer.TransferStatus; import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link ContactTransferQueryFlow}. */ -public class ContactTransferQueryFlowTest +class ContactTransferQueryFlowTest extends ContactTransferFlowTestCase { - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("contact_transfer_query.xml"); clock.setTo(DateTime.parse("2000-06-10T22:00:00.0Z")); setClientIdForFlow("NewRegistrar"); @@ -69,65 +69,65 @@ public class ContactTransferQueryFlowTest } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("contact_transfer_query.xml", "contact_transfer_query_response.xml"); } @Test - public void testSuccess_withContactRoid() throws Exception { + void testSuccess_withContactRoid() throws Exception { doSuccessfulTest("contact_transfer_query_with_roid.xml", "contact_transfer_query_response.xml"); } @Test - public void testSuccess_sponsoringClient() throws Exception { + void testSuccess_sponsoringClient() throws Exception { setClientIdForFlow("TheRegistrar"); doSuccessfulTest("contact_transfer_query.xml", "contact_transfer_query_response.xml"); } @Test - public void testSuccess_withAuthinfo() throws Exception { + void testSuccess_withAuthinfo() throws Exception { setClientIdForFlow("ClientZ"); doSuccessfulTest("contact_transfer_query_with_authinfo.xml", "contact_transfer_query_response.xml"); } @Test - public void testSuccess_clientApproved() throws Exception { + void testSuccess_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); doSuccessfulTest("contact_transfer_query.xml", "contact_transfer_query_response_client_approved.xml"); } - @Test - public void testSuccess_clientRejected() throws Exception { + @Test + void testSuccess_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); doSuccessfulTest("contact_transfer_query.xml", "contact_transfer_query_response_client_rejected.xml"); } - @Test - public void testSuccess_clientCancelled() throws Exception { + @Test + void testSuccess_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); doSuccessfulTest("contact_transfer_query.xml", "contact_transfer_query_response_client_cancelled.xml"); } @Test - public void testSuccess_serverApproved() throws Exception { + void testSuccess_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); doSuccessfulTest("contact_transfer_query.xml", "contact_transfer_query_response_server_approved.xml"); } @Test - public void testSuccess_serverCancelled() throws Exception { + void testSuccess_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); doSuccessfulTest("contact_transfer_query.xml", "contact_transfer_query_response_server_cancelled.xml"); } @Test - public void testFailure_pendingDeleteContact() throws Exception { + void testFailure_pendingDeleteContact() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); contact = persistResource( contact.asBuilder().setDeletionTime(clock.nowUtc().plusDays(1)).build()); @@ -136,7 +136,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_badContactPassword() { + void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -152,7 +152,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_badContactRoid() { + void testFailure_badContactRoid() { // Set the contact to a different ROID, but don't persist it; this is just so the substitution // code above will write the wrong ROID into the file. contact = contact.asBuilder().setRepoId("DEADBEEF_TLD-ROID").build(); @@ -164,7 +164,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_neverBeenTransferred() { + void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -174,7 +174,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_unrelatedClient() { + void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( @@ -184,7 +184,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_deletedContact() throws Exception { + void testFailure_deletedContact() throws Exception { contact = persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = @@ -195,7 +195,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testFailure_nonexistentContact() throws Exception { + void testFailure_nonexistentContact() throws Exception { deleteResource(contact); ResourceDoesNotExistException thrown = assertThrows( @@ -205,7 +205,7 @@ public class ContactTransferQueryFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-cont-transfer-query"); } diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferRejectFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactTransferRejectFlowTest.java index 47ad59a3d..621e5d4f8 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferRejectFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferRejectFlowTest.java @@ -40,15 +40,15 @@ import google.registry.model.reporting.HistoryEntry; import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferStatus; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link ContactTransferRejectFlow}. */ -public class ContactTransferRejectFlowTest +class ContactTransferRejectFlowTest extends ContactTransferFlowTestCase { - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("contact_transfer_reject.xml"); setClientIdForFlow("TheRegistrar"); setupContactWithPendingTransfer(); @@ -121,24 +121,24 @@ public class ContactTransferRejectFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setEppInput("contact_transfer_reject.xml"); dryRunFlowAssertResponse(loadFile("contact_transfer_reject_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("contact_transfer_reject.xml", "contact_transfer_reject_response.xml"); } @Test - public void testSuccess_domainAuthInfo() throws Exception { + void testSuccess_domainAuthInfo() throws Exception { doSuccessfulTest("contact_transfer_reject_with_authinfo.xml", "contact_transfer_reject_response.xml"); } @Test - public void testFailure_badPassword() { + void testFailure_badPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -154,7 +154,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_neverBeenTransferred() { + void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -163,7 +163,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_clientApproved() { + void testFailure_clientApproved() { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = assertThrows( @@ -172,7 +172,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_clientRejected() { + void testFailure_clientRejected() { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = assertThrows( @@ -181,7 +181,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_clientCancelled() { + void testFailure_clientCancelled() { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = assertThrows( @@ -190,7 +190,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_serverApproved() { + void testFailure_serverApproved() { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = assertThrows( @@ -199,7 +199,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_serverCancelled() { + void testFailure_serverCancelled() { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = assertThrows( @@ -208,7 +208,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_gainingClient() { + void testFailure_gainingClient() { setClientIdForFlow("NewRegistrar"); EppException thrown = assertThrows( @@ -217,7 +217,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_unrelatedClient() { + void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( @@ -226,7 +226,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_deletedContact() throws Exception { + void testFailure_deletedContact() throws Exception { contact = persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = @@ -238,7 +238,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testFailure_nonexistentContact() throws Exception { + void testFailure_nonexistentContact() throws Exception { deleteResource(contact); ResourceDoesNotExistException thrown = assertThrows( @@ -249,7 +249,7 @@ public class ContactTransferRejectFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-cont-transfer-reject"); } diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java index f47d90087..6197064e3 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java @@ -52,20 +52,20 @@ import google.registry.model.transfer.ContactTransferData; import google.registry.model.transfer.TransferStatus; import google.registry.persistence.VKey; import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link ContactTransferRequestFlow}. */ -public class ContactTransferRequestFlowTest +class ContactTransferRequestFlowTest extends ContactTransferFlowTestCase { - public ContactTransferRequestFlowTest() { + ContactTransferRequestFlowTest() { // We need the transfer to happen at exactly this time in order for the response to match up. clock.setTo(DateTime.parse("2000-06-08T22:00:00.0Z")); } - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("contact_transfer_request.xml"); setClientIdForFlow("NewRegistrar"); contact = persistActiveContact("sh8013"); @@ -146,18 +146,18 @@ public class ContactTransferRequestFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setEppInput("contact_transfer_request.xml"); dryRunFlowAssertResponse(loadFile("contact_transfer_request_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("contact_transfer_request.xml", "contact_transfer_request_response.xml"); } @Test - public void testFailure_noAuthInfo() { + void testFailure_noAuthInfo() { EppException thrown = assertThrows( MissingTransferRequestAuthInfoException.class, @@ -166,7 +166,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_badPassword() { + void testFailure_badPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -182,37 +182,37 @@ public class ContactTransferRequestFlowTest } @Test - public void testSuccess_clientApproved() throws Exception { + void testSuccess_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); doSuccessfulTest("contact_transfer_request.xml", "contact_transfer_request_response.xml"); } @Test - public void testSuccess_clientRejected() throws Exception { + void testSuccess_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); doSuccessfulTest("contact_transfer_request.xml", "contact_transfer_request_response.xml"); } @Test - public void testSuccess_clientCancelled() throws Exception { + void testSuccess_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); doSuccessfulTest("contact_transfer_request.xml", "contact_transfer_request_response.xml"); } @Test - public void testSuccess_serverApproved() throws Exception { + void testSuccess_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); doSuccessfulTest("contact_transfer_request.xml", "contact_transfer_request_response.xml"); } @Test - public void testSuccess_serverCancelled() throws Exception { + void testSuccess_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); doSuccessfulTest("contact_transfer_request.xml", "contact_transfer_request_response.xml"); } @Test - public void testFailure_pending() { + void testFailure_pending() { contact = persistResource( contact @@ -233,7 +233,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_sponsoringClient() { + void testFailure_sponsoringClient() { setClientIdForFlow("TheRegistrar"); EppException thrown = assertThrows( @@ -243,7 +243,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_deletedContact() throws Exception { + void testFailure_deletedContact() throws Exception { contact = persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = @@ -255,7 +255,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_nonexistentContact() throws Exception { + void testFailure_nonexistentContact() throws Exception { deleteResource(contact); ResourceDoesNotExistException thrown = assertThrows( @@ -266,7 +266,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_clientTransferProhibited() { + void testFailure_clientTransferProhibited() { contact = persistResource( contact.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build()); @@ -279,7 +279,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_serverTransferProhibited() { + void testFailure_serverTransferProhibited() { contact = persistResource( contact.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build()); @@ -292,7 +292,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testFailure_pendingDelete() { + void testFailure_pendingDelete() { contact = persistResource(contact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build()); ResourceStatusProhibitsOperationException thrown = @@ -304,7 +304,7 @@ public class ContactTransferRequestFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-cont-transfer-request"); } diff --git a/core/src/test/java/google/registry/flows/contact/ContactUpdateFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactUpdateFlowTest.java index 49fde88ef..99ce67f1f 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactUpdateFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactUpdateFlowTest.java @@ -41,13 +41,12 @@ import google.registry.model.contact.ContactResource; import google.registry.model.contact.PostalInfo; import google.registry.model.contact.PostalInfo.Type; import google.registry.model.eppcommon.StatusValue; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** Unit tests for {@link ContactUpdateFlow}. */ -public class ContactUpdateFlowTest - extends ResourceFlowTestCase { +class ContactUpdateFlowTest extends ResourceFlowTestCase { - public ContactUpdateFlowTest() { + ContactUpdateFlowTest() { setEppInput("contact_update.xml"); } @@ -65,18 +64,18 @@ public class ContactUpdateFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { persistActiveContact(getUniqueIdFromCommand()); dryRunFlowAssertResponse(loadFile("generic_success_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest(); } @Test - public void testSuccess_updatingInternationalizedPostalInfoDeletesLocalized() throws Exception { + void testSuccess_updatingInternationalizedPostalInfoDeletesLocalized() throws Exception { ContactResource contact = persistResource( newContactResource(getUniqueIdFromCommand()).asBuilder() @@ -114,7 +113,7 @@ public class ContactUpdateFlowTest } @Test - public void testSuccess_updatingLocalizedPostalInfoDeletesInternationalized() throws Exception { + void testSuccess_updatingLocalizedPostalInfoDeletesInternationalized() throws Exception { setEppInput("contact_update_localized.xml"); ContactResource contact = persistResource( @@ -153,7 +152,7 @@ public class ContactUpdateFlowTest } @Test - public void testSuccess_partialPostalInfoUpdate() throws Exception { + void testSuccess_partialPostalInfoUpdate() throws Exception { setEppInput("contact_update_partial_postalinfo.xml"); persistResource( newContactResource(getUniqueIdFromCommand()).asBuilder() @@ -188,9 +187,8 @@ public class ContactUpdateFlowTest .build()); } - @Test - public void testSuccess_updateOnePostalInfo_touchOtherPostalInfoPreservesIt() throws Exception { + void testSuccess_updateOnePostalInfo_touchOtherPostalInfoPreservesIt() throws Exception { setEppInput("contact_update_partial_postalinfo_preserve_int.xml"); persistResource( newContactResource(getUniqueIdFromCommand()).asBuilder() @@ -256,7 +254,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_neverExisted() throws Exception { + void testFailure_neverExisted() throws Exception { ResourceDoesNotExistException thrown = assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -264,7 +262,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_existedButWasDeleted() throws Exception { + void testFailure_existedButWasDeleted() throws Exception { persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); ResourceDoesNotExistException thrown = assertThrows(ResourceDoesNotExistException.class, this::runFlow); @@ -273,7 +271,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_statusValueNotClientSettable() throws Exception { + void testFailure_statusValueNotClientSettable() throws Exception { setEppInput("contact_update_prohibited_status.xml"); persistActiveContact(getUniqueIdFromCommand()); EppException thrown = assertThrows(StatusNotClientSettableException.class, this::runFlow); @@ -281,7 +279,7 @@ public class ContactUpdateFlowTest } @Test - public void testSuccess_superuserStatusValueNotClientSettable() throws Exception { + void testSuccess_superuserStatusValueNotClientSettable() throws Exception { setEppInput("contact_update_prohibited_status.xml"); persistActiveContact(getUniqueIdFromCommand()); clock.advanceOneMilli(); @@ -290,7 +288,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_unauthorizedClient() throws Exception { + void testFailure_unauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistActiveContact(getUniqueIdFromCommand()); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); @@ -298,7 +296,7 @@ public class ContactUpdateFlowTest } @Test - public void testSuccess_superuserUnauthorizedClient() throws Exception { + void testSuccess_superuserUnauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistActiveContact(getUniqueIdFromCommand()); clock.advanceOneMilli(); @@ -307,7 +305,7 @@ public class ContactUpdateFlowTest } @Test - public void testSuccess_clientUpdateProhibited_removed() throws Exception { + void testSuccess_clientUpdateProhibited_removed() throws Exception { setEppInput("contact_update_remove_client_update_prohibited.xml"); persistResource( newContactResource(getUniqueIdFromCommand()) @@ -321,7 +319,7 @@ public class ContactUpdateFlowTest } @Test - public void testSuccess_superuserClientUpdateProhibited_notRemoved() throws Exception { + void testSuccess_superuserClientUpdateProhibited_notRemoved() throws Exception { setEppInput("contact_update_prohibited_status.xml"); persistResource( newContactResource(getUniqueIdFromCommand()) @@ -339,7 +337,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_clientUpdateProhibited_notRemoved() throws Exception { + void testFailure_clientUpdateProhibited_notRemoved() throws Exception { persistResource( newContactResource(getUniqueIdFromCommand()) .asBuilder() @@ -351,7 +349,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_serverUpdateProhibited() throws Exception { + void testFailure_serverUpdateProhibited() throws Exception { persistResource( newContactResource(getUniqueIdFromCommand()) .asBuilder() @@ -364,7 +362,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_pendingDeleteProhibited() throws Exception { + void testFailure_pendingDeleteProhibited() throws Exception { persistResource( newContactResource(getUniqueIdFromCommand()) .asBuilder() @@ -377,13 +375,13 @@ public class ContactUpdateFlowTest } @Test - public void testSuccess_nonAsciiInLocAddress() throws Exception { + void testSuccess_nonAsciiInLocAddress() throws Exception { setEppInput("contact_update_hebrew_loc.xml"); doSuccessfulTest(); } @Test - public void testFailure_nonAsciiInIntAddress() throws Exception { + void testFailure_nonAsciiInIntAddress() throws Exception { setEppInput("contact_update_hebrew_int.xml"); persistActiveContact(getUniqueIdFromCommand()); EppException thrown = @@ -392,7 +390,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_declineDisclosure() throws Exception { + void testFailure_declineDisclosure() throws Exception { setEppInput("contact_update_decline_disclosure.xml"); persistActiveContact(getUniqueIdFromCommand()); EppException thrown = @@ -401,7 +399,7 @@ public class ContactUpdateFlowTest } @Test - public void testFailure_addRemoveSameValue() throws Exception { + void testFailure_addRemoveSameValue() throws Exception { setEppInput("contact_update_add_remove_same.xml"); persistActiveContact(getUniqueIdFromCommand()); EppException thrown = assertThrows(AddRemoveSameValueException.class, this::runFlow); @@ -409,7 +407,7 @@ public class ContactUpdateFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { persistActiveContact(getUniqueIdFromCommand()); clock.advanceOneMilli(); runFlow(); diff --git a/core/src/test/java/google/registry/flows/domain/DomainCheckFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainCheckFlowTest.java index d7f94e324..c8ca05372 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainCheckFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainCheckFlowTest.java @@ -74,14 +74,14 @@ import google.registry.model.reporting.HistoryEntry; import org.joda.money.CurrencyUnit; import org.joda.money.Money; import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainCheckFlow}. */ -public class DomainCheckFlowTest extends ResourceCheckFlowTestCase { +class DomainCheckFlowTest extends ResourceCheckFlowTestCase { - public DomainCheckFlowTest() { + DomainCheckFlowTest() { setEppInput("domain_check_one_tld.xml"); } @@ -102,14 +102,14 @@ public class DomainCheckFlowTest extends ResourceCheckFlowTestCase { - public DomainClaimsCheckFlowTest() { + DomainClaimsCheckFlowTest() { setEppInput("domain_check_claims.xml"); } - @Before - public void initCheckTest() { + @BeforeEach + void initCheckTest() { createTld("tld"); } @@ -60,25 +60,25 @@ public class DomainClaimsCheckFlowTest } @Test - public void testSuccess_noClaims() throws Exception { + void testSuccess_noClaims() throws Exception { doSuccessfulTest("domain_check_claims_response_none.xml"); } @Test - public void testSuccess_quietPeriod() throws Exception { + void testSuccess_quietPeriod() throws Exception { createTld("tld", TldState.QUIET_PERIOD); doSuccessfulTest("domain_check_claims_response_none.xml"); } @Test - public void testSuccess_oneClaim() throws Exception { + void testSuccess_oneClaim() throws Exception { persistClaimsList( ImmutableMap.of("example2", "2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000001")); doSuccessfulTest("domain_check_claims_response.xml"); } @Test - public void testSuccess_multipleTlds() throws Exception { + void testSuccess_multipleTlds() throws Exception { setEppInput("domain_check_claims_multiple_tlds.xml"); createTld("tld1"); createTld("tld2"); @@ -88,28 +88,28 @@ public class DomainClaimsCheckFlowTest } @Test - public void testSuccess_50IdsAllowed() throws Exception { + void testSuccess_50IdsAllowed() throws Exception { // Make sure we don't have a regression that reduces the number of allowed checks. setEppInput("domain_check_claims_50.xml"); runFlow(); } @Test - public void testFailure_TooManyIds() { + void testFailure_TooManyIds() { setEppInput("domain_check_claims_51.xml"); EppException thrown = assertThrows(TooManyResourceChecksException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFailure_tldDoesntExist() { + void testFailure_tldDoesntExist() { setEppInput("domain_check_claims_bad_tld.xml"); EppException thrown = assertThrows(TldDoesNotExistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFailure_notAuthorizedForTld() { + void testFailure_notAuthorizedForTld() { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = assertThrows(NotAuthorizedForTldException.class, this::runFlow); @@ -117,7 +117,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testSuccess_superuserNotAuthorizedForTld() throws Exception { + void testSuccess_superuserNotAuthorizedForTld() throws Exception { persistClaimsList( ImmutableMap.of("example2", "2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000001")); persistResource( @@ -130,7 +130,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testFailure_predelgation() { + void testFailure_predelgation() { createTld("tld", PREDELEGATION); setEppInput("domain_check_claims.xml"); EppException thrown = assertThrows(BadCommandForRegistryPhaseException.class, this::runFlow); @@ -138,7 +138,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testFailure_allocationToken() { + void testFailure_allocationToken() { createTld("tld"); setEppInput("domain_check_claims_allocationtoken.xml"); EppException thrown = @@ -147,7 +147,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testFailure_multipleTlds_oneHasEndedClaims() { + void testFailure_multipleTlds_oneHasEndedClaims() { createTlds("tld1", "tld2"); persistResource( Registry.get("tld2").asBuilder().setClaimsPeriodEnd(clock.nowUtc().minusMillis(1)).build()); @@ -157,7 +157,7 @@ public class DomainClaimsCheckFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-dom-check"); assertTldsFieldLogged("tld"); diff --git a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java index 18769a57a..81a105a59 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java @@ -167,23 +167,23 @@ import javax.annotation.Nullable; import org.joda.money.Money; import org.joda.time.DateTime; import org.joda.time.Duration; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainCreateFlow}. */ -public class DomainCreateFlowTest extends ResourceFlowTestCase { +class DomainCreateFlowTest extends ResourceFlowTestCase { private static final String CLAIMS_KEY = "2013041500/2/6/9/rJ1NrDO92vDsAzf7EQzgjX4R0000000001"; private AllocationToken allocationToken; - public DomainCreateFlowTest() { + DomainCreateFlowTest() { setEppInput("domain_create.xml", ImmutableMap.of("DOMAIN", "example.tld")); clock.setTo(DateTime.parse("1999-04-03T22:00:00.0Z").minus(Duration.millis(1))); } - @Before - public void initCreateTest() { + @BeforeEach + void initCreateTest() { createTld("tld"); allocationToken = persistResource( @@ -401,20 +401,20 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase substitutions = ImmutableMap.of("DOMAIN", "custom-logic-test.tld"); setEppInput("domain_create.xml", substitutions); @@ -1598,7 +1597,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase() @@ -2119,7 +2115,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase() @@ -2139,7 +2135,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase() @@ -2158,7 +2154,7 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase { +class DomainDeleteFlowTest extends ResourceFlowTestCase { private DomainBase domain; private HistoryEntry earlierHistoryEntry; @@ -119,13 +119,13 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase FEE_12_MAP = ImmutableMap.of("FEE_VERSION", "0.12", "FEE_NS", "fee12"); - public DomainDeleteFlowTest() { + DomainDeleteFlowTest() { setEppInput("domain_delete.xml"); clock.setTo(TIME_BEFORE_FLOW); } - @Before - public void initDomainTest() { + @BeforeEach + void initDomainTest() { createTld("tld"); } @@ -261,7 +261,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase { +class DomainFlowUtilsTest extends ResourceFlowTestCase { - @Before - public void setup() { + @BeforeEach + void setup() { setEppInput("domain_info.xml"); createTld("tld"); persistResource(AppEngineRule.makeRegistrar1().asBuilder().build()); } @Test - public void testValidateDomainNameAcceptsValidName() throws EppException { + void testValidateDomainNameAcceptsValidName() throws EppException { assertThat(DomainFlowUtils.validateDomainName("example.tld")).isNotNull(); } @Test - public void testValidateDomainName_IllegalCharacters() { + void testValidateDomainName_IllegalCharacters() { BadDomainNameCharacterException thrown = assertThrows( BadDomainNameCharacterException.class, @@ -63,7 +63,7 @@ public class DomainFlowUtilsTest extends ResourceFlowTestCase DomainFlowUtils.validateDomainName("-example.foo")); @@ -120,7 +120,7 @@ public class DomainFlowUtilsTest extends ResourceFlowTestCase DomainFlowUtils.validateDomainName("example-.foo")); @@ -129,7 +129,7 @@ public class DomainFlowUtilsTest extends ResourceFlowTestCase { +class DomainInfoFlowTest extends ResourceFlowTestCase { /** * The domain_info_fee.xml default substitutions common to most tests. @@ -86,8 +86,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase { +class DomainRenewFlowTest extends ResourceFlowTestCase { private static final ImmutableMap FEE_BASE_MAP = ImmutableMap.of( @@ -94,10 +94,10 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase FEE_12_MAP = updateSubstitutions(FEE_BASE_MAP, "FEE_VERSION", "0.12", "FEE_NS", "fee12"); - final DateTime expirationTime = DateTime.parse("2000-04-03T22:00:00.0Z"); + private final DateTime expirationTime = DateTime.parse("2000-04-03T22:00:00.0Z"); - @Before - public void initDomainTest() { + @BeforeEach + void initDomainTest() { createTld("tld"); clock.setTo(expirationTime.minusMillis(2)); setEppInput("domain_renew.xml", ImmutableMap.of("DOMAIN", "example.tld", "YEARS", "5")); @@ -244,7 +244,7 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase customFeeMap = @@ -297,56 +297,56 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase { private static final ImmutableMap FEE_06_MAP = @@ -87,8 +87,8 @@ public class DomainRestoreRequestFlowTest private static final ImmutableMap FEE_12_MAP = ImmutableMap.of("FEE_VERSION", "0.12", "FEE_NS", "fee12", "CURRENCY", "USD"); - @Before - public void initDomainTest() { + @BeforeEach + void initDomainTest() { createTld("tld"); setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "example.tld")); } @@ -128,14 +128,14 @@ public class DomainRestoreRequestFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "example.tld")); persistPendingDeleteDomain(); dryRunFlowAssertResponse(loadFile("generic_success_response.xml")); } @Test - public void testSuccess_expiryStillInFuture_notExtended() throws Exception { + void testSuccess_expiryStillInFuture_notExtended() throws Exception { setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "example.tld")); DateTime expirationTime = clock.nowUtc().plusYears(5).plusDays(45); persistPendingDeleteDomain(expirationTime); @@ -202,7 +202,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_expiryInPast_extendedByOneYear() throws Exception { + void testSuccess_expiryInPast_extendedByOneYear() throws Exception { setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "example.tld")); DateTime expirationTime = clock.nowUtc().minusDays(20); DateTime newExpirationTime = expirationTime.plusYears(1); @@ -280,14 +280,14 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_fee_v06() throws Exception { + void testSuccess_fee_v06() throws Exception { setEppInput("domain_update_restore_request_fee.xml", FEE_06_MAP); persistPendingDeleteDomain(); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_06_MAP)); } @Test - public void testSuccess_fee_v06_noRenewal() throws Exception { + void testSuccess_fee_v06_noRenewal() throws Exception { setEppInput("domain_update_restore_request_fee_no_renewal.xml", FEE_06_MAP); persistPendingDeleteDomain(clock.nowUtc().plusMonths(6)); runFlowAssertResponse( @@ -295,42 +295,42 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_fee_v11() throws Exception { + void testSuccess_fee_v11() throws Exception { setEppInput("domain_update_restore_request_fee.xml", FEE_11_MAP); persistPendingDeleteDomain(); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_11_MAP)); } @Test - public void testSuccess_fee_v12() throws Exception { + void testSuccess_fee_v12() throws Exception { setEppInput("domain_update_restore_request_fee.xml", FEE_12_MAP); persistPendingDeleteDomain(); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_12_MAP)); } @Test - public void testSuccess_fee_withDefaultAttributes_v06() throws Exception { + void testSuccess_fee_withDefaultAttributes_v06() throws Exception { setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_06_MAP); persistPendingDeleteDomain(); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_06_MAP)); } @Test - public void testSuccess_fee_withDefaultAttributes_v11() throws Exception { + void testSuccess_fee_withDefaultAttributes_v11() throws Exception { setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_11_MAP); persistPendingDeleteDomain(); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_11_MAP)); } @Test - public void testSuccess_fee_withDefaultAttributes_v12() throws Exception { + void testSuccess_fee_withDefaultAttributes_v12() throws Exception { setEppInput("domain_update_restore_request_fee_defaults.xml", FEE_12_MAP); persistPendingDeleteDomain(); runFlowAssertResponse(loadFile("domain_update_restore_request_response_fee.xml", FEE_12_MAP)); } @Test - public void testFailure_fee_unknownCurrency() { + void testFailure_fee_unknownCurrency() { ImmutableMap substitutions = ImmutableMap.of("FEE_VERSION", "0.12", "FEE_NS", "fee12", "CURRENCY", "BAD"); setEppInput("domain_update_restore_request_fee.xml", substitutions); @@ -340,7 +340,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_refundableFee_v06() throws Exception { + void testFailure_refundableFee_v06() throws Exception { setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_06_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -348,7 +348,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_refundableFee_v11() throws Exception { + void testFailure_refundableFee_v11() throws Exception { setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_11_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -356,7 +356,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_refundableFee_v12() throws Exception { + void testFailure_refundableFee_v12() throws Exception { setEppInput("domain_update_restore_request_fee_refundable.xml", FEE_12_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -364,7 +364,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_gracePeriodFee_v06() throws Exception { + void testFailure_gracePeriodFee_v06() throws Exception { setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_06_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -372,7 +372,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_gracePeriodFee_v11() throws Exception { + void testFailure_gracePeriodFee_v11() throws Exception { setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_11_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -380,7 +380,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_gracePeriodFee_v12() throws Exception { + void testFailure_gracePeriodFee_v12() throws Exception { setEppInput("domain_update_restore_request_fee_grace_period.xml", FEE_12_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -388,7 +388,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_appliedFee_v06() throws Exception { + void testFailure_appliedFee_v06() throws Exception { setEppInput("domain_update_restore_request_fee_applied.xml", FEE_06_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -396,7 +396,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_appliedFee_v11() throws Exception { + void testFailure_appliedFee_v11() throws Exception { setEppInput("domain_update_restore_request_fee_applied.xml", FEE_11_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -404,7 +404,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_appliedFee_v12() throws Exception { + void testFailure_appliedFee_v12() throws Exception { setEppInput("domain_update_restore_request_fee_applied.xml", FEE_12_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(UnsupportedFeeAttributeException.class, this::runFlow); @@ -412,7 +412,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_premiumNotBlocked() throws Exception { + void testSuccess_premiumNotBlocked() throws Exception { createTld("example"); setEppInput("domain_update_restore_request_premium.xml"); persistPendingDeleteDomain(); @@ -420,7 +420,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_premiumNotBlocked_andNoRenewal() throws Exception { + void testSuccess_premiumNotBlocked_andNoRenewal() throws Exception { createTld("example"); setEppInput("domain_update_restore_request_premium_no_renewal.xml"); persistPendingDeleteDomain(clock.nowUtc().plusYears(2)); @@ -429,7 +429,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_superuserOverridesReservedList() throws Exception { + void testSuccess_superuserOverridesReservedList() throws Exception { persistResource( Registry.get("tld") .asBuilder() @@ -441,7 +441,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_superuserOverridesPremiumNameBlock() throws Exception { + void testSuccess_superuserOverridesPremiumNameBlock() throws Exception { createTld("example"); setEppInput("domain_update_restore_request_premium.xml"); persistPendingDeleteDomain(); @@ -454,7 +454,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_doesNotExist() throws Exception { + void testFailure_doesNotExist() throws Exception { ResourceDoesNotExistException thrown = assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand())); @@ -462,7 +462,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_suspendedRegistrarCantRestoreDomain() { + void testFailure_suspendedRegistrarCantRestoreDomain() { persistResource( Registrar.loadByClientId("TheRegistrar") .get() @@ -475,7 +475,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_pendingRegistrarCantRestoreDomain() { + void testFailure_pendingRegistrarCantRestoreDomain() { persistResource( Registrar.loadByClientId("TheRegistrar") .get() @@ -488,7 +488,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_wrongFeeAmount_v06() throws Exception { + void testFailure_wrongFeeAmount_v06() throws Exception { setEppInput("domain_update_restore_request_fee.xml", FEE_06_MAP); persistPendingDeleteDomain(); persistResource( @@ -498,7 +498,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_wrongFeeAmount_v11() throws Exception { + void testFailure_wrongFeeAmount_v11() throws Exception { setEppInput("domain_update_restore_request_fee.xml", FEE_11_MAP); persistPendingDeleteDomain(); persistResource( @@ -508,7 +508,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_wrongFeeAmount_v12() throws Exception { + void testFailure_wrongFeeAmount_v12() throws Exception { setEppInput("domain_update_restore_request_fee.xml", FEE_12_MAP); persistPendingDeleteDomain(); persistResource( @@ -535,22 +535,22 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_wrongCurrency_v06() throws Exception { + void testFailure_wrongCurrency_v06() throws Exception { runWrongCurrencyTest(FEE_06_MAP); } @Test - public void testFailure_wrongCurrency_v11() throws Exception { + void testFailure_wrongCurrency_v11() throws Exception { runWrongCurrencyTest(FEE_11_MAP); } @Test - public void testFailure_wrongCurrency_v12() throws Exception { + void testFailure_wrongCurrency_v12() throws Exception { runWrongCurrencyTest(FEE_12_MAP); } @Test - public void testFailure_feeGivenInWrongScale_v06() throws Exception { + void testFailure_feeGivenInWrongScale_v06() throws Exception { setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_06_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow); @@ -558,7 +558,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_feeGivenInWrongScale_v11() throws Exception { + void testFailure_feeGivenInWrongScale_v11() throws Exception { setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_11_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow); @@ -566,7 +566,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_feeGivenInWrongScale_v12() throws Exception { + void testFailure_feeGivenInWrongScale_v12() throws Exception { setEppInput("domain_update_restore_request_fee_bad_scale.xml", FEE_12_MAP); persistPendingDeleteDomain(); EppException thrown = assertThrows(CurrencyValueScaleException.class, this::runFlow); @@ -574,7 +574,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_notInRedemptionPeriod() throws Exception { + void testFailure_notInRedemptionPeriod() throws Exception { persistResource( newDomainBase(getUniqueIdFromCommand()) .asBuilder() @@ -586,21 +586,21 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_notDeleted() throws Exception { + void testFailure_notDeleted() throws Exception { persistActiveDomain(getUniqueIdFromCommand()); EppException thrown = assertThrows(DomainNotEligibleForRestoreException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFailure_fullyDeleted() throws Exception { + void testFailure_fullyDeleted() throws Exception { persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1)); EppException thrown = assertThrows(ResourceDoesNotExistException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); } @Test - public void testFailure_withChange() throws Exception { + void testFailure_withChange() throws Exception { persistPendingDeleteDomain(); setEppInput("domain_update_restore_request_with_change.xml"); EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow); @@ -608,7 +608,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_withAdd() throws Exception { + void testFailure_withAdd() throws Exception { persistPendingDeleteDomain(); setEppInput("domain_update_restore_request_with_add.xml"); EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow); @@ -616,7 +616,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_withRemove() throws Exception { + void testFailure_withRemove() throws Exception { persistPendingDeleteDomain(); setEppInput("domain_update_restore_request_with_remove.xml"); EppException thrown = assertThrows(RestoreCommandIncludesChangesException.class, this::runFlow); @@ -624,7 +624,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_withSecDnsExtension() throws Exception { + void testFailure_withSecDnsExtension() throws Exception { persistPendingDeleteDomain(); setEppInput("domain_update_restore_request_with_secdns.xml"); EppException thrown = assertThrows(UnimplementedExtensionException.class, this::runFlow); @@ -632,7 +632,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_unauthorizedClient() throws Exception { + void testFailure_unauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistPendingDeleteDomain(); EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow); @@ -640,7 +640,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_superuserUnauthorizedClient() throws Exception { + void testSuccess_superuserUnauthorizedClient() throws Exception { sessionMetadata.setClientId("NewRegistrar"); persistPendingDeleteDomain(); EppException thrown = @@ -651,7 +651,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_notAuthorizedForTld() throws Exception { + void testFailure_notAuthorizedForTld() throws Exception { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); persistPendingDeleteDomain(); @@ -660,7 +660,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testSuccess_superuserNotAuthorizedForTld() throws Exception { + void testSuccess_superuserNotAuthorizedForTld() throws Exception { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); persistPendingDeleteDomain(); @@ -669,7 +669,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_premiumBlocked() throws Exception { + void testFailure_premiumBlocked() throws Exception { createTld("example"); setEppInput("domain_update_restore_request_premium.xml"); persistPendingDeleteDomain(); @@ -680,7 +680,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_reservedBlocked() throws Exception { + void testFailure_reservedBlocked() throws Exception { createTld("tld"); persistResource( Registry.get("tld") @@ -693,7 +693,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_premiumNotAcked() throws Exception { + void testFailure_premiumNotAcked() throws Exception { createTld("example"); setEppInput("domain_update_restore_request.xml", ImmutableMap.of("DOMAIN", "rich.example")); persistPendingDeleteDomain(); @@ -702,7 +702,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { persistPendingDeleteDomain(); runFlow(); assertIcannReportingActivityFieldLogged("srs-dom-rgp-restore-request"); @@ -710,7 +710,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testIcannTransactionReportField_getsStored() throws Exception { + void testIcannTransactionReportField_getsStored() throws Exception { persistPendingDeleteDomain(); runFlow(); DomainBase domain = reloadResourceByForeignKey(); @@ -726,7 +726,7 @@ public class DomainRestoreRequestFlowTest } @Test - public void testFailure_restoreReportsAreNotSupported() { + void testFailure_restoreReportsAreNotSupported() { setEppInput("domain_update_restore_report.xml"); // This exception is referred to by its fully qualified path (rather than being imported) so // that it is not included in the list of exceptions thrown by DomainRestoreRequestFlow, as this diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java index ada58dcae..d5031aa61 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferApproveFlowTest.java @@ -77,15 +77,15 @@ import java.util.stream.Stream; import org.joda.money.Money; import org.joda.time.DateTime; import org.joda.time.Duration; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferApproveFlow}. */ -public class DomainTransferApproveFlowTest +class DomainTransferApproveFlowTest extends DomainTransferFlowTestCase { - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("domain_transfer_approve.xml"); // Change the registry so that the renew price changes a day minus 1 millisecond before the // transfer (right after there will be an autorenew in the test case that has one) and then @@ -341,18 +341,18 @@ public class DomainTransferApproveFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setEppLoader("domain_transfer_approve.xml"); dryRunFlowAssertResponse(loadFile("domain_transfer_approve_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("tld", "domain_transfer_approve.xml", "domain_transfer_approve_response.xml"); } @Test - public void testSuccess_nonDefaultTransferGracePeriod() throws Exception { + void testSuccess_nonDefaultTransferGracePeriod() throws Exception { // We have to set up a new domain in a different TLD so that the billing event will be persisted // with the new transfer grace period in mind. createTld("net"); @@ -367,7 +367,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testSuccess_domainAuthInfo() throws Exception { + void testSuccess_domainAuthInfo() throws Exception { doSuccessfulTest( "tld", "domain_transfer_approve_domain_authinfo.xml", @@ -375,7 +375,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testSuccess_contactAuthInfo() throws Exception { + void testSuccess_contactAuthInfo() throws Exception { doSuccessfulTest( "tld", "domain_transfer_approve_contact_authinfo.xml", @@ -383,7 +383,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testSuccess_autorenewBeforeTransfer() throws Exception { + void testSuccess_autorenewBeforeTransfer() throws Exception { domain = reloadResourceByForeignKey(); DateTime oldExpirationTime = clock.nowUtc().minusDays(1); persistResource(domain.asBuilder().setRegistrationExpirationTime(oldExpirationTime).build()); @@ -407,7 +407,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_badContactPassword() { + void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -423,7 +423,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_badDomainPassword() { + void testFailure_badDomainPassword() { // Change the domain's password so it does not match the password in the file. persistResource( domain @@ -438,7 +438,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_neverBeenTransferred() { + void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -447,7 +447,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_clientApproved() { + void testFailure_clientApproved() { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = assertThrows( @@ -456,7 +456,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_clientRejected() { + void testFailure_clientRejected() { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = assertThrows( @@ -465,7 +465,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_clientCancelled() { + void testFailure_clientCancelled() { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = assertThrows( @@ -474,7 +474,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_serverApproved() { + void testFailure_serverApproved() { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = assertThrows( @@ -483,7 +483,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_serverCancelled() { + void testFailure_serverCancelled() { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = assertThrows( @@ -492,7 +492,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_gainingClient() { + void testFailure_gainingClient() { setClientIdForFlow("NewRegistrar"); EppException thrown = assertThrows( @@ -501,7 +501,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_unrelatedClient() { + void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( @@ -510,7 +510,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_deletedDomain() throws Exception { + void testFailure_deletedDomain() throws Exception { persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = assertThrows( @@ -520,7 +520,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_nonexistentDomain() throws Exception { + void testFailure_nonexistentDomain() throws Exception { deleteResource(domain); ResourceDoesNotExistException thrown = assertThrows( @@ -530,7 +530,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testFailure_notAuthorizedForTld() { + void testFailure_notAuthorizedForTld() { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = @@ -543,7 +543,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testSuccess_superuserNotAuthorizedForTld() throws Exception { + void testSuccess_superuserNotAuthorizedForTld() throws Exception { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); runFlowAssertResponse( @@ -556,7 +556,7 @@ public class DomainTransferApproveFlowTest // entering pending delete phase. So it's already handled in that test case. @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-dom-transfer-approve"); assertTldsFieldLogged("tld"); @@ -572,7 +572,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testIcannTransactionRecord_noRecordsToCancel() throws Exception { + void testIcannTransactionRecord_noRecordsToCancel() throws Exception { setUpGracePeriodDurations(); clock.advanceOneMilli(); runFlow(); @@ -585,7 +585,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception { + void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception { clock.advanceOneMilli(); setUpGracePeriodDurations(); DomainTransactionRecord previousSuccessRecord = @@ -613,7 +613,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testSuccess_superuserExtension_transferPeriodZero() throws Exception { + void testSuccess_superuserExtension_transferPeriodZero() throws Exception { domain = reloadResourceByForeignKey(); DomainTransferData.Builder transferDataBuilder = domain.getTransferData().asBuilder(); persistResource( @@ -632,8 +632,7 @@ public class DomainTransferApproveFlowTest } @Test - public void testSuccess_superuserExtension_transferPeriodZero_autorenewGraceActive() - throws Exception { + void testSuccess_superuserExtension_transferPeriodZero_autorenewGraceActive() throws Exception { DomainBase domain = reloadResourceByForeignKey(); Key existingAutorenewEvent = domain.getAutorenewBillingEvent(); // Set domain to have auto-renewed just before the transfer request, so that it will have an diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java index 303094a71..1587906e7 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferCancelFlowTest.java @@ -55,15 +55,15 @@ import google.registry.model.transfer.TransferResponse.DomainTransferResponse; import google.registry.model.transfer.TransferStatus; import org.joda.time.DateTime; import org.joda.time.Duration; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferCancelFlow}. */ -public class DomainTransferCancelFlowTest +class DomainTransferCancelFlowTest extends DomainTransferFlowTestCase { - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("domain_transfer_cancel.xml"); setClientIdForFlow("NewRegistrar"); setupDomainWithPendingTransfer("example", "tld"); @@ -192,31 +192,31 @@ public class DomainTransferCancelFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setEppInput("domain_transfer_cancel.xml"); eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); dryRunFlowAssertResponse(loadFile("domain_transfer_cancel_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("domain_transfer_cancel.xml", "domain_transfer_cancel_response.xml"); } @Test - public void testSuccess_domainAuthInfo() throws Exception { + void testSuccess_domainAuthInfo() throws Exception { doSuccessfulTest( "domain_transfer_cancel_domain_authinfo.xml", "domain_transfer_cancel_response.xml"); } @Test - public void testSuccess_contactAuthInfo() throws Exception { + void testSuccess_contactAuthInfo() throws Exception { doSuccessfulTest( "domain_transfer_cancel_contact_authinfo.xml", "domain_transfer_cancel_response.xml"); } @Test - public void testFailure_badContactPassword() { + void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -232,7 +232,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_badDomainPassword() { + void testFailure_badDomainPassword() { // Change the domain's password so it does not match the password in the file. domain = persistResource( @@ -248,7 +248,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_neverBeenTransferred() { + void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -257,7 +257,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_clientApproved() { + void testFailure_clientApproved() { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = assertThrows( @@ -266,7 +266,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_clientRejected() { + void testFailure_clientRejected() { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = assertThrows( @@ -275,7 +275,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_clientCancelled() { + void testFailure_clientCancelled() { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = assertThrows( @@ -284,7 +284,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_serverApproved() { + void testFailure_serverApproved() { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = assertThrows( @@ -293,7 +293,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_serverCancelled() { + void testFailure_serverCancelled() { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = assertThrows( @@ -302,7 +302,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_sponsoringClient() { + void testFailure_sponsoringClient() { setClientIdForFlow("TheRegistrar"); EppException thrown = assertThrows( @@ -311,7 +311,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_unrelatedClient() { + void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( @@ -320,7 +320,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_deletedDomain() throws Exception { + void testFailure_deletedDomain() throws Exception { domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = @@ -330,7 +330,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_nonexistentDomain() throws Exception { + void testFailure_nonexistentDomain() throws Exception { deleteResource(domain); ResourceDoesNotExistException thrown = assertThrows( @@ -339,7 +339,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testFailure_notAuthorizedForTld() { + void testFailure_notAuthorizedForTld() { persistResource( loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = @@ -352,7 +352,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testSuccess_superuserNotAuthorizedForTld() throws Exception { + void testSuccess_superuserNotAuthorizedForTld() throws Exception { persistResource( loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); clock.advanceOneMilli(); @@ -364,7 +364,7 @@ public class DomainTransferCancelFlowTest // entering pending delete phase. So it's already handled in that test case. @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { clock.advanceOneMilli(); runFlow(); assertIcannReportingActivityFieldLogged("srs-dom-transfer-cancel"); @@ -372,7 +372,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testIcannTransactionRecord_noRecordsToCancel() throws Exception { + void testIcannTransactionRecord_noRecordsToCancel() throws Exception { clock.advanceOneMilli(); runFlow(); HistoryEntry persistedEntry = getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_CANCEL); @@ -381,7 +381,7 @@ public class DomainTransferCancelFlowTest } @Test - public void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception { + void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception { clock.advanceOneMilli(); persistResource( Registry.get("tld") diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java b/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java index 950660392..0994cc3f0 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferFlowTestCase.java @@ -46,7 +46,7 @@ import google.registry.model.transfer.TransferStatus; import google.registry.testing.AppEngineRule; import org.joda.time.DateTime; import org.joda.time.Duration; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; /** * Base class for domain transfer flow unit tests. @@ -60,28 +60,28 @@ public class DomainTransferFlowTestCase // Transfer is requested on the 6th and expires on the 11th. // The "now" of this flow is on the 9th, 3 days in. - protected static final DateTime TRANSFER_REQUEST_TIME = DateTime.parse("2000-06-06T22:00:00.0Z"); - protected static final DateTime TRANSFER_EXPIRATION_TIME = + static final DateTime TRANSFER_REQUEST_TIME = DateTime.parse("2000-06-06T22:00:00.0Z"); + static final DateTime TRANSFER_EXPIRATION_TIME = TRANSFER_REQUEST_TIME.plus(Registry.DEFAULT_AUTOMATIC_TRANSFER_LENGTH); - protected static final Duration TIME_SINCE_REQUEST = Duration.standardDays(3); - protected static final int EXTENDED_REGISTRATION_YEARS = 1; - protected static final DateTime REGISTRATION_EXPIRATION_TIME = + private static final Duration TIME_SINCE_REQUEST = Duration.standardDays(3); + private static final int EXTENDED_REGISTRATION_YEARS = 1; + private static final DateTime REGISTRATION_EXPIRATION_TIME = DateTime.parse("2001-09-08T22:00:00.0Z"); - protected static final DateTime EXTENDED_REGISTRATION_EXPIRATION_TIME = + static final DateTime EXTENDED_REGISTRATION_EXPIRATION_TIME = REGISTRATION_EXPIRATION_TIME.plusYears(EXTENDED_REGISTRATION_YEARS); protected ContactResource contact; protected DomainBase domain; - protected HostResource subordinateHost; - protected HistoryEntry historyEntryDomainCreate; + HostResource subordinateHost; + private HistoryEntry historyEntryDomainCreate; - public DomainTransferFlowTestCase() { + DomainTransferFlowTestCase() { checkState(!Registry.DEFAULT_TRANSFER_GRACE_PERIOD.isShorterThan(TIME_SINCE_REQUEST)); clock.setTo(TRANSFER_REQUEST_TIME.plus(TIME_SINCE_REQUEST)); } - @Before - public void makeClientZ() { + @BeforeEach + void makeClientZ() { // Registrar ClientZ is used in tests that need another registrar that definitely doesn't own // the resources in question. persistResource( @@ -97,7 +97,7 @@ public class DomainTransferFlowTestCase } /** Adds a domain with no pending transfer on it. */ - protected void setupDomain(String label, String tld) { + void setupDomain(String label, String tld) { createTld(tld); contact = persistActiveContact("jd1234"); domain = @@ -124,7 +124,7 @@ public class DomainTransferFlowTestCase historyEntryDomainCreate = getOnlyHistoryEntryOfType(domain, DOMAIN_CREATE); } - protected BillingEvent.OneTime getBillingEventForImplicitTransfer() { + BillingEvent.OneTime getBillingEventForImplicitTransfer() { HistoryEntry historyEntry = getOnlyHistoryEntryOfType(domain, HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST); return createBillingEventForTransfer( @@ -135,7 +135,7 @@ public class DomainTransferFlowTestCase } /** Get the autorenew event that the losing client will have after a SERVER_APPROVED transfer. */ - protected BillingEvent.Recurring getLosingClientAutorenewEvent() { + BillingEvent.Recurring getLosingClientAutorenewEvent() { return new BillingEvent.Recurring.Builder() .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) @@ -148,7 +148,7 @@ public class DomainTransferFlowTestCase } /** Get the autorenew event that the gaining client will have after a SERVER_APPROVED transfer. */ - protected BillingEvent.Recurring getGainingClientAutorenewEvent() { + BillingEvent.Recurring getGainingClientAutorenewEvent() { return new BillingEvent.Recurring.Builder() .setReason(Reason.RENEW) .setFlags(ImmutableSet.of(Flag.AUTO_RENEW)) @@ -160,7 +160,7 @@ public class DomainTransferFlowTestCase .build(); } - protected void assertTransferFailed( + void assertTransferFailed( DomainBase domain, TransferStatus status, TransferData oldTransferData) { assertAboutDomains().that(domain) .doesNotHaveStatusValue(StatusValue.PENDING_TRANSFER).and() @@ -176,7 +176,7 @@ public class DomainTransferFlowTestCase } /** Adds a domain that has a pending transfer on it from TheRegistrar to NewRegistrar. */ - protected void setupDomainWithPendingTransfer(String label, String tld) { + void setupDomainWithPendingTransfer(String label, String tld) { setupDomain(label, tld); domain = persistWithPendingTransfer(domain); } diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java index 88ca0e78c..d746054bc 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferQueryFlowTest.java @@ -34,15 +34,15 @@ import google.registry.model.domain.DomainBase; import google.registry.model.eppcommon.AuthInfo.PasswordAuth; import google.registry.model.reporting.HistoryEntry; import google.registry.model.transfer.TransferStatus; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferQueryFlow}. */ -public class DomainTransferQueryFlowTest +class DomainTransferQueryFlowTest extends DomainTransferFlowTestCase { - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("domain_transfer_query.xml"); setClientIdForFlow("NewRegistrar"); setupDomainWithPendingTransfer("example", "tld"); @@ -80,67 +80,67 @@ public class DomainTransferQueryFlowTest } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("domain_transfer_query.xml", "domain_transfer_query_response.xml", 1); } @Test - public void testSuccess_sponsoringClient() throws Exception { + void testSuccess_sponsoringClient() throws Exception { setClientIdForFlow("TheRegistrar"); doSuccessfulTest("domain_transfer_query.xml", "domain_transfer_query_response.xml", 1); } @Test - public void testSuccess_domainAuthInfo() throws Exception { + void testSuccess_domainAuthInfo() throws Exception { setClientIdForFlow("ClientZ"); doSuccessfulTest( "domain_transfer_query_domain_authinfo.xml", "domain_transfer_query_response.xml", 1); } @Test - public void testSuccess_contactAuthInfo() throws Exception { + void testSuccess_contactAuthInfo() throws Exception { setClientIdForFlow("ClientZ"); doSuccessfulTest( "domain_transfer_query_contact_authinfo.xml", "domain_transfer_query_response.xml", 1); } @Test - public void testSuccess_clientApproved() throws Exception { + void testSuccess_clientApproved() throws Exception { changeTransferStatus(TransferStatus.CLIENT_APPROVED); doSuccessfulTest( "domain_transfer_query.xml", "domain_transfer_query_response_client_approved.xml", 1); } @Test - public void testSuccess_clientRejected() throws Exception { + void testSuccess_clientRejected() throws Exception { changeTransferStatus(TransferStatus.CLIENT_REJECTED); doSuccessfulTest( "domain_transfer_query.xml", "domain_transfer_query_response_client_rejected.xml", 1); } @Test - public void testSuccess_clientCancelled() throws Exception { + void testSuccess_clientCancelled() throws Exception { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); doSuccessfulTest( "domain_transfer_query.xml", "domain_transfer_query_response_client_cancelled.xml", 1); } @Test - public void testSuccess_serverApproved() throws Exception { + void testSuccess_serverApproved() throws Exception { changeTransferStatus(TransferStatus.SERVER_APPROVED); doSuccessfulTest( "domain_transfer_query.xml", "domain_transfer_query_response_server_approved.xml", 1); } @Test - public void testSuccess_serverCancelled() throws Exception { + void testSuccess_serverCancelled() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); doSuccessfulTest( "domain_transfer_query.xml", "domain_transfer_query_response_server_cancelled.xml", 1); } @Test - public void testSuccess_tenYears() throws Exception { + void testSuccess_tenYears() throws Exception { // Extend registration by 9 years here; with the extra 1 year from the transfer, we should // hit the 10-year capping. domain = @@ -153,7 +153,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_pendingDeleteDomain() throws Exception { + void testFailure_pendingDeleteDomain() throws Exception { changeTransferStatus(TransferStatus.SERVER_CANCELLED); domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().plusDays(1)).build()); @@ -162,7 +162,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_badContactPassword() { + void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -178,7 +178,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_badDomainPassword() { + void testFailure_badDomainPassword() { // Change the domain's password so it does not match the password in the file. domain = persistResource( @@ -194,7 +194,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_neverBeenTransferred() { + void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -204,7 +204,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_unrelatedClient() { + void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( @@ -214,7 +214,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_deletedDomain() throws Exception { + void testFailure_deletedDomain() throws Exception { domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = @@ -224,7 +224,7 @@ public class DomainTransferQueryFlowTest } @Test - public void testFailure_nonexistentDomain() throws Exception { + void testFailure_nonexistentDomain() throws Exception { deleteResource(domain); ResourceDoesNotExistException thrown = assertThrows( @@ -233,14 +233,14 @@ public class DomainTransferQueryFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-dom-transfer-query"); assertTldsFieldLogged("tld"); } @Test - public void testSuccess_serverApproved_afterAutorenews() throws Exception { + void testSuccess_serverApproved_afterAutorenews() throws Exception { // Set the clock to just past the extended registration time. We'd expect the domain to have // auto-renewed once, but the transfer query response should be the same. clock.setTo(EXTENDED_REGISTRATION_EXPIRATION_TIME.plusMillis(1)); diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java index 4d911ce1f..d4dbdc104 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferRejectFlowTest.java @@ -58,15 +58,15 @@ import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferStatus; import org.joda.time.DateTime; import org.joda.time.Duration; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferRejectFlow}. */ -public class DomainTransferRejectFlowTest +class DomainTransferRejectFlowTest extends DomainTransferFlowTestCase { - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("domain_transfer_reject.xml"); setClientIdForFlow("TheRegistrar"); setupDomainWithPendingTransfer("example", "tld"); @@ -152,31 +152,31 @@ public class DomainTransferRejectFlowTest } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("domain_transfer_reject.xml", "domain_transfer_reject_response.xml"); } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setEppInput("domain_transfer_reject.xml"); eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); dryRunFlowAssertResponse(loadFile("domain_transfer_reject_response.xml")); } @Test - public void testSuccess_domainAuthInfo() throws Exception { + void testSuccess_domainAuthInfo() throws Exception { doSuccessfulTest( "domain_transfer_reject_domain_authinfo.xml", "domain_transfer_reject_response.xml"); } @Test - public void testSuccess_contactAuthInfo() throws Exception { + void testSuccess_contactAuthInfo() throws Exception { doSuccessfulTest( "domain_transfer_reject_contact_authinfo.xml", "domain_transfer_reject_response.xml"); } @Test - public void testFailure_notAuthorizedForTld() { + void testFailure_notAuthorizedForTld() { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); EppException thrown = @@ -189,7 +189,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testSuccess_superuserNotAuthorizedForTld() throws Exception { + void testSuccess_superuserNotAuthorizedForTld() throws Exception { persistResource( loadRegistrar("TheRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); runFlowAssertResponse( @@ -197,7 +197,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_badContactPassword() { + void testFailure_badContactPassword() { // Change the contact's password so it does not match the password in the file. contact = persistResource( @@ -213,7 +213,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_badDomainPassword() { + void testFailure_badDomainPassword() { // Change the domain's password so it does not match the password in the file. domain = persistResource( @@ -229,7 +229,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_neverBeenTransferred() { + void testFailure_neverBeenTransferred() { changeTransferStatus(null); EppException thrown = assertThrows( @@ -238,7 +238,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_clientApproved() { + void testFailure_clientApproved() { changeTransferStatus(TransferStatus.CLIENT_APPROVED); EppException thrown = assertThrows( @@ -247,7 +247,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_clientRejected() { + void testFailure_clientRejected() { changeTransferStatus(TransferStatus.CLIENT_REJECTED); EppException thrown = assertThrows( @@ -256,7 +256,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_clientCancelled() { + void testFailure_clientCancelled() { changeTransferStatus(TransferStatus.CLIENT_CANCELLED); EppException thrown = assertThrows( @@ -265,7 +265,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_serverApproved() { + void testFailure_serverApproved() { changeTransferStatus(TransferStatus.SERVER_APPROVED); EppException thrown = assertThrows( @@ -274,7 +274,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_serverCancelled() { + void testFailure_serverCancelled() { changeTransferStatus(TransferStatus.SERVER_CANCELLED); EppException thrown = assertThrows( @@ -283,7 +283,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_gainingClient() { + void testFailure_gainingClient() { setClientIdForFlow("NewRegistrar"); EppException thrown = assertThrows( @@ -292,7 +292,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_unrelatedClient() { + void testFailure_unrelatedClient() { setClientIdForFlow("ClientZ"); EppException thrown = assertThrows( @@ -301,7 +301,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_deletedDomain() throws Exception { + void testFailure_deletedDomain() throws Exception { domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); ResourceDoesNotExistException thrown = @@ -311,7 +311,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testFailure_nonexistentDomain() throws Exception { + void testFailure_nonexistentDomain() throws Exception { deleteResource(domain); ResourceDoesNotExistException thrown = assertThrows( @@ -323,7 +323,7 @@ public class DomainTransferRejectFlowTest // entering pending delete phase. So it's already handled in that test case. @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { runFlow(); assertIcannReportingActivityFieldLogged("srs-dom-transfer-reject"); assertTldsFieldLogged("tld"); @@ -339,7 +339,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testIcannTransactionRecord_noRecordsToCancel() throws Exception { + void testIcannTransactionRecord_noRecordsToCancel() throws Exception { setUpGracePeriodDurations(); runFlow(); HistoryEntry persistedEntry = getOnlyHistoryEntryOfType(domain, DOMAIN_TRANSFER_REJECT); @@ -349,7 +349,7 @@ public class DomainTransferRejectFlowTest } @Test - public void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception { + void testIcannTransactionRecord_cancelsPreviousRecords() throws Exception { setUpGracePeriodDurations(); DomainTransactionRecord previousSuccessRecord = DomainTransactionRecord.create("tld", clock.nowUtc().plusDays(1), TRANSFER_SUCCESSFUL, 1); diff --git a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java index 2feba3d19..04cd97a71 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainTransferRequestFlowTest.java @@ -109,11 +109,11 @@ import java.util.stream.Stream; import org.joda.money.Money; import org.joda.time.DateTime; import org.joda.time.Duration; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainTransferRequestFlow}. */ -public class DomainTransferRequestFlowTest +class DomainTransferRequestFlowTest extends DomainTransferFlowTestCase { private static final ImmutableMap BASE_FEE_MAP = @@ -151,8 +151,8 @@ public class DomainTransferRequestFlowTest .put("FEE_NS", "fee12") .build(); - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("domain_transfer_request.xml"); setClientIdForFlow("NewRegistrar"); } @@ -655,7 +655,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { setupDomain("example", "tld"); setEppInput("domain_transfer_request.xml"); eppLoader.replaceAll("JD1234-REP", contact.getRepoId()); @@ -663,34 +663,34 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { setupDomain("example", "tld"); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } @Test - public void testSuccess_fee_v06() throws Exception { + void testSuccess_fee_v06() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee.xml", "domain_transfer_request_response_fee.xml", FEE_06_MAP); } @Test - public void testSuccess_fee_v11() throws Exception { + void testSuccess_fee_v11() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee.xml", "domain_transfer_request_response_fee.xml", FEE_11_MAP); } @Test - public void testSuccess_fee_v12() throws Exception { + void testSuccess_fee_v12() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee.xml", "domain_transfer_request_response_fee.xml", FEE_12_MAP); } @Test - public void testSuccess_fee_withDefaultAttributes_v06() throws Exception { + void testSuccess_fee_withDefaultAttributes_v06() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee_defaults.xml", @@ -699,7 +699,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_fee_withDefaultAttributes_v11() throws Exception { + void testSuccess_fee_withDefaultAttributes_v11() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee_defaults.xml", @@ -708,7 +708,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_fee_withDefaultAttributes_v12() throws Exception { + void testSuccess_fee_withDefaultAttributes_v12() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_fee_defaults.xml", @@ -717,7 +717,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_refundableFee_v06() { + void testFailure_refundableFee_v06() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -727,7 +727,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_refundableFee_v11() { + void testFailure_refundableFee_v11() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -737,7 +737,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_refundableFee_v12() { + void testFailure_refundableFee_v12() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -747,7 +747,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_gracePeriodFee_v06() { + void testFailure_gracePeriodFee_v06() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -757,7 +757,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_gracePeriodFee_v11() { + void testFailure_gracePeriodFee_v11() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -767,7 +767,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_gracePeriodFee_v12() { + void testFailure_gracePeriodFee_v12() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -777,7 +777,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_appliedFee_v06() { + void testFailure_appliedFee_v06() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -787,7 +787,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_appliedFee_v11() { + void testFailure_appliedFee_v11() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -797,7 +797,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_appliedFee_v12() { + void testFailure_appliedFee_v12() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -807,7 +807,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_suspendedRegistrarCantTransferDomain() { + void testFailure_suspendedRegistrarCantTransferDomain() { setupDomain("example", "tld"); clock.advanceOneMilli(); persistResource( @@ -824,7 +824,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_pendingRegistrarCantTransferDomain() { + void testFailure_pendingRegistrarCantTransferDomain() { setupDomain("example", "tld"); clock.advanceOneMilli(); persistResource( @@ -841,7 +841,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_nonDefaultAutomaticTransferLength() throws Exception { + void testSuccess_nonDefaultAutomaticTransferLength() throws Exception { setupDomain("example", "tld"); persistResource( Registry.get("tld") @@ -853,7 +853,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_nonDefaultTransferGracePeriod() throws Exception { + void testSuccess_nonDefaultTransferGracePeriod() throws Exception { setupDomain("example", "tld"); persistResource( Registry.get("tld") @@ -864,14 +864,14 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_missingPeriod_defaultsToOneYear() throws Exception { + void testSuccess_missingPeriod_defaultsToOneYear() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_missing_period.xml", "domain_transfer_request_response.xml"); } @Test - public void testSuccess_canTransferAwayFromSuspendedRegistrar() throws Exception { + void testSuccess_canTransferAwayFromSuspendedRegistrar() throws Exception { setupDomain("example", "tld"); clock.advanceOneMilli(); persistResource( @@ -884,7 +884,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_inQuietPeriod() throws Exception { + void testSuccess_inQuietPeriod() throws Exception { setupDomain("example", "tld"); persistResource( Registry.get("tld") @@ -895,7 +895,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_multiYearPeriod() { + void testFailure_multiYearPeriod() { setupDomain("example", "tld"); clock.advanceOneMilli(); EppException thrown = @@ -906,8 +906,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_superuserExtension_zeroPeriod_nonZeroAutomaticTransferLength() - throws Exception { + void testSuccess_superuserExtension_zeroPeriod_nonZeroAutomaticTransferLength() throws Exception { setupDomain("example", "tld"); eppRequestSource = EppRequestSource.TOOL; clock.advanceOneMilli(); @@ -922,8 +921,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_superuserExtension_zeroPeriod_zeroAutomaticTransferLength() - throws Exception { + void testSuccess_superuserExtension_zeroPeriod_zeroAutomaticTransferLength() throws Exception { setupDomain("example", "tld"); eppRequestSource = EppRequestSource.TOOL; clock.advanceOneMilli(); @@ -938,7 +936,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_superuserExtension_nonZeroPeriod_nonZeroAutomaticTransferLength() + void testSuccess_superuserExtension_nonZeroPeriod_nonZeroAutomaticTransferLength() throws Exception { setupDomain("example", "tld"); eppRequestSource = EppRequestSource.TOOL; @@ -954,7 +952,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_superuserExtension_zeroPeriod_autorenewGraceActive() throws Exception { + void testSuccess_superuserExtension_zeroPeriod_autorenewGraceActive() throws Exception { eppRequestSource = EppRequestSource.TOOL; setupDomain("example", "tld"); Key existingAutorenewEvent = domain.getAutorenewBillingEvent(); @@ -986,7 +984,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_superuserExtension_twoYearPeriod() { + void testFailure_superuserExtension_twoYearPeriod() { setupDomain("example", "tld"); eppRequestSource = EppRequestSource.TOOL; clock.advanceOneMilli(); @@ -1000,7 +998,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_superuserExtension_zeroPeriod_feeTransferExtension() { + void testFailure_superuserExtension_zeroPeriod_feeTransferExtension() { setupDomain("example", "tld"); eppRequestSource = EppRequestSource.TOOL; clock.advanceOneMilli(); @@ -1014,7 +1012,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_cappedExpiration() throws Exception { + void testSuccess_cappedExpiration() throws Exception { setupDomain("example", "tld"); // Set the domain to expire 10 years from now (as if it were just created with a 10-year term). domain = @@ -1031,14 +1029,14 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_domainAuthInfo() throws Exception { + void testSuccess_domainAuthInfo() throws Exception { setupDomain("example", "tld"); doSuccessfulTest( "domain_transfer_request_domain_authinfo.xml", "domain_transfer_request_response.xml"); } @Test - public void testSuccess_customLogicFee() throws Exception { + void testSuccess_customLogicFee() throws Exception { setupDomain("expensive-domain", "foo"); clock.advanceOneMilli(); doSuccessfulTest( @@ -1057,7 +1055,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_notAuthorizedForTld() { + void testFailure_notAuthorizedForTld() { setupDomain("example", "tld"); persistResource( loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); @@ -1071,7 +1069,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_superuserNotAuthorizedForTld() throws Exception { + void testSuccess_superuserNotAuthorizedForTld() throws Exception { setupDomain("example", "tld"); persistResource( loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build()); @@ -1081,7 +1079,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_autorenewGraceActive_onlyAtTransferRequestTime() throws Exception { + void testSuccess_autorenewGraceActive_onlyAtTransferRequestTime() throws Exception { setupDomain("example", "tld"); // Set the domain to have auto-renewed long enough ago that it is still in the autorenew grace // period at the transfer request time, but will have exited it by the automatic transfer time. @@ -1110,7 +1108,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_autorenewGraceActive_throughoutTransferWindow() throws Exception { + void testSuccess_autorenewGraceActive_throughoutTransferWindow() throws Exception { setupDomain("example", "tld"); Key existingAutorenewEvent = domain.getAutorenewBillingEvent(); // Set domain to have auto-renewed just before the transfer request, so that it will have an @@ -1148,7 +1146,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_autorenewGraceActive_onlyAtAutomaticTransferTime() throws Exception { + void testSuccess_autorenewGraceActive_onlyAtAutomaticTransferTime() throws Exception { setupDomain("example", "tld"); Key existingAutorenewEvent = domain.getAutorenewBillingEvent(); // Set domain to expire in 1 day, so that it will be in the autorenew grace period by the @@ -1176,7 +1174,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_premiumNotBlocked() throws Exception { + void testSuccess_premiumNotBlocked() throws Exception { setupDomain("rich", "example"); clock.advanceOneMilli(); // We don't verify the results; just check that the flow doesn't fail. @@ -1184,7 +1182,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_premiumNotBlockedInSuperuserMode() throws Exception { + void testSuccess_premiumNotBlockedInSuperuserMode() throws Exception { setupDomain("rich", "example"); clock.advanceOneMilli(); // Modify the Registrar to block premium names. @@ -1206,22 +1204,22 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_wrongCurrency_v06() { + void testFailure_wrongCurrency_v06() { runWrongCurrencyTest(FEE_06_MAP); } @Test - public void testFailure_wrongCurrency_v11() { + void testFailure_wrongCurrency_v11() { runWrongCurrencyTest(FEE_11_MAP); } @Test - public void testFailure_wrongCurrency_v12() { + void testFailure_wrongCurrency_v12() { runWrongCurrencyTest(FEE_12_MAP); } @Test - public void testFailure_unknownCurrency() { + void testFailure_unknownCurrency() { Map substitutions = Maps.newHashMap(); substitutions.putAll(FEE_06_MAP); substitutions.put("CURRENCY", "BAD"); @@ -1232,7 +1230,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_feeGivenInWrongScale_v06() { + void testFailure_feeGivenInWrongScale_v06() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -1242,7 +1240,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_feeGivenInWrongScale_v11() { + void testFailure_feeGivenInWrongScale_v11() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -1252,7 +1250,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_feeGivenInWrongScale_v12() { + void testFailure_feeGivenInWrongScale_v12() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -1275,25 +1273,25 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_wrongFeeAmount_v06() { + void testFailure_wrongFeeAmount_v06() { setupDomain("example", "tld"); runWrongFeeAmountTest(FEE_06_MAP); } @Test - public void testFailure_wrongFeeAmount_v11() { + void testFailure_wrongFeeAmount_v11() { setupDomain("example", "tld"); runWrongFeeAmountTest(FEE_11_MAP); } @Test - public void testFailure_wrongFeeAmount_v12() { + void testFailure_wrongFeeAmount_v12() { setupDomain("example", "tld"); runWrongFeeAmountTest(FEE_12_MAP); } @Test - public void testFailure_premiumBlocked() { + void testFailure_premiumBlocked() { setupDomain("rich", "example"); // Modify the Registrar to block premium names. persistResource(loadRegistrar("NewRegistrar").asBuilder().setBlockPremiumNames(true).build()); @@ -1305,7 +1303,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_feeNotProvidedOnPremiumName() { + void testFailure_feeNotProvidedOnPremiumName() { setupDomain("rich", "example"); EppException thrown = assertThrows( @@ -1315,7 +1313,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_noAuthInfo() { + void testFailure_noAuthInfo() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -1325,7 +1323,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_badContactPassword() { + void testFailure_badContactPassword() { setupDomain("example", "tld"); // Change the contact's password so it does not match the password in the file. contact = @@ -1342,7 +1340,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_badContactRepoId() { + void testFailure_badContactRepoId() { setupDomain("example", "tld"); // Set the contact to a different ROID, but don't persist it; this is just so the substitution // code above will write the wrong ROID into the file. @@ -1355,42 +1353,42 @@ public class DomainTransferRequestFlowTest } @Test - public void testSuccess_clientApproved() throws Exception { + void testSuccess_clientApproved() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.CLIENT_APPROVED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } @Test - public void testSuccess_clientRejected() throws Exception { + void testSuccess_clientRejected() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.CLIENT_REJECTED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } @Test - public void testSuccess_clientCancelled() throws Exception { + void testSuccess_clientCancelled() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.CLIENT_CANCELLED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } @Test - public void testSuccess_serverApproved() throws Exception { + void testSuccess_serverApproved() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.SERVER_APPROVED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } @Test - public void testSuccess_serverCancelled() throws Exception { + void testSuccess_serverCancelled() throws Exception { setupDomain("example", "tld"); changeTransferStatus(TransferStatus.SERVER_CANCELLED); doSuccessfulTest("domain_transfer_request.xml", "domain_transfer_request_response.xml"); } @Test - public void testFailure_pending() { + void testFailure_pending() { setupDomain("example", "tld"); domain = persistResource( @@ -1412,7 +1410,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_badDomainPassword() { + void testFailure_badDomainPassword() { setupDomain("example", "tld"); // Change the domain's password so it does not match the password in the file. domain = @@ -1429,7 +1427,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_sponsoringClient() { + void testFailure_sponsoringClient() { setupDomain("example", "tld"); setClientIdForFlow("TheRegistrar"); EppException thrown = @@ -1440,7 +1438,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_deletedDomain() throws Exception { + void testFailure_deletedDomain() throws Exception { setupDomain("example", "tld"); domain = persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build()); @@ -1452,7 +1450,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_invalidDomain() throws Exception { + void testFailure_invalidDomain() throws Exception { setupDomain("example", "tld"); setEppInput( "domain_transfer_request_wildcard.xml", @@ -1467,7 +1465,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_nonexistentDomain() { + void testFailure_nonexistentDomain() { createTld("tld"); contact = persistActiveContact("jd1234"); ResourceDoesNotExistException thrown = @@ -1478,7 +1476,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_periodInMonths() { + void testFailure_periodInMonths() { setupDomain("example", "tld"); EppException thrown = assertThrows( @@ -1488,7 +1486,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_clientTransferProhibited() { + void testFailure_clientTransferProhibited() { setupDomain("example", "tld"); domain = persistResource( @@ -1501,7 +1499,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_serverTransferProhibited() { + void testFailure_serverTransferProhibited() { setupDomain("example", "tld"); domain = persistResource( @@ -1514,7 +1512,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testFailure_pendingDelete() { + void testFailure_pendingDelete() { setupDomain("example", "tld"); domain = persistResource(domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build()); ResourceStatusProhibitsOperationException thrown = @@ -1525,7 +1523,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testIcannActivityReportField_getsLogged() throws Exception { + void testIcannActivityReportField_getsLogged() throws Exception { setupDomain("example", "tld"); clock.advanceOneMilli(); runTest("domain_transfer_request.xml", UserPrivileges.NORMAL); @@ -1534,7 +1532,7 @@ public class DomainTransferRequestFlowTest } @Test - public void testIcannTransactionRecord_getsStored() throws Exception { + void testIcannTransactionRecord_getsStored() throws Exception { setupDomain("example", "tld"); persistResource( Registry.get("tld") diff --git a/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java index a0efcc1f1..d2d115ce9 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainUpdateFlowTest.java @@ -90,8 +90,8 @@ import google.registry.model.registry.Registry; import google.registry.model.reporting.HistoryEntry; import google.registry.persistence.VKey; import org.joda.money.Money; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link DomainUpdateFlow}. */ public class DomainUpdateFlowTest extends ResourceFlowTestCase { @@ -110,7 +110,7 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase { +class HostCheckFlowTest extends ResourceCheckFlowTestCase { - public HostCheckFlowTest() { + HostCheckFlowTest() { setEppInput("host_check.xml"); } @Test - public void testNothingExists() throws Exception { + void testNothingExists() throws Exception { // These ids come from the check xml. doCheckTest( create(true, "ns1.example.tld", null), @@ -43,7 +43,7 @@ public class HostCheckFlowTest extends ResourceCheckFlowTestCase { +class HostCreateFlowTest extends ResourceFlowTestCase { private void setEppHostCreateInput(String hostName, String hostAddrs) { setEppInput( @@ -73,7 +73,7 @@ public class HostCreateFlowTest extends ResourceFlowTestCase1080:0:0:0:8:800:200C:417A"); } - public HostCreateFlowTest() { + HostCreateFlowTest() { setEppHostCreateInput("ns1.example.tld", null); clock.setTo(DateTime.parse("1999-04-03T22:00:00.0Z")); } @@ -101,19 +101,19 @@ public class HostCreateFlowTest extends ResourceFlowTestCase192.0.2.2\n" @@ -273,37 +273,37 @@ public class HostCreateFlowTest extends ResourceFlowTestCase { +class HostDeleteFlowTest extends ResourceFlowTestCase { - @Before - public void initFlowTest() { + @BeforeEach + void initFlowTest() { setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld")); } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { persistActiveHost("ns1.example.tld"); dryRunFlowAssertResponse(loadFile("host_delete_response.xml")); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { persistActiveHost("ns1.example.tld"); clock.advanceOneMilli(); assertTransactionalFlow(true); @@ -83,7 +83,7 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase { +class HostInfoFlowTest extends ResourceFlowTestCase { - public HostInfoFlowTest() { + HostInfoFlowTest() { setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld")); } - @Before - public void initHostTest() { + @BeforeEach + void initHostTest() { createTld("foobar"); } @@ -73,7 +73,7 @@ public class HostInfoFlowTest extends ResourceFlowTestCase { +class HostUpdateFlowTest extends ResourceFlowTestCase { private void setEppHostUpdateInput( String oldHostName, String newHostName, String ipOrStatusToAdd, String ipOrStatusToRem) { @@ -99,7 +99,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); createTld("tld"); @@ -421,7 +421,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); createTld("tld"); @@ -445,7 +445,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); createTld("tld"); @@ -969,7 +967,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); sessionMetadata.setClientId("TheRegistrar"); @@ -1192,7 +1190,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); sessionMetadata.setClientId("TheRegistrar"); @@ -1210,7 +1208,7 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase192.0.2.22", null); sessionMetadata.setClientId("NewRegistrar"); @@ -1249,17 +1247,17 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase { +class PollAckFlowTest extends FlowTestCase { /** This is the message id being sent in the ACK request. */ private static final long MESSAGE_ID = 3; @@ -45,8 +45,8 @@ public class PollAckFlowTest extends FlowTestCase { private DomainBase domain; private ContactResource contact; - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2011")); setClientIdForFlow("NewRegistrar"); clock.setTo(DateTime.parse("2011-01-02T01:01:01Z")); @@ -83,13 +83,13 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testDryRun() throws Exception { + void testDryRun() throws Exception { persistOneTimePollMessage(MESSAGE_ID); dryRunFlowAssertResponse(loadFile("poll_ack_response_empty.xml")); } @Test - public void testSuccess_contactPollMessage() throws Exception { + void testSuccess_contactPollMessage() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "2-2-ROID-4-3-2011")); persistResource( new PollMessage.OneTime.Builder() @@ -104,7 +104,7 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testFailure_contactPollMessage_withIncorrectYearField() throws Exception { + void testFailure_contactPollMessage_withIncorrectYearField() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "2-2-ROID-4-3-1999")); persistResource( new PollMessage.OneTime.Builder() @@ -119,14 +119,14 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testSuccess_messageOnContactResource() throws Exception { + void testSuccess_messageOnContactResource() throws Exception { persistOneTimePollMessage(MESSAGE_ID); assertTransactionalFlow(true); runFlowAssertResponse(loadFile("poll_ack_response_empty.xml")); } @Test - public void testSuccess_recentActiveAutorenew() throws Exception { + void testSuccess_recentActiveAutorenew() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2010")); persistAutorenewPollMessage(clock.nowUtc().minusMonths(6), END_OF_TIME); assertTransactionalFlow(true); @@ -134,7 +134,7 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testSuccess_oldActiveAutorenew() throws Exception { + void testSuccess_oldActiveAutorenew() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2009")); persistAutorenewPollMessage(clock.nowUtc().minusYears(2), END_OF_TIME); // Create three other messages to be queued for retrieval to get our count right, since the poll @@ -150,7 +150,7 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testSuccess_oldInactiveAutorenew() throws Exception { + void testSuccess_oldInactiveAutorenew() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-3-EXAMPLE-4-3-2010")); persistAutorenewPollMessage(clock.nowUtc().minusMonths(6), clock.nowUtc()); assertTransactionalFlow(true); @@ -158,7 +158,7 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testSuccess_moreMessages() throws Exception { + void testSuccess_moreMessages() throws Exception { // Create five messages to be queued for retrieval, one of which will be acked. for (int i = 0; i < 5; i++) { persistOneTimePollMessage(MESSAGE_ID + i); @@ -171,7 +171,7 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testFailure_noSuchMessage() throws Exception { + void testFailure_noSuchMessage() throws Exception { assertTransactionalFlow(true); Exception e = assertThrows(MessageDoesNotExistException.class, this::runFlow); assertThat(e) @@ -180,21 +180,21 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testFailure_invalidId_tooFewComponents() throws Exception { + void testFailure_invalidId_tooFewComponents() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "1-2-3")); assertTransactionalFlow(true); assertThrows(InvalidMessageIdException.class, this::runFlow); } @Test - public void testFailure_invalidId_tooManyComponents() throws Exception { + void testFailure_invalidId_tooManyComponents() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "2-2-ROID-4-3-1999-2007")); assertTransactionalFlow(true); assertThrows(InvalidMessageIdException.class, this::runFlow); } @Test - public void testFailure_contactPollMessage_withMissingYearField() throws Exception { + void testFailure_contactPollMessage_withMissingYearField() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "2-2-ROID-4-3")); persistResource( new PollMessage.OneTime.Builder() @@ -209,28 +209,28 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testFailure_invalidId_stringInsteadOfNumeric() throws Exception { + void testFailure_invalidId_stringInsteadOfNumeric() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "ABC-12345")); assertTransactionalFlow(true); assertThrows(InvalidMessageIdException.class, this::runFlow); } @Test - public void testFailure_invalidEppResourceClassId() throws Exception { + void testFailure_invalidEppResourceClassId() throws Exception { setEppInput("poll_ack.xml", ImmutableMap.of("MSGID", "999-1-1-1")); assertTransactionalFlow(true); assertThrows(InvalidMessageIdException.class, this::runFlow); } @Test - public void testFailure_missingId() throws Exception { + void testFailure_missingId() throws Exception { setEppInput("poll_ack_missing_id.xml"); assertTransactionalFlow(true); assertThrows(MissingMessageIdException.class, this::runFlow); } @Test - public void testFailure_differentRegistrar() throws Exception { + void testFailure_differentRegistrar() throws Exception { persistResource( new PollMessage.OneTime.Builder() .setId(MESSAGE_ID) @@ -244,7 +244,7 @@ public class PollAckFlowTest extends FlowTestCase { } @Test - public void testFailure_messageInFuture() throws Exception { + void testFailure_messageInFuture() throws Exception { persistResource( new PollMessage.OneTime.Builder() .setId(MESSAGE_ID) diff --git a/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java b/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java index 4010b7537..71f24ac07 100644 --- a/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/poll/PollRequestFlowTest.java @@ -38,18 +38,18 @@ import google.registry.model.transfer.TransferResponse.ContactTransferResponse; import google.registry.model.transfer.TransferResponse.DomainTransferResponse; import google.registry.model.transfer.TransferStatus; import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link PollRequestFlow}. */ -public class PollRequestFlowTest extends FlowTestCase { +class PollRequestFlowTest extends FlowTestCase { private DomainBase domain; private ContactResource contact; private HostResource host; - @Before - public void setUp() { + @BeforeEach + void setUp() { setEppInput("poll.xml"); setClientIdForFlow("NewRegistrar"); clock.setTo(DateTime.parse("2011-01-02T01:01:01Z")); @@ -81,14 +81,14 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_domainTransferApproved() throws Exception { + void testSuccess_domainTransferApproved() throws Exception { persistPendingTransferPollMessage(); assertTransactionalFlow(false); runFlowAssertResponse(loadFile("poll_response_domain_transfer.xml")); } @Test - public void testSuccess_clTridNotSpecified() throws Exception { + void testSuccess_clTridNotSpecified() throws Exception { setEppInput("poll_no_cltrid.xml"); persistPendingTransferPollMessage(); assertTransactionalFlow(false); @@ -96,7 +96,7 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_contactTransferPending() throws Exception { + void testSuccess_contactTransferPending() throws Exception { clock.setTo(DateTime.parse("2000-06-13T22:00:00.0Z")); setClientIdForFlow("TheRegistrar"); persistResource( @@ -120,7 +120,7 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_domainPendingActionComplete() throws Exception { + void testSuccess_domainPendingActionComplete() throws Exception { persistResource( new PollMessage.OneTime.Builder() .setClientId(getClientIdForFlow()) @@ -135,7 +135,7 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_domainAutorenewMessage() throws Exception { + void testSuccess_domainAutorenewMessage() throws Exception { persistResource( new PollMessage.Autorenew.Builder() .setClientId(getClientIdForFlow()) @@ -149,12 +149,12 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_empty() throws Exception { + void testSuccess_empty() throws Exception { runFlowAssertResponse(loadFile("poll_response_empty.xml")); } @Test - public void testSuccess_wrongRegistrar() throws Exception { + void testSuccess_wrongRegistrar() throws Exception { persistResource( new PollMessage.OneTime.Builder() .setClientId("different client id") @@ -166,7 +166,7 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_futurePollMessage() throws Exception { + void testSuccess_futurePollMessage() throws Exception { persistResource( new PollMessage.OneTime.Builder() .setClientId(getClientIdForFlow()) @@ -178,7 +178,7 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_futureAutorenew() throws Exception { + void testSuccess_futureAutorenew() throws Exception { persistResource( new PollMessage.Autorenew.Builder() .setClientId(getClientIdForFlow()) @@ -192,7 +192,7 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_contactDelete() throws Exception { + void testSuccess_contactDelete() throws Exception { // Contact delete poll messages do not have any response data, so ensure that no // response data block is produced in the poll message. HistoryEntry historyEntry = persistResource(new HistoryEntry.Builder() @@ -213,7 +213,7 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testSuccess_hostDelete() throws Exception { + void testSuccess_hostDelete() throws Exception { // Host delete poll messages do not have any response data, so ensure that no // response data block is produced in the poll message. HistoryEntry historyEntry = persistResource(new HistoryEntry.Builder() @@ -234,7 +234,7 @@ public class PollRequestFlowTest extends FlowTestCase { } @Test - public void testFailure_messageIdProvided() throws Exception { + void testFailure_messageIdProvided() throws Exception { setEppInput("poll_with_id.xml"); assertTransactionalFlow(false); EppException thrown = assertThrows(UnexpectedMessageIdException.class, this::runFlow); diff --git a/core/src/test/java/google/registry/flows/session/HelloFlowTest.java b/core/src/test/java/google/registry/flows/session/HelloFlowTest.java index 7a16879f8..cb9ff530a 100644 --- a/core/src/test/java/google/registry/flows/session/HelloFlowTest.java +++ b/core/src/test/java/google/registry/flows/session/HelloFlowTest.java @@ -22,13 +22,13 @@ import com.google.common.collect.ImmutableMap; import google.registry.flows.EppException; import google.registry.flows.FlowTestCase; import google.registry.flows.FlowUtils.GenericXmlSyntaxErrorException; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** Unit tests for {@link HelloFlow}. */ -public class HelloFlowTest extends FlowTestCase { +class HelloFlowTest extends FlowTestCase { @Test - public void testHello() throws Exception { + void testHello() throws Exception { setEppInput("hello.xml"); assertTransactionalFlow(false); runFlowAssertResponse( @@ -37,7 +37,7 @@ public class HelloFlowTest extends FlowTestCase { } @Test - public void testGenericSyntaxException() { + void testGenericSyntaxException() { // This is a generic syntax test--we don't have a generic flow test case so this simple // test class will do. Note: the logic this tests is common to all flows. setEppInput("generic_syntax_exception.xml"); diff --git a/core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java b/core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java index 896630291..f95cefec1 100644 --- a/core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java +++ b/core/src/test/java/google/registry/flows/session/LoginFlowTestCase.java @@ -34,17 +34,17 @@ import google.registry.flows.session.LoginFlow.TooManyFailedLoginsException; import google.registry.flows.session.LoginFlow.UnsupportedLanguageException; import google.registry.model.registrar.Registrar; import google.registry.model.registrar.Registrar.State; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link LoginFlow}. */ public abstract class LoginFlowTestCase extends FlowTestCase { - Registrar registrar; - Registrar.Builder registrarBuilder; + private Registrar registrar; + private Registrar.Builder registrarBuilder; - @Before - public void initRegistrar() { + @BeforeEach + void initRegistrar() { sessionMetadata.setClientId(null); // Don't implicitly log in (all other flows need to). registrar = loadRegistrar("NewRegistrar"); registrarBuilder = registrar.asBuilder(); @@ -70,73 +70,73 @@ public abstract class LoginFlowTestCase extends FlowTestCase { } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { doSuccessfulTest("login_valid.xml"); } @Test - public void testSuccess_suspendedRegistrar() throws Exception { + void testSuccess_suspendedRegistrar() throws Exception { persistResource(getRegistrarBuilder().setState(State.SUSPENDED).build()); doSuccessfulTest("login_valid.xml"); } @Test - public void testSuccess_missingTypes() throws Exception { + void testSuccess_missingTypes() throws Exception { // We don't actually care if you list all the right types, as long as you don't add wrong ones. doSuccessfulTest("login_valid_missing_types.xml"); } @Test - public void testFailure_invalidVersion() { + void testFailure_invalidVersion() { doFailingTest("login_invalid_version.xml", UnimplementedProtocolVersionException.class); } @Test - public void testFailure_invalidLanguage() { + void testFailure_invalidLanguage() { doFailingTest("login_invalid_language.xml", UnsupportedLanguageException.class); } @Test - public void testFailure_invalidExtension() { + void testFailure_invalidExtension() { doFailingTest("login_invalid_extension.xml", UnimplementedExtensionException.class); } @Test - public void testFailure_invalidTypes() { + void testFailure_invalidTypes() { doFailingTest("login_invalid_types.xml", UnimplementedObjectServiceException.class); } @Test - public void testFailure_newPassword() { + void testFailure_newPassword() { doFailingTest("login_invalid_newpw.xml", PasswordChangesNotSupportedException.class); } @Test - public void testFailure_unknownRegistrar() { + void testFailure_unknownRegistrar() { deleteResource(getRegistrarBuilder().build()); doFailingTest("login_valid.xml", BadRegistrarClientIdException.class); } @Test - public void testFailure_pendingRegistrar() { + void testFailure_pendingRegistrar() { persistResource(getRegistrarBuilder().setState(State.PENDING).build()); doFailingTest("login_valid.xml", RegistrarAccountNotActiveException.class); } @Test - public void testFailure_disabledRegistrar() { + void testFailure_disabledRegistrar() { persistResource(getRegistrarBuilder().setState(State.DISABLED).build()); doFailingTest("login_valid.xml", RegistrarAccountNotActiveException.class); } @Test - public void testFailure_incorrectPassword() { + void testFailure_incorrectPassword() { persistResource(getRegistrarBuilder().setPassword("diff password").build()); doFailingTest("login_valid.xml", BadRegistrarPasswordException.class); } @Test - public void testFailure_tooManyFailedLogins() { + void testFailure_tooManyFailedLogins() { persistResource(getRegistrarBuilder().setPassword("diff password").build()); doFailingTest("login_valid.xml", BadRegistrarPasswordException.class); doFailingTest("login_valid.xml", BadRegistrarPasswordException.class); @@ -145,7 +145,7 @@ public abstract class LoginFlowTestCase extends FlowTestCase { } @Test - public void testFailure_alreadyLoggedIn() { + void testFailure_alreadyLoggedIn() { sessionMetadata.setClientId("something"); doFailingTest("login_valid.xml", AlreadyLoggedInException.class); } diff --git a/core/src/test/java/google/registry/flows/session/LoginFlowViaTlsTest.java b/core/src/test/java/google/registry/flows/session/LoginFlowViaTlsTest.java index 28504631e..baef6d1bb 100644 --- a/core/src/test/java/google/registry/flows/session/LoginFlowViaTlsTest.java +++ b/core/src/test/java/google/registry/flows/session/LoginFlowViaTlsTest.java @@ -26,7 +26,7 @@ import google.registry.model.registrar.Registrar; import google.registry.testing.CertificateSamples; import google.registry.util.CidrAddressBlock; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** Unit tests for {@link LoginFlow} when accessed via a TLS transport. */ public class LoginFlowViaTlsTest extends LoginFlowTestCase { @@ -47,14 +47,14 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase { } @Test - public void testSuccess_withGoodCredentials() throws Exception { + void testSuccess_withGoodCredentials() throws Exception { persistResource(getRegistrarBuilder().build()); credentials = new TlsCredentials(true, GOOD_CERT, GOOD_IP); doSuccessfulTest("login_valid.xml"); } @Test - public void testSuccess_withGoodCredentialsIpv6() throws Exception { + void testSuccess_withGoodCredentialsIpv6() throws Exception { persistResource( getRegistrarBuilder() .setIpAddressAllowList( @@ -65,7 +65,7 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase { } @Test - public void testSuccess_withIpv6AddressInSubnet() throws Exception { + void testSuccess_withIpv6AddressInSubnet() throws Exception { persistResource( getRegistrarBuilder() .setIpAddressAllowList( @@ -76,7 +76,7 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase { } @Test - public void testSuccess_withIpv4AddressInSubnet() throws Exception { + void testSuccess_withIpv4AddressInSubnet() throws Exception { persistResource( getRegistrarBuilder() .setIpAddressAllowList(ImmutableList.of(CidrAddressBlock.create("192.168.1.255/24"))) @@ -86,21 +86,21 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase { } @Test - public void testFailure_incorrectClientCertificateHash() { + void testFailure_incorrectClientCertificateHash() { persistResource(getRegistrarBuilder().build()); credentials = new TlsCredentials(true, BAD_CERT, GOOD_IP); doFailingTest("login_valid.xml", BadRegistrarCertificateException.class); } @Test - public void testFailure_missingClientCertificateHash() { + void testFailure_missingClientCertificateHash() { persistResource(getRegistrarBuilder().build()); credentials = new TlsCredentials(true, null, GOOD_IP); doFailingTest("login_valid.xml", MissingRegistrarCertificateException.class); } @Test - public void testFailure_missingClientIpAddress() { + void testFailure_missingClientIpAddress() { persistResource( getRegistrarBuilder() .setIpAddressAllowList( @@ -113,7 +113,7 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase { } @Test - public void testFailure_incorrectClientIpv4Address() { + void testFailure_incorrectClientIpv4Address() { persistResource( getRegistrarBuilder() .setIpAddressAllowList( @@ -126,7 +126,7 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase { } @Test - public void testFailure_incorrectClientIpv6Address() { + void testFailure_incorrectClientIpv6Address() { persistResource( getRegistrarBuilder() .setIpAddressAllowList( diff --git a/core/src/test/java/google/registry/flows/session/LogoutFlowTest.java b/core/src/test/java/google/registry/flows/session/LogoutFlowTest.java index 35eb5edbc..25db702e2 100644 --- a/core/src/test/java/google/registry/flows/session/LogoutFlowTest.java +++ b/core/src/test/java/google/registry/flows/session/LogoutFlowTest.java @@ -21,30 +21,30 @@ import static org.junit.Assert.assertThrows; import google.registry.flows.EppException; import google.registry.flows.FlowTestCase; import google.registry.flows.FlowUtils.NotLoggedInException; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link LogoutFlow}. */ -public class LogoutFlowTest extends FlowTestCase { +class LogoutFlowTest extends FlowTestCase { - public LogoutFlowTest() { + LogoutFlowTest() { setEppInput("logout.xml"); } - @Before - public void setupTld() { + @BeforeEach + void setupTld() { createTld("example"); } @Test - public void testSuccess() throws Exception { + void testSuccess() throws Exception { assertTransactionalFlow(false); // All flow tests are implicitly logged in, so logout should work. runFlowAssertResponse(loadFile("logout_response.xml")); } @Test - public void testFailure() { + void testFailure() { sessionMetadata.setClientId(null); // Turn off the implicit login EppException thrown = assertThrows(NotLoggedInException.class, this::runFlow); assertAboutEppExceptions().that(thrown).marshalsToXml(); diff --git a/core/src/test/java/google/registry/model/eppcommon/EppXmlTransformerTest.java b/core/src/test/java/google/registry/model/eppcommon/EppXmlTransformerTest.java index fe151c0b8..b9e2aff90 100644 --- a/core/src/test/java/google/registry/model/eppcommon/EppXmlTransformerTest.java +++ b/core/src/test/java/google/registry/model/eppcommon/EppXmlTransformerTest.java @@ -21,14 +21,13 @@ import static org.junit.Assert.assertThrows; import google.registry.model.eppinput.EppInput; import google.registry.model.eppoutput.EppOutput; -import google.registry.testing.ShardableTestCase; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Tests for {@link EppXmlTransformer}. */ @RunWith(JUnit4.class) -public class EppXmlTransformerTest extends ShardableTestCase { +public class EppXmlTransformerTest { @Test public void testUnmarshalingEppInput() throws Exception { diff --git a/core/src/test/java/google/registry/rdap/UpdateRegistrarRdapBaseUrlsActionTest.java b/core/src/test/java/google/registry/rdap/UpdateRegistrarRdapBaseUrlsActionTest.java index 0db6ca7da..8661c8121 100644 --- a/core/src/test/java/google/registry/rdap/UpdateRegistrarRdapBaseUrlsActionTest.java +++ b/core/src/test/java/google/registry/rdap/UpdateRegistrarRdapBaseUrlsActionTest.java @@ -35,7 +35,6 @@ import google.registry.model.registrar.RegistrarAddress; import google.registry.model.registry.Registry; import google.registry.model.registry.Registry.TldType; import google.registry.testing.AppEngineRule; -import google.registry.testing.ShardableTestCase; import java.util.ArrayList; import java.util.List; import org.junit.Before; @@ -46,7 +45,7 @@ import org.junit.runners.JUnit4; /** Unit tests for {@link UpdateRegistrarRdapBaseUrlsAction}. */ @RunWith(JUnit4.class) -public final class UpdateRegistrarRdapBaseUrlsActionTest extends ShardableTestCase { +public final class UpdateRegistrarRdapBaseUrlsActionTest { /** * Example reply from the MoSAPI server. diff --git a/core/src/test/java/google/registry/rde/BrdaCopyActionTest.java b/core/src/test/java/google/registry/rde/BrdaCopyActionTest.java index 3184ee52f..ca11c0ecc 100644 --- a/core/src/test/java/google/registry/rde/BrdaCopyActionTest.java +++ b/core/src/test/java/google/registry/rde/BrdaCopyActionTest.java @@ -34,7 +34,6 @@ import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.FakeKeyringModule; import google.registry.testing.GcsTestingUtils; import google.registry.testing.GpgSystemCommandRule; -import google.registry.testing.ShardableTestCase; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -52,7 +51,7 @@ import org.junit.runners.JUnit4; /** Unit tests for {@link BrdaCopyAction}. */ @RunWith(JUnit4.class) -public class BrdaCopyActionTest extends ShardableTestCase { +public class BrdaCopyActionTest { private static final ByteSource DEPOSIT_XML = RdeTestData.loadBytes("deposit_full.xml"); diff --git a/core/src/test/java/google/registry/rde/GhostrydeGpgIntegrationTest.java b/core/src/test/java/google/registry/rde/GhostrydeGpgIntegrationTest.java index 2fd025190..5af328a94 100644 --- a/core/src/test/java/google/registry/rde/GhostrydeGpgIntegrationTest.java +++ b/core/src/test/java/google/registry/rde/GhostrydeGpgIntegrationTest.java @@ -26,7 +26,6 @@ import google.registry.keyring.api.Keyring; import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.FakeKeyringModule; import google.registry.testing.GpgSystemCommandRule; -import google.registry.testing.ShardableTestCase; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -43,7 +42,7 @@ import org.junit.runner.RunWith; /** GnuPG integration tests for {@link Ghostryde}. */ @RunWith(Theories.class) @SuppressWarnings("resource") -public class GhostrydeGpgIntegrationTest extends ShardableTestCase { +public class GhostrydeGpgIntegrationTest { @Rule public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule(); diff --git a/core/src/test/java/google/registry/rde/RdeMarshallerTest.java b/core/src/test/java/google/registry/rde/RdeMarshallerTest.java index 8caf1f632..a142b8dc7 100644 --- a/core/src/test/java/google/registry/rde/RdeMarshallerTest.java +++ b/core/src/test/java/google/registry/rde/RdeMarshallerTest.java @@ -19,7 +19,6 @@ import static google.registry.testing.DatastoreHelper.loadRegistrar; import static google.registry.xml.ValidationMode.STRICT; import google.registry.testing.AppEngineRule; -import google.registry.testing.ShardableTestCase; import google.registry.xml.XmlTestUtils; import org.junit.Rule; import org.junit.Test; @@ -28,7 +27,7 @@ import org.junit.runners.JUnit4; /** Unit tests for {@link RdeMarshaller}. */ @RunWith(JUnit4.class) -public class RdeMarshallerTest extends ShardableTestCase { +public class RdeMarshallerTest { private static final String DECLARATION = "\n"; diff --git a/core/src/test/java/google/registry/rde/RegistrarToXjcConverterTest.java b/core/src/test/java/google/registry/rde/RegistrarToXjcConverterTest.java index e4941700b..f9037496b 100644 --- a/core/src/test/java/google/registry/rde/RegistrarToXjcConverterTest.java +++ b/core/src/test/java/google/registry/rde/RegistrarToXjcConverterTest.java @@ -28,7 +28,6 @@ import google.registry.model.registrar.RegistrarAddress; import google.registry.testing.AppEngineRule; import google.registry.testing.FakeClock; import google.registry.testing.InjectRule; -import google.registry.testing.ShardableTestCase; import google.registry.xjc.rderegistrar.XjcRdeRegistrar; import google.registry.xjc.rderegistrar.XjcRdeRegistrarAddrType; import google.registry.xjc.rderegistrar.XjcRdeRegistrarPostalInfoEnumType; @@ -45,11 +44,11 @@ import org.junit.runners.JUnit4; /** * Unit tests for {@link RegistrarToXjcConverter}. * - *

This tests the mapping between {@link Registrar} and {@link XjcRdeRegistrar} as well as - * some exceptional conditions. + *

This tests the mapping between {@link Registrar} and {@link XjcRdeRegistrar} as well as some + * exceptional conditions. */ @RunWith(JUnit4.class) -public class RegistrarToXjcConverterTest extends ShardableTestCase { +public class RegistrarToXjcConverterTest { @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastoreAndCloudSql().build(); diff --git a/core/src/test/java/google/registry/rde/RydeCompressionTest.java b/core/src/test/java/google/registry/rde/RydeCompressionTest.java index d08891cb2..d587e3902 100644 --- a/core/src/test/java/google/registry/rde/RydeCompressionTest.java +++ b/core/src/test/java/google/registry/rde/RydeCompressionTest.java @@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.io.ByteStreams; -import google.registry.testing.ShardableTestCase; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; @@ -28,7 +27,7 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) -public final class RydeCompressionTest extends ShardableTestCase { +public final class RydeCompressionTest { @Test public void testCompression_decompression() throws Exception { diff --git a/core/src/test/java/google/registry/rde/RydeEncryptionTest.java b/core/src/test/java/google/registry/rde/RydeEncryptionTest.java index 1182d3bfc..b306bbe5c 100644 --- a/core/src/test/java/google/registry/rde/RydeEncryptionTest.java +++ b/core/src/test/java/google/registry/rde/RydeEncryptionTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.io.ByteStreams; import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.FakeKeyringModule; -import google.registry.testing.ShardableTestCase; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; @@ -37,7 +36,7 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) -public final class RydeEncryptionTest extends ShardableTestCase { +public final class RydeEncryptionTest { @Rule public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule(); diff --git a/core/src/test/java/google/registry/rde/RydeFileEncodingTest.java b/core/src/test/java/google/registry/rde/RydeFileEncodingTest.java index 96a580298..821de2776 100644 --- a/core/src/test/java/google/registry/rde/RydeFileEncodingTest.java +++ b/core/src/test/java/google/registry/rde/RydeFileEncodingTest.java @@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.io.ByteStreams; -import google.registry.testing.ShardableTestCase; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.OutputStream; @@ -28,7 +27,7 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) -public final class RydeFileEncodingTest extends ShardableTestCase { +public final class RydeFileEncodingTest { @Test public void testEncodeDecode() throws Exception { diff --git a/core/src/test/java/google/registry/rde/RydeGpgIntegrationTest.java b/core/src/test/java/google/registry/rde/RydeGpgIntegrationTest.java index 119ed27c3..d323c254c 100644 --- a/core/src/test/java/google/registry/rde/RydeGpgIntegrationTest.java +++ b/core/src/test/java/google/registry/rde/RydeGpgIntegrationTest.java @@ -27,7 +27,6 @@ import google.registry.keyring.api.Keyring; import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.FakeKeyringModule; import google.registry.testing.GpgSystemCommandRule; -import google.registry.testing.ShardableTestCase; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -47,7 +46,7 @@ import org.junit.runner.RunWith; /** GPG combinatorial integration tests for the Ryde classes. */ @RunWith(Theories.class) @SuppressWarnings("resource") -public class RydeGpgIntegrationTest extends ShardableTestCase { +public class RydeGpgIntegrationTest { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); diff --git a/core/src/test/java/google/registry/rde/RydeTarTest.java b/core/src/test/java/google/registry/rde/RydeTarTest.java index f5ad09817..313851a09 100644 --- a/core/src/test/java/google/registry/rde/RydeTarTest.java +++ b/core/src/test/java/google/registry/rde/RydeTarTest.java @@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat; import static java.nio.charset.StandardCharsets.UTF_8; import com.google.common.io.ByteStreams; -import google.registry.testing.ShardableTestCase; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.OutputStream; @@ -28,7 +27,7 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) -public final class RydeTarTest extends ShardableTestCase { +public final class RydeTarTest { @Test public void testWriteRead() throws Exception { diff --git a/core/src/test/java/google/registry/testing/ShardableTestCase.java b/core/src/test/java/google/registry/testing/ShardableTestCase.java deleted file mode 100644 index 392177244..000000000 --- a/core/src/test/java/google/registry/testing/ShardableTestCase.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017 The Nomulus Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package google.registry.testing; - -import com.google.common.flogger.FluentLogger; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -/** - * Test case with 3 empty methods. - * - *

The sharding test runner fails if it produces an empty shard, and we shard 4 ways. This makes - * sure that we never produces empty shards. - */ -public abstract class ShardableTestCase { - - private static final FluentLogger logger = FluentLogger.forEnclosingClass(); - - @Rule - public final TestName testName = new TestName(); - - @Before - public void beforeShardable() { - logger.atInfo().log("Starting test %s", testName.getMethodName()); - } - - @After - public void afterShardable() { - logger.atInfo().log("Finishing test %s", testName.getMethodName()); - } - - @Test - public void testNothing1() {} - - @Test - public void testNothing2() {} - - @Test - public void testNothing3() {} -} diff --git a/core/src/test/java/google/registry/testing/mapreduce/MapreduceTestCase.java b/core/src/test/java/google/registry/testing/mapreduce/MapreduceTestCase.java index e11f2f878..c1ec1d7b8 100644 --- a/core/src/test/java/google/registry/testing/mapreduce/MapreduceTestCase.java +++ b/core/src/test/java/google/registry/testing/mapreduce/MapreduceTestCase.java @@ -36,7 +36,6 @@ import com.google.common.flogger.FluentLogger; import google.registry.mapreduce.MapreduceRunner; import google.registry.testing.AppEngineRule; import google.registry.testing.FakeClock; -import google.registry.testing.ShardableTestCase; import google.registry.util.AppEngineServiceUtils; import google.registry.util.AppEngineServiceUtilsImpl; import java.io.ByteArrayInputStream; @@ -68,7 +67,7 @@ import org.mockito.junit.MockitoRule; * * @param The type of the Action class that implements the mapreduce. */ -public abstract class MapreduceTestCase extends ShardableTestCase { +public abstract class MapreduceTestCase { private static final FluentLogger logger = FluentLogger.forEnclosingClass(); diff --git a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockPostActionTest.java b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockPostActionTest.java index 7851d23f4..ee6b416c1 100644 --- a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockPostActionTest.java +++ b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockPostActionTest.java @@ -269,8 +269,7 @@ public final class RegistryLockPostActionTest { public void testFailure_incorrectRegistrarIdForDomain() { persistResource(domain.asBuilder().setPersistedCurrentSponsorClientId("NewRegistrar").build()); Map response = action.handleJsonRequest(lockRequest()); - assertFailureWithMessage( - response, "Domain example.tld is not owned by registrar TheRegistrar"); + assertFailureWithMessage(response, "Domain example.tld is not owned by registrar TheRegistrar"); } @Test