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

com.github.jsdevel.testng.selenium.MethodContextImpl Maven / Gradle / Ivy

There is a newer version: 0.11.2
Show newest version
package com.github.jsdevel.testng.selenium;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.openqa.selenium.WebDriver;


class MethodContextImpl implements MethodContext {
  final Method method;
  private PF pageFactory;
  private WebDriver webDriver;
  private final List output;
  private Object screensize;
  private String userAgent;
  private String endpoint;

  /**
   * Constructs this context with the {@link Method} representing the current
   * TestNG test run.
   * 
   * @param method The current test method being run.
   */
  public MethodContextImpl(Method method) {
    this.method = method;
    this.output = new ArrayList();
  }

  @Override
  public String getEndpoint() {
    return endpoint;
  }

  @Override
  public PF getPageFactory() {
    return this.pageFactory;
  }

  @Override
  public Object getScreensize() {
    return this.screensize;
  }
  
  @Override
  public WebDriver getWebDriver() {
    return this.webDriver;
  }

  @Override
  public String getUserAgent() {
    return this.userAgent;
  }

  @Override
  public void log(String msg) {
    this.output.add(msg);
  }

  List getOutput() {
    return Collections.unmodifiableList(output);
  }

  void setEndpoint(String endpoint) {
    this.endpoint = endpoint; 
  }
  void setPageFactory(PF pageFactory) {
    this.pageFactory = pageFactory; 
  }

  void setScreensize(Object screensize) {
    this.screensize = screensize;
  }

  void setWebDriver(WebDriver webDriver) {
    this.webDriver = webDriver;
  }

  void setUserAgent(String userAgent) {
    this.userAgent = userAgent; 
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy