mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-07 11:20:11 +01:00
Fixed tests running to NPE with runnable factory
This commit is contained in:
parent
07cca1f008
commit
8fa4af5a61
@ -23,11 +23,11 @@ import com.djrapitops.plan.settings.config.PlanConfig;
|
|||||||
import com.djrapitops.plan.storage.database.DBSystem;
|
import com.djrapitops.plan.storage.database.DBSystem;
|
||||||
import com.djrapitops.plan.storage.database.Database;
|
import com.djrapitops.plan.storage.database.Database;
|
||||||
import com.djrapitops.plan.utilities.PassEncryptUtil;
|
import com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||||
import net.playeranalytics.plugin.scheduling.RunnableFactory;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import utilities.TestConstants;
|
import utilities.TestConstants;
|
||||||
|
import utilities.mocks.objects.TestRunnableFactory;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
@ -47,7 +47,7 @@ class ActiveCookieStoreTest {
|
|||||||
underTest = new ActiveCookieStore(
|
underTest = new ActiveCookieStore(
|
||||||
Mockito.mock(PlanConfig.class),
|
Mockito.mock(PlanConfig.class),
|
||||||
dbSystem,
|
dbSystem,
|
||||||
Mockito.mock(RunnableFactory.class),
|
new TestRunnableFactory(),
|
||||||
Mockito.mock(Processing.class)
|
Mockito.mock(Processing.class)
|
||||||
);
|
);
|
||||||
user = new User(TestConstants.PLAYER_ONE_NAME, "console", null, PassEncryptUtil.createHash("testPass"), 0, WebUser.getPermissionsForLevel(0));
|
user = new User(TestConstants.PLAYER_ONE_NAME, "console", null, PassEncryptUtil.createHash("testPass"), 0, WebUser.getPermissionsForLevel(0));
|
||||||
|
@ -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.RemoveEverythingTransaction;
|
||||||
import com.djrapitops.plan.storage.database.transactions.commands.RemoveWebUserTransaction;
|
import com.djrapitops.plan.storage.database.transactions.commands.RemoveWebUserTransaction;
|
||||||
import com.djrapitops.plan.utilities.PassEncryptUtil;
|
import com.djrapitops.plan.utilities.PassEncryptUtil;
|
||||||
import net.playeranalytics.plugin.scheduling.RunnableFactory;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import utilities.TestConstants;
|
import utilities.TestConstants;
|
||||||
|
import utilities.mocks.objects.TestRunnableFactory;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -78,7 +78,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
|
|||||||
userIsRegistered();
|
userIsRegistered();
|
||||||
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
|
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);
|
String cookie = cookieStore.generateNewCookie(user);
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
|
|||||||
userIsRegistered();
|
userIsRegistered();
|
||||||
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
|
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);
|
String cookie = cookieStore.generateNewCookie(user);
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ public interface WebUserQueriesTest extends DatabaseTestPreparer {
|
|||||||
userIsRegistered();
|
userIsRegistered();
|
||||||
User user = db().query(WebUserQueries.fetchUser(WEB_USERNAME)).orElseThrow(AssertionError::new);
|
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);
|
String cookie = cookieStore.generateNewCookie(user);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user