Search in sources :

Example 6 with DefaultUser

use of org.sonar.core.user.DefaultUser in project sonarqube by SonarSource.

the class IssueFieldsSetterTest method assign.

@Test
public void assign() {
    User user = new DefaultUser().setLogin("emmerik").setName("Emmerik");
    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");
}
Also used : DefaultUser(org.sonar.core.user.DefaultUser) User(org.sonar.api.user.User) DefaultUser(org.sonar.core.user.DefaultUser) FieldDiffs(org.sonar.core.issue.FieldDiffs) Test(org.junit.Test)

Example 7 with DefaultUser

use of org.sonar.core.user.DefaultUser in project sonarqube by SonarSource.

the class DefaultUserTest method test_object_methods.

@Test
public void test_object_methods() throws Exception {
    DefaultUser john = new DefaultUser().setLogin("john").setName("John");
    DefaultUser eric = new DefaultUser().setLogin("eric").setName("Eric");
    assertThat(john).isEqualTo(john);
    assertThat(john).isNotEqualTo(eric);
    assertThat(john.hashCode()).isEqualTo(john.hashCode());
    assertThat(john.toString()).contains("login=john").contains("name=John");
}
Also used : DefaultUser(org.sonar.core.user.DefaultUser) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 DefaultUser (org.sonar.core.user.DefaultUser)7 User (org.sonar.api.user.User)5 DefaultIssue (org.sonar.core.issue.DefaultIssue)2 FieldDiffs (org.sonar.core.issue.FieldDiffs)2 IssueChangeContext (org.sonar.core.issue.IssueChangeContext)1 ThreadLocalUserSession (org.sonar.server.user.ThreadLocalUserSession)1