client: fix and enable tests (#1257)
client: fix and enable tests Co-authored-by: Owain van Brakel <owain.vanbrakel@gmail.com>
This commit is contained in:
@@ -13,5 +13,5 @@ cache:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
|
||||
script: ./gradlew build -x test --rerun-tasks
|
||||
script: ./gradlew build
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ dependencies {
|
||||
compileOnly group: 'org.apache.maven.plugin-tools', name: 'maven-plugin-annotations', version: '3.6.0'
|
||||
annotationProcessor group: 'org.eclipse.sisu', name: 'org.eclipse.sisu.inject', version: '0.3.3'
|
||||
vanilla "net.runelite.rs:vanilla:${rsversion}"
|
||||
testImplementation project(path: ':deobfuscator', configuration: 'testArchives')
|
||||
}
|
||||
|
||||
compileJava {
|
||||
@@ -47,12 +48,4 @@ compileJava.doLast() {
|
||||
]
|
||||
inject.main(jarPaths)
|
||||
loader.close()
|
||||
}
|
||||
|
||||
test {
|
||||
exclude '**/*'
|
||||
}
|
||||
|
||||
compileTestJava {
|
||||
exclude '**/*'
|
||||
}
|
||||
@@ -58,6 +58,7 @@ import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import net.runelite.client.rs.ClientUpdateCheckMode;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class PluginManagerTest
|
||||
@@ -82,7 +83,7 @@ public class PluginManagerTest
|
||||
public void before() throws IOException
|
||||
{
|
||||
Injector injector = Guice.createInjector(Modules
|
||||
.override(new RuneLiteModule(() -> null, true))
|
||||
.override(new RuneLiteModule(ClientUpdateCheckMode.NONE, true))
|
||||
.with(BoundFieldModule.of(this)));
|
||||
|
||||
RuneLite.setInjector(injector);
|
||||
@@ -140,7 +141,7 @@ public class PluginManagerTest
|
||||
{
|
||||
List<Module> modules = new ArrayList<>();
|
||||
modules.add(new GraphvizModule());
|
||||
modules.add(new RuneLiteModule(() -> null, true));
|
||||
modules.add(new RuneLiteModule(ClientUpdateCheckMode.NONE, true));
|
||||
|
||||
PluginManager pluginManager = new PluginManager(true, null, null, null, null, null);
|
||||
pluginManager.loadCorePlugins();
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
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;
|
||||
@@ -82,9 +81,20 @@ public class ItemsKeptOnDeathPluginTest
|
||||
{
|
||||
// Mock Item Composition and necessary ItemManager methods for this item
|
||||
ItemDefinition c = mock(ItemDefinition.class);
|
||||
|
||||
when(c.getId())
|
||||
.thenReturn(id);
|
||||
when(c.getName())
|
||||
.thenReturn(name);
|
||||
when(c.isTradeable())
|
||||
.thenReturn(tradeable);
|
||||
when(c.getPrice())
|
||||
.thenReturn(price);
|
||||
|
||||
if (!tradeable)
|
||||
{
|
||||
when(c.getNote()).thenReturn(-1);
|
||||
when(c.getLinkedNoteId()).thenReturn(-1);
|
||||
}
|
||||
|
||||
when(itemManager.getItemDefinition(id)).thenReturn(c);
|
||||
when(itemManager.canonicalize(id)).thenReturn(id);
|
||||
|
||||
@@ -33,7 +33,6 @@ import net.runelite.client.plugins.maxhit.calculators.testconfig.MaxHitConfig;
|
||||
import net.runelite.client.plugins.maxhit.calculators.testconfig.MeleeMaxHitConfig;
|
||||
import net.runelite.client.plugins.maxhit.calculators.testconfig.RangeMaxHitConfig;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
|
||||
@@ -43,7 +43,6 @@ import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
|
||||
@@ -37,7 +37,6 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -85,7 +84,6 @@ public class ItemUtilTest
|
||||
return i;
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void toGameItemMap()
|
||||
{
|
||||
@@ -98,7 +96,6 @@ public class ItemUtilTest
|
||||
assertEquals(ALL_MAP, itemMap2);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void containsAllItemIds()
|
||||
{
|
||||
@@ -107,7 +104,6 @@ public class ItemUtilTest
|
||||
assertFalse(ItemUtil.containsAllItemIds(items, MIX_IDS));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void containsAnyItemId()
|
||||
{
|
||||
@@ -116,7 +112,6 @@ public class ItemUtilTest
|
||||
assertTrue(ItemUtil.containsAnyItemId(items, MIX_IDS));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void containsItemId()
|
||||
{
|
||||
@@ -124,7 +119,6 @@ public class ItemUtilTest
|
||||
assertFalse(ItemUtil.containsItemId(items, ItemID.TWISTED_BOW));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void containsAllGameItems()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user