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

com.nordstrom.automation.selenium.exceptions.PlatformActivationFailedException Maven / Gradle / Ivy

Go to download

Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).

There is a newer version: 28.3.1-s4
Show newest version
package com.nordstrom.automation.selenium.exceptions;

import org.apache.commons.lang3.StringUtils;

import com.nordstrom.automation.selenium.platform.PlatformEnum;

public class PlatformActivationFailedException extends RuntimeException {

    private static final long serialVersionUID = 7336291801605667538L;
    private static final String TEMPLATE = "Failed to activate target platform '%s'";

    /**
     * Constructor for {@code platform activation failed} exception with the specified platform and optional details.
     * 
     * @param platform platform to be activated
     * @param details [optional] message details
     */
    public PlatformActivationFailedException(final PlatformEnum platform, final String... details) {
        super(getMessage(platform, details));
    }
    
    /**
     * Constructor for {@code platform activation failed} exception with the specified platform, underlying cause, and
     * optional details.
     * 
     * @param platform platform to be activated
     * @param cause underlying cause for activation failure
     * @param details [optional] message details
     */
    public PlatformActivationFailedException(
            final PlatformEnum platform, final Throwable cause, final String... details) {
        super(getMessage(platform, details), cause);
    }
    
    /**
     * Get exception message to the specified platform with optional details.
     * 
     * @param platform platform to be activated
     * @param details [optional] message details
     * @return exception message to the specified platform
     */
    private static String getMessage(final PlatformEnum platform, String... details) {
        String appendix = (details.length == 0) ? "" : "\n" + StringUtils.join(details, "\n");
        return String.format(TEMPLATE, platform.getName()) + appendix;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy