chat notifier: fix matching messages with included punctuation
The punctuation is not in \b or \s, so additionally include \z. Also added \A for the beginning, which would have the same problem, which the test also tests for. Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
@@ -113,6 +113,25 @@ public class ChatNotificationsPluginTest
|
||||
verify(messageNode).setValue("test <colHIGHLIGHT><lt>test<gt><colNORMAL> test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMatchEntireMessage()
|
||||
{
|
||||
when(config.highlightWordsString()).thenReturn(".Your divine potion effect is about to expire.");
|
||||
|
||||
String message = ".Your divine potion effect is about to expire.";
|
||||
MessageNode messageNode = mock(MessageNode.class);
|
||||
when(messageNode.getValue()).thenReturn(message);
|
||||
|
||||
ChatMessage chatMessage = new ChatMessage();
|
||||
chatMessage.setType(ChatMessageType.PUBLICCHAT);
|
||||
chatMessage.setMessageNode(messageNode);
|
||||
|
||||
chatNotificationsPlugin.startUp(); // load highlight config
|
||||
chatNotificationsPlugin.onChatMessage(chatMessage);
|
||||
|
||||
verify(messageNode).setValue("<colHIGHLIGHT>.Your divine potion effect is about to expire.<colNORMAL>");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFullStop()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user