### Question:
GrandExchangeOfferSlot extends JPanel { void updateOffer(ItemComposition offerItem, BufferedImage itemImage, @Nullable GrandExchangeOffer newOffer) { if (newOffer == null || newOffer.getState() == EMPTY) { return; } else { cardLayout.show(container, FACE_CARD); itemName.setText(offerItem.getName()); itemIcon.setIcon(new ImageIcon(itemImage)); boolean buying = newOffer.getState() == GrandExchangeOfferState.BOUGHT || newOffer.getState() == GrandExchangeOfferState.BUYING || newOffer.getState() == GrandExchangeOfferState.CANCELLED_BUY; String offerState = (buying ? "Bought " : "Sold ") + StackFormatter.quantityToRSDecimalStack(newOffer.getQuantitySold()) + " / " + StackFormatter.quantityToRSDecimalStack(newOffer.getTotalQuantity()); offerInfo.setText(offerState); itemPrice.setText(htmlLabel("Price each: ", StackFormatter.formatNumber(newOffer.getPrice()))); String action = buying ? "Spent: " : "Received: "; offerSpent.setText(htmlLabel(action, StackFormatter.formatNumber(newOffer.getSpent()) + " / " + StackFormatter.formatNumber(newOffer.getPrice() * newOffer.getTotalQuantity()))); progressBar.setForeground(getProgressColor(newOffer)); progressBar.setMaximumValue(newOffer.getTotalQuantity()); progressBar.setValue(newOffer.getQuantitySold()); for (Component c : container.getComponents()) { if (c instanceof JPanel) { JPanel panel = (JPanel) c; panel.setToolTipText(htmlTooltip(((int) progressBar.getPercentage()) + "%")); } } } revalidate(); 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); }