com.github.dreamhead.moco.mount.AbstractHttpContentResponseHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moco-core Show documentation
Show all versions of moco-core Show documentation
Moco is an easy setup stub framework, mainly focusing on testing and integration.
package com.github.dreamhead.moco.mount;
import com.github.dreamhead.moco.HttpRequest;
import com.github.dreamhead.moco.MocoException;
import com.github.dreamhead.moco.Request;
import com.github.dreamhead.moco.handler.AbstractContentResponseHandler;
import com.github.dreamhead.moco.model.MessageContent;
public abstract class AbstractHttpContentResponseHandler extends AbstractContentResponseHandler {
protected abstract MessageContent responseContent(HttpRequest httpRequest);
@Override
protected final MessageContent responseContent(final Request request) {
if (!HttpRequest.class.isInstance(request)) {
throw new MocoException("Only HTTP request is allowed");
}
return responseContent((HttpRequest) request);
}
}