### Question:
BankCalculation { void calculate() { ItemContainer bankInventory = client.getItemContainer(InventoryID.BANK); if (bankInventory == null) { return; } Item[] items = bankInventory.getItems(); int currentTab = client.getVar(Varbits.CURRENT_BANK_TAB); if (currentTab > 0) { int startIndex = 0; for (int i = currentTab - 1; i > 0; i--) { startIndex += client.getVar(TAB_VARBITS.get(i - 1)); } int itemCount = client.getVar(TAB_VARBITS.get(currentTab - 1)); items = Arrays.copyOfRange(items, startIndex, startIndex + itemCount); } if (items.length == 0 || !isBankDifferent(items)) { return; } log.debug("Calculating new bank value..."); gePrice = haPrice = 0; List<Integer> itemIds = new ArrayList<>(); for (Item item : items) { int quantity = item.getQuantity(); if (item.getId() <= 0 || quantity == 0) { continue; } if (item.getId() == COINS_995) { gePrice += quantity; haPrice += quantity; continue; } if (item.getId() == PLATINUM_TOKEN) { gePrice += quantity * 1000L; haPrice += quantity * 1000L; continue; } final ItemComposition itemComposition = itemManager.getItemComposition(item.getId()); if (config.showGE()) { itemIds.add(item.getId()); } if (config.showHA()) { int price = itemComposition.getPrice(); if (price > 0) { haPrice += (long) Math.round(price * HIGH_ALCHEMY_CONSTANT) * (long) quantity; } } } if (config.showGE() && !itemIds.isEmpty()) { for (Item item : items) { int itemId = item.getId(); int quantity = item.getQuantity(); if (itemId <= 0 || quantity == 0 || itemId == ItemID.COINS_995 || itemId == ItemID.PLATINUM_TOKEN) { continue; } gePrice += (long) itemManager.getItemPrice(itemId) * quantity; } } } @Inject  BankCalculation(ItemManager itemManager, BankValueConfig config, Client client);   }### Answer:
@Test public void testCalculate() { when(bankValueConfig.showHA()) .thenReturn(true); Item coins = mock(Item.class); when(coins.getId()) .thenReturn(ItemID.COINS_995); when(coins.getQuantity()) .thenReturn(Integer.MAX_VALUE); Item whip = mock(Item.class); when(whip.getId()) .thenReturn(ItemID.ABYSSAL_WHIP); when(whip.getQuantity()) .thenReturn(1_000_000_000); Item[] items = ImmutableList.of( coins, whip ).toArray(new Item[0]); ItemContainer bankContainer = mock(ItemContainer.class); when(bankContainer.getItems()) .thenReturn(items); when(client.getItemContainer(InventoryID.BANK)) .thenReturn(bankContainer); ItemComposition whipComp = mock(ItemComposition.class); when(whipComp.getId()) .thenReturn(ItemID.ABYSSAL_WHIP); when(whipComp.getPrice()) .thenReturn(7); when(itemManager.getItemComposition(ItemID.ABYSSAL_WHIP)) .thenReturn(whipComp); bankCalculation.calculate(); long value = bankCalculation.getHaPrice(); assertTrue(value > Integer.MAX_VALUE); }