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/caches/
|
||||||
- $HOME/.gradle/wrapper/
|
- $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'
|
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'
|
annotationProcessor group: 'org.eclipse.sisu', name: 'org.eclipse.sisu.inject', version: '0.3.3'
|
||||||
vanilla "net.runelite.rs:vanilla:${rsversion}"
|
vanilla "net.runelite.rs:vanilla:${rsversion}"
|
||||||
|
testImplementation project(path: ':deobfuscator', configuration: 'testArchives')
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
@@ -47,12 +48,4 @@ compileJava.doLast() {
|
|||||||
]
|
]
|
||||||
inject.main(jarPaths)
|
inject.main(jarPaths)
|
||||||
loader.close()
|
loader.close()
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
exclude '**/*'
|
|
||||||
}
|
|
||||||
|
|
||||||
compileTestJava {
|
|
||||||
exclude '**/*'
|
|
||||||
}
|
}
|
||||||
@@ -58,6 +58,7 @@ import org.junit.rules.TemporaryFolder;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
|
import net.runelite.client.rs.ClientUpdateCheckMode;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class PluginManagerTest
|
public class PluginManagerTest
|
||||||
@@ -82,7 +83,7 @@ public class PluginManagerTest
|
|||||||
public void before() throws IOException
|
public void before() throws IOException
|
||||||
{
|
{
|
||||||
Injector injector = Guice.createInjector(Modules
|
Injector injector = Guice.createInjector(Modules
|
||||||
.override(new RuneLiteModule(() -> null, true))
|
.override(new RuneLiteModule(ClientUpdateCheckMode.NONE, true))
|
||||||
.with(BoundFieldModule.of(this)));
|
.with(BoundFieldModule.of(this)));
|
||||||
|
|
||||||
RuneLite.setInjector(injector);
|
RuneLite.setInjector(injector);
|
||||||
@@ -140,7 +141,7 @@ public class PluginManagerTest
|
|||||||
{
|
{
|
||||||
List<Module> modules = new ArrayList<>();
|
List<Module> modules = new ArrayList<>();
|
||||||
modules.add(new GraphvizModule());
|
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 pluginManager = new PluginManager(true, null, null, null, null, null);
|
||||||
pluginManager.loadCorePlugins();
|
pluginManager.loadCorePlugins();
|
||||||
|
|||||||
@@ -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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,6 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
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;
|
||||||
@@ -82,9 +81,20 @@ public class ItemsKeptOnDeathPluginTest
|
|||||||
{
|
{
|
||||||
// Mock Item Composition and necessary ItemManager methods for this item
|
// Mock Item Composition and necessary ItemManager methods for this item
|
||||||
ItemDefinition c = mock(ItemDefinition.class);
|
ItemDefinition c = mock(ItemDefinition.class);
|
||||||
|
when(c.getId())
|
||||||
|
.thenReturn(id);
|
||||||
when(c.getName())
|
when(c.getName())
|
||||||
.thenReturn(name);
|
.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.getItemDefinition(id)).thenReturn(c);
|
||||||
when(itemManager.canonicalize(id)).thenReturn(id);
|
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.MeleeMaxHitConfig;
|
||||||
import net.runelite.client.plugins.maxhit.calculators.testconfig.RangeMaxHitConfig;
|
import net.runelite.client.plugins.maxhit.calculators.testconfig.RangeMaxHitConfig;
|
||||||
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;
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import net.runelite.client.Notifier;
|
|||||||
import net.runelite.client.config.ChatColorConfig;
|
import net.runelite.client.config.ChatColorConfig;
|
||||||
import net.runelite.client.config.RuneLiteConfig;
|
import net.runelite.client.config.RuneLiteConfig;
|
||||||
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;
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -85,7 +84,6 @@ public class ItemUtilTest
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void toGameItemMap()
|
public void toGameItemMap()
|
||||||
{
|
{
|
||||||
@@ -98,7 +96,6 @@ public class ItemUtilTest
|
|||||||
assertEquals(ALL_MAP, itemMap2);
|
assertEquals(ALL_MAP, itemMap2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void containsAllItemIds()
|
public void containsAllItemIds()
|
||||||
{
|
{
|
||||||
@@ -107,7 +104,6 @@ public class ItemUtilTest
|
|||||||
assertFalse(ItemUtil.containsAllItemIds(items, MIX_IDS));
|
assertFalse(ItemUtil.containsAllItemIds(items, MIX_IDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void containsAnyItemId()
|
public void containsAnyItemId()
|
||||||
{
|
{
|
||||||
@@ -116,7 +112,6 @@ public class ItemUtilTest
|
|||||||
assertTrue(ItemUtil.containsAnyItemId(items, MIX_IDS));
|
assertTrue(ItemUtil.containsAnyItemId(items, MIX_IDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void containsItemId()
|
public void containsItemId()
|
||||||
{
|
{
|
||||||
@@ -124,7 +119,6 @@ public class ItemUtilTest
|
|||||||
assertFalse(ItemUtil.containsItemId(items, ItemID.TWISTED_BOW));
|
assertFalse(ItemUtil.containsItemId(items, ItemID.TWISTED_BOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void containsAllGameItems()
|
public void containsAllGameItems()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user