Replace ExceptionRule with ExpectedException

This is in preparation for running the automatic refactoring script that
will replace all ExpectedExceptions with use of JUnit 4.13's assertThrows/
expectThrows.

Note that I have recorded the callsites of assertions about EppExceptions
being marshallable and will edit those specific assertions back in after
running the automatic refactoring script (which do not understand these).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178812403
This commit is contained in:
mcilwain 2017-12-12 14:10:10 -08:00 committed by jianglai
parent c5515ab4e6
commit 03c782f38e
142 changed files with 285 additions and 359 deletions

View file

@ -88,7 +88,6 @@ import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferData;
import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferResponse;
import google.registry.model.transfer.TransferStatus; import google.registry.model.transfer.TransferStatus;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import google.registry.testing.FakeSleeper; import google.registry.testing.FakeSleeper;
@ -103,6 +102,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -112,7 +112,7 @@ public class DeleteContactsAndHostsActionTest
extends MapreduceTestCase<DeleteContactsAndHostsAction> { extends MapreduceTestCase<DeleteContactsAndHostsAction> {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -43,7 +43,6 @@ import google.registry.model.poll.PollMessage;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.model.registry.Registry.TldType; import google.registry.model.registry.Registry.TldType;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import google.registry.testing.mapreduce.MapreduceTestCase; import google.registry.testing.mapreduce.MapreduceTestCase;
import java.util.Set; import java.util.Set;
@ -52,6 +51,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -62,7 +62,7 @@ public class DeleteProberDataActionTest extends MapreduceTestCase<DeleteProberDa
private static final DateTime DELETION_TIME = DateTime.parse("2010-01-01T00:00:00.000Z"); private static final DateTime DELETION_TIME = DateTime.parse("2010-01-01T00:00:00.000Z");
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Before @Before
public void init() { public void init() {

View file

@ -48,7 +48,6 @@ import google.registry.model.registry.Registry;
import google.registry.model.reporting.DomainTransactionRecord; import google.registry.model.reporting.DomainTransactionRecord;
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField; import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
@ -61,6 +60,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -70,7 +70,7 @@ public class ExpandRecurringBillingEventsActionTest
extends MapreduceTestCase<ExpandRecurringBillingEventsAction> { extends MapreduceTestCase<ExpandRecurringBillingEventsAction> {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -46,7 +46,6 @@ import com.google.appengine.tools.pipeline.impl.model.JobRecord;
import com.google.appengine.tools.pipeline.impl.model.ShardedValue; import com.google.appengine.tools.pipeline.impl.model.ShardedValue;
import com.google.appengine.tools.pipeline.impl.model.Slot; import com.google.appengine.tools.pipeline.impl.model.Slot;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import google.registry.testing.mapreduce.MapreduceTestCase; import google.registry.testing.mapreduce.MapreduceTestCase;
@ -55,6 +54,7 @@ import java.util.Optional;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -62,7 +62,7 @@ import org.junit.runners.JUnit4;
public class MapreduceEntityCleanupActionTest public class MapreduceEntityCleanupActionTest
extends MapreduceTestCase<MapreduceEntityCleanupAction> { extends MapreduceTestCase<MapreduceEntityCleanupAction> {
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
private static final DatastoreService datastore = getDatastoreService(); private static final DatastoreService datastore = getDatastoreService();
private static final FetchOptions FETCH_OPTIONS = FetchOptions.Builder.withChunkSize(200); private static final FetchOptions FETCH_OPTIONS = FetchOptions.Builder.withChunkSize(200);

View file

@ -46,7 +46,6 @@ import google.registry.flows.async.AsyncFlowEnqueuer;
import google.registry.flows.async.AsyncFlowMetrics; import google.registry.flows.async.AsyncFlowMetrics;
import google.registry.flows.async.AsyncFlowMetrics.OperationResult; import google.registry.flows.async.AsyncFlowMetrics.OperationResult;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import google.registry.testing.FakeSleeper; import google.registry.testing.FakeSleeper;
@ -61,6 +60,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -70,7 +70,7 @@ public class RefreshDnsOnHostRenameActionTest
extends MapreduceTestCase<RefreshDnsOnHostRenameAction> { extends MapreduceTestCase<RefreshDnsOnHostRenameAction> {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public InjectRule inject = new InjectRule(); public InjectRule inject = new InjectRule();

View file

@ -23,12 +23,12 @@ import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME; import static google.registry.util.DateTimeUtils.START_OF_TIME;
import com.google.api.services.bigquery.model.JobReference; import com.google.api.services.bigquery.model.JobReference;
import google.registry.testing.ExceptionRule;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -37,7 +37,7 @@ import org.junit.runners.JUnit4;
public class BigqueryUtilsTest { public class BigqueryUtilsTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private static final DateTime DATE_0 = DateTime.parse("2014-07-17T20:35:42Z"); private static final DateTime DATE_0 = DateTime.parse("2014-07-17T20:35:42Z");
private static final DateTime DATE_1 = DateTime.parse("2014-07-17T20:35:42.1Z"); private static final DateTime DATE_1 = DateTime.parse("2014-07-17T20:35:42.1Z");

View file

@ -20,7 +20,6 @@ import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import google.registry.model.ofy.CommitLogBucket; import google.registry.model.ofy.CommitLogBucket;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.testing.TaskQueueHelper.TaskMatcher;
import google.registry.util.Retrier; import google.registry.util.Retrier;
import google.registry.util.TaskEnqueuer; import google.registry.util.TaskEnqueuer;
@ -29,6 +28,7 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -40,7 +40,7 @@ public class CommitLogFanoutActionTest {
private static final String QUEUE = "the-queue"; private static final String QUEUE = "the-queue";
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()

View file

@ -32,7 +32,6 @@ import com.google.common.collect.ImmutableSet;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.model.registry.Registry.TldType; import google.registry.model.registry.Registry.TldType;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.testing.TaskQueueHelper.TaskMatcher;
import google.registry.util.Retrier; import google.registry.util.Retrier;
@ -42,6 +41,7 @@ import java.util.Optional;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -54,7 +54,7 @@ public class TldFanoutActionTest {
private final FakeResponse response = new FakeResponse(); private final FakeResponse response = new FakeResponse();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()

View file

@ -26,7 +26,6 @@ import google.registry.model.ofy.Ofy;
import google.registry.request.HttpException.NotFoundException; import google.registry.request.HttpException.NotFoundException;
import google.registry.request.RequestModule; import google.registry.request.RequestModule;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -37,6 +36,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -51,7 +51,7 @@ public final class DnsInjectionTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -19,11 +19,11 @@ import static google.registry.testing.TaskQueueHelper.assertNoTasksEnqueued;
import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued; import static google.registry.testing.TaskQueueHelper.assertTasksEnqueued;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.testing.TaskQueueHelper.TaskMatcher;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -38,7 +38,7 @@ public class DnsQueueTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private DnsQueue dnsQueue; private DnsQueue dnsQueue;

View file

@ -32,7 +32,6 @@ import google.registry.model.ofy.Ofy;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.request.HttpException.ServiceUnavailableException; import google.registry.request.HttpException.ServiceUnavailableException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeLockHandler; import google.registry.testing.FakeLockHandler;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
@ -41,6 +40,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -58,7 +58,7 @@ public class PublishDnsUpdatesActionTest {
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final FakeClock clock = new FakeClock(DateTime.parse("1971-01-01TZ")); private final FakeClock clock = new FakeClock(DateTime.parse("1971-01-01TZ"));
private final FakeLockHandler lockHandler = new FakeLockHandler(true); private final FakeLockHandler lockHandler = new FakeLockHandler(true);

View file

@ -27,11 +27,11 @@ import google.registry.model.domain.DomainResource;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
import google.registry.request.HttpException.NotFoundException; import google.registry.request.HttpException.NotFoundException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -46,7 +46,7 @@ public class RefreshDnsActionTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final DnsQueue dnsQueue = mock(DnsQueue.class); private final DnsQueue dnsQueue = mock(DnsQueue.class);
private final FakeClock clock = new FakeClock(); private final FakeClock clock = new FakeClock();

View file

@ -45,7 +45,6 @@ import google.registry.model.domain.secdns.DelegationSignerData;
import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.util.Retrier; import google.registry.util.Retrier;
import google.registry.util.SystemClock; import google.registry.util.SystemClock;
import google.registry.util.SystemSleeper; import google.registry.util.SystemSleeper;
@ -57,6 +56,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.Captor; import org.mockito.Captor;
@ -85,7 +85,7 @@ public class CloudDnsWriterTest {
private CloudDnsWriter writer; private CloudDnsWriter writer;
private ImmutableSet<ResourceRecordSet> stubZone; private ImmutableSet<ResourceRecordSet> stubZone;
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();

View file

@ -22,7 +22,6 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import com.google.common.base.VerifyException; import com.google.common.base.VerifyException;
import google.registry.testing.ExceptionRule;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.EOFException; import java.io.EOFException;
@ -37,6 +36,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import org.xbill.DNS.ARecord; import org.xbill.DNS.ARecord;
@ -64,7 +64,7 @@ public class DnsMessageTransportTest {
private DnsMessageTransport resolver; private DnsMessageTransport resolver;
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Before @Before
public void before() throws Exception { public void before() throws Exception {

View file

@ -42,7 +42,6 @@ import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.model.ofy.Ofy; import google.registry.model.ofy.Ofy;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import java.util.ArrayList; import java.util.ArrayList;
@ -53,6 +52,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.Captor; import org.mockito.Captor;
@ -77,7 +77,7 @@ public class DnsUpdateWriterTest {
AppEngineRule.builder().withDatastore().withTaskQueue().build(); AppEngineRule.builder().withDatastore().withTaskQueue().build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -37,7 +37,6 @@ import google.registry.export.BigqueryPollJobAction.BigqueryPollJobEnqueuer;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
import google.registry.request.HttpException.NotModifiedException; import google.registry.request.HttpException.NotModifiedException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeSleeper; import google.registry.testing.FakeSleeper;
import google.registry.testing.TaskQueueHelper; import google.registry.testing.TaskQueueHelper;
@ -56,6 +55,7 @@ import java.util.logging.Logger;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -70,7 +70,7 @@ public class BigqueryPollJobActionTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private static final String PROJECT_ID = "project_id"; private static final String PROJECT_ID = "project_id";
private static final String JOB_ID = "job_id"; private static final String JOB_ID = "job_id";

View file

@ -30,7 +30,6 @@ import google.registry.request.HttpException.BadRequestException;
import google.registry.request.HttpException.NoContentException; import google.registry.request.HttpException.NoContentException;
import google.registry.request.HttpException.NotModifiedException; import google.registry.request.HttpException.NotModifiedException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
@ -41,6 +40,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -53,7 +53,7 @@ public class CheckSnapshotActionTest {
@Rule public final InjectRule inject = new InjectRule(); @Rule public final InjectRule inject = new InjectRule();
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withTaskQueue().build(); @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withTaskQueue().build();
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
private final DatastoreBackupService backupService = mock(DatastoreBackupService.class); private final DatastoreBackupService backupService = mock(DatastoreBackupService.class);

View file

@ -24,7 +24,6 @@ import com.google.appengine.api.datastore.Text;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import google.registry.export.DatastoreBackupInfo.BackupStatus; import google.registry.export.DatastoreBackupInfo.BackupStatus;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import java.util.Date; import java.util.Date;
@ -33,6 +32,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -41,7 +41,7 @@ import org.junit.runners.JUnit4;
public class DatastoreBackupInfoTest { public class DatastoreBackupInfoTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -26,7 +26,6 @@ import com.google.appengine.api.modules.ModulesService;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.testing.TaskQueueHelper.TaskMatcher;
import java.util.Date; import java.util.Date;
@ -34,6 +33,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -42,7 +42,7 @@ import org.junit.runners.JUnit4;
public class DatastoreBackupServiceTest { public class DatastoreBackupServiceTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -44,7 +44,6 @@ import google.registry.export.BigqueryPollJobAction.BigqueryPollJobEnqueuer;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
import google.registry.request.HttpException.InternalServerErrorException; import google.registry.request.HttpException.InternalServerErrorException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.testing.TaskQueueHelper.TaskMatcher;
import java.io.IOException; import java.io.IOException;
@ -53,6 +52,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
@ -67,7 +67,7 @@ public class LoadSnapshotActionTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final BigqueryFactory bigqueryFactory = mock(BigqueryFactory.class); private final BigqueryFactory bigqueryFactory = mock(BigqueryFactory.class);
private final Bigquery bigquery = mock(Bigquery.class); private final Bigquery bigquery = mock(Bigquery.class);

View file

@ -39,13 +39,13 @@ import google.registry.request.HttpException.BadRequestException;
import google.registry.request.HttpException.InternalServerErrorException; import google.registry.request.HttpException.InternalServerErrorException;
import google.registry.storage.drive.DriveConnection; import google.registry.storage.drive.DriveConnection;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -54,7 +54,7 @@ import org.junit.runners.JUnit4;
public class PublishDetailReportActionTest { public class PublishDetailReportActionTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()

View file

@ -40,7 +40,6 @@ import google.registry.model.registrar.Registrar;
import google.registry.model.registrar.RegistrarContact; import google.registry.model.registrar.RegistrarContact;
import google.registry.request.Response; import google.registry.request.Response;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeSleeper; import google.registry.testing.FakeSleeper;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
@ -48,6 +47,7 @@ import google.registry.util.Retrier;
import java.io.IOException; import java.io.IOException;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -66,7 +66,7 @@ public class SyncGroupMembersActionTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -36,12 +36,12 @@ import com.google.common.collect.Iterables;
import google.registry.bigquery.BigqueryFactory; import google.registry.bigquery.BigqueryFactory;
import google.registry.request.HttpException.InternalServerErrorException; import google.registry.request.HttpException.InternalServerErrorException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.testing.TaskQueueHelper.TaskMatcher;
import java.io.IOException; import java.io.IOException;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
@ -57,7 +57,7 @@ public class UpdateSnapshotViewActionTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final BigqueryFactory bigqueryFactory = mock(BigqueryFactory.class); private final BigqueryFactory bigqueryFactory = mock(BigqueryFactory.class);
private final Bigquery bigquery = mock(Bigquery.class); private final Bigquery bigquery = mock(Bigquery.class);

View file

@ -31,7 +31,6 @@ import google.registry.model.ofy.Ofy;
import google.registry.monitoring.whitebox.EppMetric; import google.registry.monitoring.whitebox.EppMetric;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.EppLoader; import google.registry.testing.EppLoader;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeHttpSession; import google.registry.testing.FakeHttpSession;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
@ -40,6 +39,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -54,7 +54,7 @@ public class EppCommitLogsTest extends ShardableTestCase {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -21,10 +21,10 @@ import static google.registry.util.ResourceUtils.readResourceBytes;
import google.registry.model.eppinput.EppInput; import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppOutput; import google.registry.model.eppoutput.EppOutput;
import google.registry.testing.ExceptionRule;
import google.registry.testing.ShardableTestCase; import google.registry.testing.ShardableTestCase;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -33,7 +33,7 @@ import org.junit.runners.JUnit4;
public class EppXmlTransformerTest extends ShardableTestCase { public class EppXmlTransformerTest extends ShardableTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testUnmarshalingEppInput() throws Exception { public void testUnmarshalingEppInput() throws Exception {

View file

@ -33,12 +33,12 @@ import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
import google.registry.model.eppinput.EppInput; import google.registry.model.eppinput.EppInput;
import google.registry.model.eppinput.EppInput.CommandExtension; import google.registry.model.eppinput.EppInput.CommandExtension;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.util.TypeUtils; import google.registry.util.TypeUtils;
import java.util.logging.LogRecord; import java.util.logging.LogRecord;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -52,7 +52,7 @@ public class ExtensionManagerTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testDuplicateExtensionsForbidden() throws Exception { public void testDuplicateExtensionsForbidden() throws Exception {

View file

@ -49,7 +49,6 @@ import google.registry.model.tmch.ClaimsListShard.ClaimsListSingleton;
import google.registry.monitoring.whitebox.EppMetric; import google.registry.monitoring.whitebox.EppMetric;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.EppLoader; import google.registry.testing.EppLoader;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeHttpSession; import google.registry.testing.FakeHttpSession;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
@ -64,6 +63,7 @@ import java.util.Map;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -88,7 +88,7 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -19,10 +19,10 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
import google.registry.testing.ExceptionRule;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -30,7 +30,7 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public final class TlsCredentialsTest { public final class TlsCredentialsTest {
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testProvideClientCertificateHash() { public void testProvideClientCertificateHash() {

View file

@ -47,12 +47,12 @@ import com.google.api.services.groupssettings.model.Groups;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import google.registry.groups.GroupsConnection.Role; import google.registry.groups.GroupsConnection.Role;
import google.registry.testing.ExceptionRule;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -63,7 +63,7 @@ import org.junit.runners.JUnit4;
public class DirectoryGroupsConnectionTest { public class DirectoryGroupsConnectionTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final Directory directory = mock(Directory.class); private final Directory directory = mock(Directory.class);
private final Groupssettings groupsSettings = mock(Groupssettings.class); private final Groupssettings groupsSettings = mock(Groupssettings.class);

View file

@ -39,7 +39,6 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.index.EppResourceIndex; import google.registry.model.index.EppResourceIndex;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
@ -52,6 +51,7 @@ import org.joda.time.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -65,7 +65,7 @@ public class ChildEntityInputTest {
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
DomainResource domainA; DomainResource domainA;
DomainResource domainB; DomainResource domainB;

View file

@ -39,7 +39,6 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.model.index.EppResourceIndex; import google.registry.model.index.EppResourceIndex;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
@ -49,6 +48,7 @@ import java.util.NoSuchElementException;
import java.util.Set; import java.util.Set;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -62,7 +62,7 @@ public class EppResourceInputsTest {
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private <T> T serializeAndDeserialize(T obj) throws Exception { private <T> T serializeAndDeserialize(T obj) throws Exception {

View file

@ -26,7 +26,6 @@ import static org.joda.time.DateTimeZone.UTC;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.model.ofy.Ofy; import google.registry.model.ofy.Ofy;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@ -34,6 +33,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -48,7 +48,7 @@ public class EppResourceUtilsTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -19,12 +19,12 @@ import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.googlecode.objectify.annotation.Id; import com.googlecode.objectify.annotation.Id;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -33,7 +33,7 @@ import org.junit.runners.JUnit4;
public class ModelUtilsTest { public class ModelUtilsTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public AppEngineRule appEngineRule = new AppEngineRule.Builder().build(); public AppEngineRule appEngineRule = new AppEngineRule.Builder().build();

View file

@ -32,18 +32,18 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod; import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.ExceptionRule;
import org.joda.money.Money; import org.joda.money.Money;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link BillingEvent}. */ /** Unit tests for {@link BillingEvent}. */
public class BillingEventTest extends EntityTestCase { public class BillingEventTest extends EntityTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final DateTime now = DateTime.now(UTC); private final DateTime now = DateTime.now(UTC);

View file

@ -22,12 +22,12 @@ import static org.joda.money.CurrencyUnit.USD;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
import google.registry.testing.ExceptionRule;
import org.joda.money.CurrencyMismatchException; import org.joda.money.CurrencyMismatchException;
import org.joda.money.Money; import org.joda.money.Money;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -36,7 +36,7 @@ import org.junit.runners.JUnit4;
public final class RegistrarBillingEntryTest extends EntityTestCase { public final class RegistrarBillingEntryTest extends EntityTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testIndexing() throws Exception { public void testIndexing() throws Exception {

View file

@ -28,7 +28,6 @@ import google.registry.model.EntityTestCase;
import google.registry.model.billing.RegistrarCredit.CreditType; import google.registry.model.billing.RegistrarCredit.CreditType;
import google.registry.model.billing.RegistrarCreditBalance.BalanceMap; import google.registry.model.billing.RegistrarCreditBalance.BalanceMap;
import google.registry.model.registrar.Registrar; import google.registry.model.registrar.Registrar;
import google.registry.testing.ExceptionRule;
import java.util.Map; import java.util.Map;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.money.Money; import org.joda.money.Money;
@ -36,12 +35,13 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link RegistrarCreditBalance}. */ /** Unit tests for {@link RegistrarCreditBalance}. */
public class RegistrarCreditBalanceTest extends EntityTestCase { public class RegistrarCreditBalanceTest extends EntityTestCase {
@Rule @Rule
public ExceptionRule thrown = new ExceptionRule(); public ExpectedException thrown = ExpectedException.none();
private DateTime then = clock.nowUtc().plusDays(1); private DateTime then = clock.nowUtc().plusDays(1);

View file

@ -26,17 +26,17 @@ import google.registry.model.EntityTestCase;
import google.registry.model.billing.RegistrarCredit.CreditType; import google.registry.model.billing.RegistrarCredit.CreditType;
import google.registry.model.registrar.Registrar; import google.registry.model.registrar.Registrar;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.testing.ExceptionRule;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link RegistrarCredit}. */ /** Unit tests for {@link RegistrarCredit}. */
public class RegistrarCreditTest extends EntityTestCase { public class RegistrarCreditTest extends EntityTestCase {
@Rule @Rule
public ExceptionRule thrown = new ExceptionRule(); public ExpectedException thrown = ExpectedException.none();
private RegistrarCredit auctionCredit; private RegistrarCredit auctionCredit;
private RegistrarCredit promoCredit; private RegistrarCredit promoCredit;

View file

@ -26,15 +26,15 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.testing.ExceptionRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link Cursor}. */ /** Unit tests for {@link Cursor}. */
public class CursorTest extends EntityTestCase { public class CursorTest extends EntityTestCase {
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testSuccess_persistScopedCursor() { public void testSuccess_persistScopedCursor() {

View file

@ -20,10 +20,10 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Range; import com.google.common.collect.Range;
import google.registry.testing.ExceptionRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -36,7 +36,7 @@ public class TimeOfYearTest {
private static final DateTime march1 = DateTime.parse("2012-03-01T01:02:03.0Z"); private static final DateTime march1 = DateTime.parse("2012-03-01T01:02:03.0Z");
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testSuccess_fromDateTime() throws Exception { public void testSuccess_fromDateTime() throws Exception {

View file

@ -22,13 +22,13 @@ import static org.joda.time.DateTimeZone.UTC;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedMap;
import google.registry.testing.ExceptionRule;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -37,7 +37,7 @@ import org.junit.runners.JUnit4;
public class TimedTransitionPropertyTest { public class TimedTransitionPropertyTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private static final DateTime A_LONG_TIME_AGO = new DateTime(Long.MIN_VALUE, UTC); private static final DateTime A_LONG_TIME_AGO = new DateTime(Long.MIN_VALUE, UTC);

View file

@ -36,16 +36,16 @@ import google.registry.model.eppcommon.Trid;
import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferData;
import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
import google.registry.model.transfer.TransferStatus; import google.registry.model.transfer.TransferStatus;
import google.registry.testing.ExceptionRule;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link ContactResource}. */ /** Unit tests for {@link ContactResource}. */
public class ContactResourceTest extends EntityTestCase { public class ContactResourceTest extends EntityTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
ContactResource contactResource; ContactResource contactResource;

View file

@ -39,17 +39,17 @@ import google.registry.model.eppcommon.StatusValue;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.model.smd.EncodedSignedMark; import google.registry.model.smd.EncodedSignedMark;
import google.registry.testing.ExceptionRule;
import org.joda.money.Money; import org.joda.money.Money;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link DomainApplication}. */ /** Unit tests for {@link DomainApplication}. */
public class DomainApplicationTest extends EntityTestCase { public class DomainApplicationTest extends EntityTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
DomainApplication domainApplication; DomainApplication domainApplication;

View file

@ -51,19 +51,19 @@ import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferData;
import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
import google.registry.model.transfer.TransferStatus; import google.registry.model.transfer.TransferStatus;
import google.registry.testing.ExceptionRule;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.joda.money.Money; import org.joda.money.Money;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link DomainResource}. */ /** Unit tests for {@link DomainResource}. */
public class DomainResourceTest extends EntityTestCase { public class DomainResourceTest extends EntityTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
DomainResource domain; DomainResource domain;

View file

@ -24,13 +24,13 @@ import google.registry.model.billing.BillingEvent.Recurring;
import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.money.Money; import org.joda.money.Money;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -44,7 +44,7 @@ public class GracePeriodTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final DateTime now = DateTime.now(UTC); private final DateTime now = DateTime.now(UTC);
private BillingEvent.OneTime onetime; private BillingEvent.OneTime onetime;

View file

@ -25,10 +25,10 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.ExceptionRule;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link LrpTokenEntity}. */ /** Unit tests for {@link LrpTokenEntity}. */
public class LrpTokenEntityTest extends EntityTestCase { public class LrpTokenEntityTest extends EntityTestCase {
@ -37,7 +37,7 @@ public class LrpTokenEntityTest extends EntityTestCase {
LrpTokenEntity redeemedToken; LrpTokenEntity redeemedToken;
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {

View file

@ -33,18 +33,18 @@ import google.registry.model.eppcommon.Trid;
import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferData;
import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
import google.registry.model.transfer.TransferStatus; import google.registry.model.transfer.TransferStatus;
import google.registry.testing.ExceptionRule;
import java.net.InetAddress; import java.net.InetAddress;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link HostResource}. */ /** Unit tests for {@link HostResource}. */
public class HostResourceTest extends EntityTestCase { public class HostResourceTest extends EntityTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
final DateTime day3 = clock.nowUtc(); final DateTime day3 = clock.nowUtc();
final DateTime day2 = day3.minusDays(1); final DateTime day2 = day3.minusDays(1);

View file

@ -30,17 +30,17 @@ import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
import google.registry.model.domain.DomainApplication; import google.registry.model.domain.DomainApplication;
import google.registry.testing.ExceptionRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link DomainApplicationIndex}. */ /** Unit tests for {@link DomainApplicationIndex}. */
public class DomainApplicationIndexTest extends EntityTestCase { public class DomainApplicationIndexTest extends EntityTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Before @Before
public void init() throws Exception { public void init() throws Exception {

View file

@ -26,16 +26,16 @@ import com.googlecode.objectify.Key;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.model.index.ForeignKeyIndex.ForeignKeyHostIndex; import google.registry.model.index.ForeignKeyIndex.ForeignKeyHostIndex;
import google.registry.testing.ExceptionRule;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link ForeignKeyIndex}. */ /** Unit tests for {@link ForeignKeyIndex}. */
public class ForeignKeyIndexTest extends EntityTestCase { public class ForeignKeyIndexTest extends EntityTestCase {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {

View file

@ -25,11 +25,11 @@ import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.annotation.Cache; import com.googlecode.objectify.annotation.Cache;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -46,7 +46,7 @@ public class CommitLogBucketTest {
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
CommitLogBucket bucket; CommitLogBucket bucket;

View file

@ -20,10 +20,10 @@ import static org.joda.time.DateTimeZone.UTC;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -37,7 +37,7 @@ public class CommitLogCheckpointTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private static final DateTime T1 = START_OF_TIME; private static final DateTime T1 = START_OF_TIME;
private static final DateTime T2 = START_OF_TIME.plusMillis(1); private static final DateTime T2 = START_OF_TIME.plusMillis(1);

View file

@ -30,7 +30,6 @@ import google.registry.model.BackupGroupRoot;
import google.registry.model.ImmutableObject; import google.registry.model.ImmutableObject;
import google.registry.model.common.EntityGroupRoot; import google.registry.model.common.EntityGroupRoot;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import google.registry.testing.TestObject.TestVirtualObject; import google.registry.testing.TestObject.TestVirtualObject;
@ -38,6 +37,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -51,7 +51,7 @@ public class OfyCommitLogTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -28,11 +28,11 @@ import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id; import com.googlecode.objectify.annotation.Id;
import google.registry.model.contact.ContactResource; import google.registry.model.contact.ContactResource;
import google.registry.testing.ExceptionRule;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -64,7 +64,7 @@ public class OfyFilterTest {
} }
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
/** /**
* Key.create looks up kind metadata for the class of the object it is given. If this happens * Key.create looks up kind metadata for the class of the object it is given. If this happens

View file

@ -48,7 +48,6 @@ import google.registry.model.eppcommon.Trid;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.DatastoreHelper; import google.registry.testing.DatastoreHelper;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.util.SystemClock; import google.registry.util.SystemClock;
import java.util.ConcurrentModificationException; import java.util.ConcurrentModificationException;
@ -56,6 +55,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -69,7 +69,7 @@ public class OfyTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
/** An entity to use in save and delete tests. */ /** An entity to use in save and delete tests. */
private HistoryEntry someObject; private HistoryEntry someObject;

View file

@ -32,13 +32,13 @@ import google.registry.model.ofy.Ofy;
import google.registry.model.poll.PollMessageExternalKeyConverter.PollMessageExternalKeyParseException; import google.registry.model.poll.PollMessageExternalKeyConverter.PollMessageExternalKeyParseException;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -55,7 +55,7 @@ public class PollMessageExternalKeyConverterTest {
public InjectRule inject = new InjectRule(); public InjectRule inject = new InjectRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
HistoryEntry historyEntry; HistoryEntry historyEntry;
FakeClock clock = new FakeClock(DateTime.parse("2007-07-07T01:01:01Z")); FakeClock clock = new FakeClock(DateTime.parse("2007-07-07T01:01:01Z"));

View file

@ -20,10 +20,10 @@ import static google.registry.model.rde.RdeMode.THIN;
import static google.registry.model.rde.RdeNamingUtils.makePartialName; import static google.registry.model.rde.RdeNamingUtils.makePartialName;
import static google.registry.model.rde.RdeNamingUtils.makeRydeFilename; import static google.registry.model.rde.RdeNamingUtils.makeRydeFilename;
import google.registry.testing.ExceptionRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -32,7 +32,7 @@ import org.junit.runners.JUnit4;
public class RdeNamingUtilsTest { public class RdeNamingUtilsTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testMakeRydeFilename_rdeDeposit() throws Exception { public void testMakeRydeFilename_rdeDeposit() throws Exception {

View file

@ -23,10 +23,10 @@ import static google.registry.model.rde.RdeRevision.saveRevision;
import com.google.common.base.VerifyException; import com.google.common.base.VerifyException;
import com.googlecode.objectify.VoidWork; import com.googlecode.objectify.VoidWork;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -38,7 +38,7 @@ public class RdeRevisionTest {
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testGetNextRevision_objectDoesntExist_returnsZero() throws Exception { public void testGetNextRevision_objectDoesntExist_returnsZero() throws Exception {

View file

@ -37,18 +37,18 @@ import google.registry.model.EntityTestCase;
import google.registry.model.common.EntityGroupRoot; import google.registry.model.common.EntityGroupRoot;
import google.registry.model.registrar.Registrar.State; import google.registry.model.registrar.Registrar.State;
import google.registry.model.registrar.Registrar.Type; import google.registry.model.registrar.Registrar.Type;
import google.registry.testing.ExceptionRule;
import google.registry.util.CidrAddressBlock; import google.registry.util.CidrAddressBlock;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link Registrar}. */ /** Unit tests for {@link Registrar}. */
public class RegistrarTest extends EntityTestCase { public class RegistrarTest extends EntityTestCase {
@Rule @Rule
public ExceptionRule thrown = new ExceptionRule(); public ExpectedException thrown = ExpectedException.none();
private Registrar registrar; private Registrar registrar;
private RegistrarContact abuseAdminContact; private RegistrarContact abuseAdminContact;

View file

@ -20,9 +20,9 @@ import static google.registry.testing.DatastoreHelper.createTlds;
import com.google.common.net.InternetDomainName; import com.google.common.net.InternetDomainName;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -34,7 +34,7 @@ public class RegistriesTest {
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule @Rule
public ExceptionRule thrown = new ExceptionRule(); public ExpectedException thrown = ExpectedException.none();
private void initTestTlds() { private void initTestTlds() {
createTlds("foo", "a.b.c"); // Test a multipart tld. createTlds("foo", "a.b.c"); // Test a multipart tld.

View file

@ -40,18 +40,18 @@ import google.registry.model.registry.Registry.RegistryNotFoundException;
import google.registry.model.registry.Registry.TldState; import google.registry.model.registry.Registry.TldState;
import google.registry.model.registry.label.PremiumList; import google.registry.model.registry.label.PremiumList;
import google.registry.model.registry.label.ReservedList; import google.registry.model.registry.label.ReservedList;
import google.registry.testing.ExceptionRule;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.joda.money.Money; import org.joda.money.Money;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
/** Unit tests for {@link Registry}. */ /** Unit tests for {@link Registry}. */
public class RegistryTest extends EntityTestCase { public class RegistryTest extends EntityTestCase {
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
Registry registry; Registry registry;

View file

@ -26,10 +26,10 @@ import com.google.common.collect.ImmutableList;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.model.registry.label.PremiumList.PremiumListRevision; import google.registry.model.registry.label.PremiumList.PremiumListRevision;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -37,7 +37,7 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class PremiumListTest { public class PremiumListTest {
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Before @Before

View file

@ -47,12 +47,12 @@ import google.registry.model.registry.Registry;
import google.registry.model.registry.label.PremiumList.PremiumListEntry; import google.registry.model.registry.label.PremiumList.PremiumListEntry;
import google.registry.model.registry.label.PremiumList.PremiumListRevision; import google.registry.model.registry.label.PremiumList.PremiumListRevision;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import java.util.Map; import java.util.Map;
import org.joda.money.Money; import org.joda.money.Money;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -60,7 +60,7 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class PremiumListUtilsTest { public class PremiumListUtilsTest {
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Before @Before

View file

@ -43,13 +43,13 @@ import google.registry.model.ofy.Ofy;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.model.registry.label.ReservedList.ReservedListEntry; import google.registry.model.registry.label.ReservedList.ReservedListEntry;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -61,7 +61,7 @@ public class ReservedListTest {
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()

View file

@ -20,10 +20,10 @@ import static google.registry.testing.DatastoreHelper.persistResource;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -32,7 +32,7 @@ public class KmsSecretRevisionTest {
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
private KmsSecretRevision secretRevision; private KmsSecretRevision secretRevision;

View file

@ -27,7 +27,6 @@ import static org.mockito.Mockito.when;
import google.registry.model.ofy.Ofy; import google.registry.model.ofy.Ofy;
import google.registry.model.server.Lock.LockState; import google.registry.model.server.Lock.LockState;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import google.registry.util.RequestStatusChecker; import google.registry.util.RequestStatusChecker;
@ -36,6 +35,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -58,7 +58,7 @@ public class LockTest {
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private Optional<Lock> acquire(String tld, Duration leaseLength, LockState expectedLockState) { private Optional<Lock> acquire(String tld, Duration leaseLength, LockState expectedLockState) {
Lock.lockMetrics = mock(LockMetrics.class); Lock.lockMetrics = mock(LockMetrics.class);

View file

@ -22,11 +22,11 @@ import static org.joda.time.Duration.standardDays;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -40,7 +40,7 @@ public class SignedMarkRevocationListTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final FakeClock clock = new FakeClock(DateTime.parse("2013-01-01T00:00:00Z")); private final FakeClock clock = new FakeClock(DateTime.parse("2013-01-01T00:00:00Z"));

View file

@ -24,7 +24,6 @@ import com.googlecode.objectify.Key;
import google.registry.model.tmch.ClaimsListShard.ClaimsListRevision; import google.registry.model.tmch.ClaimsListShard.ClaimsListRevision;
import google.registry.model.tmch.ClaimsListShard.UnshardedSaveException; import google.registry.model.tmch.ClaimsListShard.UnshardedSaveException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -33,6 +32,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -46,7 +46,7 @@ public class ClaimsListShardTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -28,7 +28,6 @@ import google.registry.model.common.CrossTldSingleton;
import google.registry.model.ofy.CommitLogManifest; import google.registry.model.ofy.CommitLogManifest;
import google.registry.model.ofy.Ofy; import google.registry.model.ofy.Ofy;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import java.util.List; import java.util.List;
@ -36,6 +35,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -59,7 +59,7 @@ public class CommitLogRevisionsTranslatorFactoryTest {
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final FakeClock clock = new FakeClock(START_TIME); private final FakeClock clock = new FakeClock(START_TIME);

View file

@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableSortedMap;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.model.registry.label.PremiumList; import google.registry.model.registry.label.PremiumList;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.util.Clock; import google.registry.util.Clock;
import org.joda.money.Money; import org.joda.money.Money;
@ -36,6 +35,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -44,7 +44,7 @@ import org.junit.runners.JUnit4;
public class PricingEngineProxyTest { public class PricingEngineProxyTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()

View file

@ -17,9 +17,9 @@ package google.registry.rdap;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import google.registry.request.HttpException.UnprocessableEntityException; import google.registry.request.HttpException.UnprocessableEntityException;
import google.registry.testing.ExceptionRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -28,7 +28,7 @@ import org.junit.runners.JUnit4;
public class RdapSearchPatternTest { public class RdapSearchPatternTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testNoWildcards_ok() throws Exception { public void testNoWildcards_ok() throws Exception {

View file

@ -30,7 +30,6 @@ import google.registry.rde.EscrowTaskRunner.EscrowTask;
import google.registry.request.HttpException.NoContentException; import google.registry.request.HttpException.NoContentException;
import google.registry.request.HttpException.ServiceUnavailableException; import google.registry.request.HttpException.ServiceUnavailableException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeLockHandler; import google.registry.testing.FakeLockHandler;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@ -38,6 +37,7 @@ import org.joda.time.DateTimeZone;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -46,7 +46,7 @@ import org.junit.runners.JUnit4;
public class EscrowTaskRunnerTest { public class EscrowTaskRunnerTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final AppEngineRule appEngine = AppEngineRule.builder() public final AppEngineRule appEngine = AppEngineRule.builder()

View file

@ -27,7 +27,6 @@ import com.google.common.io.ByteStreams;
import google.registry.keyring.api.Keyring; import google.registry.keyring.api.Keyring;
import google.registry.rde.Ghostryde.DecodeResult; import google.registry.rde.Ghostryde.DecodeResult;
import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeKeyringModule; import google.registry.testing.FakeKeyringModule;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -43,6 +42,7 @@ import org.junit.Test;
import org.junit.experimental.theories.DataPoints; import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory; import org.junit.experimental.theories.Theory;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
/** Unit tests for {@link Ghostryde}. */ /** Unit tests for {@link Ghostryde}. */
@ -51,7 +51,7 @@ import org.junit.runner.RunWith;
public class GhostrydeTest { public class GhostrydeTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule(); public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();

View file

@ -27,7 +27,6 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.xjc.host.XjcHostStatusType; import google.registry.xjc.host.XjcHostStatusType;
import google.registry.xjc.host.XjcHostStatusValueType; import google.registry.xjc.host.XjcHostStatusValueType;
import google.registry.xjc.rdehost.XjcRdeHost; import google.registry.xjc.rdehost.XjcRdeHost;
@ -37,6 +36,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -55,7 +55,7 @@ public class HostResourceToXjcConverterTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Before @Before
public void init() { public void init() {

View file

@ -49,7 +49,6 @@ import google.registry.model.registry.Registry;
import google.registry.request.HttpException.InternalServerErrorException; import google.registry.request.HttpException.InternalServerErrorException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeKeyringModule; import google.registry.testing.FakeKeyringModule;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
@ -66,6 +65,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
@ -79,7 +79,7 @@ public class RdeReportActionTest {
private static final ByteSource IIRDEA_GOOD_XML = RdeTestData.loadBytes("iirdea_good.xml"); private static final ByteSource IIRDEA_GOOD_XML = RdeTestData.loadBytes("iirdea_good.xml");
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule(); public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@ -182,9 +182,9 @@ public class RdeReportActionTest {
@Test @Test
public void testRunWithLock_fetchFailed_throwsRuntimeException() throws Exception { public void testRunWithLock_fetchFailed_throwsRuntimeException() throws Exception {
class ExpectedException extends RuntimeException {} class ExpectedThrownException extends RuntimeException {}
when(urlFetchService.fetch(any(HTTPRequest.class))).thenThrow(new ExpectedException()); when(urlFetchService.fetch(any(HTTPRequest.class))).thenThrow(new ExpectedThrownException());
thrown.expect(ExpectedException.class); thrown.expect(ExpectedThrownException.class);
createAction().runWithLock(loadRdeReportCursor()); createAction().runWithLock(loadRdeReportCursor());
} }

View file

@ -53,7 +53,6 @@ import google.registry.model.ofy.Ofy;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
import google.registry.request.RequestParameters; import google.registry.request.RequestParameters;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeKeyringModule; import google.registry.testing.FakeKeyringModule;
import google.registry.testing.FakeLockHandler; import google.registry.testing.FakeLockHandler;
@ -93,6 +92,7 @@ import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -109,7 +109,7 @@ public class RdeStagingActionTest extends MapreduceTestCase<RdeStagingAction> {
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final FakeClock clock = new FakeClock(); private final FakeClock clock = new FakeClock();
private final FakeResponse response = new FakeResponse(); private final FakeResponse response = new FakeResponse();

View file

@ -61,7 +61,6 @@ import google.registry.request.HttpException.ServiceUnavailableException;
import google.registry.request.RequestParameters; import google.registry.request.RequestParameters;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeKeyringModule; import google.registry.testing.FakeKeyringModule;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
@ -87,6 +86,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -115,7 +115,7 @@ public class RdeUploadActionTest {
new GcsFilename("bucket", "tld_2010-10-17_full_S1_R1-report.xml.ghostryde"); new GcsFilename("bucket", "tld_2010-10-17_full_S1_R1-report.xml.ghostryde");
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final SftpServerRule sftpd = new SftpServerRule(); public final SftpServerRule sftpd = new SftpServerRule();

View file

@ -25,7 +25,6 @@ import com.google.common.io.ByteStreams;
import google.registry.config.RegistryConfig.ConfigModule; import google.registry.config.RegistryConfig.ConfigModule;
import google.registry.gcs.GcsUtils; import google.registry.gcs.GcsUtils;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.xjc.JaxbFragment; import google.registry.xjc.JaxbFragment;
import google.registry.xjc.rdecontact.XjcRdeContact; import google.registry.xjc.rdecontact.XjcRdeContact;
import google.registry.xjc.rdecontact.XjcRdeContactElement; import google.registry.xjc.rdecontact.XjcRdeContactElement;
@ -39,6 +38,7 @@ import java.io.OutputStream;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -62,7 +62,7 @@ public class RdeContactReaderTest {
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
/** Reads at least one result at 0 offset 1 maxResults */ /** Reads at least one result at 0 offset 1 maxResults */
@Test @Test

View file

@ -28,7 +28,6 @@ import com.google.common.io.ByteStreams;
import google.registry.config.RegistryConfig.ConfigModule; import google.registry.config.RegistryConfig.ConfigModule;
import google.registry.gcs.GcsUtils; import google.registry.gcs.GcsUtils;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.xjc.JaxbFragment; import google.registry.xjc.JaxbFragment;
import google.registry.xjc.rdedomain.XjcRdeDomain; import google.registry.xjc.rdedomain.XjcRdeDomain;
import google.registry.xjc.rdedomain.XjcRdeDomainElement; import google.registry.xjc.rdedomain.XjcRdeDomainElement;
@ -43,6 +42,7 @@ import java.util.NoSuchElementException;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -66,7 +66,7 @@ public class RdeDomainReaderTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Before @Before
public void before() { public void before() {

View file

@ -26,7 +26,6 @@ import com.google.common.io.ByteStreams;
import google.registry.config.RegistryConfig.ConfigModule; import google.registry.config.RegistryConfig.ConfigModule;
import google.registry.gcs.GcsUtils; import google.registry.gcs.GcsUtils;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@ -34,6 +33,7 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -59,7 +59,7 @@ public class RdeHostInputTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
/** Number of shards cannot be negative */ /** Number of shards cannot be negative */
@Test @Test

View file

@ -26,7 +26,6 @@ import com.google.common.io.ByteStreams;
import google.registry.config.RegistryConfig.ConfigModule; import google.registry.config.RegistryConfig.ConfigModule;
import google.registry.gcs.GcsUtils; import google.registry.gcs.GcsUtils;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.xjc.JaxbFragment; import google.registry.xjc.JaxbFragment;
import google.registry.xjc.rdehost.XjcRdeHost; import google.registry.xjc.rdehost.XjcRdeHost;
import google.registry.xjc.rdehost.XjcRdeHostElement; import google.registry.xjc.rdehost.XjcRdeHostElement;
@ -40,6 +39,7 @@ import java.io.OutputStream;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -59,7 +59,7 @@ public class RdeHostReaderTest {
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
/** Reads at least one result at 0 offset 1 maxResults */ /** Reads at least one result at 0 offset 1 maxResults */
@Test @Test

View file

@ -48,7 +48,6 @@ import google.registry.model.index.ForeignKeyIndex;
import google.registry.model.registrar.Registrar; import google.registry.model.registrar.Registrar;
import google.registry.model.registry.Registry.TldState; import google.registry.model.registry.Registry.TldState;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.ShardableTestCase; import google.registry.testing.ShardableTestCase;
import java.io.IOException; import java.io.IOException;
@ -60,6 +59,7 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -81,7 +81,7 @@ public class RdeImportUtilsTest extends ShardableTestCase {
public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final GcsUtils gcsUtils = mock(GcsUtils.class); private final GcsUtils gcsUtils = mock(GcsUtils.class);

View file

@ -19,7 +19,6 @@ import static google.registry.rde.imports.RdeImportsTestData.loadBytes;
import com.google.common.io.ByteSource; import com.google.common.io.ByteSource;
import google.registry.rde.imports.RdeParser.RdeHeader; import google.registry.rde.imports.RdeParser.RdeHeader;
import google.registry.testing.ExceptionRule;
import google.registry.xjc.rdecontact.XjcRdeContact; import google.registry.xjc.rdecontact.XjcRdeContact;
import google.registry.xjc.rdedomain.XjcRdeDomain; import google.registry.xjc.rdedomain.XjcRdeDomain;
import google.registry.xjc.rdeeppparams.XjcRdeEppParams; import google.registry.xjc.rdeeppparams.XjcRdeEppParams;
@ -34,6 +33,7 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -45,7 +45,7 @@ public class RdeParserTest {
private InputStream xml; private InputStream xml;
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
private void checkHeader(RdeHeader header) { private void checkHeader(RdeHeader header) {
assertThat(header.getTld()).isEqualTo("test"); assertThat(header.getTld()).isEqualTo("test");

View file

@ -50,7 +50,6 @@ import google.registry.model.transfer.TransferData;
import google.registry.model.transfer.TransferStatus; import google.registry.model.transfer.TransferStatus;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.DeterministicStringGenerator; import google.registry.testing.DeterministicStringGenerator;
import google.registry.testing.ExceptionRule;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import google.registry.util.StringGenerator; import google.registry.util.StringGenerator;
import google.registry.xjc.rdedomain.XjcRdeDomain; import google.registry.xjc.rdedomain.XjcRdeDomain;
@ -66,6 +65,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -91,7 +91,7 @@ public class XjcToDomainResourceConverterTest {
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
@Rule public final InjectRule inject = new InjectRule(); @Rule public final InjectRule inject = new InjectRule();

View file

@ -29,13 +29,13 @@ import com.google.api.client.util.Base64;
import com.google.api.client.util.StringUtils; import com.google.api.client.util.StringUtils;
import com.google.common.io.ByteSource; import com.google.common.io.ByteSource;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -51,7 +51,7 @@ public class IcannHttpReporterTest {
private MockLowLevelHttpRequest mockRequest; private MockLowLevelHttpRequest mockRequest;
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
@Rule public AppEngineRule appEngineRule = new AppEngineRule.Builder().withDatastore().build(); @Rule public AppEngineRule appEngineRule = new AppEngineRule.Builder().withDatastore().build();

View file

@ -20,7 +20,6 @@ import static org.mockito.Mockito.when;
import google.registry.reporting.IcannReportingModule.ReportType; import google.registry.reporting.IcannReportingModule.ReportType;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.util.Clock; import google.registry.util.Clock;
import java.util.Optional; import java.util.Optional;
@ -30,6 +29,7 @@ import org.joda.time.YearMonth;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -40,7 +40,7 @@ public class IcannReportingModuleTest {
HttpServletRequest req = mock(HttpServletRequest.class); HttpServletRequest req = mock(HttpServletRequest.class);
Clock clock; Clock clock;
@Rule public final ExceptionRule thrown = new ExceptionRule(); @Rule public final ExpectedException thrown = ExpectedException.none();
@Before @Before
public void setUp() { public void setUp() {

View file

@ -18,12 +18,12 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.request.JsonResponse.JSON_SAFETY_PREFIX; import static google.registry.request.JsonResponse.JSON_SAFETY_PREFIX;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import java.util.Map; import java.util.Map;
import org.json.simple.JSONValue; import org.json.simple.JSONValue;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -32,7 +32,7 @@ import org.junit.runners.JUnit4;
public class JsonResponseTest { public class JsonResponseTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
FakeResponse fakeResponse = new FakeResponse(); FakeResponse fakeResponse = new FakeResponse();
JsonResponse jsonResponse = new JsonResponse(fakeResponse); JsonResponse jsonResponse = new JsonResponse(fakeResponse);

View file

@ -20,9 +20,9 @@ import static google.registry.request.RequestModule.provideJsonPayload;
import com.google.common.net.MediaType; import com.google.common.net.MediaType;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
import google.registry.request.HttpException.UnsupportedMediaTypeException; import google.registry.request.HttpException.UnsupportedMediaTypeException;
import google.registry.testing.ExceptionRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -31,7 +31,7 @@ import org.junit.runners.JUnit4;
public final class RequestModuleTest { public final class RequestModuleTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testProvideJsonPayload() throws Exception { public void testProvideJsonPayload() throws Exception {

View file

@ -28,11 +28,11 @@ import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import google.registry.request.HttpException.BadRequestException; import google.registry.request.HttpException.BadRequestException;
import google.registry.testing.ExceptionRule;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -41,7 +41,7 @@ import org.junit.runners.JUnit4;
public class RequestParametersTest { public class RequestParametersTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final HttpServletRequest req = mock(HttpServletRequest.class); private final HttpServletRequest req = mock(HttpServletRequest.class);

View file

@ -21,12 +21,12 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import google.registry.testing.ExceptionRule;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -35,7 +35,7 @@ import org.junit.runners.JUnit4;
public class ResponseImplTest { public class ResponseImplTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final HttpServletResponse rsp = mock(HttpServletResponse.class); private final HttpServletResponse rsp = mock(HttpServletResponse.class);

View file

@ -19,11 +19,11 @@ import static com.google.common.truth.Truth8.assertThat;
import static google.registry.request.auth.Auth.AUTH_INTERNAL_ONLY; import static google.registry.request.auth.Auth.AUTH_INTERNAL_ONLY;
import com.google.common.base.Function; import com.google.common.base.Function;
import google.registry.testing.ExceptionRule;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -32,7 +32,7 @@ import org.junit.runners.JUnit4;
public final class RouterTest { public final class RouterTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -30,7 +30,6 @@ import google.registry.request.auth.RequestAuthenticator.AuthSettings;
import google.registry.request.auth.RequestAuthenticator.UserPolicy; import google.registry.request.auth.RequestAuthenticator.UserPolicy;
import google.registry.security.XsrfTokenManager; import google.registry.security.XsrfTokenManager;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.FakeOAuthService; import google.registry.testing.FakeOAuthService;
import google.registry.testing.FakeUserService; import google.registry.testing.FakeUserService;
@ -39,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -50,7 +50,7 @@ public class RequestAuthenticatorTest {
public final AppEngineRule appEngine = AppEngineRule.builder().build(); public final AppEngineRule appEngine = AppEngineRule.builder().build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private static final AuthSettings AUTH_NONE = AuthSettings.create( private static final AuthSettings AUTH_NONE = AuthSettings.create(
ImmutableList.of(AuthMethod.INTERNAL), ImmutableList.of(AuthMethod.INTERNAL),

View file

@ -22,7 +22,6 @@ import static org.mockito.Mockito.verify;
import google.registry.model.server.Lock; import google.registry.model.server.Lock;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -30,6 +29,7 @@ import org.joda.time.Duration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -44,7 +44,7 @@ public final class LockHandlerImplTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private static class CountingCallable implements Callable<Void> { private static class CountingCallable implements Callable<Void> {
int numCalled = 0; int numCalled = 0;

View file

@ -34,12 +34,12 @@ import com.google.api.services.drive.model.File;
import com.google.api.services.drive.model.ParentReference; import com.google.api.services.drive.model.ParentReference;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.net.MediaType; import com.google.common.net.MediaType;
import google.registry.testing.ExceptionRule;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
import org.mockito.ArgumentMatcher; import org.mockito.ArgumentMatcher;
@ -49,7 +49,7 @@ import org.mockito.ArgumentMatcher;
public class DriveConnectionTest { public class DriveConnectionTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final Drive drive = mock(Drive.class); private final Drive drive = mock(Drive.class);
private final Files files = mock(Files.class); private final Files files = mock(Files.class);

View file

@ -1,74 +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 static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Strings.nullToEmpty;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import google.registry.flows.EppException;
import javax.annotation.Nullable;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
/**
* A test rule similar to JUnit's {@code ExpectedException} rule that does extra checking to ensure
* that {@link EppException} derivatives have EPP-compliant error messages.
*/
public class ExceptionRule implements TestRule {
@Nullable
Class<? extends Throwable> expectedExceptionClass;
@Nullable
String expectedMessage;
@Override
public Statement apply(final Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
base.evaluate();
if (expectedExceptionClass != null) {
throw new AssertionError(String.format(
"Expected test to throw %s%s",
expectedExceptionClass.getSimpleName(),
expectedMessage == null ? "" : (" with message: " + expectedMessage)));
}
} catch (Throwable e) {
if (expectedExceptionClass == null
|| !(expectedExceptionClass.isAssignableFrom(e.getClass())
&& nullToEmpty(e.getMessage()).contains(nullToEmpty(expectedMessage)))) {
throw e; // We didn't expect this so pass it through.
}
if (e instanceof EppException) {
assertAboutEppExceptions().that((EppException) e).marshalsToXml();
}
}
}};
}
public void expect(Class<? extends Throwable> expectedExceptionClass) {
checkState(this.expectedExceptionClass == null,
"Don't use multiple `thrown.expect()` statements in your test.");
this.expectedExceptionClass = expectedExceptionClass;
}
public void expectMessage(String expectedMessage) {
this.expectedMessage = expectedMessage;
}
}

View file

@ -17,11 +17,11 @@ package google.registry.tldconfig.idn;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import google.registry.testing.ExceptionRule;
import java.net.URI; import java.net.URI;
import java.util.Optional; import java.util.Optional;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -30,7 +30,7 @@ import org.junit.runners.JUnit4;
public class IdnTableTest { public class IdnTableTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Test @Test
public void testDigits() { public void testDigits() {

View file

@ -17,12 +17,12 @@ package google.registry.tmch;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import google.registry.testing.ExceptionRule;
import google.registry.tmch.LordnLog.Result; import google.registry.tmch.LordnLog.Result;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -31,7 +31,7 @@ import org.junit.runners.JUnit4;
public class LordnLogTest { public class LordnLogTest {
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
public static final ImmutableList<String> EXAMPLE_FROM_RFC = public static final ImmutableList<String> EXAMPLE_FROM_RFC =
ImmutableList.of( ImmutableList.of(

View file

@ -40,7 +40,6 @@ import google.registry.model.domain.launch.LaunchNotice;
import google.registry.model.ofy.Ofy; import google.registry.model.ofy.Ofy;
import google.registry.model.registrar.Registrar.Type; import google.registry.model.registrar.Registrar.Type;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.testing.TaskQueueHelper.TaskMatcher;
@ -50,6 +49,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -66,7 +66,7 @@ public class LordnTaskTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

View file

@ -45,7 +45,6 @@ import google.registry.model.domain.launch.LaunchNotice;
import google.registry.model.ofy.Ofy; import google.registry.model.ofy.Ofy;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import google.registry.testing.TaskQueueHelper.TaskMatcher; import google.registry.testing.TaskQueueHelper.TaskMatcher;
@ -56,6 +55,7 @@ import org.joda.time.DateTime;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.Captor; import org.mockito.Captor;
@ -88,7 +88,7 @@ public class NordnUploadActionTest {
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Mock @Mock
private URLFetchService fetchService; private URLFetchService fetchService;

View file

@ -34,13 +34,13 @@ import com.google.appengine.api.urlfetch.URLFetchService;
import google.registry.model.registry.Registry; import google.registry.model.registry.Registry;
import google.registry.request.HttpException.ConflictException; import google.registry.request.HttpException.ConflictException;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeResponse; import google.registry.testing.FakeResponse;
import java.net.URL; import java.net.URL;
import java.util.Optional; import java.util.Optional;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.Captor; import org.mockito.Captor;
@ -88,7 +88,7 @@ public class NordnVerifyActionTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Mock @Mock
private URLFetchService fetchService; private URLFetchService fetchService;

View file

@ -23,11 +23,11 @@ import com.google.common.collect.ImmutableList;
import com.google.common.io.CharSource; import com.google.common.io.CharSource;
import google.registry.model.smd.SignedMarkRevocationList; import google.registry.model.smd.SignedMarkRevocationList;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.JUnit4; import org.junit.runners.JUnit4;
@ -40,7 +40,7 @@ public class SmdrlCsvParserTest {
.build(); .build();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
private final FakeClock clock = new FakeClock(); private final FakeClock clock = new FakeClock();

View file

@ -23,11 +23,11 @@ import com.google.appengine.api.urlfetch.HTTPResponse;
import com.google.appengine.api.urlfetch.URLFetchService; import com.google.appengine.api.urlfetch.URLFetchService;
import google.registry.testing.AppEngineRule; import google.registry.testing.AppEngineRule;
import google.registry.testing.BouncyCastleProviderRule; import google.registry.testing.BouncyCastleProviderRule;
import google.registry.testing.ExceptionRule;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.InjectRule; import google.registry.testing.InjectRule;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.Captor; import org.mockito.Captor;
@ -51,7 +51,7 @@ public class TmchActionTestCase {
public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule(); public final BouncyCastleProviderRule bouncy = new BouncyCastleProviderRule();
@Rule @Rule
public final ExceptionRule thrown = new ExceptionRule(); public final ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public final InjectRule inject = new InjectRule(); public final InjectRule inject = new InjectRule();

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