### Question:
GrandExchangeOfferSlot extends JPanel { void updateOffer(ItemComposition offerItem, BufferedImage itemImage, @Nullable GrandExchangeOffer newOffer) { if (newOffer == null || newOffer.getState() == EMPTY) { cardLayout.show(this, EMPTY_CARD); itemName.setTitle("Nothing"); } else { cardLayout.show(this, INFO_CARD); itemName.setTitle(offerItem.getName()); boolean shouldStack = offerItem.isStackable() || newOffer.getTotalQuantity() > 1; ImageIcon newItemIcon = new ImageIcon(itemImage); itemIcon.setIcon(newItemIcon); offerState.setText(getNameForState(newOffer.getState()) + " at " + StackFormatter.formatNumber(newOffer.getState() == GrandExchangeOfferState.BOUGHT ? (newOffer.getSpent() / newOffer.getTotalQuantity()) : newOffer.getPrice()) + (newOffer.getTotalQuantity() > 1 ? " gp ea" : " gp")); progressBar.setMaximum(newOffer.getTotalQuantity()); progressBar.setValue(newOffer.getQuantitySold()); progressBar.setBackground(getColorForState(newOffer.getState())); progressBar.setString(newOffer.getQuantitySold() + "/" + newOffer.getTotalQuantity()); } repaint(); } GrandExchangeOfferSlot();   }### Answer:
@Test public void testUpdateOffer() { when(offer.getState()).thenReturn(GrandExchangeOfferState.CANCELLED_BUY); GrandExchangeOfferSlot offerSlot = new GrandExchangeOfferSlot(); offerSlot.updateOffer(mock(ItemComposition.class), mock(AsyncBufferedImage.class), offer); }