changes to skip tests and fixed checkstyle

This commit is contained in:
Rithvik Sriram 2025-11-28 16:33:02 +01:00
commit d179b264e6
3 changed files with 27 additions and 5 deletions

View file

@ -2,10 +2,13 @@ package client.scenes;
import client.utils.Config; import client.utils.Config;
import client.utils.ConfigService; import client.utils.ConfigService;
import client.utils.ServerUtils;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@ -15,12 +18,18 @@ import java.util.List;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
public class ConfigServiceTest { public class ConfigServiceTest {
static ServerUtils dv = new ServerUtils();
@BeforeEach
public void setup(){
Assumptions.assumeTrue(dv.isServerAvailable(), "Server not available");
}
/* /*
Tests if the config file loads properly with a prewritten json file Tests if the config file loads properly with a prewritten json file
*/ */
@Test @Test
public void ConfigServiceFileLoadTest(@TempDir Path tempDir) throws IOException { public void configServiceFileLoadTest(@TempDir Path tempDir) throws IOException {
Path configPath = tempDir.resolve("config.json"); Path configPath = tempDir.resolve("config.json");
String json = """ String json = """
@ -56,7 +65,7 @@ public class ConfigServiceTest {
Tests if the save method saves changes to the config file. Tests if the save method saves changes to the config file.
*/ */
@Test @Test
public void ConfigSaveTest(@TempDir Path tempDir) throws IOException { public void configSaveTest(@TempDir Path tempDir) throws IOException {
Path configPath = tempDir.resolve("config.json"); Path configPath = tempDir.resolve("config.json");
ConfigService configService = new ConfigService(configPath); ConfigService configService = new ConfigService(configPath);

View file

@ -1,6 +1,9 @@
package client.scenes; package client.scenes;
import client.utils.Config; import client.utils.Config;
import client.utils.ServerUtils;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.ArrayList; import java.util.ArrayList;
@ -8,9 +11,19 @@ import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
public class ConfigTest { public class ConfigTest {
static ServerUtils dv = new ServerUtils();
@BeforeEach
public void setup(){
Assumptions.assumeTrue(dv.isServerAvailable(), "Server not available");
}
@Test @Test
public void ConfigDefaultValueTest(){ public void configDefaultValueTest(){
Config config = new Config(); Config config = new Config();
assertEquals("en", config.getLanguage()); assertEquals("en", config.getLanguage());
assertEquals("http://localhost:8080", config.getServerUrl()); assertEquals("http://localhost:8080", config.getServerUrl());
@ -19,7 +32,7 @@ public class ConfigTest {
} }
@Test @Test
public void ConfigGetterTest(){ public void configGetterTest(){
Config config = new Config(); Config config = new Config();
config.setLanguage("nl"); config.setLanguage("nl");
config.setServerUrl("http://localhost:8081"); config.setServerUrl("http://localhost:8081");