I am getting a null pointer exception when I try to call a function. I am able to call this function in another function without issue but when i try to call it a second function i get a null pointer.
public class Approvals extends SnowPortalBasePage {
@Steps
ApproveNewApplicationSteps tommy;
private static Logger logger = LogManager.getLogger();
public void approveNewEnvironment(String envName){
tommy.logIntoApproverAccount(); <--- throws null pointer
}
public void approveNewApplication(RegisterNewApplicationFormData formdata){
benchmark b = new benchmark();
tommy.setFormData(formdata);
b.start("logging into approver account");
tommy.logIntoApproverAccount(); <--- works
b.stop();
b.start("completing data assessment and rationalization task");
tommy.completeDataAssessmentAndRationalizationTask();
b.stop();
b.start();
tommy.completeTask();
b.stop();
logger.info(b.resultsSec());
}
}
this is the class with the method that is being called
public class ApproveNewApplicationSteps {
private static Logger logger = LogManager.getLogger();
private static int MAX_RETRIES = 10;
SnowPortalBasePage JohnDoe;
RegisterNewApplicationFormData formData;
public void logIntoApproverAccount() {
JohnDoe.getDriver().quit(); // close out the previous webdriver
JohnDoe.clearBrowserCookies();
JohnDoe.loginToSNOW(url, "testuser", "password");
JohnDoe.getDriver().switchTo().defaultContent();
JohnDoe.openUrl(url);
}
Any help is appreciated.