net.serenitybdd.junit.runners.TestMethodAnnotations Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of serenity-junit Show documentation
Show all versions of serenity-junit Show documentation
Serenity JUnit integration
package net.serenitybdd.junit.runners;
import com.google.common.base.Preconditions;
import net.thucydides.core.annotations.WithDriver;
import org.junit.runners.model.FrameworkMethod;
/**
* Utility class used to read Serenity annotations for a particular JUnit test.
* @author johnsmart
*
*/
public final class TestMethodAnnotations {
private final FrameworkMethod method;
private TestMethodAnnotations(final FrameworkMethod method) {
this.method = method;
}
public static TestMethodAnnotations forTest(final FrameworkMethod method) {
return new TestMethodAnnotations(method);
}
public boolean isDriverSpecified() {
return (method.getMethod().getAnnotation(WithDriver.class) != null);
}
public String specifiedDriver() {
Preconditions.checkArgument(isDriverSpecified() == true);
return (method.getMethod().getAnnotation(WithDriver.class).value());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy