client: Fix tests

This commit is contained in:
Owain van Brakel
2019-11-08 05:36:30 +01:00
parent a272c7511f
commit 46c7f53112
25 changed files with 121 additions and 2 deletions

View File

@@ -359,8 +359,7 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
&& (worldPoint.getY() & (REGION_SIZE - 1)) == objectPoint.getRegionY()) && (worldPoint.getY() & (REGION_SIZE - 1)) == objectPoint.getRegionY())
{ {
// Transform object to get the name which matches against what we've stored // Transform object to get the name which matches against what we've stored
if (getObjectDefinition(object.getId()) != null && if (objectPoint.getName().equals(getObjectDefinition(object.getId()).getName()))
objectPoint.getName().equals(getObjectDefinition(object.getId()).getName()))
{ {
log.debug("Marking object {} due to matching {}", object, objectPoint); log.debug("Marking object {} due to matching {}", object, objectPoint);
objects.add(object); objects.add(object);

View File

@@ -34,6 +34,8 @@ import net.runelite.api.Client;
import net.runelite.api.MessageNode; import net.runelite.api.MessageNode;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.eventbus.EventBus;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -55,6 +57,10 @@ public class ChatMessageManagerTest
@Bind @Bind
private ChatColorConfig chatColorConfig; private ChatColorConfig chatColorConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;

View File

@@ -56,6 +56,10 @@ public class ConfigManagerTest
@Bind @Bind
RuneLiteConfig runeliteConfig; RuneLiteConfig runeliteConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
ConfigManager manager; ConfigManager manager;

View File

@@ -37,6 +37,7 @@ import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@@ -63,6 +64,10 @@ public class AttackStylesPluginTest
@Bind @Bind
AttackStylesConfig attackConfig; AttackStylesConfig attackConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
AttackStylesPlugin attackPlugin; AttackStylesPlugin attackPlugin;

View File

@@ -35,6 +35,7 @@ import net.runelite.api.Item;
import net.runelite.api.ItemContainer; import net.runelite.api.ItemContainer;
import net.runelite.api.ItemDefinition; import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@@ -61,6 +62,10 @@ public class BankPluginTest
@Bind @Bind
private BankConfig bankConfig; private BankConfig bankConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private BankPlugin bankPlugin; private BankPlugin bankPlugin;

View File

@@ -34,6 +34,7 @@ import net.runelite.api.Client;
import net.runelite.api.ItemDefinition; import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager; import net.runelite.client.game.SpriteManager;
@@ -110,6 +111,10 @@ public class ItemValueSearchTest
@Bind @Bind
private ScheduledExecutorService scheduledExecutorService; private ScheduledExecutorService scheduledExecutorService;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -33,6 +33,7 @@ import javax.inject.Inject;
import net.runelite.api.NPC; import net.runelite.api.NPC;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Before;
@@ -50,6 +51,10 @@ public class CerberusPluginTest
@Bind @Bind
OverlayManager overlayManager; OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
CerberusPlugin cerberusPlugin; CerberusPlugin cerberusPlugin;

View File

@@ -35,6 +35,7 @@ import net.runelite.api.Client;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.OpenOSRSConfig;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -67,6 +68,10 @@ public class ChatCommandsPluginTest
@Bind @Bind
ChatCommandsConfig chatCommandsConfig; ChatCommandsConfig chatCommandsConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
ChatCommandsPlugin chatCommandsPlugin; ChatCommandsPlugin chatCommandsPlugin;

View File

@@ -31,6 +31,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@@ -54,6 +55,10 @@ public class ChatFilterPluginTest
@Bind @Bind
private ChatFilterConfig chatFilterConfig; private ChatFilterConfig chatFilterConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Mock @Mock
private Player localPlayer; private Player localPlayer;

View File

@@ -37,6 +37,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.util.Text; import net.runelite.api.util.Text;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -66,6 +67,10 @@ public class ChatNotificationsPluginTest
@Bind @Bind
private Notifier notifier; private Notifier notifier;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private ChatNotificationsPlugin chatNotificationsPlugin; private ChatNotificationsPlugin chatNotificationsPlugin;

View File

@@ -34,6 +34,7 @@ import net.runelite.api.GraphicID;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.SpotAnimationChanged; import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -89,6 +90,10 @@ public class CookingPluginTest
@Bind @Bind
OverlayManager overlayManager; OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -36,6 +36,7 @@ import net.runelite.api.MessageNode;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@@ -58,6 +59,10 @@ public class EmojiPluginTest
@Bind @Bind
private ChatMessageManager chatMessageManager; private ChatMessageManager chatMessageManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private EmojiPlugin emojiPlugin; private EmojiPlugin emojiPlugin;

View File

@@ -38,6 +38,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.MenuOptionClicked; import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.http.api.examine.ExamineClient; import net.runelite.http.api.examine.ExamineClient;
import org.junit.Before; import org.junit.Before;
@@ -78,6 +79,10 @@ public class ExaminePluginTest
@Bind @Bind
ScheduledExecutorService scheduledExecutorService; ScheduledExecutorService scheduledExecutorService;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -46,6 +46,7 @@ import net.runelite.api.events.GameTick;
import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.InteractingChanged;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.SoundManager; import net.runelite.client.game.SoundManager;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -81,6 +82,10 @@ public class IdleNotifierPluginTest
@Bind @Bind
private Notifier notifier; private Notifier notifier;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private IdleNotifierPlugin plugin; private IdleNotifierPlugin plugin;

View File

@@ -38,6 +38,7 @@ import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import org.junit.Before; import org.junit.Before;
@@ -88,6 +89,10 @@ public class ItemChargePluginTest
@Bind @Bind
private ItemChargeConfig config; private ItemChargeConfig config;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private ItemChargePlugin itemChargePlugin; private ItemChargePlugin itemChargePlugin;

View File

@@ -35,6 +35,7 @@ import net.runelite.api.Client;
import net.runelite.api.Item; import net.runelite.api.Item;
import net.runelite.api.ItemDefinition; import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemReclaimCost; import net.runelite.client.game.ItemReclaimCost;
import static net.runelite.client.plugins.itemskeptondeath.ItemsKeptOnDeathPlugin.DeathItems; import static net.runelite.client.plugins.itemskeptondeath.ItemsKeptOnDeathPlugin.DeathItems;
@@ -60,6 +61,10 @@ public class ItemsKeptOnDeathPluginTest
@Bind @Bind
private ItemManager itemManager; private ItemManager itemManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private ItemsKeptOnDeathPlugin plugin; private ItemsKeptOnDeathPlugin plugin;

View File

@@ -41,6 +41,7 @@ import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.ChatColorConfig; import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -102,6 +103,10 @@ public class MotherlodePluginTest
@Bind @Bind
private Notifier notifier; private Notifier notifier;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -32,6 +32,7 @@ import java.util.List;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -54,6 +55,10 @@ public class NpcIndicatorsPluginTest
@Bind @Bind
private NpcIndicatorsConfig npcIndicatorsConfig; private NpcIndicatorsConfig npcIndicatorsConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
private NpcIndicatorsPlugin npcIndicatorsPlugin; private NpcIndicatorsPlugin npcIndicatorsPlugin;

View File

@@ -41,6 +41,7 @@ import static net.runelite.api.widgets.WidgetID.LEVEL_UP_GROUP_ID;
import static net.runelite.api.widgets.WidgetInfo.DIALOG_SPRITE_TEXT; import static net.runelite.api.widgets.WidgetInfo.DIALOG_SPRITE_TEXT;
import static net.runelite.api.widgets.WidgetInfo.LEVEL_UP_LEVEL; import static net.runelite.api.widgets.WidgetInfo.LEVEL_UP_LEVEL;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.DrawManager; import net.runelite.client.ui.DrawManager;
@@ -97,6 +98,10 @@ public class ScreenshotPluginTest
@Bind @Bind
ScheduledExecutorService service; ScheduledExecutorService service;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -49,6 +49,7 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatCommandManager; import net.runelite.client.chat.ChatCommandManager;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -149,6 +150,10 @@ public class SlayerPluginTest
@Bind @Bind
SlayerTaskPanel panel; SlayerTaskPanel panel;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -30,6 +30,7 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.ChatMessageType; import net.runelite.api.ChatMessageType;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
@@ -60,6 +61,10 @@ public class SmeltingPluginTest
@Bind @Bind
OverlayManager overlayManager; OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -33,6 +33,7 @@ import net.runelite.api.ChatMessageType;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager; import net.runelite.client.game.SpriteManager;
import net.runelite.client.ui.overlay.infobox.InfoBox; import net.runelite.client.ui.overlay.infobox.InfoBox;
@@ -77,6 +78,10 @@ public class TimersPluginTest
@Bind @Bind
private InfoBoxManager infoBoxManager; private InfoBoxManager infoBoxManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -31,6 +31,7 @@ import java.util.TimeZone;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ConfigChanged;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -50,6 +51,10 @@ public class TimestampPluginTest
@Bind @Bind
TimestampConfig config; TimestampConfig config;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject @Inject
TimestampPlugin plugin; TimestampPlugin plugin;

View File

@@ -34,6 +34,7 @@ import net.runelite.api.Varbits;
import net.runelite.api.events.VarbitChanged; import net.runelite.api.events.VarbitChanged;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -74,6 +75,10 @@ public class WintertodtPluginTest
@Bind @Bind
Client client; Client client;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {

View File

@@ -35,6 +35,7 @@ import net.runelite.api.Skill;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.StatChanged; import net.runelite.api.events.StatChanged;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.NPCManager; import net.runelite.client.game.NPCManager;
import net.runelite.client.game.SkillIconManager; import net.runelite.client.game.SkillIconManager;
import net.runelite.client.ui.ClientToolbar; import net.runelite.client.ui.ClientToolbar;
@@ -78,6 +79,10 @@ public class XpTrackerPluginTest
@Bind @Bind
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before @Before
public void before() public void before()
{ {