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

fi.jumi.core.drivers.RunViaAnnotationDriverFinder Maven / Gradle / Ivy

There is a newer version: 0.5.437
Show newest version
// Copyright © 2011-2013, Esko Luontola 
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package fi.jumi.core.drivers;

import fi.jumi.api.RunVia;
import fi.jumi.api.drivers.Driver;

import javax.annotation.concurrent.NotThreadSafe;

@NotThreadSafe
public class RunViaAnnotationDriverFinder implements DriverFinder {

    @Override
    public Driver findTestClassDriver(Class testClass) {
        RunVia annotation = testClass.getAnnotation(RunVia.class);
        if (annotation == null) {
            return DRIVER_NOT_FOUND;
        }
        Class driverClass = annotation.value();
        try {
            return driverClass.newInstance();
        } catch (Exception e) {
            throw new RuntimeException("unable to instantiate " + driverClass, e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy