package com.kwan.springbootkwan; import com.kwan.springbootkwan.utils.SensitiveWordUtil; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest @ContextConfiguration(classes = SpringBootKwanApplication.class) public class SensitiveTest { @Autowired private SensitiveWordUtil sensitiveWordUtil; @Test public void test() { String result = sensitiveWordUtil.replace("国家 哇 nnd 复活 马化腾"); System.out.println(result); } }