All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dreamhead.moco.parser.BaseParser Maven / Gradle / Ivy

Go to download

Moco is a easy setup stub framework, mainly focusing on testing and integration.

There is a newer version: 1.5.0
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy