Disable tests

This commit is contained in:
Johannes Frohnmeyer 2022-07-28 17:05:35 +02:00
parent 5fd4fdad94
commit c4c1d7f1bb
Signed by: Johannes
GPG Key ID: E76429612C2929F4
7 changed files with 29 additions and 36 deletions

View File

@ -39,6 +39,7 @@ dependencies {
// clientRuntimeOnly("dev.quantumfusion.dashloader:dashloader-definitions:3.0-rc14-1.18")
}
test {
useJUnitPlatform()
}
//TODO re-enable once minecraft classes can be used in tests again
//test {
// useJUnitPlatform()
//}

View File

@ -1,5 +1,6 @@
package io.gitlab.jfronny.respackopts;
import io.gitlab.jfronny.commons.log.Logger;
import io.gitlab.jfronny.gson.Gson;
import io.gitlab.jfronny.gson.GsonBuilder;
import io.gitlab.jfronny.muscript.compiler.expr.*;
@ -15,8 +16,6 @@ import io.gitlab.jfronny.respackopts.server.ServerInstanceHolder;
import net.fabricmc.api.*;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Files;
@ -29,7 +28,7 @@ public class Respackopts implements ModInitializer, SaveHook {
public static final Gson GSON;
public static final String ID = "respackopts";
public static final Logger LOGGER = LoggerFactory.getLogger(ID);
public static final Logger LOGGER = Logger.forName(ID);
public static final Identifier CONF_ID = new Identifier(ID, "conf.json");
public static Path FALLBACK_CONF_DIR;

View File

@ -1,34 +1,25 @@
package io.gitlab.jfronny.respackopts;
package io.gitlab.jfronny.respackopts.test;
import io.gitlab.jfronny.gson.reflect.*;
import io.gitlab.jfronny.muscript.*;
import io.gitlab.jfronny.muscript.compiler.expr.*;
import io.gitlab.jfronny.respackopts.gson.*;
import io.gitlab.jfronny.respackopts.model.*;
import io.gitlab.jfronny.respackopts.util.*;
import org.junit.jupiter.api.*;
import io.gitlab.jfronny.gson.reflect.TypeToken;
import io.gitlab.jfronny.muscript.ExpressionParameter;
import io.gitlab.jfronny.muscript.compiler.expr.BoolExpr;
import io.gitlab.jfronny.respackopts.gson.AttachmentHolder;
import io.gitlab.jfronny.respackopts.util.MuUtils;
import org.junit.jupiter.api.Test;
import java.nio.file.*;
import java.util.*;
import java.util.List;
import java.util.Set;
import static io.gitlab.jfronny.respackopts.Respackopts.*;
import static io.gitlab.jfronny.respackopts.Respackopts.GSON;
import static org.junit.jupiter.api.Assertions.*;
class ConditionJsonSerializationTest {
@BeforeAll
static void initialize() {
Respackopts.LOGGER.info("Expected error end");
Respackopts.FALLBACK_CONF_DIR = Paths.get("./test");
Respackopts.CONFIG = new ConfigFile();
SAVE_ACTIONS.add(() -> Respackopts.LOGGER.info("Save"));
Respackopts.LOGGER.info(Respackopts.FALLBACK_CONF_DIR.toString());
}
@Test
void gsonListOrder() {
String[] expected = new String[] {"one", "two", "three", "zero", "76"};
String gson = "[\"one\", \"two\", \"three\", \"zero\", \"76\"]";
List<String> parsed = Respackopts.GSON.fromJson(gson, new TypeToken<List<String>>(){}.getType());
List<String> parsed = TestArgs.GSON.fromJson(gson, new TypeToken<List<String>>(){}.getType());
int i = 0;
for (String s : parsed) {
assertEquals(s, expected[i++]);
@ -39,7 +30,7 @@ class ConditionJsonSerializationTest {
void gsonSetOrder() {
String[] expected = new String[] {"one", "two", "three", "zero", "76"};
String gson = "[\"one\", \"two\", \"three\", \"zero\", \"76\"]";
Set<String> parsed = Respackopts.GSON.fromJson(gson, new TypeToken<Set<String>>(){}.getType());
Set<String> parsed = TestArgs.GSON.fromJson(gson, new TypeToken<Set<String>>(){}.getType());
int i = 0;
for (String s : parsed) {
assertEquals(s, expected[i++]);
@ -49,7 +40,7 @@ class ConditionJsonSerializationTest {
@Test
void gsonSingleEntryList() {
String gson = "\"someText\"";
List<String> parsed = Respackopts.GSON.fromJson(gson, new TypeToken<List<String>>(){}.getType());
List<String> parsed = TestArgs.GSON.fromJson(gson, new TypeToken<List<String>>(){}.getType());
assertEquals(parsed.size(), 1);
for (String s : parsed) {
assertEquals(s, "someText");
@ -59,7 +50,7 @@ class ConditionJsonSerializationTest {
@Test
void gsonSingleEntrySet() {
String gson = "\"someText\"";
Set<String> parsed = Respackopts.GSON.fromJson(gson, new TypeToken<Set<String>>(){}.getType());
Set<String> parsed = TestArgs.GSON.fromJson(gson, new TypeToken<Set<String>>(){}.getType());
assertEquals(parsed.size(), 1);
for (String s : parsed) {
assertEquals(s, "someText");

View File

@ -1,4 +1,4 @@
package io.gitlab.jfronny.respackopts;
package io.gitlab.jfronny.respackopts.test;
//import io.gitlab.jfronny.respackopts.model.ConfigFile;
import io.gitlab.jfronny.respackopts.model.tree.*;

View File

@ -1,4 +1,4 @@
package io.gitlab.jfronny.respackopts;
package io.gitlab.jfronny.respackopts.test;
import io.gitlab.jfronny.respackopts.model.tree.ConfigBranch;
import io.gitlab.jfronny.respackopts.model.tree.ConfigEntry;
@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test;
import java.util.Map;
import static io.gitlab.jfronny.respackopts.TemplateTree.getBranch;
import static io.gitlab.jfronny.respackopts.test.TestArgs.getBranch;
import static org.junit.jupiter.api.Assertions.*;
public class CopyTest {

View File

@ -1,4 +1,4 @@
package io.gitlab.jfronny.respackopts;
package io.gitlab.jfronny.respackopts.test;
import io.gitlab.jfronny.muscript.*;
import io.gitlab.jfronny.muscript.compiler.*;

View File

@ -1,13 +1,14 @@
package io.gitlab.jfronny.respackopts;
package io.gitlab.jfronny.respackopts.test;
import io.gitlab.jfronny.gson.*;
import io.gitlab.jfronny.muscript.compiler.expr.*;
import io.gitlab.jfronny.respackopts.gson.*;
import io.gitlab.jfronny.respackopts.gson.entry.*;
import io.gitlab.jfronny.respackopts.model.Condition;
import io.gitlab.jfronny.respackopts.model.tree.*;
public class TemplateTree {
private static final Gson GSON = new GsonBuilder()
public class TestArgs {
public static final Gson GSON = new GsonBuilder()
.registerTypeAdapter(ConfigEnumEntry.class, new EnumEntrySerializer())
.registerTypeAdapter(ConfigNumericEntry.class, new NumericEntrySerializer())
.registerTypeAdapter(ConfigBooleanEntry.class, new BooleanEntrySerializer())
@ -15,6 +16,7 @@ public class TemplateTree {
.registerTypeAdapter(Expr.class, new ExprDeserializer())
.registerTypeAdapter(StringExpr.class, new StringExprDeserializer())
.registerTypeAdapter(BoolExpr.class, new BoolExprDeserializer())
.registerTypeAdapter(Condition.class, new ConditionDeserializer())
.setLenient()
.setPrettyPrinting()
.create();