diff --git a/pom.xml b/pom.xml index 44adca431..bf8fbfddd 100755 --- a/pom.xml +++ b/pom.xml @@ -219,27 +219,27 @@ net.kyori adventure-text-serializer-gson - 4.5.1 + 4.7.0 net.kyori adventure-api - 4.5.1 + 4.7.0 net.kyori adventure-nbt - 4.5.1 + 4.7.0 net.kyori adventure-key - 4.5.1 + 4.7.0 net.kyori adventure-text-serializer-gson-legacy-impl - 4.5.1 + 4.7.0 net.kyori diff --git a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java index b8d71500e..1d3c001d5 100644 --- a/src/main/java/com/gmail/nossr50/util/text/TextUtils.java +++ b/src/main/java/com/gmail/nossr50/util/text/TextUtils.java @@ -16,9 +16,12 @@ import org.jetbrains.annotations.Nullable; import java.util.List; public class TextUtils { - private static @Nullable LegacyComponentSerializer customLegacySerializer; + private TextUtils() { + // We don't want any instances of this class. + } + /** * Makes a single component from an array of components, can optionally add prefixes and suffixes to come before and after each component * @param componentsArray target array diff --git a/src/test/java/com/gmail/nossr50/util/text/TextUtilsTest.java b/src/test/java/com/gmail/nossr50/util/text/TextUtilsTest.java new file mode 100644 index 000000000..d46673168 --- /dev/null +++ b/src/test/java/com/gmail/nossr50/util/text/TextUtilsTest.java @@ -0,0 +1,33 @@ +package com.gmail.nossr50.util.text; + +import org.junit.Assert; +import org.junit.Test; + +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.format.NamedTextColor; + +/** + * This Unit Test checks if Adventure was set up correctly and works as expected. + * Normally we can rely on this to be the case. However sometimes our dependencies + * lack so far behind that things stop working correctly. + * This test ensures that basic functionality is guaranteed to work as we would expect. + * + * See https://github.com/mcMMO-Dev/mcMMO/pull/4446 + * + */ +public class TextUtilsTest { + + @Test + public void testColorizeText() { + String inputText = "&4This text should be red."; + + /* + * If this method raises an exception, we know Adventure is not set up correctly. + * This will also make the test fail and warn us about it. + */ + TextComponent component = TextUtils.colorizeText(inputText); + + Assert.assertEquals("Looks like Adventure is not working correctly.", + NamedTextColor.DARK_RED, component.color()); + } +}