Move most API of CommandParts to util classes
Gradual transition to removing CommandParts altogether. - Move logic from CommandParts to utils classes
This commit is contained in:
@@ -11,6 +11,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -40,7 +41,7 @@ public class AddEmailCommandTest {
|
||||
AddEmailCommand command = new AddEmailCommand();
|
||||
|
||||
// when
|
||||
command.executeCommand(sender, new CommandParts(), new CommandParts());
|
||||
command.executeCommand(sender, newParts(), newParts());
|
||||
|
||||
// then
|
||||
verify(authMeMock, never()).getManagement();
|
||||
@@ -53,11 +54,15 @@ public class AddEmailCommandTest {
|
||||
AddEmailCommand command = new AddEmailCommand();
|
||||
|
||||
// when
|
||||
command.executeCommand(sender, new CommandParts(),
|
||||
command.executeCommand(sender, newParts(),
|
||||
new CommandParts(Arrays.asList("mail@example", "other_example")));
|
||||
|
||||
// then
|
||||
verify(authMeMock).getManagement();
|
||||
verify(managementMock).performAddEmail(sender, "mail@example", "other_example");
|
||||
}
|
||||
|
||||
private static CommandParts newParts() {
|
||||
return new CommandParts(new ArrayList<String>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.mockito.Mockito.never;
|
||||
@@ -40,7 +41,7 @@ public class ChangeEmailCommandTest {
|
||||
ChangeEmailCommand command = new ChangeEmailCommand();
|
||||
|
||||
// when
|
||||
command.executeCommand(sender, new CommandParts(), new CommandParts());
|
||||
command.executeCommand(sender, newParts(), newParts());
|
||||
|
||||
// then
|
||||
verify(authMeMock, never()).getManagement();
|
||||
@@ -53,11 +54,15 @@ public class ChangeEmailCommandTest {
|
||||
ChangeEmailCommand command = new ChangeEmailCommand();
|
||||
|
||||
// when
|
||||
command.executeCommand(sender, new CommandParts(),
|
||||
command.executeCommand(sender, newParts(),
|
||||
new CommandParts(Arrays.asList("new.mail@example.org", "old_mail@example.org")));
|
||||
|
||||
// then
|
||||
verify(authMeMock).getManagement();
|
||||
verify(managementMock).performChangeEmail(sender, "new.mail@example.org", "old_mail@example.org");
|
||||
}
|
||||
|
||||
private static CommandParts newParts() {
|
||||
return new CommandParts(new ArrayList<String>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Test for {@link RecoverEmailCommand}.
|
||||
*/
|
||||
@@ -27,7 +29,7 @@ public class RecoverEmailCommandTest {
|
||||
RecoverEmailCommand command = new RecoverEmailCommand();
|
||||
|
||||
// when
|
||||
command.executeCommand(sender, new CommandParts(), new CommandParts());
|
||||
command.executeCommand(sender, new CommandParts(Collections.EMPTY_LIST), new CommandParts(Collections.EMPTY_LIST));
|
||||
|
||||
// then
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user