From 68e5ced2bd581125314b703af28bd9dc443b71fb Mon Sep 17 00:00:00 2001 From: Looly Date: Sat, 9 Oct 2021 21:57:30 +0800 Subject: [PATCH] add test --- .../cn/hutool/core/lang/StrFormatterTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hutool-core/src/test/java/cn/hutool/core/lang/StrFormatterTest.java b/hutool-core/src/test/java/cn/hutool/core/lang/StrFormatterTest.java index fd8ce5742..a2ad790c9 100644 --- a/hutool-core/src/test/java/cn/hutool/core/lang/StrFormatterTest.java +++ b/hutool-core/src/test/java/cn/hutool/core/lang/StrFormatterTest.java @@ -36,4 +36,19 @@ public class StrFormatterTest { String result3 = StrFormatter.formatWith("this is \\\\? for ?", "?", "a", "b"); Assert.assertEquals("this is \\a for b", result3); } + + @Test + public void formatWithTest2() { + //通常使用 + String result1 = StrFormatter.formatWith("this is $$$ for $$$", "$$$", "a", "b"); + Assert.assertEquals("this is a for b", result1); + + //转义? + String result2 = StrFormatter.formatWith("this is \\$$$ for $$$", "$$$", "a", "b"); + Assert.assertEquals("this is $$$ for a", result2); + + //转义\ + String result3 = StrFormatter.formatWith("this is \\\\$$$ for $$$", "$$$", "a", "b"); + Assert.assertEquals("this is \\a for b", result3); + } }