diff --git a/src/test/java/com/github/houbb/sensitive/word/bugs/b32/MyWordDenyChineseNum.java b/src/test/java/com/github/houbb/sensitive/word/bugs/b32/MyWordDenyChineseNum.java new file mode 100644 index 0000000..4097909 --- /dev/null +++ b/src/test/java/com/github/houbb/sensitive/word/bugs/b32/MyWordDenyChineseNum.java @@ -0,0 +1,15 @@ +package com.github.houbb.sensitive.word.bugs.b32; + +import com.github.houbb.sensitive.word.api.IWordDeny; + +import java.util.Arrays; +import java.util.List; + +public class MyWordDenyChineseNum implements IWordDeny { + + @Override + public List deny() { + return Arrays.asList("三三九乘元功", "一军两策"); + } + +} diff --git a/src/test/java/com/github/houbb/sensitive/word/bugs/b32/MyWordDenyChineseTest.java b/src/test/java/com/github/houbb/sensitive/word/bugs/b32/MyWordDenyChineseTest.java new file mode 100644 index 0000000..282b4da --- /dev/null +++ b/src/test/java/com/github/houbb/sensitive/word/bugs/b32/MyWordDenyChineseTest.java @@ -0,0 +1,26 @@ +package com.github.houbb.sensitive.word.bugs.b32; + +import com.github.houbb.sensitive.word.api.IWordDeny; +import com.github.houbb.sensitive.word.bs.SensitiveWordBs; +import com.github.houbb.sensitive.word.support.deny.WordDenys; +import org.junit.Assert; +import org.junit.Test; + +public class MyWordDenyChineseTest { + + @Test + public void test() { + IWordDeny wordDeny = WordDenys.chains(WordDenys.system(), new MyWordDenyChineseNum()); + SensitiveWordBs sensitiveWordBs = SensitiveWordBs.newInstance() + .wordDeny(wordDeny)// 各种其他配置 + .init();// init() 初始化敏感词字典 + + final String text = "和我练习三三九乘元功、一军两策"; + + //输出测试结果 + Assert.assertEquals("[三三九乘元功, 一军两策]", sensitiveWordBs.findAll(text).toString()); + Assert.assertTrue(sensitiveWordBs.contains("三三九乘元功")); + Assert.assertTrue(sensitiveWordBs.contains("一军两策")); + } + +}