Use assertEqualsSNBT

This commit is contained in:
themode 2022-03-24 06:52:37 +01:00
parent b5367ee96a
commit d2e3055225
2 changed files with 15 additions and 16 deletions

View File

@ -4,7 +4,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static net.minestom.server.api.TestUtils.assertEqualsIgnoreSpace; import static net.minestom.server.api.TestUtils.assertEqualsSNBT;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
public class TagStructureTest { public class TagStructureTest {
@ -71,16 +71,16 @@ public class TagStructureTest {
var handler = TagHandler.newHandler(); var handler = TagHandler.newHandler();
var entry = new Entry("hello"); var entry = new Entry("hello");
handler.setTag(STRUCTURE_TAG, entry); handler.setTag(STRUCTURE_TAG, entry);
assertEqualsIgnoreSpace(""" assertEqualsSNBT("""
{ {
"entry": { "entry": {
"value": "hello" "value":"hello"
} }
} }
""", handler.asCompound().toSNBT()); """, handler.asCompound());
handler.removeTag(STRUCTURE_TAG); handler.removeTag(STRUCTURE_TAG);
assertEqualsIgnoreSpace("{}", handler.asCompound().toSNBT()); assertEqualsSNBT("{}", handler.asCompound());
} }
@Test @Test
@ -117,24 +117,24 @@ public class TagStructureTest {
// Add first entry // Add first entry
{ {
handler.setTag(STRUCTURE_TAG, entry1); handler.setTag(STRUCTURE_TAG, entry1);
assertEqualsIgnoreSpace(""" assertEqualsSNBT("""
{ {
"entry": { "entry": {
"value": "hello" "value":"hello"
} }
} }
""", handler.asCompound().toSNBT()); """, handler.asCompound());
} }
// Add second entry // Add second entry
{ {
handler.setTag(STRUCTURE_TAG2, entry2); handler.setTag(STRUCTURE_TAG2, entry2);
assertEqualsIgnoreSpace(""" assertEqualsSNBT("""
{ {
"entry": { "entry": {
"value2": "hello2" "value2": "hello2"
} }
} }
""", handler.asCompound().toSNBT()); """, handler.asCompound());
} }
} }
} }

View File

@ -4,9 +4,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static net.minestom.server.api.TestUtils.assertEqualsIgnoreSpace; import static net.minestom.server.api.TestUtils.assertEqualsSNBT;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertNull;
public class TagViewTest { public class TagViewTest {
@ -53,14 +52,14 @@ public class TagViewTest {
var handler = TagHandler.newHandler(); var handler = TagHandler.newHandler();
var entry = new Entry("hello"); var entry = new Entry("hello");
handler.setTag(VIEW_TAG, entry); handler.setTag(VIEW_TAG, entry);
assertEqualsIgnoreSpace(""" assertEqualsSNBT("""
{ {
"value": "hello" "value":"hello"
} }
""", handler.asCompound().toSNBT()); """, handler.asCompound());
handler.removeTag(VIEW_TAG); handler.removeTag(VIEW_TAG);
assertEqualsIgnoreSpace("{}", handler.asCompound().toSNBT()); assertEqualsSNBT("{}", handler.asCompound());
} }
} }