mirror of
https://github.com/google/nomulus
synced 2026-09-08 17:17:02 +00:00
Merge JUnitBackport's expectThrows into assertThrows
More information: https://github.com/junit-team/junit5/issues/531 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187034408
This commit is contained in:
@@ -23,7 +23,7 @@ import static google.registry.testing.DatastoreHelper.getOnlyPollMessage;
|
||||
import static google.registry.testing.DatastoreHelper.getPollMessages;
|
||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ResourceFlowUtils.BadAuthInfoForResourceException;
|
||||
@@ -147,7 +147,7 @@ public class ContactTransferRejectFlowTest
|
||||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||
.build());
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadAuthInfoForResourceException.class,
|
||||
() -> doFailingTest("contact_transfer_reject_with_authinfo.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
@@ -157,7 +157,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_neverBeenTransferred() throws Exception {
|
||||
changeTransferStatus(null);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_clientApproved() throws Exception {
|
||||
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_clientRejected() throws Exception {
|
||||
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_clientCancelled() throws Exception {
|
||||
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_serverApproved() throws Exception {
|
||||
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_serverCancelled() throws Exception {
|
||||
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_gainingClient() throws Exception {
|
||||
setClientIdForFlow("NewRegistrar");
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_unrelatedClient() throws Exception {
|
||||
setClientIdForFlow("ClientZ");
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ResourceNotOwnedException.class, () -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
@@ -230,7 +230,7 @@ public class ContactTransferRejectFlowTest
|
||||
contact =
|
||||
persistResource(contact.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
ResourceDoesNotExistException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ResourceDoesNotExistException.class,
|
||||
() -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
@@ -241,7 +241,7 @@ public class ContactTransferRejectFlowTest
|
||||
public void testFailure_nonexistentContact() throws Exception {
|
||||
deleteResource(contact);
|
||||
ResourceDoesNotExistException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ResourceDoesNotExistException.class,
|
||||
() -> doFailingTest("contact_transfer_reject.xml"));
|
||||
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
|
||||
Reference in New Issue
Block a user