Add generic XML syntax testing to a flow test

Adding it to one test is sufficient because we use the same loading logic across all flows.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=239506003
This commit is contained in:
gbrodman 2019-03-20 17:02:43 -07:00 committed by jianglai
parent 0ead4f8d9d
commit 9bf6a860bb
5 changed files with 26 additions and 13 deletions

View file

@ -14,10 +14,14 @@
package google.registry.flows.session;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static google.registry.testing.JUnitBackports.assertThrows;
import static org.joda.time.format.ISODateTimeFormat.dateTimeNoMillis;
import com.google.common.collect.ImmutableMap;
import google.registry.flows.EppException;
import google.registry.flows.FlowTestCase;
import google.registry.flows.FlowUtils.GenericXmlSyntaxErrorException;
import org.junit.Test;
/** Unit tests for {@link HelloFlow}. */
@ -31,4 +35,13 @@ public class HelloFlowTest extends FlowTestCase<HelloFlow> {
loadFile(
"greeting.xml", ImmutableMap.of("DATE", clock.nowUtc().toString(dateTimeNoMillis()))));
}
@Test
public void testGenericSyntaxException() {
// This is a generic syntax test--we don't have a generic flow test case so this simple
// test class will do. Note: the logic this tests is common to all flows.
setEppInput("generic_syntax_exception.xml");
EppException thrown = assertThrows(GenericXmlSyntaxErrorException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}
}