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

io.cucumber.needle.ReadInjectionProviderClassNames Maven / Gradle / Ivy

There is a newer version: 6.11.0
Show newest version
package io.cucumber.needle;

import java.util.LinkedHashSet;
import java.util.ResourceBundle;
import java.util.Set;

/**
 * Read ClassNames from properties.
 */
enum ReadInjectionProviderClassNames {
    /**
     * Singleton Instance
     */
    INSTANCE;

    private static final String CUSTOM_INJECTION_PROVIDER_CLASSES = "custom.injection.provider.classes";

    public final Set apply(final ResourceBundle resourceBundle) {
        final LinkedHashSet result = new LinkedHashSet<>();

        if (resourceBundle != null && resourceBundle.containsKey(CUSTOM_INJECTION_PROVIDER_CLASSES)) {
            final String csvProperty = resourceBundle.getString(CUSTOM_INJECTION_PROVIDER_CLASSES);
            for (final String className : csvProperty.split(",")) {
                if (className != null) {
                    final String trim = className.trim();
                    if (!"".equals(trim)) {
                        result.add(trim);
                    }
                }
            }
        }

        return result;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy