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

io.github.azagniotov.stubby4j.yaml.ConfigurableYAMLProperty Maven / Gradle / Ivy

Go to download

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy