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

net.thucydides.core.fixtureservices.ClasspathFixtureProviderService Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package net.thucydides.core.fixtureservices;

import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;

/**
 * Load any implementations of the FixtureService class declared on the classpath.
 * FixtureService implementations must be declared in a file called net.thucydides.core.fixtureservices.FixtureService
 * in the META-INF/services directory somewhere on the classpath.
 */
public class ClasspathFixtureProviderService implements FixtureProviderService {

    private List fixtureServices;

    @Override
    public List getFixtureServices() {
        if (fixtureServices == null) {
            fixtureServices = new ArrayList();

            ServiceLoader fixtureServiceLoader = ServiceLoader.load(FixtureService.class);

            for (FixtureService fixtureService : fixtureServiceLoader) {
                fixtureServices.add(fixtureService);
            }
        }
        return fixtureServices;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy