com.github.dreamhead.moco.parser.BaseParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moco-runner Show documentation
Show all versions of moco-runner Show documentation
Moco is a easy setup stub framework, mainly focusing on testing and integration.
package com.github.dreamhead.moco.parser;
import com.github.dreamhead.moco.MocoConfig;
import com.github.dreamhead.moco.Server;
import com.github.dreamhead.moco.parser.model.SessionSetting;
import com.github.dreamhead.moco.util.Jsons;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import java.io.InputStream;
public abstract class BaseParser implements Parser {
protected abstract T createServer(ImmutableList read,
Optional port, MocoConfig... configs);
public T parseServer(final ImmutableList streams, final Optional port,
final MocoConfig... configs) {
ImmutableList settings = Jsons.toObjects(streams, SessionSetting.class);
return createServer(settings, port, configs);
}
}