mirror of
https://github.com/google/nomulus.git
synced 2025-06-14 16:34:45 +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
|
@ -24,7 +24,7 @@ import static google.registry.testing.DatastoreHelper.persistActiveContact;
|
|||
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
|
||||
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 com.google.common.collect.ImmutableSet;
|
||||
import google.registry.flows.EppException;
|
||||
|
@ -74,7 +74,7 @@ public class ContactDeleteFlowTest
|
|||
@Test
|
||||
public void testFailure_neverExisted() throws Exception {
|
||||
ResourceDoesNotExistException thrown =
|
||||
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public class ContactDeleteFlowTest
|
|||
public void testFailure_existedButWasDeleted() throws Exception {
|
||||
persistDeletedContact(getUniqueIdFromCommand(), clock.nowUtc().minusDays(1));
|
||||
ResourceDoesNotExistException thrown =
|
||||
expectThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||
assertThrows(ResourceDoesNotExistException.class, this::runFlow);
|
||||
assertThat(thrown).hasMessageThat().contains(String.format("(%s)", getUniqueIdFromCommand()));
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class ContactDeleteFlowTest
|
|||
newContactResource(getUniqueIdFromCommand()).asBuilder()
|
||||
.setStatusValues(ImmutableSet.of(statusValue))
|
||||
.build());
|
||||
EppException thrown = expectThrows(exception, this::runFlow);
|
||||
EppException thrown = assertThrows(exception, this::runFlow);
|
||||
assertThat(thrown).hasMessageThat().contains(statusValue.getXmlName());
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class ContactDeleteFlowTest
|
|||
public void testFailure_unauthorizedClient() throws Exception {
|
||||
sessionMetadata.setClientId("NewRegistrar");
|
||||
persistActiveContact(getUniqueIdFromCommand());
|
||||
EppException thrown = expectThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
EppException thrown = assertThrows(ResourceNotOwnedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ public class ContactDeleteFlowTest
|
|||
createTld("tld");
|
||||
persistResource(
|
||||
newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand())));
|
||||
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
|
||||
EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ public class ContactDeleteFlowTest
|
|||
createTld("tld");
|
||||
persistResource(
|
||||
newDomainResource("example.tld", persistActiveContact(getUniqueIdFromCommand())));
|
||||
EppException thrown = expectThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
|
||||
EppException thrown = assertThrows(ResourceToDeleteIsReferencedException.class, this::runFlow);
|
||||
assertAboutEppExceptions().that(thrown).marshalsToXml();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue