@Test public void scrollClosedByComponentUuid_does_not_return_closed_issues_without_close_date() { RuleType ruleType = randomSupportedRuleType(); OrganizationDto organization = dbTester.organizations().insert(); ComponentDto component = randomComponent(organization); IssueDto issueWithoutCloseDate = insertNewClosedIssue(component, ruleType, t -> t.setIssueCloseDate(null)); insertToClosedDiff(issueWithoutCloseDate); IssueDto issueCloseDate = insertNewClosedIssue(component, ruleType); IssueChangeDto changeDto = insertToClosedDiff(issueCloseDate); RecorderResultHandler resultHandler = new RecorderResultHandler(); underTest.scrollClosedByComponentUuid(component.uuid(), NO_FILTERING_ON_CLOSE_DATE, resultHandler); assertThat(resultHandler.issues).hasSize(1); IssueDto issue = resultHandler.issues.iterator().next(); assertThat(issue.getKey()).isEqualTo(issue.getKey()); assertThat(issue.getClosedChangeData()).contains(changeDto.getChangeData()); }
@Test public void scrollClosedByComponentUuid_does_not_return_closed_issues_of_type_SECURITY_HOTSPOT() { RuleType ruleType = randomSupportedRuleType(); OrganizationDto organization = dbTester.organizations().insert(); ComponentDto component = randomComponent(organization); IssueDto securityHotspotIssue = insertNewClosedIssue(component, RuleType.SECURITY_HOTSPOT); insertToClosedDiff(securityHotspotIssue); IssueDto issue = insertNewClosedIssue(component, ruleType); IssueChangeDto issueChange = insertToClosedDiff(issue); RecorderResultHandler resultHandler = new RecorderResultHandler(); underTest.scrollClosedByComponentUuid(component.uuid(), NO_FILTERING_ON_CLOSE_DATE, resultHandler); assertThat(resultHandler.issues) .extracting(IssueDto::getKey, t -> t.getClosedChangeData().get()) .containsOnly(tuple(issue.getKey(), issueChange.getChangeData())); }
@Test public void scrollClosedByComponentUuid_returns_closed_issues_without_isHotspot_flag() { RuleType ruleType = randomSupportedRuleType(); OrganizationDto organization = dbTester.organizations().insert(); ComponentDto component = randomComponent(organization); IssueDto noHotspotFlagIssue = insertNewClosedIssue(component, ruleType); IssueChangeDto noFlagIssueChange = insertToClosedDiff(noHotspotFlagIssue); manuallySetToNullFromHotpotsColumn(noHotspotFlagIssue); IssueDto issue = insertNewClosedIssue(component, ruleType); IssueChangeDto issueChange = insertToClosedDiff(issue); RecorderResultHandler resultHandler = new RecorderResultHandler(); underTest.scrollClosedByComponentUuid(component.uuid(), NO_FILTERING_ON_CLOSE_DATE, resultHandler); assertThat(resultHandler.issues) .extracting(IssueDto::getKey, t -> t.getClosedChangeData().get()) .containsOnly( tuple(issue.getKey(), issueChange.getChangeData()), tuple(noHotspotFlagIssue.getKey(), noFlagIssueChange.getChangeData())); }