com.nordstrom.automation.selenium.exceptions.ContainerVacatedException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium3-foundation Show documentation
Show all versions of selenium3-foundation Show documentation
Selenium3 Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium 3.0 (WebDriver).
package com.nordstrom.automation.selenium.exceptions;
import java.lang.reflect.Method;
import com.nordstrom.automation.selenium.utility.ReflectUtil;
/**
* This exception is thrown when a client calls a method of a container object that's no longer valid.
*/
public class ContainerVacatedException extends RuntimeException {
private static final long serialVersionUID = 2043877560841903084L;
private final transient Method vacater;
private static final String PREAMBLE = "Container object was vacated by invocation of method: ";
/**
* Constructs a new {@code container vacated} exception with the specified vacater.
*
* @param vacater method that caused the container to be vacated
*/
public ContainerVacatedException(Method vacater) {
super(getMessage(vacater));
this.vacater = vacater;
}
/**
* Get the method that caused the affected container object to be vacated.
*
* @return method that vacated the target object
*/
public Method getVacater() {
return vacater;
}
/**
* Assemble the message for this exception.
*
* @param method method that vacated the target object.
* @return message for this exception
*/
private static String getMessage(Method method) {
String className = method.getDeclaringClass().getSimpleName();
String signature = ReflectUtil.getSignature(method);
return PREAMBLE + className + ":" + signature;
}
}