mirror of
https://github.com/google/nomulus.git
synced 2025-06-29 15:53:35 +02:00
Merge JUnitBackport's expectThrows into assertThrows
More information: https://github.com/junit-team/junit5/issues/531 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187034408
This commit is contained in:
parent
f96a0b7da9
commit
606b470cd0
180 changed files with 1325 additions and 1381 deletions
|
@ -19,7 +19,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
@ -178,7 +178,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_syntheticFlagWithoutCreationTime() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
oneTime
|
||||
|
@ -194,7 +194,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_syntheticCreationTimeWithoutFlag() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> oneTime.asBuilder().setSyntheticCreationTime(now.plusDays(10)).build());
|
||||
assertThat(thrown)
|
||||
|
@ -205,7 +205,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_syntheticFlagWithoutCancellationMatchingKey() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
oneTime
|
||||
|
@ -223,7 +223,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_cancellationMatchingKeyWithoutFlag() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
oneTime
|
||||
|
@ -266,7 +266,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_cancellation_forGracePeriodWithoutBillingEvent() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
BillingEvent.Cancellation.forGracePeriod(
|
||||
|
@ -280,7 +280,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_cancellationWithNoBillingEvent() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
cancellationOneTime
|
||||
|
@ -294,7 +294,7 @@ public class BillingEventTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_cancellationWithBothBillingEvents() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
cancellationOneTime
|
||||
|
|
|
@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -98,7 +97,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testBadTimeOrdering_causesError() throws Exception {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
new RegistrarBillingEntry.Builder()
|
||||
|
@ -122,7 +121,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testRegistrarMismatch_causesError() throws Exception {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
new RegistrarBillingEntry.Builder()
|
||||
|
@ -168,7 +167,7 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testZeroAmount_causesError() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
new RegistrarBillingEntry.Builder()
|
||||
|
|
|
@ -19,7 +19,7 @@ import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
|
|||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.money.CurrencyUnit.JPY;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class RegistrarCreditTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_missingTld() throws Exception {
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class, () -> promoCredit.asBuilder().setTld(null).build());
|
||||
assertThat(thrown).hasMessageThat().contains("tld");
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class RegistrarCreditTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_NonexistentTld() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> promoCredit.asBuilder().setTld("example").build());
|
||||
assertThat(thrown).hasMessageThat().contains("example");
|
||||
|
@ -95,7 +95,7 @@ public class RegistrarCreditTest extends EntityTestCase {
|
|||
public void testFailure_CurrencyDoesNotMatchTldCurrency() throws Exception {
|
||||
assertThat(Registry.get("tld").getCurrency()).isEqualTo(USD);
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> promoCredit.asBuilder().setTld("tld").setCurrency(JPY).build());
|
||||
assertThat(thrown).hasMessageThat().contains("currency");
|
||||
|
|
|
@ -21,7 +21,7 @@ import static google.registry.model.common.Cursor.CursorType.RECURRING_BILLING;
|
|||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
||||
import google.registry.model.EntityTestCase;
|
||||
|
@ -71,7 +71,7 @@ public class CursorTest extends EntityTestCase {
|
|||
final DateTime time = DateTime.parse("2012-07-12T03:30:00.000Z");
|
||||
final DomainResource domain = persistActiveDomain("notaregistry.tld");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
ofy().transact(() -> ofy().save().entity(Cursor.create(RDE_UPLOAD, time, domain))));
|
||||
|
@ -84,7 +84,7 @@ public class CursorTest extends EntityTestCase {
|
|||
public void testFailure_invalidScopeOnKeyCreate() throws Exception {
|
||||
createTld("tld");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Cursor.createKey(RDE_UPLOAD, persistActiveDomain("notaregistry.tld")));
|
||||
assertThat(thrown)
|
||||
|
@ -95,7 +95,7 @@ public class CursorTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_createGlobalKeyForScopedCursorType() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> Cursor.createGlobalKey(RDE_UPLOAD));
|
||||
assertThrows(IllegalArgumentException.class, () -> Cursor.createGlobalKey(RDE_UPLOAD));
|
||||
assertThat(thrown).hasMessageThat().contains("Cursor type is not a global cursor");
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class CursorTest extends EntityTestCase {
|
|||
public void testFailure_invalidScopeOnGlobalKeyCreate() throws Exception {
|
||||
createTld("tld");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Cursor.createKey(RECURRING_BILLING, persistActiveDomain("notaregistry.tld")));
|
||||
assertThat(thrown)
|
||||
|
@ -114,7 +114,7 @@ public class CursorTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_nullScope() throws Exception {
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() -> Cursor.create(RECURRING_BILLING, START_OF_TIME, null));
|
||||
assertThat(thrown).hasMessageThat().contains("Cursor scope cannot be null");
|
||||
|
@ -124,7 +124,7 @@ public class CursorTest extends EntityTestCase {
|
|||
public void testFailure_nullCursorType() throws Exception {
|
||||
createTld("tld");
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class,
|
||||
() -> Cursor.create(null, START_OF_TIME, Registry.get("tld")));
|
||||
assertThat(thrown).hasMessageThat().contains("Cursor type cannot be null");
|
||||
|
@ -134,7 +134,7 @@ public class CursorTest extends EntityTestCase {
|
|||
public void testFailure_nullTime() throws Exception {
|
||||
createTld("tld");
|
||||
NullPointerException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NullPointerException.class, () -> Cursor.create(RDE_UPLOAD, null, Registry.get("tld")));
|
||||
assertThat(thrown).hasMessageThat().contains("Cursor time cannot be null");
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.testing.ContactResourceSubject.assertAboutContacts
|
|||
import static google.registry.testing.DatastoreHelper.cloneAndSetAutoTimestamps;
|
||||
import static google.registry.testing.DatastoreHelper.createTld;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -200,7 +200,7 @@ public class ContactResourceTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testSetCreationTime_cantBeCalledTwice() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> contactResource.asBuilder().setCreationTime(END_OF_TIME));
|
||||
assertThat(thrown).hasMessageThat().contains("creationTime can only be set once");
|
||||
|
|
|
@ -18,7 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.EntityTestCase;
|
||||
|
@ -67,7 +67,7 @@ public class AllocationTokenTest extends EntityTestCase {
|
|||
.setToken("foobar")
|
||||
.setCreationTime(DateTime.parse("2010-11-12T05:00:00Z"));
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> builder.setCreationTime(DateTime.parse("2010-11-13T05:00:00Z")));
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("creationTime can only be set once");
|
||||
|
@ -77,7 +77,7 @@ public class AllocationTokenTest extends EntityTestCase {
|
|||
public void testSetToken_cantCallMoreThanOnce() throws Exception {
|
||||
AllocationToken.Builder builder = new AllocationToken.Builder().setToken("foobar");
|
||||
IllegalStateException thrown =
|
||||
expectThrows(IllegalStateException.class, () -> builder.setToken("barfoo"));
|
||||
assertThrows(IllegalStateException.class, () -> builder.setToken("barfoo"));
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("token can only be set once");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.newDomainResource;
|
|||
import static google.registry.testing.DatastoreHelper.newHostResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.USD;
|
||||
|
||||
|
@ -446,7 +446,7 @@ public class DomainResourceTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_uppercaseDomainName() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> domain.asBuilder().setFullyQualifiedDomainName("AAA.BBB"));
|
||||
assertThat(thrown)
|
||||
|
@ -457,7 +457,7 @@ public class DomainResourceTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_utf8DomainName() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> domain.asBuilder().setFullyQualifiedDomainName("みんな.みんな"));
|
||||
assertThat(thrown)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.model.domain;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.googlecode.objectify.Key;
|
||||
|
@ -93,7 +93,7 @@ public class GracePeriodTest {
|
|||
@Test
|
||||
public void testFailure_forBillingEvent_autoRenew() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> GracePeriod.forBillingEvent(GracePeriodStatus.AUTO_RENEW, onetime));
|
||||
assertThat(thrown).hasMessageThat().contains("autorenew");
|
||||
|
@ -102,7 +102,7 @@ public class GracePeriodTest {
|
|||
@Test
|
||||
public void testFailure_createForRecurring_notAutoRenew() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
GracePeriod.createForRecurring(
|
||||
|
|
|
@ -21,7 +21,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
|||
import static google.registry.testing.DatastoreHelper.newDomainResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.HostResourceSubject.assertAboutHosts;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.InetAddresses;
|
||||
|
@ -158,7 +158,7 @@ public class HostResourceTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_uppercaseHostName() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> host.asBuilder().setFullyQualifiedHostName("AAA.BBB.CCC"));
|
||||
assertThat(thrown)
|
||||
|
@ -169,7 +169,7 @@ public class HostResourceTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_utf8HostName() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> host.asBuilder().setFullyQualifiedHostName("みんな.みんな.みんな"));
|
||||
assertThat(thrown)
|
||||
|
|
|
@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
|||
import static google.registry.testing.DatastoreHelper.newDomainApplication;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistSimpleResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -45,7 +45,7 @@ public class DomainApplicationIndexTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_create_nullReferences() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> DomainApplicationIndex.createWithSpecifiedKeys("blah.com", null));
|
||||
assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty.");
|
||||
|
@ -54,7 +54,7 @@ public class DomainApplicationIndexTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_create_emptyReferences() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> createWithSpecifiedKeys("blah.com", ImmutableSet.of()));
|
||||
assertThat(thrown).hasMessageThat().contains("Keys must not be null or empty.");
|
||||
|
|
|
@ -19,7 +19,7 @@ import static google.registry.model.ofy.CommitLogBucket.getBucketKey;
|
|||
import static google.registry.model.ofy.CommitLogBucket.loadAllBuckets;
|
||||
import static google.registry.model.ofy.CommitLogBucket.loadBucket;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
|
@ -66,14 +66,14 @@ public class CommitLogBucketTest {
|
|||
@Test
|
||||
public void test_getBucketKey_bucketNumberTooLow_throws() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> getBucketKey(0));
|
||||
assertThrows(IllegalArgumentException.class, () -> getBucketKey(0));
|
||||
assertThat(thrown).hasMessageThat().contains("0 not in [");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getBucketKey_bucketNumberTooHigh_throws() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> getBucketKey(11));
|
||||
assertThrows(IllegalArgumentException.class, () -> getBucketKey(11));
|
||||
assertThat(thrown).hasMessageThat().contains("11 not in [");
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.model.ofy;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class CommitLogCheckpointTest {
|
|||
@Test
|
||||
public void test_create_notEnoughBucketTimestamps_throws() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(1, T1, 2, T2)));
|
||||
assertThat(thrown).hasMessageThat().contains("Bucket ids are incorrect");
|
||||
|
@ -67,7 +67,7 @@ public class CommitLogCheckpointTest {
|
|||
@Test
|
||||
public void test_create_tooManyBucketTimestamps_throws() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
CommitLogCheckpoint.create(
|
||||
|
@ -78,7 +78,7 @@ public class CommitLogCheckpointTest {
|
|||
@Test
|
||||
public void test_create_wrongBucketIds_throws() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
CommitLogCheckpoint.create(
|
||||
|
@ -89,7 +89,7 @@ public class CommitLogCheckpointTest {
|
|||
@Test
|
||||
public void test_create_wrongBucketIdOrder_throws() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
CommitLogCheckpoint.create(
|
||||
|
|
|
@ -20,7 +20,7 @@ import static com.googlecode.objectify.ObjectifyService.register;
|
|||
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
|
||||
import static google.registry.model.ofy.CommitLogBucket.getBucketKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
|
@ -161,7 +161,7 @@ public class OfyCommitLogTest {
|
|||
final CommitLogManifest backupsArentAllowedOnMe =
|
||||
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> ofy().transactNew(() -> ofy().delete().entity(backupsArentAllowedOnMe)));
|
||||
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @NotBackedUp");
|
||||
|
@ -172,7 +172,7 @@ public class OfyCommitLogTest {
|
|||
final CommitLogManifest backupsArentAllowedOnMe =
|
||||
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.of());
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> ofy().transactNew(() -> ofy().save().entity(backupsArentAllowedOnMe)));
|
||||
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @NotBackedUp");
|
||||
|
@ -182,7 +182,7 @@ public class OfyCommitLogTest {
|
|||
public void testTransactNew_deleteVirtualEntityKey_throws() throws Exception {
|
||||
final Key<TestVirtualObject> virtualEntityKey = TestVirtualObject.createKey("virtual");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> ofy().transactNew(() -> ofy().delete().key(virtualEntityKey)));
|
||||
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity");
|
||||
|
@ -192,7 +192,7 @@ public class OfyCommitLogTest {
|
|||
public void testTransactNew_saveVirtualEntity_throws() throws Exception {
|
||||
final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> ofy().transactNew(() -> ofy().save().entity(virtualEntity)));
|
||||
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity");
|
||||
|
@ -202,7 +202,7 @@ public class OfyCommitLogTest {
|
|||
public void test_deleteWithoutBackup_withVirtualEntityKey_throws() throws Exception {
|
||||
final Key<TestVirtualObject> virtualEntityKey = TestVirtualObject.createKey("virtual");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> ofy().deleteWithoutBackup().key(virtualEntityKey));
|
||||
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity");
|
||||
|
@ -212,7 +212,7 @@ public class OfyCommitLogTest {
|
|||
public void test_saveWithoutBackup_withVirtualEntity_throws() throws Exception {
|
||||
final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> ofy().saveWithoutBackup().entity(virtualEntity));
|
||||
assertThat(thrown).hasMessageThat().contains("Can't save/delete a @VirtualEntity");
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class OfyCommitLogTest {
|
|||
@Test
|
||||
public void testTransact_twoSavesOnSameKey_throws() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -235,7 +235,7 @@ public class OfyCommitLogTest {
|
|||
@Test
|
||||
public void testTransact_saveAndDeleteSameKey_throws() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.model.ofy;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.ofy.ObjectifyService.initOfy;
|
||||
import static google.registry.testing.DatastoreHelper.newContactResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
|
||||
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
|
||||
|
@ -72,7 +72,7 @@ public class OfyFilterTest {
|
|||
@Test
|
||||
public void testFilterRegistersTypes() throws Exception {
|
||||
UnregisteredEntity entity = new UnregisteredEntity(5L);
|
||||
IllegalStateException e = expectThrows(IllegalStateException.class, () -> Key.create(entity));
|
||||
IllegalStateException e = assertThrows(IllegalStateException.class, () -> Key.create(entity));
|
||||
assertThat(e)
|
||||
.hasMessageThat()
|
||||
.isEqualTo(
|
||||
|
|
|
@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
|||
import static google.registry.testing.DatastoreHelper.newContactResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
@ -90,7 +89,7 @@ public class OfyTest {
|
|||
// Set the clock in Ofy to the same time as the backup group root's save time.
|
||||
Ofy ofy = new Ofy(new FakeClock(groupTimestamp));
|
||||
TimestampInversionException thrown =
|
||||
expectThrows(TimestampInversionException.class, () -> ofy.transact(work));
|
||||
assertThrows(TimestampInversionException.class, () -> ofy.transact(work));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.contains(
|
||||
|
@ -121,7 +120,7 @@ public class OfyTest {
|
|||
@Test
|
||||
public void testSavingKeyTwice() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -139,7 +138,7 @@ public class OfyTest {
|
|||
@Test
|
||||
public void testDeletingKeyTwice() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -157,7 +156,7 @@ public class OfyTest {
|
|||
@Test
|
||||
public void testSaveDeleteKey() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -175,7 +174,7 @@ public class OfyTest {
|
|||
@Test
|
||||
public void testDeleteSaveKey() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -404,7 +403,7 @@ public class OfyTest {
|
|||
@Test
|
||||
public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntity() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> getBaseEntityClassFromEntityOrKey(new SystemClock()));
|
||||
assertThat(thrown).hasMessageThat().contains("SystemClock");
|
||||
|
@ -413,7 +412,7 @@ public class OfyTest {
|
|||
@Test
|
||||
public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntityKey() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
getBaseEntityClassFromEntityOrKey(
|
||||
|
|
|
@ -19,7 +19,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
import static google.registry.model.rde.RdeMode.FULL;
|
||||
import static google.registry.model.rde.RdeRevision.getNextRevision;
|
||||
import static google.registry.model.rde.RdeRevision.saveRevision;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.google.common.base.VerifyException;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
|
@ -67,7 +67,7 @@ public class RdeRevisionTest {
|
|||
@Test
|
||||
public void testSaveRevision_objectDoesntExist_newRevisionIsOne_throwsVe() throws Exception {
|
||||
VerifyException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
VerifyException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -85,7 +85,7 @@ public class RdeRevisionTest {
|
|||
public void testSaveRevision_objectExistsAtZero_newRevisionIsZero_throwsVe() throws Exception {
|
||||
save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0);
|
||||
VerifyException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
VerifyException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -119,7 +119,7 @@ public class RdeRevisionTest {
|
|||
public void testSaveRevision_objectExistsAtZero_newRevisionIsTwo_throwsVe() throws Exception {
|
||||
save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0);
|
||||
VerifyException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
VerifyException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -136,7 +136,7 @@ public class RdeRevisionTest {
|
|||
@Test
|
||||
public void testSaveRevision_negativeRevision_throwsIae() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
ofy()
|
||||
|
@ -153,7 +153,7 @@ public class RdeRevisionTest {
|
|||
@Test
|
||||
public void testSaveRevision_callerNotInTransaction_throwsIse() throws Exception {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> saveRevision("frenzy", DateTime.parse("1984-12-18TZ"), FULL, 1));
|
||||
assertThat(thrown).hasMessageThat().contains("transaction");
|
||||
|
|
|
@ -27,7 +27,6 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
|||
import static google.registry.testing.DatastoreHelper.persistSimpleResource;
|
||||
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
@ -141,7 +140,7 @@ public class RegistrarTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_passwordNull() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> new Registrar.Builder().setPassword(null));
|
||||
assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long.");
|
||||
}
|
||||
|
@ -149,7 +148,7 @@ public class RegistrarTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_passwordTooShort() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> new Registrar.Builder().setPassword("abcde"));
|
||||
assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long.");
|
||||
}
|
||||
|
@ -157,7 +156,7 @@ public class RegistrarTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_passwordTooLong() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new Registrar.Builder().setPassword("abcdefghijklmnopq"));
|
||||
assertThat(thrown).hasMessageThat().contains("Password must be 6-16 characters long.");
|
||||
|
@ -320,7 +319,7 @@ public class RegistrarTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_missingRegistrarType() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new Registrar.Builder().setRegistrarName("blah").build());
|
||||
assertThat(thrown).hasMessageThat().contains("Registrar type cannot be null");
|
||||
|
@ -329,7 +328,7 @@ public class RegistrarTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_missingRegistrarName() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
new Registrar.Builder().setClientId("blahid").setType(Registrar.Type.TEST).build());
|
||||
|
@ -339,7 +338,7 @@ public class RegistrarTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_missingAddress() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
new Registrar.Builder()
|
||||
|
@ -438,28 +437,28 @@ public class RegistrarTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_loadByClientId_clientIdIsNull() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(null));
|
||||
assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(null));
|
||||
assertThat(thrown).hasMessageThat().contains("clientId must be specified");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_loadByClientId_clientIdIsEmpty() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(""));
|
||||
assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientId(""));
|
||||
assertThat(thrown).hasMessageThat().contains("clientId must be specified");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_loadByClientIdCached_clientIdIsNull() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(null));
|
||||
assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(null));
|
||||
assertThat(thrown).hasMessageThat().contains("clientId must be specified");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_loadByClientIdCached_clientIdIsEmpty() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(""));
|
||||
assertThrows(IllegalArgumentException.class, () -> Registrar.loadByClientIdCached(""));
|
||||
assertThat(thrown).hasMessageThat().contains("clientId must be specified");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.newRegistry;
|
|||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.money.CurrencyUnit.EUR;
|
||||
|
@ -196,7 +195,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
"tld-reserved057",
|
||||
"lol,RESERVED_FOR_ANCHOR_TENANT,another_conflict");
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> {
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -354,21 +353,21 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_tldNeverSet() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> new Registry.Builder().build());
|
||||
assertThrows(IllegalArgumentException.class, () -> new Registry.Builder().build());
|
||||
assertThat(thrown).hasMessageThat().contains("No registry TLD specified");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_setTldStr_null() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(null));
|
||||
assertThrows(IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(null));
|
||||
assertThat(thrown).hasMessageThat().contains("TLD must not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_setTldStr_invalidTld() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> new Registry.Builder().setTldStr(".tld").build());
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
|
@ -378,7 +377,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_setTldStr_nonCanonicalTld() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> new Registry.Builder().setTldStr("TLD").build());
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
|
@ -420,7 +419,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_pricingEngineIsRequired() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new Registry.Builder().setTldStr("invalid").build());
|
||||
assertThat(thrown)
|
||||
|
@ -431,7 +430,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_negativeRenewBillingCostTransitionValue() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
|
@ -444,7 +443,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_negativeCreateBillingCost() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, -42)));
|
||||
assertThat(thrown).hasMessageThat().contains("createBillingCost cannot be negative");
|
||||
|
@ -453,7 +452,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_negativeRestoreBillingCost() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, -42)));
|
||||
assertThat(thrown).hasMessageThat().contains("restoreBillingCost cannot be negative");
|
||||
|
@ -462,7 +461,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_negativeServerStatusChangeBillingCost() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
|
@ -474,7 +473,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_renewBillingCostTransitionValue_wrongCurrency() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
|
@ -488,7 +487,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_createBillingCost_wrongCurrency() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(EUR, 42)).build());
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency");
|
||||
|
@ -497,7 +496,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_restoreBillingCost_wrongCurrency() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(EUR, 42)).build());
|
||||
assertThat(thrown).hasMessageThat().contains("cost must be in the registry's currency");
|
||||
|
@ -506,7 +505,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_serverStatusChangeBillingCost_wrongCurrency() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
|
@ -544,7 +543,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_eapFee_wrongCurrency() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
Registry.get("tld")
|
||||
|
@ -557,7 +556,7 @@ public class RegistryTest extends EntityTestCase {
|
|||
@Test
|
||||
public void testFailure_roidSuffixTooLong() {
|
||||
IllegalArgumentException e =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Registry.get("tld").asBuilder().setRoidSuffix("123456789"));
|
||||
assertThat(e).hasMessageThat().isEqualTo("ROID suffix must be in format ^[A-Z0-9_]{1,8}$");
|
||||
|
|
|
@ -22,7 +22,6 @@ import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
|||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.registry.Registry;
|
||||
|
@ -82,7 +81,7 @@ public class PremiumListTest {
|
|||
@Test
|
||||
public void testParse_cannotIncludeDuplicateLabels() {
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
PremiumList.get("tld")
|
||||
|
|
|
@ -34,7 +34,7 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
|||
import static google.registry.testing.DatastoreHelper.loadPremiumListEntries;
|
||||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.joda.time.Duration.standardMinutes;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -112,7 +112,7 @@ public class PremiumListUtilsTest {
|
|||
throws Exception {
|
||||
deletePremiumList(PremiumList.get("tld").get());
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class, () -> getPremiumPrice("blah", Registry.get("tld")));
|
||||
assertThat(thrown).hasMessageThat().contains("Could not load premium list 'tld'");
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import static google.registry.testing.DatastoreHelper.createTld;
|
|||
import static google.registry.testing.DatastoreHelper.persistReservedList;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
@ -266,7 +265,7 @@ public class ReservedListTest {
|
|||
assertThat(matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar")).isFalse();
|
||||
persistReservedList("reserved2", "lol,RESERVED_FOR_ANCHOR_TENANT,bar");
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar"));
|
||||
assertThat(thrown)
|
||||
|
@ -469,7 +468,7 @@ public class ReservedListTest {
|
|||
@Test
|
||||
public void testSave_badSyntax() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> persistReservedList("tld", "lol,FULLY_BLOCKED,e,e # yup"));
|
||||
assertThat(thrown).hasMessageThat().contains("Could not parse line in reserved list");
|
||||
|
@ -484,7 +483,7 @@ public class ReservedListTest {
|
|||
@Test
|
||||
public void testSave_additionalRestrictionWithIncompatibleReservationType() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
persistResource(
|
||||
|
@ -504,7 +503,7 @@ public class ReservedListTest {
|
|||
@Test
|
||||
public void testSave_badNameservers_invalidSyntax() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
persistReservedList(
|
||||
|
@ -517,7 +516,7 @@ public class ReservedListTest {
|
|||
@Test
|
||||
public void testSave_badNameservers_tooFewPartsForHostname() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
persistReservedList(
|
||||
|
@ -530,7 +529,7 @@ public class ReservedListTest {
|
|||
@Test
|
||||
public void testSave_noPasswordWithAnchorTenantReservation() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
persistResource(
|
||||
|
@ -548,7 +547,7 @@ public class ReservedListTest {
|
|||
@Test
|
||||
public void testSave_noNameserversWithNameserverRestrictedReservation() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
persistResource(
|
||||
|
@ -568,7 +567,7 @@ public class ReservedListTest {
|
|||
public void testParse_cannotIncludeDuplicateLabels() {
|
||||
ReservedList rl = new ReservedList.Builder().setName("blah").build();
|
||||
IllegalStateException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() ->
|
||||
rl.parse(
|
||||
|
|
|
@ -17,7 +17,7 @@ package google.registry.model.server;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
|
@ -47,7 +47,7 @@ public class KmsSecretRevisionTest {
|
|||
@Test
|
||||
public void test_setEncryptedValue_tooLong_throwsException() {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
secretRevision =
|
||||
|
|
|
@ -20,7 +20,7 @@ import static google.registry.model.server.Lock.LockState.FREE;
|
|||
import static google.registry.model.server.Lock.LockState.IN_USE;
|
||||
import static google.registry.model.server.Lock.LockState.OWNER_DIED;
|
||||
import static google.registry.model.server.Lock.LockState.TIMED_OUT;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
@ -136,7 +136,7 @@ public class LockTest {
|
|||
@Test
|
||||
public void testFailure_emptyResourceName() throws Exception {
|
||||
IllegalArgumentException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> Lock.acquire("", "", TWO_MILLIS, requestStatusChecker));
|
||||
assertThat(thrown).hasMessageThat().contains("resourceName cannot be null or empty");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue