io.github.azagniotov.stubby4j.yaml.ConfigurableYAMLProperty 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.yaml;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import static io.github.azagniotov.stubby4j.utils.StringUtils.toLower;
public enum ConfigurableYAMLProperty {
BODY,
FILE,
HEADERS,
HTTPLIFECYCLE,
LATENCY,
METHOD,
POST,
QUERY,
REQUEST,
RESPONSE,
STATUS,
URL;
private static final Map CACHE;
static {
CACHE = new HashMap<>();
for (final ConfigurableYAMLProperty enumMember : EnumSet.allOf(ConfigurableYAMLProperty.class)) {
CACHE.put(enumMember.toString(), enumMember);
}
}
public static boolean isUnknownProperty(final String stubbedProperty) {
return !CACHE.containsKey(toLower(stubbedProperty));
}
public static Optional ofNullableProperty(final String stubbedProperty) {
return Optional.ofNullable(CACHE.get(toLower(stubbedProperty)));
}
@Override
public String toString() {
return toLower(this.name());
}
}