Re-add assertions that EppExceptions marshal correctly

These checks were removed in [] and re-adding them is the last
step of the migration to using expectThrows/assertThrows globally.

Note that this is roughly half of them. More to come in a follow-up CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179216707
This commit is contained in:
mcilwain 2017-12-15 11:15:15 -08:00 committed by Ben McIlwain
parent 16a1d6d196
commit da08baab92
17 changed files with 529 additions and 316 deletions

View file

@ -19,9 +19,10 @@ import static google.registry.testing.ContactResourceSubject.assertAboutContacts
import static google.registry.testing.DatastoreHelper.assertNoBillingEvents;
import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistDeletedContact;
import static google.registry.testing.JUnitBackports.assertThrows;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.expectThrows;
import google.registry.flows.EppException;
import google.registry.flows.ResourceFlowTestCase;
import google.registry.flows.contact.ContactFlowUtils.BadInternationalizedPostalInfoException;
import google.registry.flows.contact.ContactFlowUtils.DeclineContactDisclosureFieldDisallowedPolicyException;
@ -75,6 +76,7 @@ public class ContactCreateFlowTest
.hasMessageThat()
.contains(
String.format("Object with given ID (%s) already exists", getUniqueIdFromCommand()));
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
@ -86,13 +88,17 @@ public class ContactCreateFlowTest
@Test
public void testFailure_nonAsciiInIntAddress() throws Exception {
setEppInput("contact_create_hebrew_int.xml");
assertThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
EppException thrown =
expectThrows(BadInternationalizedPostalInfoException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test
public void testFailure_declineDisclosure() throws Exception {
setEppInput("contact_create_decline_disclosure.xml");
assertThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
EppException thrown =
expectThrows(DeclineContactDisclosureFieldDisallowedPolicyException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
@Test