@ScenarioScoped
public class TestTempData
{
}
@Inject TestTempData tmpData works >>>> FINE >>>> in below class
public class MyStepDefClass
{
@Inject
TestTempData tmpData;
@Inject
CreateWebDriver driver;
@When("Navigating to url {string}")
public void navigateTo(String url)
{
driver.getDriver.get(url)
}
}
But in below class ######### @Inject TestTempData tmpData is giving - Null Pointer Exception
@ScenarioScoped
public class CreateWebDriver {
@Inject
TestTempData tmpData; //**Returning null**
public WebDriver driver;
public CreateWebDriver ()
{
driver = new RemoteWebDriver("http://hub-address:4444/wd/hub")
System.out.println(tmpData); // **Throwing Null pointer Exception**
}
}