MsgUtil unit test

This commit is contained in:
Ghost_chu committed 2021-06-16 18:41:08 +08:00
1 parent add9ba29c7
commit a97fdf3815
1 file changed
+20
@@ -21,6 +21,7 @@ package org.maxgamer.quickshop.util;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
public class MsgUtilTest {
@@ -34,4 +35,23 @@ public class MsgUtilTest {
}
}
@Test
public void fillArgs() {
String sample = "I like apple and orange";
Assertions.assertEquals(sample, MsgUtil.fillArgs("I like {0} and {1}", "apple", "orange"));
}
@Test
public void getSubString() {
String sample = "cra";
Assertions.assertEquals(sample, MsgUtil.getSubString("Minecraft", "Mine", "ft"));
}
@Test
public void isJson() {
Assertions.assertTrue(MsgUtil.isJson("{}"));
Assertions.assertTrue(MsgUtil.isJson("[]"));
Assertions.assertFalse(MsgUtil.isJson("{]"));
}
}