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

net.thucydides.core.screenshots.ScreenshotBlurCheck Maven / Gradle / Ivy

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

import net.thucydides.core.annotations.BlurScreenshots;
import net.thucydides.core.reflection.StackTraceAnalyser;

import java.lang.reflect.Method;
import java.util.Optional;

public class ScreenshotBlurCheck {


    public Optional blurLevel() {
        return fromAnnotation();
    }

    private Optional fromAnnotation() {
        for(Method callingMethod : StackTraceAnalyser.inscopeMethodsIn(new Throwable().getStackTrace())) {
            if (callingMethod.getAnnotation(BlurScreenshots.class) != null) {
                return Optional.of(callingMethod.getAnnotation(BlurScreenshots.class).value());
            }
        }
        return Optional.empty();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy