[Test] Fixed NetworkSettingsTest

This commit is contained in:
Rsl1122 2018-10-13 13:35:42 +03:00
parent e6396f816f
commit 40c6b09801
2 changed files with 19 additions and 30 deletions

View File

@ -1,53 +1,43 @@
package com.djrapitops.plan.system.settings.network;
import com.djrapitops.plan.DaggerPlanBungeeComponent;
import com.djrapitops.plan.PlanBungeeComponent;
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
import com.djrapitops.plan.system.database.databases.sql.tables.ServerTable;
import com.djrapitops.plan.system.info.server.Server;
import org.junit.*;
import com.djrapitops.plan.DaggerPlanBukkitComponent;
import com.djrapitops.plan.PlanBukkitComponent;
import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.system.PlanSystem;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import utilities.TestConstants;
import utilities.mocks.PlanBungeeMocker;
import static org.junit.Assert.assertEquals;
import utilities.mocks.PlanBukkitMocker;
public class NetworkSettingsTest {
@ClassRule
public static TemporaryFolder temporaryFolder = new TemporaryFolder();
private static SQLDB db;
private static PlanBungeeComponent COMPONENT;
private static PlanBukkitComponent COMPONENT;
@BeforeClass
public static void setUpClass() throws Exception {
PlanBungeeMocker planBungeeMocker = PlanBungeeMocker.setUp()
PlanBukkitMocker mocker = PlanBukkitMocker.setUp()
.withDataFolder(temporaryFolder.getRoot())
.withPluginDescription()
.withResourceFetchingFromJar()
.withProxy();
COMPONENT = DaggerPlanBungeeComponent.builder().plan(planBungeeMocker.getPlanMock()).build();
.withServer();
COMPONENT = DaggerPlanBukkitComponent.builder().plan(mocker.getPlanMock()).build();
}
@AfterClass
public static void tearDownClass() {
if (db != null) {
db.close();
}
}
@Before
public void setUp() {
db.remove().everything();
ServerTable serverTable = db.getServerTable();
serverTable.saveCurrentServerInfo(new Server(-1, TestConstants.SERVER_UUID, "ServerName", "", 20));
assertEquals(db.getServerUUIDSupplier().get(), TestConstants.SERVER_UUID);
COMPONENT.system().disable();
}
@Test
@Ignore
public void testTransfer() {
NetworkSettings networkSettings = null; // TODO new NetworkSettings();
public void transferDoesNotProduceException() throws EnableException {
PlanSystem system = COMPONENT.system();
system.enable();
NetworkSettings networkSettings = system.getConfigSystem().getConfig().getNetworkSettings();
networkSettings.placeToDatabase();
networkSettings.loadFromDatabase();
}

View File

@ -42,7 +42,6 @@ public class SystemMockUtil {
private SystemMockUtil initializeBukkitSystem(File dataFolder) throws Exception {
Plan planMock = PlanBukkitMocker.setUp()
.withDataFolder(dataFolder)
.withLogging()
.withResourceFetchingFromJar()
.withPluginDescription()
.withServer()