io.github.azagniotov.stubby4j.stubs.AbstractBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stubby4j Show documentation
Show all versions of stubby4j Show documentation
A highly flexible & configurable tool for testing interactions of SOA applications with web services (REST, SOAP, WSDL etc.) over HTTP(S) protocol. It is an actual HTTP server (stubby4j uses embedded Jetty) that acts like a real web service, ready for consumption by your code. Allows stubbing of external systems with ease for integration testing
package io.github.azagniotov.stubby4j.stubs;
import io.github.azagniotov.stubby4j.yaml.ConfigurableYAMLProperty;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import static io.github.azagniotov.generics.TypeSafeConverter.as;
public abstract class AbstractBuilder {
final Map fieldNameAndValues;
AbstractBuilder() {
this.fieldNameAndValues = new HashMap<>();
}
E getStaged(final Class clazzor, final ConfigurableYAMLProperty property, E defaultValue) {
return fieldNameAndValues.containsKey(property) ? as(clazzor, fieldNameAndValues.get(property)) : defaultValue;
}
public void stage(final Optional fieldNameOptional, final Optional