mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-25 02:27:43 +01:00
Moved to using JUnit 5.4 TempDir instead of junitpioneer
This commit is contained in:
parent
039696910c
commit
33eec6d990
@ -107,7 +107,6 @@ subprojects {
|
||||
testCompile "org.junit.platform:junit-platform-runner:1.4.0" // JUnit 4 runner for JUnit 5 tests
|
||||
testCompile "org.junit.vintage:junit-vintage-engine:5.4.0" // JUnit 4 compatibility for JUnit 5
|
||||
testCompile "org.junit.jupiter:junit-jupiter-params:5.4.0" // JUnit 5, parameterized tests
|
||||
testCompile "org.junit-pioneer:junit-pioneer:0.3.0" // TempDirectory TODO REMOVE W/ JUNIT 5.4
|
||||
testCompile "org.mockito:mockito-core:2.24.0" // Mockito Core
|
||||
testCompile "org.mockito:mockito-junit-jupiter:2.24.0" // Mockito JUnit 5 Extension
|
||||
testCompile "org.seleniumhq.selenium:selenium-java:3.141.59" // Selenium (Browser tests)
|
||||
|
@ -21,9 +21,9 @@ import com.djrapitops.plan.system.settings.config.ConfigReader;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.platform.runner.JUnitPlatform;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import java.nio.file.Path;
|
||||
@ -33,7 +33,6 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@RunWith(JUnitPlatform.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class ConfigChangeTest {
|
||||
|
||||
private Path temporaryFolder;
|
||||
@ -41,7 +40,7 @@ class ConfigChangeTest {
|
||||
private Config config;
|
||||
|
||||
@BeforeEach
|
||||
void prepareTemporaryFolder(@TempDirectory.TempDir Path temporaryFolder) {
|
||||
void prepareTemporaryFolder(@TempDir Path temporaryFolder) {
|
||||
this.temporaryFolder = temporaryFolder;
|
||||
}
|
||||
|
||||
|
@ -25,10 +25,9 @@ import com.djrapitops.plugin.logging.console.TestPluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ConsoleErrorLogger;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.platform.runner.JUnitPlatform;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import utilities.TestResources;
|
||||
|
||||
import java.io.File;
|
||||
@ -47,10 +46,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@RunWith(JUnitPlatform.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class ConfigUpdaterTest {
|
||||
|
||||
private static Path tempDir;
|
||||
@TempDir
|
||||
public static Path tempDir;
|
||||
|
||||
private static File oldConfig;
|
||||
private static File oldBungeeConfig;
|
||||
@ -61,9 +60,7 @@ class ConfigUpdaterTest {
|
||||
private static ConfigUpdater UNDER_TEST;
|
||||
|
||||
@BeforeAll
|
||||
static void prepareConfigFiles(@TempDirectory.TempDir Path temporaryDir) throws URISyntaxException, IOException {
|
||||
tempDir = temporaryDir;
|
||||
|
||||
static void prepareConfigFiles() throws URISyntaxException, IOException {
|
||||
oldConfig = tempDir.resolve("config.yml").toFile();
|
||||
File configResource = TestResources.getTestResourceFile("config/4.5.2-config.yml", ConfigUpdater.class);
|
||||
Files.copy(configResource.toPath(), oldConfig.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
|
@ -19,10 +19,9 @@ package com.djrapitops.plan.system.settings.config;
|
||||
import com.djrapitops.plan.utilities.file.FileUtil;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.platform.runner.JUnitPlatform;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
import utilities.TestResources;
|
||||
|
||||
import java.io.File;
|
||||
@ -41,13 +40,12 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@RunWith(JUnitPlatform.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class ConfigWriterTest {
|
||||
|
||||
private Path tempFolder;
|
||||
|
||||
@BeforeEach
|
||||
void prepareTempFolder(@TempDirectory.TempDir Path tempFolder) {
|
||||
void prepareTempFolder(@TempDir Path tempFolder) {
|
||||
this.tempFolder = tempFolder;
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,9 @@ package com.djrapitops.plan.utilities.file;
|
||||
import com.jayway.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.platform.runner.JUnitPlatform;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junitpioneer.jupiter.TempDirectory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -34,13 +33,12 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@RunWith(JUnitPlatform.class)
|
||||
@ExtendWith(TempDirectory.class)
|
||||
class FileWatcherTest {
|
||||
|
||||
private Path temporaryDir;
|
||||
|
||||
@BeforeEach
|
||||
void setUpTemporaryDir(@TempDirectory.TempDir Path dir) {
|
||||
void setUpTemporaryDir(@TempDir Path dir) {
|
||||
temporaryDir = dir;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user