Fixed tests running to NPE with runnable factory

This commit is contained in:
Risto Lahtela 2021-03-20 12:44:32 +02:00
parent 07cca1f008
commit 8fa4af5a61
2 changed files with 6 additions and 6 deletions

View File

@ -23,11 +23,11 @@ import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.Database;
import com.djrapitops.plan.utilities.PassEncryptUtil;
import net.playeranalytics.plugin.scheduling.RunnableFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import utilities.TestConstants;
import utilities.mocks.objects.TestRunnableFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@ -47,7 +47,7 @@ class ActiveCookieStoreTest {
underTest = new ActiveCookieStore(
Mockito.mock(PlanConfig.class),
dbSystem,
Mockito.mock(RunnableFactory.class),
new TestRunnableFactory(),
Mockito.mock(Processing.class)
);
user = new User(TestConstants.PLAYER_ONE_NAME, "console", null, PassEncryptUtil.createHash("testPass"), 0, WebUser.getPermissionsForLevel(0));

View File

@ -27,10 +27,10 @@ import com.djrapitops.plan.storage.database.transactions.commands.RegisterWebUse
import com.djrapitops.plan.storage.database.transactions.commands.RemoveEverythingTransaction;
import com.djrapitops.plan.storage.database.transactions.commands.RemoveWebUserTransaction;
import com.djrapitops.plan.utilities.PassEncryptUtil;
import net.playeranalytics.plugin.scheduling.RunnableFactory;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import utilities.TestConstants;
import utilities.mocks.objects.TestRunnableFactory;
import java.util.Collections;
import java.util.Map;
@ -78,7 +78,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
userIsRegistered();
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
ActiveCookieStore cookieStore = new ActiveCookieStore(Mockito.mock(PlanConfig.class), dbSystem(), Mockito.mock(RunnableFactory.class), Mockito.mock(Processing.class));
ActiveCookieStore cookieStore = new ActiveCookieStore(Mockito.mock(PlanConfig.class), dbSystem(), new TestRunnableFactory(), Mockito.mock(Processing.class));
String cookie = cookieStore.generateNewCookie(user);
@ -92,7 +92,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
userIsRegistered();
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
ActiveCookieStore cookieStore = new ActiveCookieStore(Mockito.mock(PlanConfig.class), dbSystem(), Mockito.mock(RunnableFactory.class), Mockito.mock(Processing.class));
ActiveCookieStore cookieStore = new ActiveCookieStore(Mockito.mock(PlanConfig.class), dbSystem(), new TestRunnableFactory(), Mockito.mock(Processing.class));
String cookie = cookieStore.generateNewCookie(user);
@ -106,7 +106,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
userIsRegistered();
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
ActiveCookieStore cookieStore = new ActiveCookieStore(Mockito.mock(PlanConfig.class), dbSystem(), Mockito.mock(RunnableFactory.class), Mockito.mock(Processing.class));
ActiveCookieStore cookieStore = new ActiveCookieStore(Mockito.mock(PlanConfig.class), dbSystem(), new TestRunnableFactory(), Mockito.mock(Processing.class));
String cookie = cookieStore.generateNewCookie(user);