@Test public void shouldReportUnknownUser() { // given String user = "******"; given(dataSource.getAuth(user)).willReturn(null); CommandSender sender = mock(CommandSender.class); // when command.executeCommand(sender, Collections.singletonList(user)); // then verify(service).send(sender, MessageKey.UNKNOWN_USER); }
@Test public void shouldReturnEmail() { // given String user = "******"; String email = "*****@*****.**"; PlayerAuth auth = mock(PlayerAuth.class); given(auth.getEmail()).willReturn(email); given(dataSource.getAuth(user)).willReturn(auth); CommandSender sender = mock(CommandSender.class); // when command.executeCommand(sender, Collections.singletonList(user)); // then verify(sender).sendMessage(argThat(containsString(email))); }