From ba5de5a8a83b6dd570d0f751daca3d66b0924479 Mon Sep 17 00:00:00 2001 From: ericek111 Date: Fri, 25 Sep 2026 10:27:11 +0000 Subject: [PATCH] Give the importer test a fresh profile every run The test home under target/ outlives a run, so the identity the first run imported made every later run fail. The test now points AppDirs at a temporary directory of its own, which also works when another test resolved the profile first. Co-Authored-By: Claude Opus 5.5 --- .../teamspeak/TeamSpeakImporterTest.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/ts3-client/core/src/test/java/com/ts3client/teamspeak/TeamSpeakImporterTest.java b/ts3-client/core/src/test/java/com/ts3client/teamspeak/TeamSpeakImporterTest.java index 7accf71..2629499 100644 --- a/ts3-client/core/src/test/java/com/ts3client/teamspeak/TeamSpeakImporterTest.java +++ b/ts3-client/core/src/test/java/com/ts3client/teamspeak/TeamSpeakImporterTest.java @@ -1,15 +1,17 @@ package com.ts3client.teamspeak; +import com.ts3client.config.AppDirs; import com.ts3client.config.Bookmark; import com.ts3client.config.Bookmarks; import com.ts3client.config.IdentityEntry; import com.ts3client.config.IdentityStore; import com.ts3client.config.Settings; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; -import java.io.File; -import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -18,10 +20,15 @@ import static org.junit.jupiter.api.Assertions.assertTrue; class TeamSpeakImporterTest { - /** The stores resolve {@code ~/.ts3jclient} once, so point them at scratch space before they load. */ - @BeforeAll - static void isolateHome() throws Exception { - System.setProperty("user.home", Files.createTempDirectory("ts3j-import").toString()); + /** Each test starts from an empty profile; the shared test home keeps identities from earlier runs. */ + @BeforeEach + void freshProfile(@TempDir Path dir) { + AppDirs.init(dir.resolve("profile").toFile(), dir.resolve("chats")); + } + + @AfterEach + void defaultProfile() { + AppDirs.init(null, null); } @Test