com.github.dreamhead.moco.internal.AbstractResponseBase 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.internal;
import com.github.dreamhead.moco.MocoProcedure;
import com.github.dreamhead.moco.ResponseBase;
import com.github.dreamhead.moco.resource.Resource;
import static com.github.dreamhead.moco.Moco.text;
import static com.github.dreamhead.moco.Moco.with;
import static com.github.dreamhead.moco.util.Preconditions.checkNotNullOrEmpty;
import static com.google.common.base.Preconditions.checkNotNull;
public abstract class AbstractResponseBase implements ResponseBase {
@Override
public final T response(final String content) {
return this.response(text(checkNotNullOrEmpty(content, "Content should not be null")));
}
@Override
public final T response(final Resource resource) {
return this.response(with(checkNotNull(resource, "Resource should not be null")));
}
@Override
public final T response(final MocoProcedure procedure) {
return this.response(with(checkNotNull(procedure, "Procedure should not be null")));
}
}