/** * Sets the configuration context for current thread * * @param configuration the configuration instance * @throws IllegalArgumentException when provided configuration instance is null */ public static void set(FundamentalTestConfiguration configuration) { if (configuration == null) { throw new IllegalArgumentException("configuration instance can't be null"); } if (GrapheneProxy.isProxyInstance(configuration)) { throw new IllegalArgumentException("instance of the proxy can't be set to the configuration"); } REFERENCE.set(configuration); }
/** * Sets the configuration context for current thread * * @param configuration the configuration instance * @throws IllegalArgumentException when provided configuration instance is null */ public static void set(RichFacesPageFragmentsConfiguration configuration) { if (configuration == null) { throw new IllegalArgumentException("configuration instance can't be null"); } if (GrapheneProxy.isProxyInstance(configuration)) { throw new IllegalArgumentException("instance of the proxy can't be set to the configuration"); } REFERENCE.set(configuration); }
protected static GrapheneContext getContext(Object object) { if (!GrapheneProxy.isProxyInstance(object)) { throw new IllegalArgumentException("The parameter [object] has to be instance of " + GrapheneProxyInstance.class.getName() + ", but it is not. The given object is " + object + "."); } return ((GrapheneProxyInstance) object).getGrapheneContext(); }
public static WebElement unwrap(WebElement element) { Preconditions.checkNotNull(element, "The element cannot be null."); WebElement result = element; while (GrapheneProxy.isProxyInstance(result)) { result = ((GrapheneProxyInstance) result).unwrap(); } return result; }
@Override public WebDriver enhance(final WebDriver instance, Class<? extends Annotation> qualifier) { if (GrapheneProxy.isProxyInstance(instance)) { GrapheneProxyInstance proxy = (GrapheneProxyInstance) instance; proxy.registerInterceptor(interceptor); } return instance; }
@Override public WebDriver deenhance(WebDriver instance, Class<? extends Annotation> qualifier) { if (GrapheneProxy.isProxyInstance(instance)) { GrapheneProxyInstance proxy = (GrapheneProxyInstance) instance; proxy.unregisterInterceptor(interceptor); } return instance; }
protected static GrapheneContext getContext(Object object) { if (!GrapheneProxy.isProxyInstance(object)) { throw new IllegalArgumentException("The parameter [object] has to be instance of " + GrapheneProxyInstance.class.getName() + ", but it is not. The given object is " + object + "."); } return ((GrapheneProxyInstance) object).getGrapheneContext(); }
if (GrapheneProxy.isProxyInstance(target)) { proxy = (GrapheneProxyInstance) ((GrapheneProxyInstance) target).copy(); } else {
if (GrapheneProxy.isProxyInstance(target)) { proxy = (GrapheneProxyInstance) ((GrapheneProxyInstance) target).copy(); } else {
private RequestGuardFactory getRequestGuardFactoryFor(Object target) { GrapheneContext context; if (GrapheneProxy.isProxyInstance(target)) { context = ((GrapheneProxyInstance) target).getGrapheneContext(); } else { context = context(); } return new RequestGuardFactory( JSInterfaceFactory.create(context, RequestGuard.class), JSInterfaceFactory.create(context, Document.class), context); }
private RequestGuardFactory getRequestGuardFactoryFor(Object target) { GrapheneContext context; if (GrapheneProxy.isProxyInstance(target)) { context = ((GrapheneProxyInstance) target).getGrapheneContext(); } else { context = context(); } return new RequestGuardFactory( JSInterfaceFactory.create(context, RequestGuard.class), JSInterfaceFactory.create(context, Document.class), context); }