@@ -0,0 +1,1732 @@
+package org.apollo.game.message.handler;%0A%0Aimport org.apollo.cache.def.ItemDefinition;%0Aimport org.apollo.game.message.impl.ItemOnItemMessage;%0Aimport org.apollo.game.model.Item;%0Aimport org.apollo.game.model.World;%0Aimport org.apollo.game.model.entity.Player;%0Aimport org.apollo.game.model.inter.bank.BankConstants;%0Aimport org.apollo.game.model.inv.Inventory;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mockito;%0Aimport org.powermock.api.mockito.PowerMockito;%0Aimport org.powermock.core.classloader.annotations.PrepareForTest;%0Aimport org.powermock.modules.junit4.PowerMockRunner;%0A%0Aimport static org.junit.Assert.assertTrue;%0A%0A@RunWith(PowerMockRunner.class)%0A@PrepareForTest(%7BPlayer.class, ItemDefinition.class%7D)%0Apublic class ItemOnItemVerificationHandlerTest %7B%0A%0A%09private ItemOnItemVerificationHandler verificationHandler = new ItemOnItemVerificationHandler(new World());%0A%0A%09@BeforeClass%0A%09public static void setupTestItemDefinitions() %7B%0A%09%09PowerMockito.mockStatic(ItemDefinition.class);%0A%09%09Mockito.when(ItemDefinition.lookup(4151)).thenReturn(new ItemDefinition(4151));%0A%09%7D%0A%0A%09@Test%0A%09public void testTerminateWithNoSourceItem() throws Exception %7B%0A%09%09Player player = PowerMockito.mock(Player.class);%0A%09%09Inventory inventory = new Inventory(28);%0A%09%09inventory.set(1, new Item(4151, 1));%0A%0A%09%09Mockito.when(player.getInventory()).thenReturn(inventory);%0A%0A%09%09ItemOnItemMessage itemOnItemMessage = new ItemOnItemMessage(BankConstants.SIDEBAR_INVENTORY_ID, 500, 1,%0A%09%09%09%09BankConstants.SIDEBAR_INVENTORY_ID, 4151, 1);%0A%0A%09%09verificationHandler.handle(player, itemOnItemMessage);%0A%0A%09%09assertTrue(%22ItemOnItemVerificationHandler: failed checking source item / slot exists%22, itemOnItemMessage.terminated());%0A%09%7D%0A%7D

Test messages with an invalid source are terminated