chatfilterplugin: Fix tests
This commit is contained in:
@@ -36,10 +36,10 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
@@ -121,12 +121,11 @@ public class ChatFilterPluginTest
|
||||
assertNull(chatFilterPlugin.censorMessage("te\u008Cst"));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testReplayedMessage()
|
||||
{
|
||||
when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE);
|
||||
when(chatFilterConfig.filteredWords()).thenReturn("hello osrs");
|
||||
chatFilterPlugin.setFilterType(ChatFilterType.REMOVE_MESSAGE);
|
||||
chatFilterPlugin.setFilteredWords("hello osrs");
|
||||
|
||||
chatFilterPlugin.updateFilteredPatterns();
|
||||
assertNull(chatFilterPlugin.censorMessage("hello\u00A0osrs"));
|
||||
@@ -147,11 +146,10 @@ public class ChatFilterPluginTest
|
||||
assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal"));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testMessageFromClanIsFiltered()
|
||||
{
|
||||
when(client.isClanMember("B0aty")).thenReturn(true);
|
||||
lenient().when(client.isClanMember("B0aty")).thenReturn(true);
|
||||
chatFilterPlugin.setFilterClan(true);
|
||||
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("B0aty"));
|
||||
}
|
||||
@@ -159,7 +157,7 @@ public class ChatFilterPluginTest
|
||||
@Test
|
||||
public void testMessageFromClanIsNotFiltered()
|
||||
{
|
||||
when(client.isClanMember("B0aty")).thenReturn(true);
|
||||
lenient().when(client.isClanMember("B0aty")).thenReturn(true);
|
||||
chatFilterPlugin.setFilterClan(false);
|
||||
assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("B0aty"));
|
||||
}
|
||||
@@ -167,15 +165,15 @@ public class ChatFilterPluginTest
|
||||
@Test
|
||||
public void testMessageFromSelfIsNotFiltered()
|
||||
{
|
||||
when(localPlayer.getName()).thenReturn("Swampletics");
|
||||
lenient().when(localPlayer.getName()).thenReturn("Swampletics");
|
||||
assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("Swampletics"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageFromNonFriendNonClanIsFiltered()
|
||||
{
|
||||
when(client.isFriended("Woox", false)).thenReturn(false);
|
||||
when(client.isClanMember("Woox")).thenReturn(false);
|
||||
lenient().when(client.isFriended("Woox", false)).thenReturn(false);
|
||||
lenient().when(client.isClanMember("Woox")).thenReturn(false);
|
||||
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Woox"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user