Hi Johan,
Looks like it does not work for my case. My understanding is
Whitebox.setInternalState(testInstance, lockMock) is used to set a
member field of a class. But my case is like below. appLock is an
internal variable in one method.
public int start() {
ApplicationLock appLock = getApplicationLock();
if (!appLock.tryObtain()) {
err.println("Controller is already running. Couldn't start
one more instance.");
return 1;
}
...
}
protected ApplicationLock getApplicationLock() {
return new ApplicationLock(getAppFolder(), LOCK_FILE_NAME);