com.nordstrom.automation.selenium.exceptions.PlatformActivationFailedException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-foundation Show documentation
Show all versions of selenium-foundation Show documentation
Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).
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;
}
}