mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Merge JUnitBackport's expectThrows into assertThrows
More information: https://github.com/junit-team/junit5/issues/531 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187034408
This commit is contained in:
parent
f96a0b7da9
commit
606b470cd0
180 changed files with 1325 additions and 1381 deletions
|
@ -30,7 +30,7 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
|||
import static google.registry.testing.DomainResourceSubject.assertAboutDomains;
|
||||
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
|
||||
import static google.registry.testing.HistoryEntrySubject.assertAboutHistoryEntries;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -223,7 +223,7 @@ public class DomainTransferCancelFlowTest
|
|||
.setAuthInfo(ContactAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||
.build());
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadAuthInfoForResourceException.class,
|
||||
() -> doFailingTest("domain_transfer_cancel_contact_authinfo.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
|
@ -239,7 +239,7 @@ public class DomainTransferCancelFlowTest
|
|||
.setAuthInfo(DomainAuthInfo.create(PasswordAuth.create("badpassword")))
|
||||
.build());
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadAuthInfoForResourceException.class,
|
||||
() -> doFailingTest("domain_transfer_cancel_domain_authinfo.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
|
@ -249,7 +249,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_neverBeenTransferred() throws Exception {
|
||||
changeTransferStatus(null);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_clientApproved() throws Exception {
|
||||
changeTransferStatus(TransferStatus.CLIENT_APPROVED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_clientRejected() throws Exception {
|
||||
changeTransferStatus(TransferStatus.CLIENT_REJECTED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_clientCancelled() throws Exception {
|
||||
changeTransferStatus(TransferStatus.CLIENT_CANCELLED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_serverApproved() throws Exception {
|
||||
changeTransferStatus(TransferStatus.SERVER_APPROVED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_serverCancelled() throws Exception {
|
||||
changeTransferStatus(TransferStatus.SERVER_CANCELLED);
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotPendingTransferException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_sponsoringClient() throws Exception {
|
||||
setClientIdForFlow("TheRegistrar");
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_unrelatedClient() throws Exception {
|
||||
setClientIdForFlow("ClientZ");
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotTransferInitiatorException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public class DomainTransferCancelFlowTest
|
|||
domain =
|
||||
persistResource(domain.asBuilder().setDeletionTime(clock.nowUtc().minusDays(1)).build());
|
||||
ResourceDoesNotExistException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ public class DomainTransferCancelFlowTest
|
|||
public void testFailure_nonexistentDomain() throws Exception {
|
||||
deleteResource(domain);
|
||||
ResourceDoesNotExistException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
ResourceDoesNotExistException.class, () -> doFailingTest("domain_transfer_cancel.xml"));
|
||||
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ public class DomainTransferCancelFlowTest
|
|||
persistResource(
|
||||
loadRegistrar("NewRegistrar").asBuilder().setAllowedTlds(ImmutableSet.of()).build());
|
||||
EppException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
NotAuthorizedForTldException.class,
|
||||
() ->
|
||||
doSuccessfulTest(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue