Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2019-07-19 00:27:10 +02:00
35 changed files with 671 additions and 318 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,13 +30,12 @@ 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.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID;
import net.runelite.client.game.ItemManager;
import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,7 +45,7 @@ import static org.mockito.Mockito.when;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class BankCalculationTest
public class ContainerCalculationTest
{
@Mock
@Bind
@@ -56,12 +55,8 @@ public class BankCalculationTest
@Bind
private ItemManager itemManager;
@Mock
@Bind
private BankConfig bankConfig;
@Inject
private BankPlugin bankplugin;
private ContainerCalculation containerCalculation;
@Before
public void before()
@@ -72,9 +67,6 @@ public class BankCalculationTest
@Test
public void testCalculate()
{
when(bankConfig.showHA())
.thenReturn(true);
Item coins = mock(Item.class);
when(coins.getId())
.thenReturn(ItemID.COINS_995);
@@ -92,13 +84,6 @@ public class BankCalculationTest
whip
).toArray(new Item[0]);
ItemContainer bankContainer = mock(ItemContainer.class);
when(bankContainer.getItems())
.thenReturn(items);
when(client.getItemContainer(InventoryID.BANK))
.thenReturn(bankContainer);
ItemDefinition whipComp = mock(ItemDefinition.class);
when(whipComp.getId())
.thenReturn(ItemID.ABYSSAL_WHIP);
@@ -107,10 +92,10 @@ public class BankCalculationTest
when(itemManager.getItemDefinition(ItemID.ABYSSAL_WHIP))
.thenReturn(whipComp);
BankCalculation bankCalculation = new BankCalculation(itemManager, bankplugin, client);
bankCalculation.calculate();
final ContainerPrices prices = containerCalculation.calculate(items);
assertNotNull(prices);
long value = bankCalculation.getHaPrice();
assertTrue(value == Integer.MAX_VALUE);
long value = prices.getHighAlchPrice();
assertTrue(value > Integer.MAX_VALUE);
}
}
}