use of org.sonar.api.issue.Issue.RESOLUTION_FIXED in project sonarqube by SonarSource.
the class SearchActionTest method returns_hotpots_reviewed_as_fixed_if_status_is_REVIEWED_and_resolution_is_FIXED.
@Test
public void returns_hotpots_reviewed_as_fixed_if_status_is_REVIEWED_and_resolution_is_FIXED() {
ComponentDto project = dbTester.components().insertPublicProject();
userSessionRule.registerComponents(project);
indexPermissions();
ComponentDto file = dbTester.components().insertComponent(newFileDto(project));
List<IssueDto> fixedHotspots = insertRandomNumberOfHotspotsOfAllSupportedStatusesAndResolutions(project, file).filter(t -> STATUS_REVIEWED.equals(t.getStatus()) && RESOLUTION_FIXED.equals(t.getResolution())).collect(toList());
indexIssues();
SearchWsResponse response = newRequest(project, STATUS_REVIEWED, RESOLUTION_FIXED).executeProtobuf(SearchWsResponse.class);
assertThat(response.getHotspotsList()).extracting(SearchWsResponse.Hotspot::getKey).containsExactlyInAnyOrder(fixedHotspots.stream().map(IssueDto::getKey).toArray(String[]::new));
}
use of org.sonar.api.issue.Issue.RESOLUTION_FIXED in project sonarqube by SonarSource.
the class IssueUpdaterTest method verify_notification_with_resolution.
@Test
public void verify_notification_with_resolution() {
UserDto assignee = db.users().insertUser();
RuleDefinitionDto rule = db.rules().insertIssueRule();
ComponentDto project = db.components().insertPublicProject();
ComponentDto file = db.components().insertComponent(newFileDto(project));
DefaultIssue issue = db.issues().insertIssue(rule, project, file, t -> t.setSeverity(MAJOR).setAssigneeUuid(assignee.getUuid())).toDefaultIssue();
UserDto changeAuthor = db.users().insertUser();
IssueChangeContext context = IssueChangeContext.createUser(new Date(), changeAuthor.getUuid());
issueFieldsSetter.setResolution(issue, RESOLUTION_FIXED, context);
underTest.saveIssueAndPreloadSearchResponseData(db.getSession(), issue, context, false);
verify(notificationManager).scheduleForSending(notificationArgumentCaptor.capture());
IssuesChangesNotification issueChangeNotification = notificationArgumentCaptor.getValue();
IssuesChangesNotificationBuilder builder = issuesChangesSerializer.from(issueChangeNotification);
assertThat(builder.getIssues()).hasSize(1);
ChangedIssue changedIssue = builder.getIssues().iterator().next();
assertThat(changedIssue.getKey()).isEqualTo(issue.key());
assertThat(changedIssue.getNewStatus()).isEqualTo(issue.status());
assertThat(changedIssue.getNewResolution()).contains(RESOLUTION_FIXED);
assertThat(changedIssue.getAssignee()).contains(userOf(assignee));
assertThat(changedIssue.getRule()).isEqualTo(ruleOf(rule));
assertThat(changedIssue.getProject()).isEqualTo(projectOf(project));
assertThat(builder.getChange()).isEqualTo(new UserChange(issue.updateDate().getTime(), userOf(changeAuthor)));
}
Aggregations