@Test public void whenTargetIsIgnoring() { IgnoreRepository ignoreRepository = mock(IgnoreRepository.class); CheckTarget checkTarget = new CheckTarget(ignoreRepository, mock(FinalStage.class)); PlayerProfile targetProfile = mock(PlayerProfile.class); UUID targetProfileUUID = UUID.randomUUID(); when(targetProfile.getUuid()).thenReturn(targetProfileUUID); PrivateMessage privateMessage = new PrivateMessage(UUID.randomUUID(), "to", "text", "fromName"); when(ignoreRepository.isIgnoring(eq(targetProfileUUID), eq(privateMessage.getFromName()))).thenReturn(true); Assert.assertEquals(MessageSendResponse.IGNORING, checkTarget.checkTargetAndSend(targetProfile, privateMessage, "proxy")); }
public MessageSendResponse checkTargetAndSend(PlayerProfile targetProfile, PrivateMessage privateMessage, String targetProxy) { if (ignoreRepository.isIgnoring(targetProfile.getUuid(), privateMessage.getFromName())) { return MessageSendResponse.IGNORING; } else if (!targetProfile.getPlayerPreferences().isPrivateMessages()) { return MessageSendResponse.DISABLED; } else { return finalStage.sendFinalStage(targetProfile, privateMessage, targetProxy); } }
CheckTarget { public MessageSendResponse checkTargetAndSend(PlayerProfile targetProfile, PrivateMessage privateMessage, String targetProxy) { if (ignoreRepository.isIgnoring(targetProfile.getUuid(), privateMessage.getFromName())) { return MessageSendResponse.IGNORING; } else if (!targetProfile.getPlayerPreferences().isPrivateMessages()) { return MessageSendResponse.DISABLED; } else { return finalStage.sendFinalStage(targetProfile, privateMessage, targetProxy); } } }
CheckTarget { public MessageSendResponse checkTargetAndSend(PlayerProfile targetProfile, PrivateMessage privateMessage, String targetProxy) { if (ignoreRepository.isIgnoring(targetProfile.getUuid(), privateMessage.getFromName())) { return MessageSendResponse.IGNORING; } else if (!targetProfile.getPlayerPreferences().isPrivateMessages()) { return MessageSendResponse.DISABLED; } else { return finalStage.sendFinalStage(targetProfile, privateMessage, targetProxy); } }  }
CheckTarget { public MessageSendResponse checkTargetAndSend(PlayerProfile targetProfile, PrivateMessage privateMessage, String targetProxy) { if (ignoreRepository.isIgnoring(targetProfile.getUuid(), privateMessage.getFromName())) { return MessageSendResponse.IGNORING; } else if (!targetProfile.getPlayerPreferences().isPrivateMessages()) { return MessageSendResponse.DISABLED; } else { return finalStage.sendFinalStage(targetProfile, privateMessage, targetProxy); } }  MessageSendResponse checkTargetAndSend(PlayerProfile targetProfile, PrivateMessage privateMessage, String targetProxy); }
CheckTarget { public MessageSendResponse checkTargetAndSend(PlayerProfile targetProfile, PrivateMessage privateMessage, String targetProxy) { if (ignoreRepository.isIgnoring(targetProfile.getUuid(), privateMessage.getFromName())) { return MessageSendResponse.IGNORING; } else if (!targetProfile.getPlayerPreferences().isPrivateMessages()) { return MessageSendResponse.DISABLED; } else { return finalStage.sendFinalStage(targetProfile, privateMessage, targetProxy); } }  MessageSendResponse checkTargetAndSend(PlayerProfile targetProfile, PrivateMessage privateMessage, String targetProxy);  }