mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Get rid of custom ExceptionRule methods
The only remaining methods on ExceptionRule after this are methods that also exist on ExpectedException, which will allow us to, in the next CL, swap out the one for the other and then run the automated refactoring to turn it all into assertThrows/expectThrows. Note that there were some assertions about root causes that couldn't easily be turned into ExpectedException invocations, so I simply converted them directly to usages of assertThrows/expectThrows. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=178623431
This commit is contained in:
parent
68a26f5b6e
commit
b825a2b5a8
144 changed files with 1176 additions and 894 deletions
|
@ -649,8 +649,8 @@ public class ExpandRecurringBillingEventsActionTest
|
|||
@Test
|
||||
public void testFailure_cursorAfterExecutionTime() throws Exception {
|
||||
action.cursorTimeParam = Optional.of(clock.nowUtc().plusYears(1));
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Cursor time must be earlier than execution time.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Cursor time must be earlier than execution time.");
|
||||
runMapreduce();
|
||||
}
|
||||
|
||||
|
@ -658,8 +658,8 @@ public class ExpandRecurringBillingEventsActionTest
|
|||
public void testFailure_cursorAtExecutionTime() throws Exception {
|
||||
// The clock advances one milli on runMapreduce.
|
||||
action.cursorTimeParam = Optional.of(clock.nowUtc().plusMillis(1));
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Cursor time must be earlier than execution time.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Cursor time must be earlier than execution time.");
|
||||
runMapreduce();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,8 @@ public final class DnsInjectionTest {
|
|||
public void testRefreshDns_missingDomain_throwsNotFound() throws Exception {
|
||||
when(req.getParameter("type")).thenReturn("domain");
|
||||
when(req.getParameter("name")).thenReturn("example.lol");
|
||||
thrown.expect(NotFoundException.class, "domain example.lol not found");
|
||||
thrown.expect(NotFoundException.class);
|
||||
thrown.expectMessage("domain example.lol not found");
|
||||
component.refreshDns().run();
|
||||
}
|
||||
|
||||
|
@ -114,7 +115,8 @@ public final class DnsInjectionTest {
|
|||
public void testRefreshDns_missingHost_throwsNotFound() throws Exception {
|
||||
when(req.getParameter("type")).thenReturn("host");
|
||||
when(req.getParameter("name")).thenReturn("ns1.example.lol");
|
||||
thrown.expect(NotFoundException.class, "host ns1.example.lol not found");
|
||||
thrown.expect(NotFoundException.class);
|
||||
thrown.expectMessage("host ns1.example.lol not found");
|
||||
component.refreshDns().run();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ public class DnsQueueTest {
|
|||
|
||||
@Test
|
||||
public void test_addHostRefreshTask_failsOnUnknownTld() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
"octopus.notatld is not a subordinate host to a known tld");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("octopus.notatld is not a subordinate host to a known tld");
|
||||
try {
|
||||
dnsQueue.addHostRefreshTask("octopus.notatld");
|
||||
} finally {
|
||||
|
@ -85,7 +85,8 @@ public class DnsQueueTest {
|
|||
|
||||
@Test
|
||||
public void test_addDomainRefreshTask_failsOnUnknownTld() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "TLD notatld does not exist");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("TLD notatld does not exist");
|
||||
try {
|
||||
dnsQueue.addDomainRefreshTask("fake.notatld");
|
||||
} finally {
|
||||
|
|
|
@ -187,7 +187,8 @@ public class PublishDnsUpdatesActionTest {
|
|||
|
||||
@Test
|
||||
public void testLockIsntAvailable() throws Exception {
|
||||
thrown.expect(ServiceUnavailableException.class, "Lock failure");
|
||||
thrown.expect(ServiceUnavailableException.class);
|
||||
thrown.expectMessage("Lock failure");
|
||||
action = createAction("xn--q9jyb4c");
|
||||
action.domains = ImmutableSet.of("example.com", "example2.com");
|
||||
action.hosts = ImmutableSet.of("ns1.example.com", "ns2.example.com", "ns1.example2.com");
|
||||
|
|
|
@ -78,8 +78,8 @@ public class RefreshDnsActionTest {
|
|||
public void testSuccess_externalHostNotEnqueued() throws Exception {
|
||||
persistActiveDomain("example.xn--q9jyb4c");
|
||||
persistActiveHost("ns1.example.xn--q9jyb4c");
|
||||
thrown.expect(BadRequestException.class,
|
||||
"ns1.example.xn--q9jyb4c isn't a subordinate hostname");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("ns1.example.xn--q9jyb4c isn't a subordinate hostname");
|
||||
try {
|
||||
run(TargetType.HOST, "ns1.example.xn--q9jyb4c");
|
||||
} finally {
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.dns.writer.dnsupdate;
|
|||
|
||||
import static com.google.common.io.BaseEncoding.base16;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.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.when;
|
||||
|
@ -129,8 +129,7 @@ public class DnsMessageTransportTest {
|
|||
Duration testTimeout = Duration.standardSeconds(1);
|
||||
DnsMessageTransport resolver = new DnsMessageTransport(mockFactory, UPDATE_HOST, testTimeout);
|
||||
Message expectedQuery = new Message();
|
||||
SocketTimeoutException e =
|
||||
expectThrows(SocketTimeoutException.class, () -> resolver.send(expectedQuery));
|
||||
assertThrows(SocketTimeoutException.class, () -> resolver.send(expectedQuery));
|
||||
verify(mockSocket).setSoTimeout((int) testTimeout.getMillis());
|
||||
}
|
||||
|
||||
|
@ -146,7 +145,8 @@ public class DnsMessageTransportTest {
|
|||
}
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
when(mockSocket.getOutputStream()).thenReturn(outputStream);
|
||||
thrown.expect(IllegalArgumentException.class, "message larger than maximum");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("message larger than maximum");
|
||||
|
||||
resolver.send(oversize);
|
||||
}
|
||||
|
@ -157,9 +157,8 @@ public class DnsMessageTransportTest {
|
|||
when(mockSocket.getInputStream())
|
||||
.thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse)));
|
||||
when(mockSocket.getOutputStream()).thenReturn(new ByteArrayOutputStream());
|
||||
thrown.expect(
|
||||
VerifyException.class,
|
||||
"response ID "
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("response ID "
|
||||
+ expectedResponse.getHeader().getID()
|
||||
+ " does not match query ID "
|
||||
+ simpleQuery.getHeader().getID());
|
||||
|
@ -174,8 +173,8 @@ public class DnsMessageTransportTest {
|
|||
when(mockSocket.getInputStream())
|
||||
.thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse)));
|
||||
when(mockSocket.getOutputStream()).thenReturn(new ByteArrayOutputStream());
|
||||
thrown.expect(
|
||||
VerifyException.class, "response opcode 'STATUS' does not match query opcode 'QUERY'");
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("response opcode 'STATUS' does not match query opcode 'QUERY'");
|
||||
|
||||
resolver.send(simpleQuery);
|
||||
}
|
||||
|
|
|
@ -390,7 +390,8 @@ public class DnsUpdateWriterTest {
|
|||
.build();
|
||||
persistResource(domain);
|
||||
when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL));
|
||||
thrown.expect(VerifyException.class, "SERVFAIL");
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("SERVFAIL");
|
||||
|
||||
writer.publishDomain("example.tld");
|
||||
writer.commit();
|
||||
|
@ -405,7 +406,8 @@ public class DnsUpdateWriterTest {
|
|||
.build();
|
||||
persistResource(host);
|
||||
when(mockResolver.send(any(Message.class))).thenReturn(messageWithResponseCode(Rcode.SERVFAIL));
|
||||
thrown.expect(VerifyException.class, "SERVFAIL");
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("SERVFAIL");
|
||||
|
||||
writer.publishHost("ns1.example.tld");
|
||||
writer.commit();
|
||||
|
|
|
@ -208,7 +208,8 @@ public class BigqueryPollJobActionTest {
|
|||
when(bigqueryJobsGet.execute()).thenReturn(
|
||||
new Job().setStatus(new JobStatus().setState("DONE")));
|
||||
action.payload = "payload".getBytes(UTF_8);
|
||||
thrown.expect(BadRequestException.class, "Cannot deserialize task from payload");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("Cannot deserialize task from payload");
|
||||
action.run();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,8 @@ public class CheckSnapshotActionTest {
|
|||
public void testPost_forPendingBackup_returnsNotModified() throws Exception {
|
||||
setPendingBackup();
|
||||
|
||||
thrown.expect(NotModifiedException.class, "Datastore backup some_backup still pending");
|
||||
thrown.expect(NotModifiedException.class);
|
||||
thrown.expectMessage("Datastore backup some_backup still pending");
|
||||
action.run();
|
||||
}
|
||||
|
||||
|
@ -140,9 +141,8 @@ public class CheckSnapshotActionTest {
|
|||
.plus(Duration.standardMinutes(3))
|
||||
.plus(Duration.millis(1234)));
|
||||
|
||||
thrown.expect(
|
||||
NoContentException.class,
|
||||
"Datastore backup some_backup abandoned - "
|
||||
thrown.expect(NoContentException.class);
|
||||
thrown.expectMessage("Datastore backup some_backup abandoned - "
|
||||
+ "not complete after 20 hours, 3 minutes and 1 second");
|
||||
|
||||
action.run();
|
||||
|
@ -188,7 +188,8 @@ public class CheckSnapshotActionTest {
|
|||
when(backupService.findByName("some_backup"))
|
||||
.thenThrow(new IllegalArgumentException("No backup found"));
|
||||
|
||||
thrown.expect(BadRequestException.class, "Bad backup name some_backup: No backup found");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("Bad backup name some_backup: No backup found");
|
||||
|
||||
action.run();
|
||||
}
|
||||
|
@ -219,7 +220,8 @@ public class CheckSnapshotActionTest {
|
|||
when(backupService.findByName("some_backup"))
|
||||
.thenThrow(new IllegalArgumentException("No backup found"));
|
||||
|
||||
thrown.expect(BadRequestException.class, "Bad backup name some_backup: No backup found");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("Bad backup name some_backup: No backup found");
|
||||
|
||||
action.run();
|
||||
}
|
||||
|
|
|
@ -186,18 +186,16 @@ public class LoadSnapshotActionTest {
|
|||
@Test
|
||||
public void testFailure_doPost_badGcsFilename() throws Exception {
|
||||
action.snapshotFile = "gs://bucket/snapshot";
|
||||
thrown.expect(
|
||||
BadRequestException.class,
|
||||
"Error calling load snapshot: backup info file extension missing");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("Error calling load snapshot: backup info file extension missing");
|
||||
action.run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_doPost_bigqueryThrowsException() throws Exception {
|
||||
when(bigqueryJobsInsert.execute()).thenThrow(new IOException("The Internet has gone missing"));
|
||||
thrown.expect(
|
||||
InternalServerErrorException.class,
|
||||
"Error loading snapshot: The Internet has gone missing");
|
||||
thrown.expect(InternalServerErrorException.class);
|
||||
thrown.expectMessage("Error loading snapshot: The Internet has gone missing");
|
||||
action.run();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,8 @@ public class PublishDetailReportActionTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_noRegistrarParameter() throws Exception {
|
||||
thrown.expect(BadRequestException.class, REGISTRAR_ID_PARAM);
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage(REGISTRAR_ID_PARAM);
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
GCS_BUCKET_PARAM, "mah-buckit",
|
||||
GCS_FOLDER_PREFIX_PARAM, "some/folder/",
|
||||
|
@ -117,7 +118,8 @@ public class PublishDetailReportActionTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_noGcsBucketParameter() throws Exception {
|
||||
thrown.expect(BadRequestException.class, GCS_BUCKET_PARAM);
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage(GCS_BUCKET_PARAM);
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
REGISTRAR_ID_PARAM, "TheRegistrar",
|
||||
GCS_FOLDER_PREFIX_PARAM, "some/folder/",
|
||||
|
@ -126,7 +128,8 @@ public class PublishDetailReportActionTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_noGcsFolderPrefixParameter() throws Exception {
|
||||
thrown.expect(BadRequestException.class, GCS_FOLDER_PREFIX_PARAM);
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage(GCS_FOLDER_PREFIX_PARAM);
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
REGISTRAR_ID_PARAM, "TheRegistrar",
|
||||
GCS_BUCKET_PARAM, "mah-buckit",
|
||||
|
@ -135,7 +138,8 @@ public class PublishDetailReportActionTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_noReportNameParameter() throws Exception {
|
||||
thrown.expect(BadRequestException.class, DETAIL_REPORT_NAME_PARAM);
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage(DETAIL_REPORT_NAME_PARAM);
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
REGISTRAR_ID_PARAM, "TheRegistrar",
|
||||
GCS_BUCKET_PARAM, "mah-buckit",
|
||||
|
@ -144,7 +148,8 @@ public class PublishDetailReportActionTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_registrarNotFound() throws Exception {
|
||||
thrown.expect(BadRequestException.class, "FakeRegistrar");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("FakeRegistrar");
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
REGISTRAR_ID_PARAM, "FakeRegistrar",
|
||||
GCS_BUCKET_PARAM, "mah-buckit",
|
||||
|
@ -156,7 +161,8 @@ public class PublishDetailReportActionTest {
|
|||
public void testFailure_registrarHasNoDriveFolder() throws Exception {
|
||||
persistResource(
|
||||
loadRegistrar("TheRegistrar").asBuilder().setDriveFolderId(null).build());
|
||||
thrown.expect(BadRequestException.class, "drive folder");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("drive folder");
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
REGISTRAR_ID_PARAM, "TheRegistrar",
|
||||
GCS_BUCKET_PARAM, "mah-buckit",
|
||||
|
@ -166,7 +172,8 @@ public class PublishDetailReportActionTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_gcsBucketNotFound() throws Exception {
|
||||
thrown.expect(BadRequestException.class, "fake-buckit");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("fake-buckit");
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
REGISTRAR_ID_PARAM, "TheRegistrar",
|
||||
GCS_BUCKET_PARAM, "fake-buckit",
|
||||
|
@ -176,7 +183,8 @@ public class PublishDetailReportActionTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_gcsFileNotFound() throws Exception {
|
||||
thrown.expect(BadRequestException.class, "some/folder/fake_file.csv");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("some/folder/fake_file.csv");
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
REGISTRAR_ID_PARAM, "TheRegistrar",
|
||||
GCS_BUCKET_PARAM, "mah-buckit",
|
||||
|
@ -189,7 +197,8 @@ public class PublishDetailReportActionTest {
|
|||
when(driveConnection.createFile(
|
||||
anyString(), any(MediaType.class), anyString(), any(byte[].class)))
|
||||
.thenThrow(new IOException("Drive is down"));
|
||||
thrown.expect(InternalServerErrorException.class, "Drive is down");
|
||||
thrown.expect(InternalServerErrorException.class);
|
||||
thrown.expectMessage("Drive is down");
|
||||
action.handleJsonRequest(ImmutableMap.of(
|
||||
REGISTRAR_ID_PARAM, "TheRegistrar",
|
||||
GCS_BUCKET_PARAM, "mah-buckit",
|
||||
|
|
|
@ -127,7 +127,8 @@ public class UpdateSnapshotViewActionTest {
|
|||
public void testFailure_bigqueryConnectionThrowsError() throws Exception {
|
||||
when(bigqueryTables.update(anyString(), anyString(), anyString(), any(Table.class)))
|
||||
.thenThrow(new IOException("I'm sorry Dave, I can't let you do that"));
|
||||
thrown.expect(InternalServerErrorException.class, "Error in update snapshot view action");
|
||||
thrown.expect(InternalServerErrorException.class);
|
||||
thrown.expectMessage("Error in update snapshot view action");
|
||||
action.run();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ public final class TlsCredentialsTest {
|
|||
|
||||
@Test
|
||||
public void testProvideClientCertificateHash_missing() {
|
||||
thrown.expect(BadRequestException.class, "Missing header: X-SSL-Certificate");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("Missing header: X-SSL-Certificate");
|
||||
HttpServletRequest req = mock(HttpServletRequest.class);
|
||||
TlsCredentials.EppTlsModule.provideClientCertificateHash(req);
|
||||
}
|
||||
|
@ -57,7 +58,8 @@ public final class TlsCredentialsTest {
|
|||
|
||||
@Test
|
||||
public void testProvideRequestedServername_missing() {
|
||||
thrown.expect(BadRequestException.class, "Missing header: X-Requested-Servername-SNI");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("Missing header: X-Requested-Servername-SNI");
|
||||
HttpServletRequest req = mock(HttpServletRequest.class);
|
||||
TlsCredentials.EppTlsModule.provideRequestedServername(req);
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ public class ContactCreateFlowTest
|
|||
@Test
|
||||
public void testFailure_alreadyExists() throws Exception {
|
||||
persistActiveContact(getUniqueIdFromCommand());
|
||||
thrown.expect(
|
||||
ResourceAlreadyExistsException.class,
|
||||
thrown.expect(ResourceAlreadyExistsException.class);
|
||||
thrown.expectMessage(
|
||||
String.format("Object with given ID (%s) already exists", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
|
|
@ -69,18 +69,16 @@ public class ContactDeleteFlowTest
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -90,7 +88,8 @@ public class ContactDeleteFlowTest
|
|||
newContactResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.setStatusValues(ImmutableSet.of(statusValue))
|
||||
.build());
|
||||
thrown.expect(exception, statusValue.getXmlName());
|
||||
thrown.expect(exception);
|
||||
thrown.expectMessage(statusValue.getXmlName());
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -163,18 +163,16 @@ public class ContactInfoFlowTest extends ResourceFlowTestCase<ContactInfoFlow, C
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistContactResource(false);
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -206,9 +206,8 @@ public class ContactTransferApproveFlowTest
|
|||
public void testFailure_deletedContact() throws Exception {
|
||||
contact = persistResource(
|
||||
contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_approve.xml");
|
||||
}
|
||||
|
||||
|
@ -217,9 +216,8 @@ public class ContactTransferApproveFlowTest
|
|||
deleteResource(contact);
|
||||
contact = persistResource(
|
||||
contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_approve.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -190,18 +190,16 @@ public class ContactTransferCancelFlowTest
|
|||
public void testFailure_deletedContact() throws Exception {
|
||||
contact = persistResource(
|
||||
contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_cancel.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentContact() throws Exception {
|
||||
deleteResource(contact);
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_cancel.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -169,18 +169,16 @@ public class ContactTransferQueryFlowTest
|
|||
public void testFailure_deletedContact() throws Exception {
|
||||
contact = persistResource(
|
||||
contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_query.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentContact() throws Exception {
|
||||
deleteResource(contact);
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_query.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -205,18 +205,16 @@ public class ContactTransferRejectFlowTest
|
|||
public void testFailure_deletedContact() throws Exception {
|
||||
contact = persistResource(
|
||||
contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_reject.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentContact() throws Exception {
|
||||
deleteResource(contact);
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_reject.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -223,18 +223,16 @@ public class ContactTransferRequestFlowTest
|
|||
public void testFailure_deletedContact() throws Exception {
|
||||
contact = persistResource(
|
||||
contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_request.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentContact() throws Exception {
|
||||
deleteResource(contact);
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("contact_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
@ -242,7 +240,8 @@ public class ContactTransferRequestFlowTest
|
|||
public void testFailure_clientTransferProhibited() throws Exception {
|
||||
contact = persistResource(
|
||||
contact.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "clientTransferProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("clientTransferProhibited");
|
||||
doFailingTest("contact_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
@ -250,7 +249,8 @@ public class ContactTransferRequestFlowTest
|
|||
public void testFailure_serverTransferProhibited() throws Exception {
|
||||
contact = persistResource(
|
||||
contact.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverTransferProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("serverTransferProhibited");
|
||||
doFailingTest("contact_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,8 @@ public class ContactTransferRequestFlowTest
|
|||
public void testFailure_pendingDelete() throws Exception {
|
||||
contact = persistResource(
|
||||
contact.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingDelete");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("pendingDelete");
|
||||
doFailingTest("contact_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -253,18 +253,16 @@ public class ContactUpdateFlowTest
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -349,7 +347,8 @@ public class ContactUpdateFlowTest
|
|||
newContactResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverUpdateProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("serverUpdateProhibited");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -359,7 +358,8 @@ public class ContactUpdateFlowTest
|
|||
newContactResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingDelete");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("pendingDelete");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,8 @@ public class DomainAllocateFlowTest
|
|||
.setAllowedRegistrantContactIds(ImmutableSet.of("jd1234"))
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForTldException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForTldException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlowAsSuperuser();
|
||||
}
|
||||
|
||||
|
@ -267,7 +268,8 @@ public class DomainAllocateFlowTest
|
|||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.net", "ns2.example.net"))
|
||||
.build());
|
||||
thrown.expect(RegistrantNotAllowedException.class, "jd1234");
|
||||
thrown.expect(RegistrantNotAllowedException.class);
|
||||
thrown.expectMessage("jd1234");
|
||||
runFlowAsSuperuser();
|
||||
}
|
||||
|
||||
|
@ -311,7 +313,8 @@ public class DomainAllocateFlowTest
|
|||
"reserved",
|
||||
"example-one,NAMESERVER_RESTRICTED," + "ns2.example.net:ns3.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlowAsSuperuser();
|
||||
}
|
||||
|
||||
|
@ -363,7 +366,8 @@ public class DomainAllocateFlowTest
|
|||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns1.example.net", "ns2.example.net", "ns3.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlowAsSuperuser();
|
||||
}
|
||||
|
||||
|
@ -381,7 +385,8 @@ public class DomainAllocateFlowTest
|
|||
.setAllowedFullyQualifiedHostNames(
|
||||
ImmutableSet.of("ns4.example.net", "ns2.example.net", "ns3.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForTldException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForTldException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlowAsSuperuser();
|
||||
}
|
||||
|
||||
|
|
|
@ -1055,7 +1055,8 @@ public class DomainApplicationCreateFlowTest
|
|||
persistActiveHost("ns1.example.net");
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class, "(ns2.example.net)");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class);
|
||||
thrown.expectMessage("(ns2.example.net)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1064,7 +1065,8 @@ public class DomainApplicationCreateFlowTest
|
|||
persistActiveHost("ns1.example.net");
|
||||
persistActiveHost("ns2.example.net");
|
||||
persistActiveContact("jd1234");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class, "(sh8013)");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class);
|
||||
thrown.expectMessage("(sh8013)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1562,7 +1564,8 @@ public class DomainApplicationCreateFlowTest
|
|||
persistResource(Registry.get("tld").asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
|
||||
.build());
|
||||
thrown.expect(RegistrantNotAllowedException.class, "jd1234");
|
||||
thrown.expect(RegistrantNotAllowedException.class);
|
||||
thrown.expectMessage("jd1234");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1572,7 +1575,8 @@ public class DomainApplicationCreateFlowTest
|
|||
persistResource(Registry.get("tld").asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForTldException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForTldException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1633,7 +1637,8 @@ public class DomainApplicationCreateFlowTest
|
|||
.build());
|
||||
persistContactsAndHosts();
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1691,7 +1696,8 @@ public class DomainApplicationCreateFlowTest
|
|||
.build());
|
||||
persistContactsAndHosts();
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1710,7 +1716,8 @@ public class DomainApplicationCreateFlowTest
|
|||
.build());
|
||||
persistContactsAndHosts();
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(NameserversNotAllowedForTldException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForTldException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -123,9 +123,8 @@ public class DomainApplicationDeleteFlowTest
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -135,9 +134,8 @@ public class DomainApplicationDeleteFlowTest
|
|||
.setRepoId("1-TLD")
|
||||
.setDeletionTime(clock.nowUtc().minusSeconds(1))
|
||||
.build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -261,9 +261,8 @@ public class DomainApplicationInfoFlowTest
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -275,9 +274,8 @@ public class DomainApplicationInfoFlowTest
|
|||
.setDeletionTime(clock.nowUtc().minusDays(1))
|
||||
.setRegistrant(Key.create(persistActiveContact("jd1234")))
|
||||
.build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -417,9 +417,8 @@ public class DomainApplicationUpdateFlowTest
|
|||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
persistReferencedEntities();
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -427,9 +426,8 @@ public class DomainApplicationUpdateFlowTest
|
|||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistReferencedEntities();
|
||||
persistResource(newApplicationBuilder().setDeletionTime(START_OF_TIME).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -448,7 +446,8 @@ public class DomainApplicationUpdateFlowTest
|
|||
persistReferencedEntities();
|
||||
persistResource(newApplicationBuilder().setStatusValues(
|
||||
ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED)).build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverUpdateProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("serverUpdateProhibited");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -480,9 +479,8 @@ public class DomainApplicationUpdateFlowTest
|
|||
persistActiveContact("sh8013");
|
||||
persistActiveContact("mak21");
|
||||
persistNewApplication();
|
||||
thrown.expect(
|
||||
LinkedResourcesDoNotExistException.class,
|
||||
"(ns2.example.tld)");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class);
|
||||
thrown.expectMessage("(ns2.example.tld)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -492,9 +490,8 @@ public class DomainApplicationUpdateFlowTest
|
|||
persistActiveHost("ns2.example.tld");
|
||||
persistActiveContact("mak21");
|
||||
persistNewApplication();
|
||||
thrown.expect(
|
||||
LinkedResourcesDoNotExistException.class,
|
||||
"(sh8013)");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class);
|
||||
thrown.expectMessage("(sh8013)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -749,7 +746,8 @@ public class DomainApplicationUpdateFlowTest
|
|||
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.tld:ns3.example.tld"))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns2.example.tld");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns2.example.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -827,7 +825,8 @@ public class DomainApplicationUpdateFlowTest
|
|||
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.tld:ns3.example.tld"))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns2.example.tld");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns2.example.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -846,7 +845,8 @@ public class DomainApplicationUpdateFlowTest
|
|||
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.tld:ns2.example.tld"))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(NameserversNotAllowedForTldException.class, "ns2.example.tld");
|
||||
thrown.expect(NameserversNotAllowedForTldException.class);
|
||||
thrown.expectMessage("ns2.example.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -637,7 +637,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
.build());
|
||||
setEppInput("domain_create_lrp.xml");
|
||||
persistContactsAndHosts();
|
||||
thrown.expect(InvalidLrpTokenException.class, "Invalid limited registration period token");
|
||||
thrown.expect(InvalidLrpTokenException.class);
|
||||
thrown.expectMessage("Invalid limited registration period token");
|
||||
runFlow();
|
||||
assertThat(ofy().load().entity(token).now().getRedemptionHistoryEntry()).isNull();
|
||||
}
|
||||
|
@ -648,7 +649,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
.setLrpPeriod(new Interval(clock.nowUtc().minusDays(1), clock.nowUtc().plusDays(1)))
|
||||
.build());
|
||||
persistContactsAndHosts();
|
||||
thrown.expect(InvalidLrpTokenException.class, "Invalid limited registration period token");
|
||||
thrown.expect(InvalidLrpTokenException.class);
|
||||
thrown.expectMessage("Invalid limited registration period token");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1043,9 +1045,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
persistActiveHost("ns1.example.net");
|
||||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
thrown.expect(
|
||||
LinkedResourcesDoNotExistException.class,
|
||||
"(ns2.example.net)");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class);
|
||||
thrown.expectMessage("(ns2.example.net)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1058,9 +1059,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(
|
||||
LinkedResourceInPendingDeleteProhibitsOperationException.class,
|
||||
"ns2.example.net");
|
||||
thrown.expect(LinkedResourceInPendingDeleteProhibitsOperationException.class);
|
||||
thrown.expectMessage("ns2.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1095,9 +1095,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
persistActiveHost("ns1.example.net");
|
||||
persistActiveHost("ns2.example.net");
|
||||
persistActiveContact("jd1234");
|
||||
thrown.expect(
|
||||
LinkedResourcesDoNotExistException.class,
|
||||
"(sh8013)");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class);
|
||||
thrown.expectMessage("(sh8013)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1110,9 +1109,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(
|
||||
LinkedResourceInPendingDeleteProhibitsOperationException.class,
|
||||
"jd1234");
|
||||
thrown.expect(LinkedResourceInPendingDeleteProhibitsOperationException.class);
|
||||
thrown.expectMessage("jd1234");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1708,7 +1706,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
persistResource(Registry.get("tld").asBuilder()
|
||||
.setAllowedRegistrantContactIds(ImmutableSet.of("someone"))
|
||||
.build());
|
||||
thrown.expect(RegistrantNotAllowedException.class, "jd1234");
|
||||
thrown.expect(RegistrantNotAllowedException.class);
|
||||
thrown.expectMessage("jd1234");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1718,7 +1717,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
persistResource(Registry.get("tld").asBuilder()
|
||||
.setAllowedFullyQualifiedHostNames(ImmutableSet.of("ns2.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForTldException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForTldException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1785,7 +1785,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
persistReservedList(
|
||||
"reserved", "example,NAMESERVER_RESTRICTED,ns2.example.net:ns3.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1800,7 +1801,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
persistReservedList(
|
||||
"reserved", "lol,NAMESERVER_RESTRICTED,ns1.example.net:ns2.example.net"))
|
||||
.build());
|
||||
thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class, "example.tld");
|
||||
thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class);
|
||||
thrown.expectMessage("example.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1849,7 +1851,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
"example,NAMESERVER_RESTRICTED,"
|
||||
+ "ns1.example.net:ns2.example.net:ns3.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForTldException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForTldException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1867,7 +1870,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
"example,NAMESERVER_RESTRICTED,"
|
||||
+ "ns2.example.net:ns3.example.net:ns4.example.net"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns1.example.net");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns1.example.net");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1887,7 +1891,8 @@ public class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow,
|
|||
"lol,NAMESERVER_RESTRICTED,"
|
||||
+ "ns1.example.net:ns2.example.net:ns3.example.net"))
|
||||
.build());
|
||||
thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class, "example.tld");
|
||||
thrown.expect(DomainNotAllowedForTldWithCreateRestrictionException.class);
|
||||
thrown.expectMessage("example.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -651,18 +651,16 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -721,7 +719,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
persistResource(newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.addStatusValue(StatusValue.CLIENT_DELETE_PROHIBITED)
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "clientDeleteProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("clientDeleteProhibited");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -730,7 +729,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
persistResource(newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.addStatusValue(StatusValue.SERVER_DELETE_PROHIBITED)
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverDeleteProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("serverDeleteProhibited");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -739,7 +739,8 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase<DomainDeleteFlow,
|
|||
persistResource(newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingDelete");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("pendingDelete");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -373,9 +373,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -384,9 +383,8 @@ public class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Dom
|
|||
persistResource(newDomainResource("example.tld").asBuilder()
|
||||
.setDeletionTime(clock.nowUtc().minusDays(1))
|
||||
.build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -410,32 +410,32 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_clientRenewProhibited() throws Exception {
|
||||
persistDomain(StatusValue.CLIENT_RENEW_PROHIBITED);
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "clientRenewProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("clientRenewProhibited");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_serverRenewProhibited() throws Exception {
|
||||
persistDomain(StatusValue.SERVER_RENEW_PROHIBITED);
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverRenewProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("serverRenewProhibited");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.setDeletionTime(clock.nowUtc().plusDays(1))
|
||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingDelete");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("pendingDelete");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -574,7 +575,8 @@ public class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, D
|
|||
.asBuilder()
|
||||
.setRegistrationExpirationTime(DateTime.parse("2001-09-08T22:00:00.0Z"))
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingTransfer");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("pendingTransfer");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -340,9 +340,8 @@ public class DomainRestoreRequestFlowTest extends
|
|||
|
||||
@Test
|
||||
public void testFailure_doesNotExist() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -480,16 +480,16 @@ public class DomainTransferApproveFlowTest
|
|||
public void testFailure_deletedDomain() throws Exception {
|
||||
persistResource(
|
||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_approve.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentDomain() throws Exception {
|
||||
deleteResource(domain);
|
||||
thrown.expect(ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_approve.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -285,18 +285,16 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_deletedDomain() throws Exception {
|
||||
domain = persistResource(
|
||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_cancel.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentDomain() throws Exception {
|
||||
deleteResource(domain);
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_cancel.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -207,18 +207,16 @@ public class DomainTransferQueryFlowTest
|
|||
public void testFailure_deletedDomain() throws Exception {
|
||||
domain = persistResource(
|
||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_query.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentDomain() throws Exception {
|
||||
deleteResource(domain);
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_query.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -268,18 +268,16 @@ public class DomainTransferRejectFlowTest
|
|||
public void testFailure_deletedDomain() throws Exception {
|
||||
domain = persistResource(
|
||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_reject.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonexistentDomain() throws Exception {
|
||||
deleteResource(domain);
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_reject.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -1224,9 +1224,8 @@ public class DomainTransferRequestFlowTest
|
|||
setupDomain("example", "tld");
|
||||
domain = persistResource(
|
||||
domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
doFailingTest("domain_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
@ -1238,7 +1237,8 @@ public class DomainTransferRequestFlowTest
|
|||
ImmutableMap.of("YEARS", "1", "DOMAIN", "--invalid", "EXDATE", "2002-09-08T22:00:00.0Z"));
|
||||
eppLoader.replaceAll("JD1234-REP", contact.getRepoId());
|
||||
assertTransactionalFlow(true);
|
||||
thrown.expect(ResourceDoesNotExistException.class, "(--invalid)");
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage("(--invalid)");
|
||||
runFlow(CommitMode.LIVE, UserPrivileges.NORMAL);
|
||||
}
|
||||
|
||||
|
@ -1246,9 +1246,8 @@ public class DomainTransferRequestFlowTest
|
|||
public void testFailure_nonexistentDomain() throws Exception {
|
||||
createTld("tld");
|
||||
contact = persistActiveContact("jd1234");
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", "example.tld"));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", "example.tld"));
|
||||
doFailingTest("domain_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
@ -1264,7 +1263,8 @@ public class DomainTransferRequestFlowTest
|
|||
setupDomain("example", "tld");
|
||||
domain = persistResource(
|
||||
domain.asBuilder().addStatusValue(StatusValue.CLIENT_TRANSFER_PROHIBITED).build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "clientTransferProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("clientTransferProhibited");
|
||||
doFailingTest("domain_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
@ -1273,7 +1273,8 @@ public class DomainTransferRequestFlowTest
|
|||
setupDomain("example", "tld");
|
||||
domain = persistResource(
|
||||
domain.asBuilder().addStatusValue(StatusValue.SERVER_TRANSFER_PROHIBITED).build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverTransferProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("serverTransferProhibited");
|
||||
doFailingTest("domain_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
@ -1282,7 +1283,8 @@ public class DomainTransferRequestFlowTest
|
|||
setupDomain("example", "tld");
|
||||
domain = persistResource(
|
||||
domain.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingDelete");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("pendingDelete");
|
||||
doFailingTest("domain_transfer_request.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -822,9 +822,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
persistReferencedEntities();
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -832,9 +831,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistReferencedEntities();
|
||||
persistDeletedDomain(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -844,9 +842,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistActiveContact("sh8013");
|
||||
persistActiveContact("mak21");
|
||||
persistActiveDomain(getUniqueIdFromCommand());
|
||||
thrown.expect(
|
||||
LinkedResourcesDoNotExistException.class,
|
||||
"(ns2.example.foo)");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class);
|
||||
thrown.expectMessage("(ns2.example.foo)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -856,9 +853,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistActiveHost("ns2.example.foo");
|
||||
persistActiveContact("mak21");
|
||||
persistActiveDomain(getUniqueIdFromCommand());
|
||||
thrown.expect(
|
||||
LinkedResourcesDoNotExistException.class,
|
||||
"(sh8013)");
|
||||
thrown.expect(LinkedResourcesDoNotExistException.class);
|
||||
thrown.expectMessage("(sh8013)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -956,7 +952,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
newDomainResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.setStatusValues(ImmutableSet.of(SERVER_UPDATE_PROHIBITED))
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverUpdateProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("serverUpdateProhibited");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -968,7 +965,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.setDeletionTime(clock.nowUtc().plusDays(1))
|
||||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingDelete");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("pendingDelete");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1098,9 +1096,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(
|
||||
LinkedResourceInPendingDeleteProhibitsOperationException.class,
|
||||
"mak21");
|
||||
thrown.expect(LinkedResourceInPendingDeleteProhibitsOperationException.class);
|
||||
thrown.expectMessage("mak21");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1116,9 +1113,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.addStatusValue(StatusValue.PENDING_DELETE)
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(
|
||||
LinkedResourceInPendingDeleteProhibitsOperationException.class,
|
||||
"ns2.example.foo");
|
||||
thrown.expect(LinkedResourceInPendingDeleteProhibitsOperationException.class);
|
||||
thrown.expectMessage("ns2.example.foo");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1256,7 +1252,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistReservedList(
|
||||
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns3.example.foo"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns2.example.foo");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns2.example.foo");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1317,7 +1314,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistReservedList(
|
||||
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns3.example.foo"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns2.example.foo");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns2.example.foo");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1351,7 +1349,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
.setReservedLists(
|
||||
persistReservedList("reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class, "ns2.example.foo");
|
||||
thrown.expect(NameserversNotAllowedForDomainException.class);
|
||||
thrown.expectMessage("ns2.example.foo");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -1368,7 +1367,8 @@ public class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow,
|
|||
persistReservedList(
|
||||
"reserved", "example,NAMESERVER_RESTRICTED,ns1.example.foo:ns2.example.foo"))
|
||||
.build());
|
||||
thrown.expect(NameserversNotAllowedForTldException.class, "ns2.example.foo");
|
||||
thrown.expect(NameserversNotAllowedForTldException.class);
|
||||
thrown.expectMessage("ns2.example.foo");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -170,9 +170,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
public void testFailure_superordinateMissing() throws Exception {
|
||||
setEppHostCreateInput("ns1.example.tld", null);
|
||||
createTld("tld");
|
||||
thrown.expect(
|
||||
SuperordinateDomainDoesNotExistException.class,
|
||||
"(example.tld)");
|
||||
thrown.expect(SuperordinateDomainDoesNotExistException.class);
|
||||
thrown.expectMessage("(example.tld)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -186,9 +185,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.build());
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(
|
||||
SuperordinateDomainInPendingDeleteException.class,
|
||||
"Superordinate domain for this hostname is in pending delete");
|
||||
thrown.expect(SuperordinateDomainInPendingDeleteException.class);
|
||||
thrown.expectMessage("Superordinate domain for this hostname is in pending delete");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -196,8 +194,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
public void testFailure_alreadyExists() throws Exception {
|
||||
setEppHostCreateInput("ns1.example.tld", null);
|
||||
persistActiveHost(getUniqueIdFromCommand());
|
||||
thrown.expect(
|
||||
ResourceAlreadyExistsException.class,
|
||||
thrown.expect(ResourceAlreadyExistsException.class);
|
||||
thrown.expectMessage(
|
||||
String.format("Object with given ID (%s) already exists", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
@ -212,7 +210,8 @@ public class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, Hos
|
|||
@Test
|
||||
public void testFailure_nonPunyCodedHostname() throws Exception {
|
||||
setEppHostCreateInput("ns1.çauçalito.みんな", null);
|
||||
thrown.expect(HostNameNotPunyCodedException.class, "expected ns1.xn--aualito-txac.xn--q9jyb4c");
|
||||
thrown.expect(HostNameNotPunyCodedException.class);
|
||||
thrown.expectMessage("expected ns1.xn--aualito-txac.xn--q9jyb4c");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,14 +81,16 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(ResourceDoesNotExistException.class, "(ns1.example.tld)");
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage("(ns1.example.tld)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistDeletedHost("ns1.example.tld", clock.nowUtc().minusDays(1));
|
||||
thrown.expect(ResourceDoesNotExistException.class, "(ns1.example.tld)");
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage("(ns1.example.tld)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -98,7 +100,8 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
newHostResource("ns1.example.tld").asBuilder()
|
||||
.setStatusValues(ImmutableSet.of(statusValue))
|
||||
.build());
|
||||
thrown.expect(exception, statusValue.getXmlName());
|
||||
thrown.expect(exception);
|
||||
thrown.expectMessage(statusValue.getXmlName());
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -268,7 +271,8 @@ public class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, Hos
|
|||
@Test
|
||||
public void testFailure_nonPunyCodedHostname() throws Exception {
|
||||
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld"));
|
||||
thrown.expect(HostNameNotPunyCodedException.class, "expected ns1.xn--aualito-txac.tld");
|
||||
thrown.expect(HostNameNotPunyCodedException.class);
|
||||
thrown.expectMessage("expected ns1.xn--aualito-txac.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -143,9 +143,8 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -153,9 +152,8 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistResource(
|
||||
persistHostResource().asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -169,7 +167,8 @@ public class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostRes
|
|||
@Test
|
||||
public void testFailure_nonPunyCodedHostname() throws Exception {
|
||||
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.çauçalito.tld"));
|
||||
thrown.expect(HostNameNotPunyCodedException.class, "expected ns1.xn--aualito-txac.tld");
|
||||
thrown.expect(HostNameNotPunyCodedException.class);
|
||||
thrown.expectMessage("expected ns1.xn--aualito-txac.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -759,9 +759,8 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
public void testFailure_superordinateMissing() throws Exception {
|
||||
createTld("tld");
|
||||
persistActiveHost(oldHostName());
|
||||
thrown.expect(
|
||||
SuperordinateDomainDoesNotExistException.class,
|
||||
"(example.tld)");
|
||||
thrown.expect(SuperordinateDomainDoesNotExistException.class);
|
||||
thrown.expectMessage("(example.tld)");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -781,35 +780,31 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
.build());
|
||||
persistActiveSubordinateHost(oldHostName(), domain);
|
||||
clock.advanceOneMilli();
|
||||
thrown.expect(
|
||||
SuperordinateDomainInPendingDeleteException.class,
|
||||
"Superordinate domain for this hostname is in pending delete");
|
||||
thrown.expect(SuperordinateDomainInPendingDeleteException.class);
|
||||
thrown.expectMessage("Superordinate domain for this hostname is in pending delete");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_neverExisted_updateWithoutNameChange() throws Exception {
|
||||
setEppInput("host_update_name_unchanged.xml");
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistDeletedHost(oldHostName(), clock.nowUtc().minusDays(1));
|
||||
thrown.expect(
|
||||
ResourceDoesNotExistException.class,
|
||||
String.format("(%s)", getUniqueIdFromCommand()));
|
||||
thrown.expect(ResourceDoesNotExistException.class);
|
||||
thrown.expectMessage(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -819,7 +814,8 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
|
||||
clock.advanceOneMilli();
|
||||
setEppHostUpdateInput("ns1.example.tld", "ns1.example.tld", null, null);
|
||||
thrown.expect(HostAlreadyExistsException.class, "ns1.example.tld");
|
||||
thrown.expect(HostAlreadyExistsException.class);
|
||||
thrown.expectMessage("ns1.example.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -828,7 +824,8 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
createTld("tld");
|
||||
persistActiveSubordinateHost(oldHostName(), persistActiveDomain("example.tld"));
|
||||
persistActiveHost("ns2.example.tld");
|
||||
thrown.expect(HostAlreadyExistsException.class, "ns2.example.tld");
|
||||
thrown.expect(HostAlreadyExistsException.class);
|
||||
thrown.expectMessage("ns2.example.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -850,7 +847,8 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
@Test
|
||||
public void testFailure_referToNonPunyCodedHostname() throws Exception {
|
||||
setEppHostUpdateInput("ns1.çauçalito.tld", "ns1.sausalito.tld", null, null);
|
||||
thrown.expect(HostNameNotPunyCodedException.class, "expected ns1.xn--aualito-txac.tld");
|
||||
thrown.expect(HostNameNotPunyCodedException.class);
|
||||
thrown.expectMessage("expected ns1.xn--aualito-txac.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -858,7 +856,8 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
public void testFailure_renameToNonPunyCodedHostname() throws Exception {
|
||||
persistActiveHost("ns1.sausalito.tld");
|
||||
setEppHostUpdateInput("ns1.sausalito.tld", "ns1.çauçalito.tld", null, null);
|
||||
thrown.expect(HostNameNotPunyCodedException.class, "expected ns1.xn--aualito-txac.tld");
|
||||
thrown.expect(HostNameNotPunyCodedException.class);
|
||||
thrown.expectMessage("expected ns1.xn--aualito-txac.tld");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -977,7 +976,8 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
.setStatusValues(ImmutableSet.of(StatusValue.SERVER_UPDATE_PROHIBITED))
|
||||
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "serverUpdateProhibited");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("serverUpdateProhibited");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
@ -989,7 +989,8 @@ public class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, Hos
|
|||
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
|
||||
.setSuperordinateDomain(Key.create(persistActiveDomain("example.tld")))
|
||||
.build());
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class, "pendingDelete");
|
||||
thrown.expect(ResourceStatusProhibitsOperationException.class);
|
||||
thrown.expectMessage("pendingDelete");
|
||||
runFlow();
|
||||
}
|
||||
|
||||
|
|
|
@ -126,8 +126,8 @@ public class DirectoryGroupsConnectionTest {
|
|||
public void test_addMemberToGroup_handlesMemberKeyNotFoundException() throws Exception {
|
||||
when(membersInsert.execute()).thenThrow(
|
||||
makeResponseException(SC_NOT_FOUND, "Resource Not Found: memberKey"));
|
||||
thrown.expect(RuntimeException.class,
|
||||
"Adding member jim@example.com to group spam@example.com "
|
||||
thrown.expect(RuntimeException.class);
|
||||
thrown.expectMessage("Adding member jim@example.com to group spam@example.com "
|
||||
+ "failed because the member wasn't found.");
|
||||
connection.addMemberToGroup("spam@example.com", "jim@example.com", Role.MEMBER);
|
||||
}
|
||||
|
|
|
@ -83,13 +83,15 @@ public class EppResourceInputsTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_keyInputType_polymorphicSubclass() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "non-polymorphic");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("non-polymorphic");
|
||||
createKeyInput(DomainResource.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_keyInputType_noInheritanceBetweenTypes_eppResource() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "inheritance");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("inheritance");
|
||||
createKeyInput(EppResource.class, DomainBase.class);
|
||||
}
|
||||
|
||||
|
@ -102,13 +104,15 @@ public class EppResourceInputsTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_entityInputType_noInheritanceBetweenTypes_eppResource() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "inheritance");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("inheritance");
|
||||
createEntityInput(EppResource.class, DomainResource.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_entityInputType_noInheritanceBetweenTypes_subclasses() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "inheritance");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("inheritance");
|
||||
createEntityInput(DomainBase.class, DomainResource.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,8 +182,8 @@ public class BillingEventTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_syntheticFlagWithoutCreationTime() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage(
|
||||
"Synthetic creation time must be set if and only if the SYNTHETIC flag is set.");
|
||||
oneTime.asBuilder()
|
||||
.setFlags(ImmutableSet.of(BillingEvent.Flag.SYNTHETIC))
|
||||
|
@ -193,8 +193,8 @@ public class BillingEventTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_syntheticCreationTimeWithoutFlag() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage(
|
||||
"Synthetic creation time must be set if and only if the SYNTHETIC flag is set");
|
||||
oneTime.asBuilder()
|
||||
.setSyntheticCreationTime(now.plusDays(10))
|
||||
|
@ -203,8 +203,8 @@ public class BillingEventTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_syntheticFlagWithoutCancellationMatchingKey() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage(
|
||||
"Cancellation matching billing event must be set if and only if the SYNTHETIC flag is set");
|
||||
oneTime.asBuilder()
|
||||
.setFlags(ImmutableSet.of(BillingEvent.Flag.SYNTHETIC))
|
||||
|
@ -214,8 +214,8 @@ public class BillingEventTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_cancellationMatchingKeyWithoutFlag() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage(
|
||||
"Cancellation matching billing event must be set if and only if the SYNTHETIC flag is set");
|
||||
oneTime.asBuilder()
|
||||
.setCancellationMatchingBillingEvent(Key.create(recurring))
|
||||
|
@ -250,7 +250,8 @@ public class BillingEventTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_cancellation_forGracePeriodWithoutBillingEvent() {
|
||||
thrown.expect(IllegalArgumentException.class, "grace period without billing event");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("grace period without billing event");
|
||||
BillingEvent.Cancellation.forGracePeriod(
|
||||
GracePeriod.createWithoutBillingEvent(
|
||||
GracePeriodStatus.REDEMPTION,
|
||||
|
@ -262,13 +263,15 @@ public class BillingEventTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_cancellationWithNoBillingEvent() {
|
||||
thrown.expect(IllegalStateException.class, "exactly one billing event");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("exactly one billing event");
|
||||
cancellationOneTime.asBuilder().setOneTimeEventKey(null).setRecurringEventKey(null).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_cancellationWithBothBillingEvents() {
|
||||
thrown.expect(IllegalStateException.class, "exactly one billing event");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("exactly one billing event");
|
||||
cancellationOneTime.asBuilder()
|
||||
.setOneTimeEventKey(Key.create(oneTime))
|
||||
.setRecurringEventKey(Key.create(recurring))
|
||||
|
|
|
@ -100,7 +100,8 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testBadTimeOrdering_causesError() throws Exception {
|
||||
thrown.expect(IllegalStateException.class, "Created timestamp not after previous");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Created timestamp not after previous");
|
||||
new RegistrarBillingEntry.Builder()
|
||||
.setPrevious(
|
||||
new RegistrarBillingEntry.Builder()
|
||||
|
@ -120,7 +121,8 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testRegistrarMismatch_causesError() throws Exception {
|
||||
thrown.expect(IllegalStateException.class, "Parent not same as previous");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Parent not same as previous");
|
||||
new RegistrarBillingEntry.Builder()
|
||||
.setPrevious(
|
||||
new RegistrarBillingEntry.Builder()
|
||||
|
@ -160,7 +162,8 @@ public final class RegistrarBillingEntryTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testZeroAmount_causesError() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Amount can't be zero");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Amount can't be zero");
|
||||
new RegistrarBillingEntry.Builder()
|
||||
.setPrevious(null)
|
||||
.setParent(loadRegistrar("NewRegistrar"))
|
||||
|
|
|
@ -81,20 +81,23 @@ public class RegistrarCreditTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_missingTld() throws Exception {
|
||||
thrown.expect(NullPointerException.class, "tld");
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("tld");
|
||||
promoCredit.asBuilder().setTld(null).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_NonexistentTld() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "example");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("example");
|
||||
promoCredit.asBuilder().setTld("example").build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_CurrencyDoesNotMatchTldCurrency() throws Exception {
|
||||
assertThat(Registry.get("tld").getCurrency()).isEqualTo(USD);
|
||||
thrown.expect(IllegalArgumentException.class, "currency");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("currency");
|
||||
promoCredit.asBuilder().setTld("tld").setCurrency(JPY).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,50 +74,54 @@ public class CursorTest extends EntityTestCase {
|
|||
clock.advanceOneMilli();
|
||||
final DateTime time = DateTime.parse("2012-07-12T03:30:00.000Z");
|
||||
final DomainResource domain = persistActiveDomain("notaregistry.tld");
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Class required for cursor does not match scope class");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Class required for cursor does not match scope class");
|
||||
ofy().transact(() -> ofy().save().entity(Cursor.create(RDE_UPLOAD, time, domain)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_invalidScopeOnKeyCreate() throws Exception {
|
||||
createTld("tld");
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Class required for cursor does not match scope class");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Class required for cursor does not match scope class");
|
||||
Cursor.createKey(RDE_UPLOAD, persistActiveDomain("notaregistry.tld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_createGlobalKeyForScopedCursorType() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Cursor type is not a global cursor");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Cursor type is not a global cursor");
|
||||
Cursor.createGlobalKey(RDE_UPLOAD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_invalidScopeOnGlobalKeyCreate() throws Exception {
|
||||
createTld("tld");
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Class required for cursor does not match scope class");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Class required for cursor does not match scope class");
|
||||
Cursor.createKey(RECURRING_BILLING, persistActiveDomain("notaregistry.tld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nullScope() throws Exception {
|
||||
thrown.expect(NullPointerException.class, "Cursor scope cannot be null");
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("Cursor scope cannot be null");
|
||||
Cursor.create(RECURRING_BILLING, START_OF_TIME, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nullCursorType() throws Exception {
|
||||
createTld("tld");
|
||||
thrown.expect(NullPointerException.class, "Cursor type cannot be null");
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("Cursor type cannot be null");
|
||||
Cursor.create(null, START_OF_TIME, Registry.get("tld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nullTime() throws Exception {
|
||||
createTld("tld");
|
||||
thrown.expect(NullPointerException.class, "Cursor time cannot be null");
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("Cursor time cannot be null");
|
||||
Cursor.create(RDE_UPLOAD, null, Registry.get("tld"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,7 +206,8 @@ public class ContactResourceTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testSetCreationTime_cantBeCalledTwice() {
|
||||
thrown.expect(IllegalStateException.class, "creationTime can only be set once");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("creationTime can only be set once");
|
||||
contactResource.asBuilder().setCreationTime(END_OF_TIME);
|
||||
}
|
||||
|
||||
|
|
|
@ -445,15 +445,15 @@ public class DomainResourceTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_uppercaseDomainName() {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Domain name must be in puny-coded, lower-case form");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Domain name must be in puny-coded, lower-case form");
|
||||
domain.asBuilder().setFullyQualifiedDomainName("AAA.BBB");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_utf8DomainName() {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Domain name must be in puny-coded, lower-case form");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Domain name must be in puny-coded, lower-case form");
|
||||
domain.asBuilder().setFullyQualifiedDomainName("みんな.みんな");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,13 +96,15 @@ public class GracePeriodTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_forBillingEvent_autoRenew() {
|
||||
thrown.expect(IllegalArgumentException.class, "autorenew");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("autorenew");
|
||||
GracePeriod.forBillingEvent(GracePeriodStatus.AUTO_RENEW, onetime);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_createForRecurring_notAutoRenew() {
|
||||
thrown.expect(IllegalArgumentException.class, "autorenew");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("autorenew");
|
||||
GracePeriod.createForRecurring(
|
||||
GracePeriodStatus.RENEW,
|
||||
now.plusDays(1),
|
||||
|
|
|
@ -163,15 +163,15 @@ public class HostResourceTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_uppercaseHostName() {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Host name must be in puny-coded, lower-case form");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Host name must be in puny-coded, lower-case form");
|
||||
host.asBuilder().setFullyQualifiedHostName("AAA.BBB.CCC");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_utf8HostName() {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Host name must be in puny-coded, lower-case form");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Host name must be in puny-coded, lower-case form");
|
||||
host.asBuilder().setFullyQualifiedHostName("みんな.みんな.みんな");
|
||||
}
|
||||
|
||||
|
|
|
@ -49,13 +49,15 @@ public class DomainApplicationIndexTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_create_nullReferences() {
|
||||
thrown.expect(IllegalArgumentException.class, "Keys must not be null or empty.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Keys must not be null or empty.");
|
||||
DomainApplicationIndex.createWithSpecifiedKeys("blah.com", null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_create_emptyReferences() {
|
||||
thrown.expect(IllegalArgumentException.class, "Keys must not be null or empty.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Keys must not be null or empty.");
|
||||
createWithSpecifiedKeys("blah.com", ImmutableSet.<Key<DomainApplication>>of());
|
||||
}
|
||||
|
||||
|
|
|
@ -69,13 +69,15 @@ public class CommitLogBucketTest {
|
|||
|
||||
@Test
|
||||
public void test_getBucketKey_bucketNumberTooLow_throws() {
|
||||
thrown.expect(IllegalArgumentException.class, "0 not in [");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("0 not in [");
|
||||
getBucketKey(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getBucketKey_bucketNumberTooHigh_throws() {
|
||||
thrown.expect(IllegalArgumentException.class, "11 not in [");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("11 not in [");
|
||||
getBucketKey(11);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,25 +60,29 @@ public class CommitLogCheckpointTest {
|
|||
|
||||
@Test
|
||||
public void test_create_notEnoughBucketTimestamps_throws() {
|
||||
thrown.expect(IllegalArgumentException.class, "Bucket ids are incorrect");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Bucket ids are incorrect");
|
||||
CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(1, T1, 2, T2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_create_tooManyBucketTimestamps_throws() {
|
||||
thrown.expect(IllegalArgumentException.class, "Bucket ids are incorrect");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Bucket ids are incorrect");
|
||||
CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(1, T1, 2, T2, 3, T3, 4, T1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_create_wrongBucketIds_throws() {
|
||||
thrown.expect(IllegalArgumentException.class, "Bucket ids are incorrect");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Bucket ids are incorrect");
|
||||
CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(0, T1, 1, T2, 2, T3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_create_wrongBucketIdOrder_throws() {
|
||||
thrown.expect(IllegalArgumentException.class, "Bucket ids are incorrect");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Bucket ids are incorrect");
|
||||
CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(2, T2, 1, T1, 3, T3));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,8 @@ public class OfyCommitLogTest {
|
|||
public void testTransactNew_deleteNotBackedUpKind_throws() throws Exception {
|
||||
final CommitLogManifest backupsArentAllowedOnMe =
|
||||
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.<Key<?>>of());
|
||||
thrown.expect(IllegalArgumentException.class, "Can't save/delete a @NotBackedUp");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Can't save/delete a @NotBackedUp");
|
||||
ofy().transactNew(() -> ofy().delete().entity(backupsArentAllowedOnMe));
|
||||
}
|
||||
|
||||
|
@ -171,41 +172,47 @@ public class OfyCommitLogTest {
|
|||
public void testTransactNew_saveNotBackedUpKind_throws() throws Exception {
|
||||
final CommitLogManifest backupsArentAllowedOnMe =
|
||||
CommitLogManifest.create(getBucketKey(1), clock.nowUtc(), ImmutableSet.<Key<?>>of());
|
||||
thrown.expect(IllegalArgumentException.class, "Can't save/delete a @NotBackedUp");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Can't save/delete a @NotBackedUp");
|
||||
ofy().transactNew(() -> ofy().save().entity(backupsArentAllowedOnMe));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactNew_deleteVirtualEntityKey_throws() throws Exception {
|
||||
final Key<TestVirtualObject> virtualEntityKey = TestVirtualObject.createKey("virtual");
|
||||
thrown.expect(IllegalArgumentException.class, "Can't save/delete a @VirtualEntity");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Can't save/delete a @VirtualEntity");
|
||||
ofy().transactNew(() -> ofy().delete().key(virtualEntityKey));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactNew_saveVirtualEntity_throws() throws Exception {
|
||||
final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual");
|
||||
thrown.expect(IllegalArgumentException.class, "Can't save/delete a @VirtualEntity");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Can't save/delete a @VirtualEntity");
|
||||
ofy().transactNew(() -> ofy().save().entity(virtualEntity));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_deleteWithoutBackup_withVirtualEntityKey_throws() throws Exception {
|
||||
final Key<TestVirtualObject> virtualEntityKey = TestVirtualObject.createKey("virtual");
|
||||
thrown.expect(IllegalArgumentException.class, "Can't save/delete a @VirtualEntity");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Can't save/delete a @VirtualEntity");
|
||||
ofy().deleteWithoutBackup().key(virtualEntityKey);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_saveWithoutBackup_withVirtualEntity_throws() throws Exception {
|
||||
final TestVirtualObject virtualEntity = TestVirtualObject.create("virtual");
|
||||
thrown.expect(IllegalArgumentException.class, "Can't save/delete a @VirtualEntity");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Can't save/delete a @VirtualEntity");
|
||||
ofy().saveWithoutBackup().entity(virtualEntity);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransact_twoSavesOnSameKey_throws() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Multiple entries with same key");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Multiple entries with same key");
|
||||
ofy()
|
||||
.transact(
|
||||
() -> {
|
||||
|
@ -216,7 +223,8 @@ public class OfyCommitLogTest {
|
|||
|
||||
@Test
|
||||
public void testTransact_saveAndDeleteSameKey_throws() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Multiple entries with same key");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Multiple entries with same key");
|
||||
ofy()
|
||||
.transact(
|
||||
() -> {
|
||||
|
|
|
@ -92,9 +92,8 @@ public class OfyTest {
|
|||
.getUpdateAutoTimestamp().getTimestamp();
|
||||
// Set the clock in Ofy to the same time as the backup group root's save time.
|
||||
Ofy ofy = new Ofy(new FakeClock(groupTimestamp));
|
||||
thrown.expect(
|
||||
TimestampInversionException.class,
|
||||
String.format(
|
||||
thrown.expect(TimestampInversionException.class);
|
||||
thrown.expectMessage(String.format(
|
||||
"Timestamp inversion between transaction time (%s) and entities rooted under:\n"
|
||||
+ "{Key<?>(ContactResource(\"2-ROID\"))=%s}",
|
||||
groupTimestamp,
|
||||
|
@ -122,7 +121,8 @@ public class OfyTest {
|
|||
|
||||
@Test
|
||||
public void testSavingKeyTwice() {
|
||||
thrown.expect(IllegalArgumentException.class, "Multiple entries with same key");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Multiple entries with same key");
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
|
@ -133,7 +133,8 @@ public class OfyTest {
|
|||
|
||||
@Test
|
||||
public void testDeletingKeyTwice() {
|
||||
thrown.expect(IllegalArgumentException.class, "Multiple entries with same key");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Multiple entries with same key");
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
|
@ -144,7 +145,8 @@ public class OfyTest {
|
|||
|
||||
@Test
|
||||
public void testSaveDeleteKey() {
|
||||
thrown.expect(IllegalArgumentException.class, "Multiple entries with same key");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Multiple entries with same key");
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
|
@ -155,7 +157,8 @@ public class OfyTest {
|
|||
|
||||
@Test
|
||||
public void testDeleteSaveKey() {
|
||||
thrown.expect(IllegalArgumentException.class, "Multiple entries with same key");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Multiple entries with same key");
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
|
@ -372,13 +375,15 @@ public class OfyTest {
|
|||
|
||||
@Test
|
||||
public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntity() {
|
||||
thrown.expect(IllegalStateException.class, "SystemClock");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("SystemClock");
|
||||
getBaseEntityClassFromEntityOrKey(new SystemClock());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_getBaseEntityClassFromEntityOrKey_unregisteredEntityKey() {
|
||||
thrown.expect(IllegalArgumentException.class, "UnknownKind");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("UnknownKind");
|
||||
getBaseEntityClassFromEntityOrKey(Key.create(
|
||||
com.google.appengine.api.datastore.KeyFactory.createKey("UnknownKind", 1)));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,8 @@ public class RdeRevisionTest {
|
|||
|
||||
@Test
|
||||
public void testSaveRevision_objectDoesntExist_newRevisionIsOne_throwsVe() throws Exception {
|
||||
thrown.expect(VerifyException.class, "object missing");
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("object missing");
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
|
@ -81,7 +82,8 @@ public class RdeRevisionTest {
|
|||
@Test
|
||||
public void testSaveRevision_objectExistsAtZero_newRevisionIsZero_throwsVe() throws Exception {
|
||||
save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0);
|
||||
thrown.expect(VerifyException.class, "object already created");
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("object already created");
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
|
@ -108,7 +110,8 @@ public class RdeRevisionTest {
|
|||
@Test
|
||||
public void testSaveRevision_objectExistsAtZero_newRevisionIsTwo_throwsVe() throws Exception {
|
||||
save("melancholy", DateTime.parse("1984-12-18TZ"), FULL, 0);
|
||||
thrown.expect(VerifyException.class, "should be at 1 ");
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("should be at 1 ");
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
|
@ -118,7 +121,8 @@ public class RdeRevisionTest {
|
|||
|
||||
@Test
|
||||
public void testSaveRevision_negativeRevision_throwsIae() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Negative revision");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Negative revision");
|
||||
ofy().transact(new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
|
@ -128,7 +132,8 @@ public class RdeRevisionTest {
|
|||
|
||||
@Test
|
||||
public void testSaveRevision_callerNotInTransaction_throwsIse() throws Exception {
|
||||
thrown.expect(IllegalStateException.class, "transaction");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("transaction");
|
||||
saveRevision("frenzy", DateTime.parse("1984-12-18TZ"), FULL, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,19 +143,22 @@ public class RegistrarTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_passwordNull() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Password must be 6-16 characters long.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Password must be 6-16 characters long.");
|
||||
new Registrar.Builder().setPassword(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_passwordTooShort() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Password must be 6-16 characters long.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Password must be 6-16 characters long.");
|
||||
new Registrar.Builder().setPassword("abcde");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_passwordTooLong() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Password must be 6-16 characters long.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Password must be 6-16 characters long.");
|
||||
new Registrar.Builder().setPassword("abcdefghijklmnopq");
|
||||
}
|
||||
|
||||
|
@ -315,21 +318,22 @@ public class RegistrarTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_missingRegistrarType() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Registrar type cannot be null");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrar type cannot be null");
|
||||
new Registrar.Builder().setRegistrarName("blah").build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_missingRegistrarName() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Registrar name cannot be null");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrar name cannot be null");
|
||||
new Registrar.Builder().setClientId("blahid").setType(Registrar.Type.TEST).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_missingAddress() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Must specify at least one of localized or internationalized address");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Must specify at least one of localized or internationalized address");
|
||||
new Registrar.Builder()
|
||||
.setClientId("blahid")
|
||||
.setType(Registrar.Type.TEST)
|
||||
|
@ -416,25 +420,29 @@ public class RegistrarTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_loadByClientId_clientIdIsNull() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "clientId must be specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("clientId must be specified");
|
||||
Registrar.loadByClientId(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_loadByClientId_clientIdIsEmpty() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "clientId must be specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("clientId must be specified");
|
||||
Registrar.loadByClientId("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_loadByClientIdCached_clientIdIsNull() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "clientId must be specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("clientId must be specified");
|
||||
Registrar.loadByClientIdCached(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_loadByClientIdCached_clientIdIsEmpty() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "clientId must be specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("clientId must be specified");
|
||||
Registrar.loadByClientIdCached("");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,8 +202,8 @@ public class RegistryTest extends EntityTestCase {
|
|||
ReservedList rl3 = persistReservedList(
|
||||
"tld-reserved057",
|
||||
"lol,RESERVED_FOR_ANCHOR_TENANT,another_conflict");
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"auth code conflicts for labels: [lol=[conflict1, conflict2, another_conflict]]");
|
||||
@SuppressWarnings("unused")
|
||||
Registry unused = Registry.get("tld").asBuilder().setReservedLists(rl1, rl2, rl3).build();
|
||||
|
@ -354,29 +354,31 @@ public class RegistryTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_tldNeverSet() {
|
||||
thrown.expect(IllegalArgumentException.class, "No registry TLD specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("No registry TLD specified");
|
||||
new Registry.Builder().build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_setTldStr_null() {
|
||||
thrown.expect(IllegalArgumentException.class, "TLD must not be null");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("TLD must not be null");
|
||||
new Registry.Builder().setTldStr(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_setTldStr_invalidTld() {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Cannot create registry for TLD that is not a valid, canonical domain name");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown
|
||||
.expectMessage("Cannot create registry for TLD that is not a valid, canonical domain name");
|
||||
new Registry.Builder().setTldStr(".tld").build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_setTldStr_nonCanonicalTld() {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Cannot create registry for TLD that is not a valid, canonical domain name");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown
|
||||
.expectMessage("Cannot create registry for TLD that is not a valid, canonical domain name");
|
||||
new Registry.Builder().setTldStr("TLD").build();
|
||||
}
|
||||
|
||||
|
@ -400,39 +402,44 @@ public class RegistryTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_pricingEngineIsRequired() {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "All registries must have a configured pricing engine");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("All registries must have a configured pricing engine");
|
||||
new Registry.Builder().setTldStr("invalid").build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_negativeRenewBillingCostTransitionValue() {
|
||||
thrown.expect(IllegalArgumentException.class, "billing cost cannot be negative");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("billing cost cannot be negative");
|
||||
Registry.get("tld").asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(USD, -42)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_negativeCreateBillingCost() {
|
||||
thrown.expect(IllegalArgumentException.class, "createBillingCost cannot be negative");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("createBillingCost cannot be negative");
|
||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(USD, -42));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_negativeRestoreBillingCost() {
|
||||
thrown.expect(IllegalArgumentException.class, "restoreBillingCost cannot be negative");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("restoreBillingCost cannot be negative");
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(USD, -42));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_negativeServerStatusChangeBillingCost() {
|
||||
thrown.expect(IllegalArgumentException.class, "billing cost cannot be negative");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("billing cost cannot be negative");
|
||||
Registry.get("tld").asBuilder().setServerStatusChangeBillingCost(Money.of(USD, -42));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_renewBillingCostTransitionValue_wrongCurrency() {
|
||||
thrown.expect(IllegalArgumentException.class, "cost must be in the registry's currency");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("cost must be in the registry's currency");
|
||||
Registry.get("tld").asBuilder()
|
||||
.setRenewBillingCostTransitions(ImmutableSortedMap.of(START_OF_TIME, Money.of(EUR, 42)))
|
||||
.build();
|
||||
|
@ -440,19 +447,22 @@ public class RegistryTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_createBillingCost_wrongCurrency() {
|
||||
thrown.expect(IllegalArgumentException.class, "cost must be in the registry's currency");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("cost must be in the registry's currency");
|
||||
Registry.get("tld").asBuilder().setCreateBillingCost(Money.of(EUR, 42)).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_restoreBillingCost_wrongCurrency() {
|
||||
thrown.expect(IllegalArgumentException.class, "cost must be in the registry's currency");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("cost must be in the registry's currency");
|
||||
Registry.get("tld").asBuilder().setRestoreBillingCost(Money.of(EUR, 42)).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_serverStatusChangeBillingCost_wrongCurrency() {
|
||||
thrown.expect(IllegalArgumentException.class, "cost must be in the registry's currency");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("cost must be in the registry's currency");
|
||||
Registry.get("tld").asBuilder().setServerStatusChangeBillingCost(Money.of(EUR, 42)).build();
|
||||
}
|
||||
|
||||
|
@ -483,8 +493,8 @@ public class RegistryTest extends EntityTestCase {
|
|||
|
||||
@Test
|
||||
public void testFailure_eapFee_wrongCurrency() {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "All EAP fees must be in the registry's currency");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("All EAP fees must be in the registry's currency");
|
||||
Registry.get("tld").asBuilder()
|
||||
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
|
||||
.build();
|
||||
|
|
|
@ -80,8 +80,8 @@ public class PremiumListTest {
|
|||
|
||||
@Test
|
||||
public void testParse_cannotIncludeDuplicateLabels() {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage(
|
||||
"List 'tld' cannot contain duplicate labels. Dupes (with counts) were: [lol x 2]");
|
||||
PremiumList.get("tld")
|
||||
.get()
|
||||
|
|
|
@ -112,7 +112,8 @@ public class PremiumListUtilsTest {
|
|||
public void testGetPremiumPrice_throwsExceptionWhenNonExistentPremiumListConfigured()
|
||||
throws Exception {
|
||||
deletePremiumList(PremiumList.get("tld").get());
|
||||
thrown.expect(IllegalStateException.class, "Could not load premium list 'tld'");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Could not load premium list 'tld'");
|
||||
getPremiumPrice("blah", Registry.get("tld"));
|
||||
}
|
||||
|
||||
|
|
|
@ -269,8 +269,8 @@ public class ReservedListTest {
|
|||
assertThat(matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "foo")).isTrue();
|
||||
assertThat(matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar")).isFalse();
|
||||
persistReservedList("reserved2", "lol,RESERVED_FOR_ANCHOR_TENANT,bar");
|
||||
thrown.expect(
|
||||
IllegalStateException.class, "There are conflicting auth codes for domain: lol.tld");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("There are conflicting auth codes for domain: lol.tld");
|
||||
matchesAnchorTenantReservation(InternetDomainName.from("lol.tld"), "bar");
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,8 @@ public class ReservedListTest {
|
|||
|
||||
@Test
|
||||
public void testSave_badSyntax() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Could not parse line in reserved list");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Could not parse line in reserved list");
|
||||
persistReservedList("tld", "lol,FULLY_BLOCKED,e,e # yup");
|
||||
}
|
||||
|
||||
|
@ -480,9 +481,8 @@ public class ReservedListTest {
|
|||
|
||||
@Test
|
||||
public void testSave_additionalRestrictionWithIncompatibleReservationType() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Only anchor tenant and nameserver restricted reservations "
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Only anchor tenant and nameserver restricted reservations "
|
||||
+ "should have restrictions imposed");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
|
@ -494,7 +494,8 @@ public class ReservedListTest {
|
|||
|
||||
@Test
|
||||
public void testSave_badNameservers_invalidSyntax() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Not a valid domain name: 'ns@.domain.tld'");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Not a valid domain name: 'ns@.domain.tld'");
|
||||
persistReservedList(
|
||||
"reserved1",
|
||||
"lol,NAMESERVER_RESTRICTED,ns1.domain.tld:ns2.domain.tld",
|
||||
|
@ -503,7 +504,8 @@ public class ReservedListTest {
|
|||
|
||||
@Test
|
||||
public void testSave_badNameservers_tooFewPartsForHostname() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "domain.tld is not a valid nameserver hostname");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("domain.tld is not a valid nameserver hostname");
|
||||
persistReservedList(
|
||||
"reserved1",
|
||||
"lol,NAMESERVER_RESTRICTED,ns1.domain.tld:ns2.domain.tld",
|
||||
|
@ -512,8 +514,8 @@ public class ReservedListTest {
|
|||
|
||||
@Test
|
||||
public void testSave_noPasswordWithAnchorTenantReservation() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
"Anchor tenant reservations must have an auth code configured");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Anchor tenant reservations must have an auth code configured");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
.asBuilder()
|
||||
|
@ -524,8 +526,8 @@ public class ReservedListTest {
|
|||
|
||||
@Test
|
||||
public void testSave_noNameserversWithNameserverRestrictedReservation() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"Nameserver restricted reservations must have at least one nameserver configured");
|
||||
persistResource(
|
||||
Registry.get("tld")
|
||||
|
@ -538,8 +540,8 @@ public class ReservedListTest {
|
|||
@Test
|
||||
public void testParse_cannotIncludeDuplicateLabels() {
|
||||
ReservedList rl = new ReservedList.Builder().setName("blah").build();
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage(
|
||||
"List 'blah' cannot contain duplicate labels. Dupes (with counts) were: [lol x 2]");
|
||||
rl.parse(
|
||||
ImmutableList.of(
|
||||
|
|
|
@ -49,7 +49,8 @@ public class KmsSecretRevisionTest {
|
|||
|
||||
@Test
|
||||
public void test_setEncryptedValue_tooLong_throwsException() {
|
||||
thrown.expect(IllegalArgumentException.class, "Secret is greater than 67108864 bytes");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Secret is greater than 67108864 bytes");
|
||||
secretRevision =
|
||||
persistResource(
|
||||
new KmsSecretRevision.Builder()
|
||||
|
|
|
@ -138,7 +138,8 @@ public class LockTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_emptyResourceName() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "resourceName cannot be null or empty");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("resourceName cannot be null or empty");
|
||||
Lock.acquire("", "", TWO_MILLIS, requestStatusChecker);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,8 +148,8 @@ public class PricingEngineProxyTest {
|
|||
.asBuilder()
|
||||
.setPremiumPricingEngine("fake")
|
||||
.build());
|
||||
thrown.expect(
|
||||
IllegalStateException.class, "Could not load pricing engine fake for TLD example");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Could not load pricing engine fake for TLD example");
|
||||
getDomainCreateCost("bad.example", clock.nowUtc(), 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,8 @@ public class EscrowTaskRunnerTest {
|
|||
clock.setTo(DateTime.parse("2006-06-06T00:30:00Z"));
|
||||
persistResource(
|
||||
Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-07TZ"), registry));
|
||||
thrown.expect(NoContentException.class, "Already completed");
|
||||
thrown.expect(NoContentException.class);
|
||||
thrown.expectMessage("Already completed");
|
||||
runner.lockRunAndRollForward(
|
||||
task, registry, standardSeconds(30), CursorType.RDE_STAGING, standardDays(1));
|
||||
}
|
||||
|
@ -110,7 +111,8 @@ public class EscrowTaskRunnerTest {
|
|||
clock.setTo(DateTime.parse("2006-06-06T00:30:00Z"));
|
||||
persistResource(
|
||||
Cursor.create(CursorType.RDE_STAGING, DateTime.parse("2006-06-06TZ"), registry));
|
||||
thrown.expect(ServiceUnavailableException.class, "Lock in use: " + lockName + " for TLD: lol");
|
||||
thrown.expect(ServiceUnavailableException.class);
|
||||
thrown.expectMessage("Lock in use: " + lockName + " for TLD: lol");
|
||||
runner.lockHandler = new FakeLockHandler(false);
|
||||
runner.lockRunAndRollForward(
|
||||
task, registry, standardSeconds(30), CursorType.RDE_STAGING, standardDays(1));
|
||||
|
|
|
@ -194,7 +194,8 @@ public class GhostrydeTest {
|
|||
korruption(ciphertext, ciphertext.length / 2);
|
||||
|
||||
ByteArrayInputStream bsIn = new ByteArrayInputStream(ciphertext);
|
||||
thrown.expect(IllegalStateException.class, "tampering");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("tampering");
|
||||
try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) {
|
||||
ByteStreams.copy(decryptor, ByteStreams.nullOutputStream());
|
||||
}
|
||||
|
@ -247,8 +248,8 @@ public class GhostrydeTest {
|
|||
}
|
||||
|
||||
ByteArrayInputStream bsIn = new ByteArrayInputStream(bsOut.toByteArray());
|
||||
thrown.expect(
|
||||
PGPException.class,
|
||||
thrown.expect(PGPException.class);
|
||||
thrown.expectMessage(
|
||||
"Message was encrypted for keyid a59c132f3589a1d5 but ours is c9598c84ec70b9fd");
|
||||
try (Ghostryde.Decryptor decryptor = ghost.openDecryptor(bsIn, privateKey)) {
|
||||
ByteStreams.copy(decryptor, ByteStreams.nullOutputStream());
|
||||
|
|
|
@ -175,7 +175,8 @@ public class RdeReportActionTest {
|
|||
when(httpResponse.getResponseCode()).thenReturn(SC_BAD_REQUEST);
|
||||
when(httpResponse.getContent()).thenReturn(IIRDEA_BAD_XML.read());
|
||||
when(urlFetchService.fetch(request.capture())).thenReturn(httpResponse);
|
||||
thrown.expect(InternalServerErrorException.class, "The structure of the report is invalid.");
|
||||
thrown.expect(InternalServerErrorException.class);
|
||||
thrown.expectMessage("The structure of the report is invalid.");
|
||||
createAction().runWithLock(loadRdeReportCursor());
|
||||
}
|
||||
|
||||
|
|
|
@ -312,7 +312,8 @@ public class RdeUploadActionTest {
|
|||
Cursor.create(CursorType.RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
RdeUploadAction action = createAction(uploadUrl);
|
||||
action.lazyJsch = Lazies.of(createThrowingJSchSpy(action.lazyJsch.get(), 3));
|
||||
thrown.expect(RuntimeException.class, "The crow flies in square circles.");
|
||||
thrown.expect(RuntimeException.class);
|
||||
thrown.expectMessage("The crow flies in square circles.");
|
||||
action.runWithLock(uploadCursor);
|
||||
}
|
||||
|
||||
|
@ -386,7 +387,8 @@ public class RdeUploadActionTest {
|
|||
DateTime uploadCursor = DateTime.parse("2010-10-17TZ");
|
||||
persistResource(
|
||||
Cursor.create(CursorType.RDE_STAGING, stagingCursor, Registry.get("tld")));
|
||||
thrown.expect(ServiceUnavailableException.class, "Waiting for RdeStagingAction to complete");
|
||||
thrown.expect(ServiceUnavailableException.class);
|
||||
thrown.expectMessage("Waiting for RdeStagingAction to complete");
|
||||
createAction(null).runWithLock(uploadCursor);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,14 +64,16 @@ public class RdeHostInputTest {
|
|||
/** Number of shards cannot be negative */
|
||||
@Test
|
||||
public void testNegativeShards_throwsIllegalArgumentException() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Number of shards must be greater than zero");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Number of shards must be greater than zero");
|
||||
getInput(Optional.of(-1));
|
||||
}
|
||||
|
||||
/** Number of shards cannot be zero */
|
||||
@Test
|
||||
public void testZeroShards_throwsIllegalArgumentException() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Number of shards must be greater than zero");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Number of shards must be greater than zero");
|
||||
getInput(Optional.of(0));
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
|||
public void testValidateEscrowFile_tldNotFound() throws Exception {
|
||||
xmlInput = DEPOSIT_BADTLD_XML.openBufferedStream();
|
||||
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
|
||||
thrown.expect(IllegalArgumentException.class, "Tld 'badtld' not found in the registry");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Tld 'badtld' not found in the registry");
|
||||
rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badtld.xml");
|
||||
}
|
||||
|
||||
|
@ -295,9 +296,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
|||
public void testValidateEscrowFile_tldWrongState() throws Exception {
|
||||
xmlInput = DEPOSIT_GETLD_XML.openBufferedStream();
|
||||
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Tld 'getld' is in state GENERAL_AVAILABILITY and cannot be imported");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Tld 'getld' is in state GENERAL_AVAILABILITY and cannot be imported");
|
||||
rdeImportUtils.validateEscrowFileForImport("invalid-deposit-getld.xml");
|
||||
}
|
||||
|
||||
|
@ -306,8 +306,8 @@ public class RdeImportUtilsTest extends ShardableTestCase {
|
|||
public void testValidateEscrowFile_badRegistrar() throws Exception {
|
||||
xmlInput = DEPOSIT_BADREGISTRAR_XML.openBufferedStream();
|
||||
when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput);
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Registrar 'RegistrarY' not found in the registry");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrar 'RegistrarY' not found in the registry");
|
||||
rdeImportUtils.validateEscrowFileForImport("invalid-deposit-badregistrar.xml");
|
||||
}
|
||||
|
||||
|
|
|
@ -78,9 +78,8 @@ public class RdeParserTest {
|
|||
@Test
|
||||
public void testGetContactNotAtElement_throwsIllegalStateException() throws Exception {
|
||||
try (RdeParser parser = new RdeParser(xml)) {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Not at element urn:ietf:params:xml:ns:rdeContact-1.0:contact");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Not at element urn:ietf:params:xml:ns:rdeContact-1.0:contact");
|
||||
parser.getContact();
|
||||
}
|
||||
}
|
||||
|
@ -162,9 +161,8 @@ public class RdeParserTest {
|
|||
@Test
|
||||
public void testGetDomainNotAtElement_throwsIllegalStateException() throws Exception {
|
||||
try (RdeParser parser = new RdeParser(xml)) {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Not at element urn:ietf:params:xml:ns:rdeDomain-1.0:domain");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Not at element urn:ietf:params:xml:ns:rdeDomain-1.0:domain");
|
||||
parser.getDomain();
|
||||
}
|
||||
}
|
||||
|
@ -274,8 +272,8 @@ public class RdeParserTest {
|
|||
@Test
|
||||
public void testGetHostNotAtElement_throwsIllegalStateException() throws Exception {
|
||||
try (RdeParser parser = new RdeParser(xml)) {
|
||||
thrown.expect(
|
||||
IllegalStateException.class, "Not at element urn:ietf:params:xml:ns:rdeHost-1.0:host");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Not at element urn:ietf:params:xml:ns:rdeHost-1.0:host");
|
||||
parser.getHost();
|
||||
}
|
||||
}
|
||||
|
@ -386,9 +384,8 @@ public class RdeParserTest {
|
|||
@Test
|
||||
public void testGetRegistrarNotAtElement_throwsIllegalStateException() throws Exception {
|
||||
try (RdeParser parser = new RdeParser(xml)) {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Not at element urn:ietf:params:xml:ns:rdeRegistrar-1.0:registrar");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Not at element urn:ietf:params:xml:ns:rdeRegistrar-1.0:registrar");
|
||||
parser.getRegistrar();
|
||||
}
|
||||
}
|
||||
|
@ -425,8 +422,8 @@ public class RdeParserTest {
|
|||
@Test
|
||||
public void testGetNndnNotAtElement_throwsIllegalStateException() throws Exception {
|
||||
try (RdeParser parser = new RdeParser(xml)) {
|
||||
thrown.expect(
|
||||
IllegalStateException.class, "Not at element urn:ietf:params:xml:ns:rdeNNDN-1.0:NNDN");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Not at element urn:ietf:params:xml:ns:rdeNNDN-1.0:NNDN");
|
||||
parser.getNndn();
|
||||
}
|
||||
}
|
||||
|
@ -462,9 +459,8 @@ public class RdeParserTest {
|
|||
@Test
|
||||
public void testGetIdnNotAtElement_throwsIllegalStateException() throws Exception {
|
||||
try (RdeParser parser = new RdeParser(xml)) {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Not at element urn:ietf:params:xml:ns:rdeIDN-1.0:idnTableRef");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Not at element urn:ietf:params:xml:ns:rdeIDN-1.0:idnTableRef");
|
||||
parser.getIdn();
|
||||
}
|
||||
}
|
||||
|
@ -502,9 +498,8 @@ public class RdeParserTest {
|
|||
@Test
|
||||
public void testGetEppParamsNotAtElement_throwsIllegalStateException() throws Exception {
|
||||
try (RdeParser parser = new RdeParser(xml)) {
|
||||
thrown.expect(
|
||||
IllegalStateException.class,
|
||||
"Not at element urn:ietf:params:xml:ns:rdeEppParams-1.0:eppParams");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Not at element urn:ietf:params:xml:ns:rdeEppParams-1.0:eppParams");
|
||||
parser.getEppParams();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,8 +216,8 @@ public class XjcToDomainResourceConverterTest {
|
|||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_pendingRestorePeriod.xml");
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Unsupported grace period status: PENDING_RESTORE");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Unsupported grace period status: PENDING_RESTORE");
|
||||
convertDomainInTransaction(xjcDomain);
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,8 @@ public class XjcToDomainResourceConverterTest {
|
|||
persistActiveHost("ns1.example.net");
|
||||
persistActiveHost("ns2.example.net");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_attrs.xml");
|
||||
thrown.expect(IllegalArgumentException.class, "Host attributes are not yet supported");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Host attributes are not yet supported");
|
||||
convertDomainInTransaction(xjcDomain);
|
||||
}
|
||||
|
||||
|
@ -280,8 +281,8 @@ public class XjcToDomainResourceConverterTest {
|
|||
persistActiveContact("sh8013");
|
||||
persistActiveHost("ns1.example.net");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_host_objs.xml");
|
||||
thrown.expect(
|
||||
IllegalStateException.class, "HostResource not found with name 'ns2.example.net'");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("HostResource not found with name 'ns2.example.net'");
|
||||
convertDomainInTransaction(xjcDomain);
|
||||
}
|
||||
|
||||
|
@ -289,7 +290,8 @@ public class XjcToDomainResourceConverterTest {
|
|||
public void testConvertDomainResourceRegistrantNotFound() throws Exception {
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
|
||||
thrown.expect(IllegalStateException.class, "Registrant not found: 'jd1234'");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Registrant not found: 'jd1234'");
|
||||
convertDomainInTransaction(xjcDomain);
|
||||
}
|
||||
|
||||
|
@ -298,8 +300,8 @@ public class XjcToDomainResourceConverterTest {
|
|||
persistActiveContact("jd1234");
|
||||
persistActiveContact("sh8013");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment_registrant_missing.xml");
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "Registrant is missing for domain 'example1.example'");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrant is missing for domain 'example1.example'");
|
||||
convertDomainInTransaction(xjcDomain);
|
||||
}
|
||||
|
||||
|
@ -307,7 +309,8 @@ public class XjcToDomainResourceConverterTest {
|
|||
public void testConvertDomainResourceAdminNotFound() throws Exception {
|
||||
persistActiveContact("jd1234");
|
||||
final XjcRdeDomain xjcDomain = loadDomainFromRdeXml("domain_fragment.xml");
|
||||
thrown.expect(IllegalStateException.class, "Contact not found: 'sh8013'");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Contact not found: 'sh8013'");
|
||||
convertDomainInTransaction(xjcDomain);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,8 +127,8 @@ public class IcannHttpReporterTest {
|
|||
|
||||
@Test
|
||||
public void testFail_invalidFilename_nonSixDigitYearMonth() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"Expected file format: tld-reportType-yyyyMM.csv, got test-transactions-20176.csv instead");
|
||||
IcannHttpReporter reporter = createReporter();
|
||||
reporter.send(FAKE_PAYLOAD, "test-transactions-20176.csv");
|
||||
|
@ -136,8 +136,8 @@ public class IcannHttpReporterTest {
|
|||
|
||||
@Test
|
||||
public void testFail_invalidFilename_notActivityOrTransactions() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"Expected file format: tld-reportType-yyyyMM.csv, got test-invalid-201706.csv instead");
|
||||
IcannHttpReporter reporter = createReporter();
|
||||
reporter.send(FAKE_PAYLOAD, "test-invalid-201706.csv");
|
||||
|
@ -145,8 +145,8 @@ public class IcannHttpReporterTest {
|
|||
|
||||
@Test
|
||||
public void testFail_invalidFilename_invalidTldName() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"Expected file format: tld-reportType-yyyyMM.csv, got n!-n-activity-201706.csv instead");
|
||||
IcannHttpReporter reporter = createReporter();
|
||||
reporter.send(FAKE_PAYLOAD, "n!-n-activity-201706.csv");
|
||||
|
@ -154,9 +154,8 @@ public class IcannHttpReporterTest {
|
|||
|
||||
@Test
|
||||
public void testFail_invalidFilename_tldDoesntExist() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"TLD hello does not exist");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("TLD hello does not exist");
|
||||
IcannHttpReporter reporter = createReporter();
|
||||
reporter.send(FAKE_PAYLOAD, "hello-activity-201706.csv");
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ public class IcannReportingModuleTest {
|
|||
@Test
|
||||
public void testInvalidYearMonthParameter_throwsException() {
|
||||
when(req.getParameter("yearMonth")).thenReturn("201705");
|
||||
thrown.expect(
|
||||
BadRequestException.class, "yearMonth must be in yyyy-MM format, got 201705 instead");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("yearMonth must be in yyyy-MM format, got 201705 instead");
|
||||
IcannReportingModule.provideYearMonthOptional(req);
|
||||
}
|
||||
|
||||
|
@ -88,9 +88,8 @@ public class IcannReportingModuleTest {
|
|||
|
||||
@Test
|
||||
public void testInvalidSubdir_throwsException() {
|
||||
thrown.expect(
|
||||
BadRequestException.class,
|
||||
"subdir must not start or end with a \"/\", got /whoops instead.");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("subdir must not start or end with a \"/\", got /whoops instead.");
|
||||
IcannReportingModule.provideSubdir(Optional.of("/whoops"), new YearMonth(2017, 6));
|
||||
}
|
||||
|
||||
|
|
|
@ -47,13 +47,15 @@ public final class RequestModuleTest {
|
|||
|
||||
@Test
|
||||
public void testProvideJsonPayload_malformedInput_throws500() throws Exception {
|
||||
thrown.expect(BadRequestException.class, "Malformed JSON");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("Malformed JSON");
|
||||
provideJsonPayload(MediaType.JSON_UTF_8, "{\"k\":");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProvideJsonPayload_emptyInput_throws500() throws Exception {
|
||||
thrown.expect(BadRequestException.class, "Malformed JSON");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("Malformed JSON");
|
||||
provideJsonPayload(MediaType.JSON_UTF_8, "");
|
||||
}
|
||||
|
||||
|
|
|
@ -53,14 +53,16 @@ public class RequestParametersTest {
|
|||
|
||||
@Test
|
||||
public void testExtractRequiredParameter_notPresent_throwsBadRequest() throws Exception {
|
||||
thrown.expect(BadRequestException.class, "spin");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("spin");
|
||||
extractRequiredParameter(req, "spin");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractRequiredParameter_empty_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("spin")).thenReturn("");
|
||||
thrown.expect(BadRequestException.class, "spin");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("spin");
|
||||
extractRequiredParameter(req, "spin");
|
||||
}
|
||||
|
||||
|
@ -144,7 +146,8 @@ public class RequestParametersTest {
|
|||
@Test
|
||||
public void testExtractEnumValue_nonExistentValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("spin")).thenReturn("sing");
|
||||
thrown.expect(BadRequestException.class, "spin");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("spin");
|
||||
extractEnumParameter(req, Club.class, "spin");
|
||||
}
|
||||
|
||||
|
@ -163,7 +166,8 @@ public class RequestParametersTest {
|
|||
@Test
|
||||
public void testOptionalExtractEnumValue_nonExistentValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("spin")).thenReturn("sing");
|
||||
thrown.expect(BadRequestException.class, "spin");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("spin");
|
||||
extractOptionalEnumParameter(req, Club.class, "spin");
|
||||
}
|
||||
|
||||
|
@ -177,7 +181,8 @@ public class RequestParametersTest {
|
|||
@Test
|
||||
public void testExtractRequiredDatetimeParameter_badValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("timeParam")).thenReturn("Tuesday at three o'clock");
|
||||
thrown.expect(BadRequestException.class, "timeParam");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("timeParam");
|
||||
extractRequiredDatetimeParameter(req, "timeParam");
|
||||
}
|
||||
|
||||
|
@ -191,7 +196,8 @@ public class RequestParametersTest {
|
|||
@Test
|
||||
public void testExtractOptionalDatetimeParameter_badValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("timeParam")).thenReturn("Tuesday at three o'clock");
|
||||
thrown.expect(BadRequestException.class, "timeParam");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("timeParam");
|
||||
extractOptionalDatetimeParameter(req, "timeParam");
|
||||
}
|
||||
|
||||
|
@ -203,7 +209,8 @@ public class RequestParametersTest {
|
|||
|
||||
@Test
|
||||
public void testExtractRequiredDatetimeParameter_noValue_throwsBadRequest() throws Exception {
|
||||
thrown.expect(BadRequestException.class, "timeParam");
|
||||
thrown.expect(BadRequestException.class);
|
||||
thrown.expectMessage("timeParam");
|
||||
extractRequiredDatetimeParameter(req, "timeParam");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,9 +40,8 @@ public final class RouterTest {
|
|||
|
||||
@Test
|
||||
public void testRoute_noRoutes_throws() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"No routes found for class: google.registry.request.RouterTest.Empty");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("No routes found for class: google.registry.request.RouterTest.Empty");
|
||||
Router.create(Empty.class);
|
||||
}
|
||||
|
||||
|
@ -145,8 +144,8 @@ public final class RouterTest {
|
|||
|
||||
@Test
|
||||
public void testRoute_methodsInComponentAreIgnored_throws() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"No routes found for class: google.registry.request.RouterTest.WeirdMethodsComponent");
|
||||
Router.create(WeirdMethodsComponent.class);
|
||||
}
|
||||
|
@ -172,7 +171,8 @@ public final class RouterTest {
|
|||
|
||||
@Test
|
||||
public void testCreate_twoTasksWithSameMethodAndPath_resultsInError() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Multiple entries with same key");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Multiple entries with same key");
|
||||
Router.create(DuplicateComponent.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,38 +391,42 @@ public class RequestAuthenticatorTest {
|
|||
|
||||
@Test
|
||||
public void testCheckAuthConfig_NoMethods_failure() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Must specify at least one auth method");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Must specify at least one auth method");
|
||||
|
||||
RequestAuthenticator.checkAuthConfig(AUTH_NO_METHODS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckAuthConfig_WrongMethodOrdering_failure() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
"Auth methods must be unique and strictly in order - INTERNAL, API, LEGACY");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown
|
||||
.expectMessage("Auth methods must be unique and strictly in order - INTERNAL, API, LEGACY");
|
||||
|
||||
RequestAuthenticator.checkAuthConfig(AUTH_WRONG_METHOD_ORDERING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckAuthConfig_DuplicateMethods_failure() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
"Auth methods must be unique and strictly in order - INTERNAL, API, LEGACY");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown
|
||||
.expectMessage("Auth methods must be unique and strictly in order - INTERNAL, API, LEGACY");
|
||||
|
||||
RequestAuthenticator.checkAuthConfig(AUTH_DUPLICATE_METHODS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckAuthConfig_InternalWithUser_failure() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
"Actions with INTERNAL auth method may not require USER auth level");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Actions with INTERNAL auth method may not require USER auth level");
|
||||
|
||||
RequestAuthenticator.checkAuthConfig(AUTH_INTERNAL_WITH_USER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckAuthConfig_WronglyIgnoringUser_failure() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"Actions with auth methods beyond INTERNAL must not specify the IGNORED user policy");
|
||||
|
||||
RequestAuthenticator.checkAuthConfig(AUTH_WRONGLY_IGNORING_USER);
|
||||
|
|
|
@ -215,8 +215,8 @@ public class DriveConnectionTest {
|
|||
new ChildReference().setId("id2")))
|
||||
.setNextPageToken(null);
|
||||
when(childrenList.execute()).thenReturn(childList);
|
||||
thrown.expect(IllegalStateException.class,
|
||||
"Could not update file 'title' in Drive folder id 'driveFolderId' "
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Could not update file 'title' in Drive folder id 'driveFolderId' "
|
||||
+ "because multiple files with that name already exist.");
|
||||
driveConnection.createOrUpdateFile("title", MediaType.WEBM_VIDEO, "driveFolderId", DATA);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ package google.registry.testing;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.base.Strings.nullToEmpty;
|
||||
import static com.google.common.base.Throwables.getRootCause;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
|
@ -37,8 +36,6 @@ public class ExceptionRule implements TestRule {
|
|||
@Nullable
|
||||
String expectedMessage;
|
||||
|
||||
private boolean useRootCause;
|
||||
|
||||
@Override
|
||||
public Statement apply(final Statement base, Description description) {
|
||||
return new Statement() {
|
||||
|
@ -53,10 +50,9 @@ public class ExceptionRule implements TestRule {
|
|||
expectedMessage == null ? "" : (" with message: " + expectedMessage)));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Throwable cause = useRootCause ? getRootCause(e) : e;
|
||||
if (expectedExceptionClass == null
|
||||
|| !(expectedExceptionClass.isAssignableFrom(cause.getClass())
|
||||
&& nullToEmpty(cause.getMessage()).contains(nullToEmpty(expectedMessage)))) {
|
||||
|| !(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) {
|
||||
|
@ -72,19 +68,7 @@ public class ExceptionRule implements TestRule {
|
|||
this.expectedExceptionClass = expectedExceptionClass;
|
||||
}
|
||||
|
||||
public void expect(Class<? extends Throwable> expectedExceptionClass, String expectedMessage) {
|
||||
expect(expectedExceptionClass);
|
||||
public void expectMessage(String expectedMessage) {
|
||||
this.expectedMessage = expectedMessage;
|
||||
}
|
||||
|
||||
public void expectRootCause(Class<? extends Throwable> expectedExceptionClass) {
|
||||
expect(expectedExceptionClass);
|
||||
this.useRootCause = true;
|
||||
}
|
||||
|
||||
public void expectRootCause(
|
||||
Class<? extends Throwable> expectedExceptionClass, String expectedMessage) {
|
||||
expect(expectedExceptionClass, expectedMessage);
|
||||
this.useRootCause = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,8 @@ public class IdnTableTest {
|
|||
public void testMissingUrl_throwsNpe() {
|
||||
ImmutableList<String> of = ImmutableList.<String>of(
|
||||
"# Policy: https://love.example/policy.html");
|
||||
thrown.expect(NullPointerException.class, "sloth missing '# URL:");
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("sloth missing '# URL:");
|
||||
IdnTable.createFrom("sloth", of, Optional.<LanguageValidator>empty());
|
||||
}
|
||||
|
||||
|
@ -116,7 +117,8 @@ public class IdnTableTest {
|
|||
public void testMissingPolicy_throwsNpe() {
|
||||
ImmutableList<String> of = ImmutableList.<String>of(
|
||||
"# URL: https://love.example/sloth.txt");
|
||||
thrown.expect(NullPointerException.class, "sloth missing '# Policy:");
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("sloth missing '# Policy:");
|
||||
IdnTable.createFrom("sloth", of, Optional.<LanguageValidator>empty());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,8 +166,8 @@ public class LordnTaskTest {
|
|||
.setRepoId("9000-EXAMPLE")
|
||||
.setCreationClientId("nonexistentRegistrar")
|
||||
.build();
|
||||
thrown.expect(
|
||||
IllegalStateException.class, "No registrar found for client id: nonexistentRegistrar");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("No registrar found for client id: nonexistentRegistrar");
|
||||
persistDomainAndEnqueueLordn(domain);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,8 @@ public class LordnTaskTest {
|
|||
public void test_loadAllTasks_retryLogic_allFailures() throws Exception {
|
||||
Queue queue = mock(Queue.class);
|
||||
when(queue.leaseTasks(any(LeaseOptions.class))).thenThrow(TransientFailureException.class);
|
||||
thrown.expect(RuntimeException.class, "Error leasing tasks");
|
||||
thrown.expect(RuntimeException.class);
|
||||
thrown.expectMessage("Error leasing tasks");
|
||||
LordnTask.loadAllTasks(queue, "tld");
|
||||
}
|
||||
|
||||
|
|
|
@ -202,7 +202,8 @@ public class NordnUploadActionTest {
|
|||
public void testFailure_nullRegistryUser() throws Exception {
|
||||
persistClaimsModeDomain();
|
||||
persistResource(Registry.get("tld").asBuilder().setLordnUsername(null).build());
|
||||
thrown.expect(VerifyException.class, "lordnUsername is not set for tld.");
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("lordnUsername is not set for tld.");
|
||||
action.run();
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,8 @@ public class NordnVerifyActionTest {
|
|||
@Test
|
||||
public void failureVerifyNotReady() throws Exception {
|
||||
when(httpResponse.getResponseCode()).thenReturn(SC_NO_CONTENT);
|
||||
thrown.expect(ConflictException.class, "Not ready");
|
||||
thrown.expect(ConflictException.class);
|
||||
thrown.expectMessage("Not ready");
|
||||
action.run();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,8 @@ public class SmdrlCsvParserTest {
|
|||
|
||||
@Test
|
||||
public void testFail_badVersion() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "version");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("version");
|
||||
SmdrlCsvParser.parse(ImmutableList.of(
|
||||
"666,2013-11-24T23:30:04.3Z",
|
||||
"smd-id,insertion-datetime",
|
||||
|
@ -119,7 +120,8 @@ public class SmdrlCsvParserTest {
|
|||
|
||||
@Test
|
||||
public void testFail_badHeader() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "header");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("header");
|
||||
SmdrlCsvParser.parse(ImmutableList.of(
|
||||
"1,2013-11-24T23:30:04.3Z",
|
||||
"lol,cat",
|
||||
|
@ -128,7 +130,8 @@ public class SmdrlCsvParserTest {
|
|||
|
||||
@Test
|
||||
public void testFail_tooManyColumns() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "elements");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("elements");
|
||||
SmdrlCsvParser.parse(ImmutableList.of(
|
||||
"1,2013-11-24T23:30:04.3Z",
|
||||
"smd-id,insertion-datetime",
|
||||
|
|
|
@ -14,8 +14,10 @@
|
|||
|
||||
package google.registry.tmch;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.config.RegistryConfig.ConfigModule.TmchCaMode.PILOT;
|
||||
import static google.registry.config.RegistryConfig.ConfigModule.TmchCaMode.PRODUCTION;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.tmch.TmchTestData.loadFile;
|
||||
import static google.registry.util.ResourceUtils.readResourceUtf8;
|
||||
import static google.registry.util.X509Utils.loadCertificate;
|
||||
|
@ -65,18 +67,18 @@ public class TmchCertificateAuthorityTest {
|
|||
public void testFailure_prodRootExpired() throws Exception {
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PRODUCTION);
|
||||
clock.setTo(DateTime.parse("2024-01-01T00:00:00Z"));
|
||||
thrown.expectRootCause(
|
||||
CertificateExpiredException.class, "NotAfter: Sun Jul 23 23:59:59 UTC 2023");
|
||||
tmchCertificateAuthority.getRoot();
|
||||
CertificateExpiredException e =
|
||||
expectThrows(CertificateExpiredException.class, tmchCertificateAuthority::getRoot);
|
||||
assertThat(e).hasMessageThat().containsMatch("NotAfter: Sun Jul 23 23:59:59 UTC 2023");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_prodRootNotYetValid() throws Exception {
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PRODUCTION);
|
||||
clock.setTo(DateTime.parse("2000-01-01T00:00:00Z"));
|
||||
thrown.expectRootCause(CertificateNotYetValidException.class,
|
||||
"NotBefore: Wed Jul 24 00:00:00 UTC 2013");
|
||||
tmchCertificateAuthority.getRoot();
|
||||
CertificateNotYetValidException e =
|
||||
expectThrows(CertificateNotYetValidException.class, tmchCertificateAuthority::getRoot);
|
||||
assertThat(e).hasMessageThat().containsMatch("NotBefore: Wed Jul 24 00:00:00 UTC 2013");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -85,8 +87,11 @@ public class TmchCertificateAuthorityTest {
|
|||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PILOT);
|
||||
TmchCrl.set(
|
||||
readResourceUtf8(TmchCertificateAuthority.class, "icann-tmch.crl"), "http://cert.crl");
|
||||
thrown.expectRootCause(SignatureException.class, "Signature does not match");
|
||||
tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE));
|
||||
SignatureException e =
|
||||
expectThrows(
|
||||
SignatureException.class,
|
||||
() -> tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE)));
|
||||
assertThat(e).hasMessageThat().contains("Signature does not match");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -98,14 +103,18 @@ public class TmchCertificateAuthorityTest {
|
|||
@Test
|
||||
public void testFailure_verifySignatureDoesntMatch() throws Exception {
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PRODUCTION);
|
||||
thrown.expectRootCause(SignatureException.class, "Signature does not match");
|
||||
tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE));
|
||||
SignatureException e =
|
||||
expectThrows(
|
||||
SignatureException.class,
|
||||
() -> tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE)));
|
||||
assertThat(e).hasMessageThat().contains("Signature does not match");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_verifyRevoked() throws Exception {
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(PILOT);
|
||||
thrown.expect(CertificateRevokedException.class, "revoked, reason: KEY_COMPROMISE");
|
||||
thrown.expect(CertificateRevokedException.class);
|
||||
thrown.expectMessage("revoked, reason: KEY_COMPROMISE");
|
||||
tmchCertificateAuthority.verify(loadCertificate(REVOKED_TEST_CERTIFICATE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package google.registry.tmch;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.util.ResourceUtils.readResourceBytes;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
@ -60,17 +61,22 @@ public class TmchCrlActionTest extends TmchActionTestCase {
|
|||
// doesn't matter that the wrong CRT would be used to verify it because that check happens after
|
||||
// the age check.
|
||||
TmchCrlAction action = newTmchCrlAction(TmchCaMode.PRODUCTION);
|
||||
thrown.expectRootCause(CRLException.class, "New CRL is more out of date than our current CRL.");
|
||||
action.run();
|
||||
Exception e = expectThrows(Exception.class, action::run);
|
||||
assertThat(e).hasCauseThat().isInstanceOf(CRLException.class);
|
||||
assertThat(e)
|
||||
.hasCauseThat()
|
||||
.hasMessageThat()
|
||||
.contains("New CRL is more out of date than our current CRL.");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_crlNotSignedByRoot() throws Exception {
|
||||
clock.setTo(DateTime.parse("2013-07-24TZ"));
|
||||
when(httpResponse.getContent()).thenReturn(
|
||||
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch.crl").read());
|
||||
thrown.expectRootCause(SignatureException.class, "Signature does not match.");
|
||||
newTmchCrlAction(TmchCaMode.PILOT).run();
|
||||
when(httpResponse.getContent())
|
||||
.thenReturn(readResourceBytes(TmchCertificateAuthority.class, "icann-tmch.crl").read());
|
||||
Exception e = expectThrows(Exception.class, newTmchCrlAction(TmchCaMode.PILOT)::run);
|
||||
assertThat(e).hasCauseThat().isInstanceOf(SignatureException.class);
|
||||
assertThat(e).hasCauseThat().hasMessageThat().isEqualTo("Signature does not match.");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -78,7 +84,7 @@ public class TmchCrlActionTest extends TmchActionTestCase {
|
|||
clock.setTo(DateTime.parse("1984-01-01TZ"));
|
||||
when(httpResponse.getContent()).thenReturn(
|
||||
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch-pilot.crl").read());
|
||||
thrown.expectRootCause(CertificateNotYetValidException.class);
|
||||
newTmchCrlAction(TmchCaMode.PILOT).run();
|
||||
Exception e = expectThrows(Exception.class, newTmchCrlAction(TmchCaMode.PILOT)::run);
|
||||
assertThat(e).hasCauseThat().isInstanceOf(CertificateNotYetValidException.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
|
||||
package google.registry.tmch;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.tmch.TmchTestData.loadSmd;
|
||||
|
||||
import google.registry.config.RegistryConfig.ConfigModule.TmchCaMode;
|
||||
|
@ -86,24 +89,23 @@ public class TmchXmlSignatureTest {
|
|||
public void testWrongCertificateAuthority() throws Exception {
|
||||
tmchXmlSignature = new TmchXmlSignature(new TmchCertificateAuthority(TmchCaMode.PRODUCTION));
|
||||
smdData = loadSmd("active/Court-Agent-Arabic-Active.smd");
|
||||
thrown.expectRootCause(CertificateSignatureException.class, "Signature does not match");
|
||||
tmchXmlSignature.verify(smdData);
|
||||
CertificateSignatureException e =
|
||||
expectThrows(CertificateSignatureException.class, () -> tmchXmlSignature.verify(smdData));
|
||||
assertThat(e).hasMessageThat().contains("Signature does not match");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTimeTravelBeforeCertificateWasCreated() throws Exception {
|
||||
smdData = loadSmd("active/Court-Agent-Arabic-Active.smd");
|
||||
clock.setTo(DateTime.parse("2013-05-01T00:00:00Z"));
|
||||
thrown.expectRootCause(CertificateNotYetValidException.class);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
assertThrows(CertificateNotYetValidException.class, () -> tmchXmlSignature.verify(smdData));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTimeTravelAfterCertificateHasExpired() throws Exception {
|
||||
smdData = loadSmd("active/Court-Agent-Arabic-Active.smd");
|
||||
clock.setTo(DateTime.parse("2023-06-01T00:00:00Z"));
|
||||
thrown.expectRootCause(CertificateExpiredException.class);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
assertThrows(CertificateExpiredException.class, () -> tmchXmlSignature.verify(smdData));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -324,35 +326,40 @@ public class TmchXmlSignatureTest {
|
|||
@Test
|
||||
public void testRevokedTmvTmvrevokedCourtAgentFrenchActive() throws Exception {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-Court-Agent-French-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
tmchXmlSignature.verify(smdData);
|
||||
CertificateRevokedException e =
|
||||
expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData));
|
||||
assertThat(e).hasMessageThat().contains("KEY_COMPROMISE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedTrademarkAgentEnglishActive() throws Exception {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-Trademark-Agent-English-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
tmchXmlSignature.verify(smdData);
|
||||
CertificateRevokedException e =
|
||||
expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData));
|
||||
assertThat(e).hasMessageThat().contains("KEY_COMPROMISE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedTrademarkAgentRussianActive() throws Exception {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-Trademark-Agent-Russian-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
tmchXmlSignature.verify(smdData);
|
||||
CertificateRevokedException e =
|
||||
expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData));
|
||||
assertThat(e).hasMessageThat().contains("KEY_COMPROMISE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedTreatystatuteAgentChineseActive() throws Exception {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-TreatyStatute-Agent-Chinese-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
tmchXmlSignature.verify(smdData);
|
||||
CertificateRevokedException e =
|
||||
expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData));
|
||||
assertThat(e).hasMessageThat().contains("KEY_COMPROMISE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedTreatystatuteAgentEnglishActive() throws Throwable {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-TreatyStatute-Agent-English-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
tmchXmlSignature.verify(smdData);
|
||||
CertificateRevokedException e =
|
||||
expectThrows(CertificateRevokedException.class, () -> tmchXmlSignature.verify(smdData));
|
||||
assertThat(e).hasMessageThat().contains("KEY_COMPROMISE");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,8 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
|
||||
@Test
|
||||
public void testFailure_nonexistentParentRegistrar() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Registrar FakeRegistrar not found");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrar FakeRegistrar not found");
|
||||
runCommandForced(
|
||||
"--registrar=FakeRegistrar",
|
||||
"--credit_id=" + creditId,
|
||||
|
@ -91,7 +92,8 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
@Test
|
||||
public void testFailure_nonexistentCreditId() throws Exception {
|
||||
long badId = creditId + 1;
|
||||
thrown.expect(NullPointerException.class, "ID " + badId);
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("ID " + badId);
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--credit_id=" + badId,
|
||||
|
@ -101,7 +103,8 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
|
||||
@Test
|
||||
public void testFailure_negativeBalance() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "negative");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("negative");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--credit_id=" + creditId,
|
||||
|
@ -111,7 +114,8 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
|
||||
@Test
|
||||
public void testFailure_noRegistrar() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--registrar");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--registrar");
|
||||
runCommandForced(
|
||||
"--credit_id=" + creditId,
|
||||
"--balance=\"USD 100\"",
|
||||
|
@ -120,7 +124,8 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
|
||||
@Test
|
||||
public void testFailure_noCreditId() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--credit_id");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--credit_id");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--balance=\"USD 100\"",
|
||||
|
@ -129,7 +134,8 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
|
||||
@Test
|
||||
public void testFailure_noBalance() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--balance");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--balance");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--credit_id=" + creditId,
|
||||
|
@ -138,7 +144,8 @@ public class CreateCreditBalanceCommandTest extends CommandTestCase<CreateCredit
|
|||
|
||||
@Test
|
||||
public void testFailure_noEffectiveTime() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--effective_time");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--effective_time");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--credit_id=" + creditId,
|
||||
|
|
|
@ -93,7 +93,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_nonexistentParentRegistrar() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Registrar FakeRegistrar not found");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrar FakeRegistrar not found");
|
||||
runCommandForced(
|
||||
"--registrar=FakeRegistrar",
|
||||
"--type=PROMOTION",
|
||||
|
@ -104,7 +105,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_nonexistentTld() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "faketld");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("faketld");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--type=PROMOTION",
|
||||
|
@ -115,7 +117,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_nonexistentType() throws Exception {
|
||||
thrown.expect(ParameterException.class, "Invalid value for --type");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("Invalid value for --type");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--type=BADTYPE",
|
||||
|
@ -126,7 +129,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_negativeBalance() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "negative");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("negative");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--type=PROMOTION",
|
||||
|
@ -137,7 +141,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_noRegistrar() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--registrar");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--registrar");
|
||||
runCommandForced(
|
||||
"--type=PROMOTION",
|
||||
"--tld=tld",
|
||||
|
@ -147,7 +152,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_noType() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--type");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--type");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--tld=tld",
|
||||
|
@ -157,7 +163,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_noTld() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--tld");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--tld");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--type=PROMOTION",
|
||||
|
@ -167,7 +174,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_noBalance() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--balance");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--balance");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--type=PROMOTION",
|
||||
|
@ -177,7 +185,8 @@ public class CreateCreditCommandTest extends CommandTestCase<CreateCreditCommand
|
|||
|
||||
@Test
|
||||
public void testFailure_noEffectiveTime() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--effective_time");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--effective_time");
|
||||
runCommandForced(
|
||||
"--registrar=TheRegistrar",
|
||||
"--type=PROMOTION",
|
||||
|
|
|
@ -69,7 +69,8 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
|
||||
@Test
|
||||
public void testFailure_duplicateDomains() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Duplicate arguments found: \'example.tld\'");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Duplicate arguments found: \'example.tld\'");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
|
@ -81,7 +82,8 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
|
||||
@Test
|
||||
public void testFailure_missingDomain() throws Exception {
|
||||
thrown.expect(ParameterException.class, "Main parameters are required");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("Main parameters are required");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
|
@ -91,35 +93,40 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
|
||||
@Test
|
||||
public void testFailure_missingClientId() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--client");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--client");
|
||||
runCommandForced(
|
||||
"--admins=crr-admin", "--techs=crr-tech", "--registrant=crr-admin", "example.tld");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_missingRegistrant() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Registrant must be specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrant must be specified");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar", "--admins=crr-admin", "--techs=crr-tech", "example.tld");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_missingAdmins() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "At least one admin must be specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("At least one admin must be specified");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar", "--registrant=crr-admin", "--techs=crr-tech", "example.tld");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_missingTechs() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "At least one tech must be specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("At least one tech must be specified");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar", "--registrant=crr-admin", "--admins=crr-admin", "example.tld");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_tooManyNameServers() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "There can be at most 13 nameservers");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("There can be at most 13 nameservers");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
|
@ -134,7 +141,8 @@ public class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomain
|
|||
|
||||
@Test
|
||||
public void testFailure_badPeriod() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--period");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--period");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--registrant=crr-admin",
|
||||
|
|
|
@ -50,7 +50,8 @@ public class CreateHostCommandTest extends EppToolCommandTestCase<CreateHostComm
|
|||
@Test
|
||||
public void testFailure_invalidIpAddress() throws Exception {
|
||||
createTld("tld");
|
||||
thrown.expect(IllegalArgumentException.class, "'a.b.c.d' is not an IP string literal.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("'a.b.c.d' is not an IP string literal.");
|
||||
runCommandForced(
|
||||
"--client=NewRegistrar",
|
||||
"--host=example.tld",
|
||||
|
|
|
@ -226,47 +226,44 @@ public class CreateLrpTokensCommandTest extends CommandTestCase<CreateLrpTokensC
|
|||
|
||||
@Test
|
||||
public void testFailure_missingAssigneeOrFile() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Exactly one of either assignee or filename must be specified.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Exactly one of either assignee or filename must be specified.");
|
||||
runCommand("--tlds=tld");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_bothAssigneeAndFile() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Exactly one of either assignee or filename must be specified.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Exactly one of either assignee or filename must be specified.");
|
||||
runCommand("--assignee=domain.tld", "--tlds=tld", "--input=" + assigneeFilePath);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_bothMetadataAndFile() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Metadata cannot be specified along with a filename.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Metadata cannot be specified along with a filename.");
|
||||
runCommand("--tlds=tld", "--input=" + assigneeFilePath, "--metadata=key=foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_bothAssigneeAndMetadataColumns() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Metadata columns cannot be specified along with an assignee.");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Metadata columns cannot be specified along with an assignee.");
|
||||
runCommand("--assignee=domain.tld", "--tlds=tld", "--metadata_columns=foo=1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_badTld() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "TLDs do not exist: foo");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("TLDs do not exist: foo");
|
||||
runCommand("--assignee=domain.tld", "--tlds=foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_oneAssignee_byFile_insufficientMetadata() throws Exception {
|
||||
Files.asCharSink(assigneeFile, UTF_8).write("domain.tld,foo");
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
"Entry for domain.tld does not have a value for key2 (index 2)");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Entry for domain.tld does not have a value for key2 (index 2)");
|
||||
runCommand("--input=" + assigneeFilePath, "--tlds=tld", "--metadata_columns=key=1,key2=2");
|
||||
}
|
||||
|
||||
|
|
|
@ -92,13 +92,15 @@ public class CreatePremiumListCommandTest<C extends CreatePremiumListCommand>
|
|||
any(byte[].class)))
|
||||
.thenReturn(
|
||||
JSON_SAFETY_PREFIX + "{\"status\":\"error\",\"error\":\"foo already exists\"}");
|
||||
thrown.expect(VerifyException.class, "Server error:");
|
||||
thrown.expect(VerifyException.class);
|
||||
thrown.expectMessage("Server error:");
|
||||
runCommandForced("-i=" + premiumTermsPath, "-n=foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRun_noInputFileSpecified_throwsException() throws Exception {
|
||||
thrown.expect(ParameterException.class, "The following option is required");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("The following option is required");
|
||||
runCommand();
|
||||
}
|
||||
|
||||
|
@ -108,7 +110,8 @@ public class CreatePremiumListCommandTest<C extends CreatePremiumListCommand>
|
|||
"tmp_file2",
|
||||
readResourceUtf8(
|
||||
CreatePremiumListCommandTest.class, "testdata/example_invalid_premium_terms.csv"));
|
||||
thrown.expect(IllegalArgumentException.class, "Could not parse line in premium list");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Could not parse line in premium list");
|
||||
runCommandForced("-i=" + premiumTermsPath, "-n=foo");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -441,7 +441,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
public void testFailure_billingAccountMap_doesNotContainEntryForTldAllowed() throws Exception {
|
||||
createTlds("foo");
|
||||
|
||||
thrown.expect(IllegalArgumentException.class, "USD");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("USD");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=some_password",
|
||||
|
@ -694,7 +695,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_badPhoneNumber() throws Exception {
|
||||
thrown.expect(ParameterException.class, "phone");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("phone");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=some_password",
|
||||
|
@ -713,7 +715,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_badPhoneNumber2() throws Exception {
|
||||
thrown.expect(ParameterException.class, "phone");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("phone");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=some_password",
|
||||
|
@ -754,7 +757,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_missingRegistrarType() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Registrar type cannot be null");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Registrar type cannot be null");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=some_password",
|
||||
|
@ -920,7 +924,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_certHashNotBase64() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "base64");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("base64");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=some_password",
|
||||
|
@ -939,7 +944,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_certHashNotA256BitValue() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "256");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("256");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=some_password",
|
||||
|
@ -958,7 +964,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_missingName() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "--name is a required field");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("--name is a required field");
|
||||
runCommandForced(
|
||||
"--password=blobio",
|
||||
"--registrar_type=REAL",
|
||||
|
@ -975,7 +982,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_missingPassword() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "--password is a required field");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("--password is a required field");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--registrar_type=REAL",
|
||||
|
@ -992,7 +1000,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_emptyPassword() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "--password is a required field");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("--password is a required field");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=\"\"",
|
||||
|
@ -1325,7 +1334,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_missingIcannReferralEmail() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "--icann_referral_email");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("--icann_referral_email");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=some_password",
|
||||
|
@ -1435,7 +1445,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
@Test
|
||||
public void testFailure_alreadyExists() throws Exception {
|
||||
persistNewRegistrar("existing", "Existing Registrar", Registrar.Type.REAL, 1L);
|
||||
thrown.expect(IllegalStateException.class, "Registrar existing already exists");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("Registrar existing already exists");
|
||||
runCommandForced(
|
||||
"--name=blobio",
|
||||
"--password=some_password",
|
||||
|
@ -1453,8 +1464,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_registrarNameSimilarToExisting() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
"The registrar name tHeRe GiStRaR normalizes "
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("The registrar name tHeRe GiStRaR normalizes "
|
||||
+ "identically to existing registrar name The Registrar");
|
||||
// Normalizes identically to "The Registrar" which is created by AppEngineRule.
|
||||
runCommandForced(
|
||||
|
@ -1474,8 +1485,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_clientIdNormalizesToExisting() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
"The registrar client identifier theregistrar "
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("The registrar client identifier theregistrar "
|
||||
+ "normalizes identically to existing registrar TheRegistrar");
|
||||
runCommandForced(
|
||||
"--name=blahhh",
|
||||
|
@ -1494,7 +1505,8 @@ public class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarC
|
|||
|
||||
@Test
|
||||
public void testFailure_clientIdIsInvalidFormat() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"Client identifier (.L33T) can only contain lowercase letters, numbers, and hyphens");
|
||||
runCommandForced(
|
||||
"--name=blahhh",
|
||||
|
|
|
@ -54,7 +54,8 @@ public class CreateRegistrarGroupsCommandTest extends
|
|||
|
||||
@Test
|
||||
public void test_throwsExceptionForNonExistentRegistrar() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class,
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage(
|
||||
"Could not load registrar with id FakeRegistrarThatDefinitelyDoesNotExist");
|
||||
runCommandForced("FakeRegistrarThatDefinitelyDoesNotExist");
|
||||
}
|
||||
|
|
|
@ -90,7 +90,8 @@ public class CreateReservedListCommandTest extends
|
|||
public void testFailure_reservedListWithThatNameAlreadyExists() throws Exception {
|
||||
ReservedList rl = persistReservedList("xn--q9jyb4c_foo", "jones,FULLY_BLOCKED");
|
||||
persistResource(Registry.get("xn--q9jyb4c").asBuilder().setReservedLists(rl).build());
|
||||
thrown.expect(IllegalArgumentException.class, "A reserved list already exists by this name");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("A reserved list already exists by this name");
|
||||
runCommandForced("--name=xn--q9jyb4c_foo", "--input=" + reservedTermsPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,13 +78,15 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_multipleArguments() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Can't create more than one TLD at a time");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Can't create more than one TLD at a time");
|
||||
runCommandForced("--roid_suffix=BLAH", "--dns_writers=VoidDnsWriter", "xn--q9jyb4c", "test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_multipleDuplicateArguments() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Can't create more than one TLD at a time");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Can't create more than one TLD at a time");
|
||||
runCommandForced("--roid_suffix=BLAH", "--dns_writers=VoidDnsWriter", "test", "test");
|
||||
}
|
||||
|
||||
|
@ -301,7 +303,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_invalidAddGracePeriod() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Invalid format: \"5m\"");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Invalid format: \"5m\"");
|
||||
runCommandForced(
|
||||
"--add_grace_period=5m",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
|
@ -324,7 +327,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_invalidRedemptionGracePeriod() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Invalid format: \"5m\"");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Invalid format: \"5m\"");
|
||||
runCommandForced(
|
||||
"--redemption_grace_period=5m",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
|
@ -334,7 +338,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_invalidPendingDeleteLength() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Invalid format: \"5m\"");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Invalid format: \"5m\"");
|
||||
runCommandForced(
|
||||
"--pending_delete_length=5m",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
|
@ -344,7 +349,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_invalidTldState() throws Exception {
|
||||
thrown.expect(ParameterException.class, "Invalid value for --initial_tld_state parameter");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("Invalid value for --initial_tld_state parameter");
|
||||
runCommandForced(
|
||||
"--initial_tld_state=INVALID_STATE",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
|
@ -355,9 +361,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
@Test
|
||||
public void testFailure_bothTldStateFlags() throws Exception {
|
||||
DateTime now = DateTime.now(UTC);
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Don't pass both --initial_tld_state and --tld_state_transitions");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Don't pass both --initial_tld_state and --tld_state_transitions");
|
||||
runCommandForced(
|
||||
String.format(
|
||||
"--tld_state_transitions=%s=PREDELEGATION,%s=SUNRISE",
|
||||
|
@ -369,7 +374,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_negativeInitialRenewBillingCost() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "Renew billing cost cannot be negative");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Renew billing cost cannot be negative");
|
||||
runCommandForced(
|
||||
"--initial_renew_billing_cost=USD -42",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
|
@ -379,8 +385,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_invalidEapCurrency() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class, "All EAP fees must be in the registry's currency");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("All EAP fees must be in the registry's currency");
|
||||
runCommandForced(
|
||||
String.format(
|
||||
"--eap_fee_schedule=\"%s=JPY 123456\"", START_OF_TIME.toString(DATETIME_FORMAT)),
|
||||
|
@ -391,26 +397,30 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_noTldName() throws Exception {
|
||||
thrown.expect(ParameterException.class, "Main parameters are required (\"Names of the TLDs\")");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("Main parameters are required (\"Names of the TLDs\")");
|
||||
runCommandForced();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_noDnsWriter() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "At least one DNS writer must be specified");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("At least one DNS writer must be specified");
|
||||
runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_alreadyExists() throws Exception {
|
||||
createTld("xn--q9jyb4c");
|
||||
thrown.expect(IllegalStateException.class, "TLD 'xn--q9jyb4c' already exists");
|
||||
thrown.expect(IllegalStateException.class);
|
||||
thrown.expectMessage("TLD 'xn--q9jyb4c' already exists");
|
||||
runCommandForced("--roid_suffix=NOTDUPE", "--dns_writers=VoidDnsWriter", "xn--q9jyb4c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_tldStartsWithDigit() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "TLDs cannot begin with a number");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("TLDs cannot begin with a number");
|
||||
runCommandForced("1foo", "--roid_suffix=1FOO", "--dns_writers=VoidDnsWriter");
|
||||
}
|
||||
|
||||
|
@ -546,7 +556,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_setPremiumListThatDoesntExist() throws Exception {
|
||||
thrown.expect(IllegalArgumentException.class, "The premium list 'phonies' doesn't exist");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("The premium list 'phonies' doesn't exist");
|
||||
runCommandForced(
|
||||
"--premium_list=phonies",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
|
@ -556,8 +567,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_addLrpPeriod_backwardsInterval() throws Exception {
|
||||
thrown.expect(
|
||||
ParameterException.class,
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage(
|
||||
"--lrp_period=2005-06-09T12:30:00Z/2004-07-10T13:30:00Z not an ISO-8601 interval");
|
||||
runCommandForced(
|
||||
"--lrp_period=2005-06-09T12:30:00Z/2004-07-10T13:30:00Z",
|
||||
|
@ -568,7 +579,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_addLrpPeriod_badInterval() throws Exception {
|
||||
thrown.expect(ParameterException.class, "--lrp_period=foobar not an ISO-8601 interval");
|
||||
thrown.expect(ParameterException.class);
|
||||
thrown.expectMessage("--lrp_period=foobar not an ISO-8601 interval");
|
||||
runCommandForced(
|
||||
"--lrp_period=foobar",
|
||||
"--roid_suffix=Q9JYB4C",
|
||||
|
@ -578,9 +590,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
|
||||
@Test
|
||||
public void testFailure_specifiedDnsWriters_dontExist() throws Exception {
|
||||
thrown.expect(
|
||||
IllegalArgumentException.class,
|
||||
"Invalid DNS writer name(s) specified: [Deadbeef, Invalid]");
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Invalid DNS writer name(s) specified: [Deadbeef, Invalid]");
|
||||
runCommandForced("xn--q9jyb4c", "--roid_suffix=Q9JYB4C", "--dns_writers=Invalid,Deadbeef");
|
||||
}
|
||||
|
||||
|
@ -606,7 +617,8 @@ public class CreateTldCommandTest extends CommandTestCase<CreateTldCommand> {
|
|||
private void runFailureReservedListsTest(
|
||||
String reservedLists, Class<? extends Exception> errorClass, String errorMsg)
|
||||
throws Exception {
|
||||
thrown.expect(errorClass, errorMsg);
|
||||
thrown.expect(errorClass);
|
||||
thrown.expectMessage(errorMsg);
|
||||
runCommandForced(
|
||||
"--reserved_lists",
|
||||
reservedLists,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue