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

@ -23,6 +23,7 @@ import com.google.common.io.ByteSource;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nullable;
/** Contains helper methods for dealing with test data. */
public final class TestDataHelper {
@ -56,7 +57,7 @@ public final class TestDataHelper {
* context class, and substitutes in values for placeholders of the form <code>%tagname%</code>.
*/
public static String loadFile(
Class<?> context, String filename, Map<String, String> substitutions) {
Class<?> context, String filename, @Nullable Map<String, String> substitutions) {
String fileContents = loadFile(context, filename);
for (Entry<String, String> entry : nullToEmpty(substitutions).entrySet()) {
fileContents = fileContents.replaceAll("%" + entry.getKey() + "%", entry.getValue());