client: Add back item tests (#1160)
* Fix upstream merge * mixins: Fix checkstyle * client: Add back item tests * discord: builder default
This commit is contained in:
committed by
Kyleeld
parent
6ab7640266
commit
75ef43cc0e
@@ -48,6 +48,7 @@ public class DiscordMessage
|
||||
String avatarUrl;
|
||||
@SerializedName("tts")
|
||||
boolean textToSpeech;
|
||||
@Builder.Default
|
||||
List<DiscordEmbed> embeds = new ArrayList<>();
|
||||
|
||||
public DiscordMessage()
|
||||
|
||||
@@ -37,7 +37,6 @@ import net.runelite.client.game.ItemManager;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
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;
|
||||
@@ -65,21 +64,12 @@ public class ContainerCalculationTest
|
||||
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testCalculate()
|
||||
{
|
||||
Item coins = mock(Item.class);
|
||||
when(coins.getId())
|
||||
.thenReturn(ItemID.COINS_995);
|
||||
when(coins.getQuantity())
|
||||
.thenReturn(Integer.MAX_VALUE);
|
||||
Item coins = new Item(ItemID.COINS_995, Integer.MAX_VALUE);
|
||||
|
||||
Item whip = mock(Item.class);
|
||||
when(whip.getId())
|
||||
.thenReturn(ItemID.ABYSSAL_WHIP);
|
||||
when(whip.getQuantity())
|
||||
.thenReturn(1_000_000_000);
|
||||
Item whip = new Item(ItemID.ABYSSAL_WHIP, 1_000_000_000);
|
||||
|
||||
Item[] items = ImmutableList.of(
|
||||
coins,
|
||||
|
||||
@@ -41,7 +41,6 @@ import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
@@ -98,7 +97,6 @@ public class ItemChargePluginTest
|
||||
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testOnChatMessage()
|
||||
{
|
||||
@@ -137,8 +135,7 @@ public class ItemChargePluginTest
|
||||
when(client.getItemContainer(eq(InventoryID.EQUIPMENT))).thenReturn(equipmentItemContainer);
|
||||
Item[] items = new Item[EquipmentInventorySlot.RING.getSlotIdx() + 1];
|
||||
when(equipmentItemContainer.getItems()).thenReturn(items);
|
||||
Item ring = mock(Item.class);
|
||||
when(ring.getId()).thenReturn(ItemID.RING_OF_FORGING);
|
||||
Item ring = new Item(ItemID.RING_OF_FORGING, 1);
|
||||
items[EquipmentInventorySlot.RING.getSlotIdx()] = ring;
|
||||
// Run message
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_RING_OF_FORGING, "", 0);
|
||||
|
||||
@@ -90,21 +90,15 @@ public class ItemsKeptOnDeathPluginTest
|
||||
when(itemManager.canonicalize(id)).thenReturn(id);
|
||||
when(itemManager.getItemPrice(id, true)).thenReturn(price);
|
||||
|
||||
return mockItem(id, qty);
|
||||
return item(id, qty);
|
||||
}
|
||||
|
||||
// Creates a mocked item
|
||||
private Item mockItem(final int id, final int qty)
|
||||
// Creates a new item
|
||||
private static Item item(final int id, final int qty)
|
||||
{
|
||||
Item item = mock(Item.class);
|
||||
|
||||
// when(item.getId()).thenReturn(id);
|
||||
// when(item.getQuantity()).thenReturn(qty);
|
||||
|
||||
return item;
|
||||
return new Item(id, qty);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void deathPriceTestRegularItems()
|
||||
{
|
||||
@@ -118,7 +112,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals(35000, plugin.getDeathPrice(defender));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void deathPriceTestItemMapping()
|
||||
{
|
||||
@@ -134,7 +127,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals(1000000, plugin.getDeathPrice(slayerHelm));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void deathPriceTestFixedPriceItems()
|
||||
{
|
||||
@@ -159,7 +151,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals(13500 + braceletOffset, plugin.getDeathPrice(brace));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void deathPriceTestDynamicPriceItems()
|
||||
{
|
||||
@@ -193,7 +184,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
};
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void alwaysLostTestRunePouch()
|
||||
{
|
||||
@@ -207,7 +197,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertFalse(deathItems.isHasAlwaysLost());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void alwaysLostTestRunePouchWildy()
|
||||
{
|
||||
@@ -222,7 +211,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertTrue(deathItems.isHasAlwaysLost());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void alwaysLostTestLootBag()
|
||||
{
|
||||
@@ -237,7 +225,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void alwaysLostTestLootBagWildy()
|
||||
{
|
||||
@@ -296,7 +283,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertFalse(plugin.isClueBoxable(ItemID.SPADE));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clueBoxTestDefault()
|
||||
{
|
||||
@@ -321,7 +307,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals((inv.length + equip.length) - expectedKept.size(), lost.size());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clueBoxTestDeepWildy()
|
||||
{
|
||||
@@ -346,7 +331,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals((inv.length + equip.length) - keptOffset, lost.size());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clueBoxTestDeepWildyProtectItem()
|
||||
{
|
||||
@@ -373,7 +357,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals((inv.length + equip.length) - keptOffset, lost.size());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clueBoxTestDeepWildySkulled()
|
||||
{
|
||||
@@ -396,7 +379,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals(lost.size(), (inv.length + equip.length) - keptOffset);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clueBoxTestLowWildy()
|
||||
{
|
||||
@@ -422,7 +404,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals(lost.size(), (inv.length + equip.length) - keptOffset);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clueBoxTestLowWildyProtectItem()
|
||||
{
|
||||
@@ -450,7 +431,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals((inv.length + equip.length) - keptOffset, lost.size());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clueBoxTestLowWildySkulled()
|
||||
{
|
||||
@@ -499,7 +479,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
};
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void clueBoxTestCasketProtect()
|
||||
{
|
||||
@@ -537,7 +516,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
};
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void gracefulValueTest()
|
||||
{
|
||||
@@ -566,7 +544,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals((inv.length + equip.length) - expectedKept.size(), lost.size());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void gracefulValueTestWildy()
|
||||
{
|
||||
@@ -592,7 +569,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertEquals((inv.length + equip.length) - expectedKept.size(), lost.size());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void lostIfNotProtectedTestLost()
|
||||
{
|
||||
@@ -608,7 +584,6 @@ public class ItemsKeptOnDeathPluginTest
|
||||
assertTrue(lost.contains(new ItemStack(ItemID.SHADOW_SWORD, 1)));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void lostIfNotProtectedTestKept()
|
||||
{
|
||||
|
||||
@@ -52,7 +52,6 @@ public class MaxHitCalculatorTest
|
||||
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void calculate()
|
||||
{
|
||||
|
||||
@@ -112,7 +112,6 @@ public class MotherlodePluginTest
|
||||
when(client.getMapRegions()).thenReturn(new int[]{14679});
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testOreCounter()
|
||||
{
|
||||
@@ -128,12 +127,12 @@ public class MotherlodePluginTest
|
||||
// Create before inventory
|
||||
ItemContainer inventory = mock(ItemContainer.class);
|
||||
Item[] items = new Item[]{
|
||||
mockItem(ItemID.RUNITE_ORE, 1),
|
||||
mockItem(ItemID.GOLDEN_NUGGET, 4),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
item(ItemID.RUNITE_ORE, 1),
|
||||
item(ItemID.GOLDEN_NUGGET, 4),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
|
||||
};
|
||||
when(inventory.getItems())
|
||||
@@ -147,17 +146,16 @@ public class MotherlodePluginTest
|
||||
inventory = mock(ItemContainer.class);
|
||||
// +1 rune, +4 nugget, +2 coal, +1 addy
|
||||
items = new Item[]{
|
||||
mockItem(ItemID.RUNITE_ORE, 1),
|
||||
mockItem(ItemID.RUNITE_ORE, 1),
|
||||
mockItem(ItemID.GOLDEN_NUGGET, 8),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.ADAMANTITE_ORE, 1),
|
||||
|
||||
item(ItemID.RUNITE_ORE, 1),
|
||||
item(ItemID.RUNITE_ORE, 1),
|
||||
item(ItemID.GOLDEN_NUGGET, 8),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.ADAMANTITE_ORE, 1),
|
||||
};
|
||||
when(inventory.getItems())
|
||||
.thenReturn(items);
|
||||
@@ -173,11 +171,8 @@ public class MotherlodePluginTest
|
||||
verifyNoMoreInteractions(motherlodeSession);
|
||||
}
|
||||
|
||||
private static Item mockItem(int itemId, int quantity)
|
||||
private static Item item(int itemId, int quantity)
|
||||
{
|
||||
Item item = mock(Item.class);
|
||||
when(item.getId()).thenReturn(itemId);
|
||||
when(item.getQuantity()).thenReturn(quantity);
|
||||
return item;
|
||||
return new Item(itemId, quantity);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user