/*
 * #%L
 * wcm.io
 * %%
 * Copyright (C) 2017 wcm.io
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package io.wcm.qa.galenium.util;

import org.openqa.selenium.WebDriver;

import com.relevantcodes.extentreports.ExtentTest;

public class GaleniumContext {

  private static final ThreadLocal<GaleniumContext> THREAD_LOCAL_CONTEXT = new ThreadLocal<GaleniumContext>() {
    @Override
    protected GaleniumContext initialValue() {
      return new GaleniumContext();
    }
  };

  private WebDriver driver;
  private ExtentTest extentTest;
  private String testDescription;
  private TestDevice testDevice;
  private String testName;

  public static GaleniumContext getContext() {
    return THREAD_LOCAL_CONTEXT.get();
  }

  public static WebDriver getDriver() {
    return THREAD_LOCAL_CONTEXT.get().driver;
  }

  public static ExtentTest getExtentTest() {
    return THREAD_LOCAL_CONTEXT.get().extentTest;
  }

  public static String getTestDescription() {
    return THREAD_LOCAL_CONTEXT.get().testDescription;
  }

  public static TestDevice getTestDevice() {
    return THREAD_LOCAL_CONTEXT.get().testDevice;
  }

  public static String getTestName() {
    return THREAD_LOCAL_CONTEXT.get().testName;
  }

  public void setDriver(WebDriver driver) {
    this.driver = driver;
  }

  public void setExtentTest(ExtentTest extentTest) {
    this.extentTest = extentTest;
  }

  public void setTestDescription(String testDescription) {
    this.testDescription = testDescription;
  }

  public void setTestDevice(TestDevice testDevice) {
    this.testDevice = testDevice;
  }

  public void setTestName(String testName) {
    this.testName = testName;
  }

}

@@ -692,16 +692,53 @@
 bDriver;
+%0Aimport org.testng.asserts.Assertion;
 %0A%0Aimport
@@ -1036,16 +1036,47 @@
 %7D%0A  %7D;%0A%0A
+  private Assertion assertion;%0A
   privat
@@ -1223,16 +1223,113 @@
 tName;%0A%0A
+  public static Assertion getAssertion() %7B%0A    return THREAD_LOCAL_CONTEXT.get().assertion;%0A  %7D%0A%0A
   public
@@ -1843,24 +1843,24 @@
 estName() %7B%0A
-
     return T
@@ -1892,32 +1892,119 @@
 .testName;%0A  %7D%0A%0A
+  public void setAssertion(Assertion assertion) %7B%0A    this.assertion = assertion;%0A  %7D%0A%0A
   public void se

add assertion to context