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())
{
// Transform object to get the name which matches against what we've stored
if (getObjectDefinition(object.getId()) != null &&
objectPoint.getName().equals(getObjectDefinition(object.getId()).getName()))
if (objectPoint.getName().equals(getObjectDefinition(object.getId()).getName()))
{
log.debug("Marking object {} due to matching {}", object, objectPoint);
objects.add(object);

View File

@@ -34,6 +34,8 @@ import net.runelite.api.Client;
import net.runelite.api.MessageNode;
import net.runelite.api.events.ChatMessage;
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.Test;
import org.junit.runner.RunWith;
@@ -55,6 +57,10 @@ public class ChatMessageManagerTest
@Bind
private ChatColorConfig chatColorConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject
private ChatMessageManager chatMessageManager;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -34,6 +34,7 @@ import net.runelite.api.GraphicID;
import net.runelite.api.Player;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -89,6 +90,10 @@ public class CookingPluginTest
@Bind
OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@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.GameStateChanged;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -58,6 +59,10 @@ public class EmojiPluginTest
@Bind
private ChatMessageManager chatMessageManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject
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.widgets.Widget;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager;
import net.runelite.http.api.examine.ExamineClient;
import org.junit.Before;
@@ -78,6 +79,10 @@ public class ExaminePluginTest
@Bind
ScheduledExecutorService scheduledExecutorService;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@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.InteractingChanged;
import net.runelite.client.Notifier;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.SoundManager;
import org.junit.Before;
import org.junit.Test;
@@ -81,6 +82,10 @@ public class IdleNotifierPluginTest
@Bind
private Notifier notifier;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject
private IdleNotifierPlugin plugin;

View File

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

View File

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

View File

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

View File

@@ -32,6 +32,7 @@ import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.client.config.OpenOSRSConfig;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
@@ -54,6 +55,10 @@ public class NpcIndicatorsPluginTest
@Bind
private NpcIndicatorsConfig npcIndicatorsConfig;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Inject
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.LEVEL_UP_LEVEL;
import net.runelite.client.Notifier;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.DrawManager;
@@ -97,6 +98,10 @@ public class ScreenshotPluginTest
@Bind
ScheduledExecutorService service;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@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.chat.ChatCommandManager;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -149,6 +150,10 @@ public class SlayerPluginTest
@Bind
SlayerTaskPanel panel;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before
public void before()
{

View File

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

View File

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

View File

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

View File

@@ -34,6 +34,7 @@ import net.runelite.api.Varbits;
import net.runelite.api.events.VarbitChanged;
import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.ui.overlay.OverlayManager;
import org.junit.Before;
import org.junit.Test;
@@ -74,6 +75,10 @@ public class WintertodtPluginTest
@Bind
Client client;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@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.GameTick;
import net.runelite.api.events.StatChanged;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.game.NPCManager;
import net.runelite.client.game.SkillIconManager;
import net.runelite.client.ui.ClientToolbar;
@@ -78,6 +79,10 @@ public class XpTrackerPluginTest
@Bind
private OverlayManager overlayManager;
@Mock
@Bind
private OpenOSRSConfig openOSRSConfig;
@Before
public void before()
{