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

@ -34,14 +34,14 @@ public class EppLifecycleLoginTest extends EppTestCase {
@Test
public void testLoginAndLogout_recordsEppMetric() throws Exception {
assertCommandAndResponse("login_valid.xml", "login_response.xml");
assertThatLoginSucceeds("NewRegistrar", "foo-BAR2");
assertThat(getRecordedEppMetric())
.hasClientId("NewRegistrar")
.and()
.hasCommandName("Login")
.and()
.hasStatus(SUCCESS);
assertCommandAndResponse("logout.xml", "logout_response.xml");
assertThatLogoutSucceeds();
assertThat(getRecordedEppMetric())
.hasClientId("NewRegistrar")
.and()