use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class ActionFinderTest method doest_not_return_assign_to_me_action_when_issue_already_assigned_to_user.
@Test
public void doest_not_return_assign_to_me_action_when_issue_already_assigned_to_user() {
userSession.logIn("julien");
IssueDto issue = newDto(newXooX1().setId(10), newFileDto(project, null), project).setKee(ISSUE_KEY).setAssignee("julien");
assertThat(underTest.listAvailableActions(issue)).doesNotContain("assign_to_me");
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class IssueFinderTest method fail_when_issue_key_does_not_exist.
@Test
public void fail_when_issue_key_does_not_exist() throws Exception {
IssueDto issueDto = insertIssue();
userSession.addProjectUuidPermissions(USER, issueDto.getProjectUuid());
expectedException.expect(NotFoundException.class);
expectedException.expectMessage("Issue with key 'UNKNOWN' does not exist");
underTest.getByKey(db.getSession(), "UNKNOWN");
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class IssueFinderTest method fail_when_not_enough_permission.
@Test
public void fail_when_not_enough_permission() throws Exception {
IssueDto issueDto = insertIssue();
userSession.addProjectUuidPermissions(CODEVIEWER, issueDto.getProjectUuid());
expectedException.expect(ForbiddenException.class);
underTest.getByKey(db.getSession(), issueDto.getKey());
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class IssueUpdaterTest method update_issue.
@Test
public void update_issue() throws Exception {
DefaultIssue issue = issueDbTester.insertIssue(newIssue().setSeverity(MAJOR)).toDefaultIssue();
IssueChangeContext context = IssueChangeContext.createUser(new Date(), "john");
issueFieldsSetter.setSeverity(issue, BLOCKER, context);
underTest.saveIssue(dbTester.getSession(), issue, context, null);
IssueDto issueReloaded = dbClient.issueDao().selectByKey(dbTester.getSession(), issue.key()).get();
assertThat(issueReloaded.getSeverity()).isEqualTo(BLOCKER);
}
use of org.sonar.db.issue.IssueDto in project sonarqube by SonarSource.
the class IssuesFinderSortTest method should_not_sort_with_null_sort.
@Test
public void should_not_sort_with_null_sort() {
IssueDto issue1 = new IssueDto().setId(1L).setAssignee("perceval");
IssueDto issue2 = new IssueDto().setId(2L).setAssignee("arthur");
IssueDto issue3 = new IssueDto().setId(3L).setAssignee("vincent");
IssueDto issue4 = new IssueDto().setId(4L).setAssignee(null);
List<IssueDto> dtoList = newArrayList(issue1, issue2, issue3, issue4);
IssueQuery query = IssueQuery.builder().sort(null).build();
IssuesFinderSort issuesFinderSort = new IssuesFinderSort(dtoList, query);
List<IssueDto> result = newArrayList(issuesFinderSort.sort());
assertThat(result).hasSize(4);
assertThat(result.get(0).getAssignee()).isEqualTo("perceval");
assertThat(result.get(1).getAssignee()).isEqualTo("arthur");
assertThat(result.get(2).getAssignee()).isEqualTo("vincent");
assertThat(result.get(3).getAssignee()).isNull();
}
Aggregations