use of org.sonar.core.issue.FieldDiffs in project sonarqube by SonarSource.
the class ChangelogActionTest method return_many_changelog.
@Test
public void return_many_changelog() {
UserDto user = insertUser();
IssueDto issueDto = insertNewIssue();
userSession.logIn("john").addProjectPermission(USER, project, file);
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setUserUuid(user.getUuid()).setDiff("severity", "MAJOR", "BLOCKER").setCreationDate(new Date()), new FieldDiffs().setDiff("status", "RESOLVED", "CLOSED").setCreationDate(new Date()));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(2);
}
use of org.sonar.core.issue.FieldDiffs in project sonarqube by SonarSource.
the class ChangelogActionTest method changelog_of_file_move_contains_file_names.
@Test
public void changelog_of_file_move_contains_file_names() {
RuleDto rule = db.rules().insertRule(newRuleDto());
ComponentDto project = db.components().insertPrivateProject();
ComponentDto file1 = db.components().insertComponent(newFileDto(project));
ComponentDto file2 = db.components().insertComponent(newFileDto(project));
IssueDto issueDto = db.issues().insertIssue(newDto(rule, file2, project));
userSession.logIn("john").addProjectPermission(USER, project, file);
db.issues().insertFieldDiffs(issueDto, new FieldDiffs().setDiff("file", file1.uuid(), file2.uuid()).setCreationDate(new Date()));
ChangelogWsResponse result = call(issueDto.getKey());
assertThat(result.getChangelogList()).hasSize(1);
assertThat(result.getChangelogList().get(0).hasUser()).isFalse();
assertThat(result.getChangelogList().get(0).getCreationDate()).isNotEmpty();
assertThat(result.getChangelogList().get(0).getDiffsList()).extracting(Diff::getKey, Diff::getOldValue, Diff::getNewValue).containsOnly(tuple("file", file1.longName(), file2.longName()));
}
Aggregations