mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-12-31 18:07:56 +01:00
Log into a temporary folder during tests
This commit is contained in:
parent
61ac1ec1ec
commit
ebe072858e
@ -32,6 +32,8 @@ import com.discordsrv.common.scheduler.Scheduler;
|
|||||||
import com.discordsrv.common.scheduler.StandardScheduler;
|
import com.discordsrv.common.scheduler.StandardScheduler;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
@ -41,9 +43,16 @@ public class MockDiscordSRV extends AbstractDiscordSRV<MainConfig, ConnectionCon
|
|||||||
|
|
||||||
private final Scheduler scheduler = new StandardScheduler(this);
|
private final Scheduler scheduler = new StandardScheduler(this);
|
||||||
private final Logger logger = JavaLoggerImpl.getRoot();
|
private final Logger logger = JavaLoggerImpl.getRoot();
|
||||||
|
private final Path path;
|
||||||
|
|
||||||
public MockDiscordSRV() {
|
public MockDiscordSRV() {
|
||||||
load();
|
load();
|
||||||
|
|
||||||
|
Path path = Paths.get("/tmp/discordsrv-test");
|
||||||
|
try {
|
||||||
|
path = Files.createTempDirectory("discordsrv-test");
|
||||||
|
} catch (IOException ignored) {}
|
||||||
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,7 +62,7 @@ public class MockDiscordSRV extends AbstractDiscordSRV<MainConfig, ConnectionCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Path dataDirectory() {
|
public Path dataDirectory() {
|
||||||
return Paths.get("");
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user