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