BankPlugin extends Plugin { @Nullable ContainerPrices calculate(@Nullable Item[] items) { if (items == null) { return null; } long ge = 0; long alch = 0; for (final Item item : items) { final int qty = item.getQuantity(); final int id = item.getId(); if (id <= 0 || qty == 0) { continue; } alch += (long) getHaPrice(id) * qty; ge += (long) itemManager.getItemPrice(id) * qty; } return new ContainerPrices(ge, alch); }  @Subscribe void onMenuShouldLeftClick(MenuShouldLeftClick event); @Subscribe void onMenuEntryAdded(MenuEntryAdded event); @Subscribe void onScriptCallbackEvent(ScriptCallbackEvent event); @Subscribe void onWidgetLoaded(WidgetLoaded event); @Subscribe void onScriptPostFired(ScriptPostFired event); @Subscribe void onItemContainerChanged(ItemContainerChanged event);  }
@Test public void testCalculate() { Item coins = new Item(ItemID.COINS_995, Integer.MAX_VALUE); Item whip = new Item(ItemID.ABYSSAL_WHIP, 1_000_000_000); Item[] items = ImmutableList.of( coins, whip ).toArray(new Item[0]); ItemComposition whipComp = mock(ItemComposition.class); when(whipComp.getHaPrice()) .thenReturn(4); when(itemManager.getItemComposition(ItemID.ABYSSAL_WHIP)) .thenReturn(whipComp); when(itemManager.getItemPrice(ItemID.ABYSSAL_WHIP)) .thenReturn(3); final ContainerPrices prices = bankPlugin.calculate(items); assertNotNull(prices); assertTrue(prices.getHighAlchPrice() > Integer.MAX_VALUE); assertTrue(prices.getGePrice() > Integer.MAX_VALUE); }