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

com.version1.screenshots.ScreenshotsHelper Maven / Gradle / Ivy

package com.version1.screenshots;
import java.util.HashMap;
import java.util.Map;

/**
 * ScreenshotsHelper class for CaptureScreenshots class
 */
class ScreenshotsHelper {
    private static final ThreadLocal> screenShots = new ThreadLocal>() {
        @Override
        protected Map initialValue() {
            return new HashMap<>();
        }
    };

    /**
    * Adds the screenshot in the Map collection of type 
    * @param name for the screenshot
    * @param image to be cloned and stored in the Map collection
    */
    public static void add(String name, byte[] image) {
    	screenShots.get().put(name, image.clone());
    }

    /**
    * Returns the screenshot for the current test
    * @return screenshot of the current test
    */
    public static Map getScreenShotsForCurrentTest() {
        return screenShots.get();
    }

    /**
    * Removes the screenshot after the test run
    */
    public static void tidyUpAfterTestRun() {
    	screenShots.remove();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy