### Question:
ChatManager { public String filterWord(String userWord) { if ( StringUtil.checkNotEmpty(userWord) ) { String lower = userWord.toLowerCase(); Matcher matcher = wordPattern.matcher(lower); lower = matcher.replaceAll("*"); return lower; } return userWord; } ChatManager(); static final ChatManager getInstance(); void reload(); final void importWord(String wordFileName, TreeSet<String> wordSet); Set<String> getFilteredWord(); String getFilteredWordRegex(TreeSet<String> wordSet); String filterWord(String userWord); boolean hasFilterWord(Pattern pattern, String userWord); boolean containBadWord(String userWord); final boolean processChatAsyn(User user, BceChat chat); final boolean processVoiceChatAsyn(User user, BceVoiceChat chat); final void processChatToWorldAsyn(User user, String content); final void sendSysChat(User toUser, String content); final void sendPrivateSysChat(SessionKey userSessionKey, String content); final void processChat(User user, BceChat chat, Room room); final void processVoiceChat(User user, BceVoiceChat chat, Room room); final byte[] storeVoiceContent(byte[] content); final byte[] retrieveVoiceContent(String voiceKey); void sendPrivateChat(User user, String toUserId, String content, ChatType chatType);  }### Answer:
@Test public void testFilterWord() { ChatManager manager = ChatManager.getInstance(); String userWord = "我操共产党"; boolean result = manager.containBadWord(userWord); assertTrue(result); String newWord = manager.filterWord(userWord); assertEquals("**", newWord); userWord = "正常的词语"; result = manager.containBadWord(userWord); assertFalse(result); newWord = manager.filterWord(userWord); assertEquals("正常的词语", newWord); }