Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2021-08-11 21:39:01 +02:00
24 changed files with 800 additions and 250 deletions

View File

@@ -0,0 +1,211 @@
/*
* Copyright (c) 2016-2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins;
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.grapher.graphviz.GraphvizGrapher;
import com.google.inject.grapher.graphviz.GraphvizModule;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import com.google.inject.util.Modules;
import java.applet.Applet;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import net.runelite.api.Client;
import net.runelite.client.RuneLite;
import net.runelite.client.RuneLiteModule;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.eventbus.EventBus;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import static org.mockito.ArgumentMatchers.any;
import org.mockito.Mock;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class PluginManagerTest
{
private static final String PLUGIN_PACKAGE = "net.runelite.client.plugins";
@Rule
public TemporaryFolder folder = new TemporaryFolder();
@Mock
@Bind
public Applet applet;
@Mock
@Bind
public Client client;
private Set<Class<?>> pluginClasses;
private Set<Class<?>> configClasses;
@Before
public void before() throws IOException
{
OkHttpClient okHttpClient = mock(OkHttpClient.class);
when(okHttpClient.newCall(any(Request.class)))
.thenThrow(new RuntimeException("in plugin manager test"));
Injector injector = Guice.createInjector(Modules
.override(new RuneLiteModule(okHttpClient, () -> null, true, false,
RuneLite.DEFAULT_SESSION_FILE,
RuneLite.DEFAULT_CONFIG_FILE))
.with(BoundFieldModule.of(this)));
RuneLite.setInjector(injector);
// Find plugins and configs we expect to have
pluginClasses = new HashSet<>();
configClasses = new HashSet<>();
Set<ClassInfo> classes = ClassPath.from(getClass().getClassLoader()).getTopLevelClassesRecursive(PLUGIN_PACKAGE);
for (ClassInfo classInfo : classes)
{
Class<?> clazz = classInfo.load();
PluginDescriptor pluginDescriptor = clazz.getAnnotation(PluginDescriptor.class);
if (pluginDescriptor != null)
{
pluginClasses.add(clazz);
continue;
}
if (Config.class.isAssignableFrom(clazz))
{
configClasses.add(clazz);
}
}
}
@Test
public void testLoadPlugins() throws Exception
{
PluginManager pluginManager = new PluginManager(false, false, null, null, null, null);
pluginManager.setOutdated(true);
pluginManager.loadCorePlugins();
Collection<Plugin> plugins = pluginManager.getPlugins();
long expected = pluginClasses.stream()
.map(cl -> cl.getAnnotation(PluginDescriptor.class))
.filter(Objects::nonNull)
.filter(PluginDescriptor::loadWhenOutdated)
.count();
assertEquals(expected, plugins.size());
pluginManager = new PluginManager(false, false, null, null, null, null);
pluginManager.loadCorePlugins();
plugins = pluginManager.getPlugins();
// Check that the plugins register with the eventbus without errors
EventBus eventBus = new EventBus();
plugins.forEach(eventBus::register);
expected = pluginClasses.stream()
.map(cl -> cl.getAnnotation(PluginDescriptor.class))
.filter(Objects::nonNull)
.filter(pd -> !pd.developerPlugin())
.count();
assertEquals(expected, plugins.size());
}
@Test
public void dumpGraph() throws Exception
{
PluginManager pluginManager = new PluginManager(true, false, null, null, null, null);
pluginManager.loadCorePlugins();
Injector graphvizInjector = Guice.createInjector(new GraphvizModule());
GraphvizGrapher graphvizGrapher = graphvizInjector.getInstance(GraphvizGrapher.class);
File dotFolder = folder.newFolder();
try (PrintWriter out = new PrintWriter(new File(dotFolder, "runelite.dot"), "UTF-8"))
{
graphvizGrapher.setOut(out);
graphvizGrapher.setRankdir("TB");
graphvizGrapher.graph(RuneLite.getInjector());
}
for (Plugin p : pluginManager.getPlugins())
{
try (PrintWriter out = new PrintWriter(new File(dotFolder, p.getName() + ".dot"), "UTF-8"))
{
graphvizGrapher.setOut(out);
graphvizGrapher.setRankdir("TB");
graphvizGrapher.graph(p.getInjector());
}
}
}
@Test
public void ensureNoDuplicateConfigKeyNames()
{
for (final Class<?> clazz : configClasses)
{
final Set<String> configKeyNames = new HashSet<>();
for (final Method method : clazz.getMethods())
{
if (!method.isDefault())
{
continue;
}
final ConfigItem annotation = method.getAnnotation(ConfigItem.class);
if (annotation == null)
{
continue;
}
final String configKeyName = annotation.keyName();
if (configKeyNames.contains(configKeyName))
{
throw new IllegalArgumentException("keyName " + configKeyName + " is duplicated in " + clazz);
}
configKeyNames.add(configKeyName);
}
}
}
}

View File

@@ -0,0 +1,173 @@
/*
* Copyright (c) 2020 Jordan <nightfirecat@protonmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.itemstats;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import java.awt.Color;
import net.runelite.api.Client;
import net.runelite.api.EquipmentInventorySlot;
import net.runelite.api.InventoryID;
import net.runelite.api.ItemContainer;
import net.runelite.client.game.ItemManager;
import net.runelite.client.util.Text;
import net.runelite.http.api.item.ItemEquipmentStats;
import net.runelite.http.api.item.ItemStats;
import org.apache.commons.lang3.StringUtils;
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.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class ItemStatOverlayTest
{
// Weapon definitions
private static final ItemStats ABYSSAL_DAGGER = new ItemStats(true, 0.453, 8,
ItemEquipmentStats.builder()
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
.isTwoHanded(false)
.astab(75)
.aslash(40)
.acrush(-4)
.amagic(1)
.dmagic(1)
.str(75)
.aspeed(4)
.build());
private static final ItemStats KATANA = new ItemStats(true, 0, 8,
ItemEquipmentStats.builder()
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
.isTwoHanded(true)
.astab(7)
.aslash(45)
.dstab(3)
.dslash(7)
.dcrush(7)
.drange(-3)
.str(40)
.aspeed(4)
.build());
private static final ItemStats BLOWPIPE = new ItemStats(true, 0, 0,
ItemEquipmentStats.builder()
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
.isTwoHanded(true)
.arange(60)
.rstr(40)
.aspeed(3)
.build());
private static final ItemStats HEAVY_BALLISTA = new ItemStats(true, 4, 8,
ItemEquipmentStats.builder()
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
.isTwoHanded(true)
.arange(110)
.aspeed(7)
.build());
@Inject
ItemStatOverlay overlay;
@Mock
@Bind
Client client;
@Mock
@Bind
ItemStatConfig config;
@Mock
@Bind
ItemManager itemManager;
@Before
public void before()
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
when(config.colorBetterUncapped()).thenReturn(new Color(0));
when(config.colorWorse()).thenReturn(new Color(0));
}
@Test
public void testUnarmedAttackSpeed()
{
assertEquals(ItemStatOverlay.UNARMED.getEquipment().getAspeed(), ABYSSAL_DAGGER.getEquipment().getAspeed());
assertEquals(ItemStatOverlay.UNARMED.getEquipment().getAspeed(), KATANA.getEquipment().getAspeed());
assertEquals(-1, BLOWPIPE.getEquipment().getAspeed() - ItemStatOverlay.UNARMED.getEquipment().getAspeed());
assertEquals(3, HEAVY_BALLISTA.getEquipment().getAspeed() - ItemStatOverlay.UNARMED.getEquipment().getAspeed());
}
@Test
public void testBuildStatBonusString()
{
// Empty equipment (fully unarmed)
final ItemContainer equipment = mock(ItemContainer.class);
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipment);
String tooltip;
String sanitizedTooltip;
tooltip = overlay.buildStatBonusString(ABYSSAL_DAGGER);
sanitizedTooltip = Text.sanitizeMultilineText(tooltip);
assertTrue(sanitizedTooltip.contains("Stab: +75"));
assertTrue(sanitizedTooltip.contains("Slash: +40"));
assertTrue(sanitizedTooltip.contains("Crush: -4"));
assertEquals(2, StringUtils.countMatches(sanitizedTooltip, "Magic: +1")); // Attack and defense
assertTrue(sanitizedTooltip.contains("Melee Str: +75"));
assertFalse(sanitizedTooltip.contains("Speed:"));
tooltip = overlay.buildStatBonusString(KATANA);
sanitizedTooltip = Text.sanitizeMultilineText(tooltip);
assertTrue(sanitizedTooltip.contains("Stab: +7"));
assertTrue(sanitizedTooltip.contains("Slash: +45"));
assertTrue(sanitizedTooltip.contains("Stab: +3")); // Defense
assertTrue(sanitizedTooltip.contains("Slash: +7")); // Defense
assertTrue(sanitizedTooltip.contains("Crush: +7")); // Defense
assertTrue(sanitizedTooltip.contains("Range: -3")); // Defense
assertTrue(sanitizedTooltip.contains("Melee Str: +40"));
assertFalse(sanitizedTooltip.contains("Speed:"));
tooltip = overlay.buildStatBonusString(BLOWPIPE);
sanitizedTooltip = Text.sanitizeMultilineText(tooltip);
assertTrue(sanitizedTooltip.contains("Range: +60"));
assertTrue(sanitizedTooltip.contains("Range Str: +40"));
assertTrue(sanitizedTooltip.contains("Speed: -1"));
assertFalse(sanitizedTooltip.contains("Stab:"));
tooltip = overlay.buildStatBonusString(HEAVY_BALLISTA);
sanitizedTooltip = Text.sanitizeMultilineText(tooltip);
assertTrue(sanitizedTooltip.contains("Range: +110"));
assertTrue(sanitizedTooltip.contains("Speed: +3"));
assertFalse(sanitizedTooltip.contains("Stab:"));
}
}

View File

@@ -101,7 +101,7 @@ public class NpcIndicatorsPluginTest
when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("goblin");
when(npcIndicatorsConfig.deadNpcMenuColor()).thenReturn(Color.RED);
npcIndicatorsPlugin.rebuildAllNpcs();
npcIndicatorsPlugin.rebuild();
NPC npc = mock(NPC.class);
when(npc.getName()).thenReturn("Goblin");
@@ -127,7 +127,7 @@ public class NpcIndicatorsPluginTest
when(npcIndicatorsConfig.highlightMenuNames()).thenReturn(true);
when(npcIndicatorsConfig.getHighlightColor()).thenReturn(Color.BLUE);
npcIndicatorsPlugin.rebuildAllNpcs();
npcIndicatorsPlugin.rebuild();
NPC npc = mock(NPC.class);
when(npc.getName()).thenReturn("Goblin");
@@ -149,7 +149,7 @@ public class NpcIndicatorsPluginTest
{
when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("Joseph");
npcIndicatorsPlugin.rebuildAllNpcs();
npcIndicatorsPlugin.rebuild();
NPC npc = mock(NPC.class);
when(npc.getName()).thenReturn("Joseph");
@@ -168,7 +168,7 @@ public class NpcIndicatorsPluginTest
{
when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("Werewolf");
npcIndicatorsPlugin.rebuildAllNpcs();
npcIndicatorsPlugin.rebuild();
NPC npc = mock(NPC.class);
when(npc.getName()).thenReturn("Joseph");

View File

@@ -0,0 +1,154 @@
/*
* Copyright (c) 2020, Landy Chan <https://github.com/landychan>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.prayer;
import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.EquipmentInventorySlot;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemContainer;
import net.runelite.api.Prayer;
import net.runelite.api.Skill;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.http.api.item.ItemEquipmentStats;
import net.runelite.http.api.item.ItemStats;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import org.mockito.Mock;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class PrayerPluginTest
{
private static final ItemStats HIGH_PRAYER_BONUS_WEAPON = new ItemStats(false, 0, 0,
ItemEquipmentStats.builder()
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
.prayer(50)
.build());
@Inject
private PrayerPlugin prayerPlugin;
@Mock
@Bind
private Client client;
@Mock
@Bind
private PrayerConfig config;
@Mock
@Bind
private OverlayManager overlayManager;
@Mock
@Bind
private InfoBoxManager infoBoxManager;
@Mock
@Bind
private ItemManager itemManager;
@Before
public void before()
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
}
@Test
public void testGetEstimatedTimeRemainingOverOneHour()
{
ItemContainer itemContainer = mock(ItemContainer.class);
when(itemContainer.getItems()).thenReturn(new Item[]{new Item(-1, 1)});
when(itemManager.getItemStats(anyInt(), anyBoolean())).thenReturn(HIGH_PRAYER_BONUS_WEAPON);
when(client.isPrayerActive(Prayer.PRESERVE)).thenReturn(true);
when(client.getBoostedSkillLevel(Skill.PRAYER)).thenReturn(99);
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(itemContainer);
prayerPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), itemContainer));
assertEquals("1:19:12", prayerPlugin.getEstimatedTimeRemaining(false));
}
@Test
public void testGetEstimatedTimeRemainingUnderOneHour()
{
ItemContainer itemContainer = mock(ItemContainer.class);
when(itemContainer.getItems()).thenReturn(new Item[]{});
when(client.isPrayerActive(Prayer.PRESERVE)).thenReturn(true);
when(client.getBoostedSkillLevel(Skill.PRAYER)).thenReturn(99);
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(itemContainer);
prayerPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), itemContainer));
assertEquals("29:42", prayerPlugin.getEstimatedTimeRemaining(false));
}
@Test
public void testGetEstimatedTimeRemainingFormatForOrbUnderOneHour()
{
ItemContainer itemContainer = mock(ItemContainer.class);
when(itemContainer.getItems()).thenReturn(new Item[]{});
when(client.isPrayerActive(Prayer.PRESERVE)).thenReturn(true);
when(client.getBoostedSkillLevel(Skill.PRAYER)).thenReturn(99);
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(itemContainer);
prayerPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), itemContainer));
assertEquals("29m", prayerPlugin.getEstimatedTimeRemaining(true));
}
@Test
public void testGetEstimatedTimeRemainingFormatForOrbOverOneHour()
{
ItemContainer itemContainer = mock(ItemContainer.class);
when(itemContainer.getItems()).thenReturn(new Item[]{new Item(-1, 1)});
when(itemManager.getItemStats(anyInt(), anyBoolean())).thenReturn(HIGH_PRAYER_BONUS_WEAPON);
when(client.isPrayerActive(Prayer.PRESERVE)).thenReturn(true);
when(client.getBoostedSkillLevel(Skill.PRAYER)).thenReturn(99);
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(itemContainer);
prayerPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), itemContainer));
assertEquals("79m", prayerPlugin.getEstimatedTimeRemaining(true));
}
}

View File

@@ -31,6 +31,7 @@ import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import javax.inject.Named;
import net.runelite.api.ChatMessageType;
import static net.runelite.api.ChatMessageType.GAMEMESSAGE;
import net.runelite.api.Client;
@@ -55,6 +56,7 @@ import net.runelite.client.chat.ChatCommandManager;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.npchighlight.NpcIndicatorsService;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.http.api.chat.ChatClient;
@@ -168,6 +170,14 @@ public class SlayerPluginTest
@Bind
ChatClient chatClient;
@Bind
@Named("developerMode")
boolean developerMode;
@Mock
@Bind
NpcIndicatorsService npcIndicatorsService;
@Inject
SlayerPlugin slayerPlugin;
@@ -871,14 +881,13 @@ public class SlayerPluginTest
slayerPlugin.onStatChanged(statChanged);
NPCComposition npcComposition = mock(NPCComposition.class);
when(npcComposition.getName()).thenReturn("Suqah");
when(npcComposition.getActions()).thenReturn(new String[]{"Attack"});
NPC npc1 = mock(NPC.class);
when(npc1.getName()).thenReturn("Suqah");
when(npc1.getTransformedComposition()).thenReturn(npcComposition);
NPC npc2 = mock(NPC.class);
when(npc2.getName()).thenReturn("Suqah");
when(npc2.getTransformedComposition()).thenReturn(npcComposition);
when(client.getNpcs()).thenReturn(Arrays.asList(npc1, npc2));