### Question:
ItemChargePlugin extends Plugin { @Subscribe public void onChatMessage(ChatMessage event) { String message = event.getMessage(); Matcher dodgyCheckMatcher = DODGY_CHECK_PATTERN.matcher(message); Matcher dodgyProtectMatcher = DODGY_PROTECT_PATTERN.matcher(message); Matcher dodgyBreakMatcher = DODGY_BREAK_PATTERN.matcher(message); if (event.getType() == ChatMessageType.SERVER || event.getType() == ChatMessageType.FILTERED) { if (config.recoilNotification() && message.contains(RING_OF_RECOIL_BREAK_MESSAGE)) { notifier.notify("Your Ring of Recoil has shattered"); } else if (dodgyBreakMatcher.find()) { if (config.dodgyNotification()) { notifier.notify("Your dodgy necklace has crumbled to dust."); } updateDodgyNecklaceCharges(MAX_DODGY_CHARGES); } else if (dodgyCheckMatcher.find()) { updateDodgyNecklaceCharges(Integer.parseInt(dodgyCheckMatcher.group(1))); } else if (dodgyProtectMatcher.find()) { updateDodgyNecklaceCharges(Integer.parseInt(dodgyProtectMatcher.group(1))); } } }  @Subscribe void onConfigChanged(ConfigChanged event); @Subscribe void onChatMessage(ChatMessage event); @Subscribe void onItemContainerChanged(ItemContainerChanged event);  }### Answer:
@Test public void testOnChatMessage() { ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", CHECK, "", 0); itemChargePlugin.onChatMessage(chatMessage); verify(config).dodgyNecklace(eq(10)); reset(config); chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", PROTECT, "", 0); itemChargePlugin.onChatMessage(chatMessage); verify(config).dodgyNecklace(eq(9)); reset(config); chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", PROTECT_1, "", 0); itemChargePlugin.onChatMessage(chatMessage); verify(config).dodgyNecklace(eq(1)); reset(config); chatMessage = new ChatMessage(null, ChatMessageType.SERVER, "", BREAK, "", 0); itemChargePlugin.onChatMessage(chatMessage); verify(config).dodgyNecklace(eq(10)); reset(config); }