Refactor assertCommandAndResponse to be "fluent"

This is in preparation for automatic EPP consolidation.

The assertion will now look like:
assertThatCommand("file.xml"[, substitution])
    .atTime(time)
    .hasResponse("file2.xml"[, substitution]);

Also, added convenience functions for often reused commands (login and logout)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190617505
This commit is contained in:
guyben 2018-03-27 08:18:47 -07:00 committed by jianglai
parent c1ca88ac9e
commit 422ec9b97a
15 changed files with 892 additions and 1054 deletions

View file

@ -37,25 +37,19 @@ public class EppLoggedOutTest extends EppTestCase {
@Test
public void testHello() throws Exception {
DateTime now = DateTime.now(UTC);
assertCommandAndResponse(
"hello.xml",
null,
"greeting.xml",
ImmutableMap.of("DATE", now.toString(dateTimeNoMillis())),
now);
assertThatCommand("hello.xml", null)
.atTime(now)
.hasResponse("greeting.xml", ImmutableMap.of("DATE", now.toString(dateTimeNoMillis())));
}
@Test
public void testSyntaxError() throws Exception {
assertCommandAndResponse(
"syntax_error.xml",
ImmutableMap.of(),
"response_error_no_cltrid.xml",
ImmutableMap.of(
"MSG",
"Syntax error at line 4, column 65: cvc-complex-type.3.2.2: "
+ "Attribute 'xsi:schemaLocation' is not allowed to appear in element 'epp'.",
"CODE",
"2001"));
assertThatCommand("syntax_error.xml")
.hasResponse(
"response_error_no_cltrid.xml",
ImmutableMap.of(
"CODE", "2001",
"MSG", "Syntax error at line 4, column 65: cvc-complex-type.3.2.2: "
+ "Attribute 'xsi:schemaLocation' is not allowed to appear in element 'epp'."));
}
}