use of org.sonar.core.user.DefaultUser in project sonarqube by SonarSource.
the class AssignActionTest method should_execute.
@Test
public void should_execute() {
User assignee = new DefaultUser();
Map<String, Object> properties = newHashMap();
properties.put(AssignAction.VERIFIED_ASSIGNEE, assignee);
DefaultIssue issue = mock(DefaultIssue.class);
Action.Context context = mock(Action.Context.class);
when(context.issue()).thenReturn(issue);
action.execute(properties, context);
verify(issueUpdater).assign(eq(issue), eq(assignee), any(IssueChangeContext.class));
}
use of org.sonar.core.user.DefaultUser in project sonarqube by SonarSource.
the class AssignActionTest method should_verify_assignee_exists.
@Test
public void should_verify_assignee_exists() {
String assignee = "arthur";
Map<String, Object> properties = newHashMap();
properties.put("assignee", assignee);
User user = new DefaultUser().setLogin(assignee);
List<DefaultIssue> issues = newArrayList(new DefaultIssue().setKey("ABC"));
when(userFinder.findByLogin(assignee)).thenReturn(user);
assertThat(action.verify(properties, issues, mock(ThreadLocalUserSession.class))).isTrue();
assertThat(properties.get(AssignAction.VERIFIED_ASSIGNEE)).isEqualTo(user);
}
use of org.sonar.core.user.DefaultUser in project sonarqube by SonarSource.
the class IssueFieldsSetterTest method change_assignee.
@Test
public void change_assignee() {
User user = new DefaultUser().setLogin("emmerik").setName("Emmerik");
issue.setAssignee("morgan");
boolean updated = updater.assign(issue, user, context);
assertThat(updated).isTrue();
assertThat(issue.assignee()).isEqualTo("emmerik");
assertThat(issue.mustSendNotifications()).isTrue();
FieldDiffs.Diff diff = issue.currentChange().get(ASSIGNEE);
assertThat(diff.oldValue()).isEqualTo(UNUSED);
assertThat(diff.newValue()).isEqualTo("Emmerik");
}
use of org.sonar.core.user.DefaultUser in project sonarqube by SonarSource.
the class DefaultUserTest method test_email.
@Test
public void test_email() {
DefaultUser user = new DefaultUser();
assertThat(user.email()).isNull();
user.setEmail("");
assertThat(user.email()).isNull();
user.setEmail(" ");
assertThat(user.email()).isNull();
user.setEmail("s@b.com");
assertThat(user.email()).isEqualTo("s@b.com");
}
use of org.sonar.core.user.DefaultUser in project sonarqube by SonarSource.
the class IssueFieldsSetterTest method not_change_assignee.
@Test
public void not_change_assignee() {
User user = new DefaultUser().setLogin("morgan").setName("Morgan");
issue.setAssignee("morgan");
boolean updated = updater.assign(issue, user, context);
assertThat(updated).isFalse();
assertThat(issue.currentChange()).isNull();
assertThat(issue.mustSendNotifications()).isFalse();
}
Aggregations