#437 Add email should not allow to change email

- Create separate test for adding email
- Check that no email is yet registered for add email
This commit is contained in:
ljacqu
2016-01-13 22:08:40 +01:00
parent 4042ced5f2
commit 8ed8b32589
5 changed files with 112 additions and 55 deletions
@@ -2,6 +2,7 @@ package fr.xephi.authme.command.executable.email;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.process.Management;
import fr.xephi.authme.util.WrapperMock;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -27,6 +28,7 @@ public class AddEmailCommandTest {
@Before
public void setUpMocks() {
commandService = mock(CommandService.class);
WrapperMock.createInstance();
}
@Test
@@ -51,10 +53,10 @@ public class AddEmailCommandTest {
given(commandService.getManagement()).willReturn(management);
// when
command.executeCommand(sender, Arrays.asList("mail@example", "other_example"), commandService);
command.executeCommand(sender, Arrays.asList("mail@example", "mail@example"), commandService);
// then
verify(management).performAddEmail(sender, "mail@example", "other_example");
verify(management).performAddEmail(sender, "mail@example");
}
}