In BaseActivity.java, "prepare" method used for unit testing is referencing private variable "_runtimeContext" which is null/not initialized in the context of running unit tests.
This code:
public void prepare(ActivityRuntimeContext runtimeContext) {
if (!(logger instanceof ActivityLogger))
logger = new ActivityLogger(_runtimeContext);
Needs to be changed to this:
public void prepare(ActivityRuntimeContext runtimeContext) {
if (!(logger instanceof ActivityLogger))
logger = new ActivityLogger(runtimeContext);
Also, in ActivityLogger.java, the constructor needs to change from this:
public ActivityLogger(ActivityRuntimeContext runtimeContext) {
this.runtimeContext = runtimeContext;
if (runtimeContext.getPerformanceLevel() < 9)
this.runtimeContext.setLogPersister(ActivityLogger::persist);
}
To this:
public ActivityLogger(ActivityRuntimeContext runtimeContext) {
this.runtimeContext = runtimeContext;
if (runtimeContext.getPerformanceLevel() < 9 && !(runtimeContext instanceof MockRuntimeContext))
this.runtimeContext.setLogPersister(ActivityLogger::persist);
}
In BaseActivity.java, "prepare" method used for unit testing is referencing private variable "_runtimeContext" which is null/not initialized in the context of running unit tests.
This code:
Needs to be changed to this:
Also, in ActivityLogger.java, the constructor needs to change from this:
To this: