use of org.sonar.server.issue.notification.FPOrWontFixNotification.FpOrWontFix.WONT_FIX in project sonarqube by SonarSource.
the class FPOrWontFixNotificationTest method hashcode_is_based_on_issues_change_and_resolution.
@Test
public void hashcode_is_based_on_issues_change_and_resolution() {
Rule rule = newRandomNotAHotspotRule("rule_name");
Project project = new Project.Builder("prj_uuid").setKey("prj_key").setProjectName("prj_name").build();
Set<ChangedIssue> changedIssues = IntStream.range(0, 2 + new Random().nextInt(5)).mapToObj(i -> new ChangedIssue.Builder("key_" + i).setNewStatus("status").setRule(rule).setProject(project).build()).collect(Collectors.toSet());
AnalysisChange change = new AnalysisChange(12);
User user = new User("uuid", "login", null);
FPOrWontFixNotification underTest = new FPOrWontFixNotification(change, changedIssues, WONT_FIX);
assertThat(underTest.hashCode()).isEqualTo(new FPOrWontFixNotification(change, changedIssues, WONT_FIX).hashCode()).isEqualTo(new FPOrWontFixNotification(change, ImmutableSet.copyOf(changedIssues), WONT_FIX).hashCode()).isNotEqualTo(new Object().hashCode()).isNotEqualTo(new FPOrWontFixNotification(change, Collections.emptySet(), WONT_FIX).hashCode()).isNotEqualTo(new FPOrWontFixNotification(change, ImmutableSet.of(changedIssues.iterator().next()), WONT_FIX).hashCode()).isNotEqualTo(new FPOrWontFixNotification(new AnalysisChange(14), changedIssues, WONT_FIX).hashCode()).isNotEqualTo(new FPOrWontFixNotification(new IssuesChangesNotificationBuilder.UserChange(12, user), changedIssues, WONT_FIX).hashCode()).isNotEqualTo(new FPOrWontFixNotification(change, changedIssues, FP)).hashCode();
}
use of org.sonar.server.issue.notification.FPOrWontFixNotification.FpOrWontFix.WONT_FIX in project sonarqube by SonarSource.
the class FPOrWontFixNotificationTest method equals_is_based_on_issues_change_and_resolution.
@Test
public void equals_is_based_on_issues_change_and_resolution() {
Rule rule = newRandomNotAHotspotRule("rule_name");
Project project = new Project.Builder("prj_uuid").setKey("prj_key").setProjectName("prj_name").build();
Set<ChangedIssue> changedIssues = IntStream.range(0, 2 + new Random().nextInt(5)).mapToObj(i -> new ChangedIssue.Builder("key_" + i).setNewStatus("status").setRule(rule).setProject(project).build()).collect(Collectors.toSet());
AnalysisChange change = new AnalysisChange(12);
User user = new User("uuid", "login", null);
FPOrWontFixNotification underTest = new FPOrWontFixNotification(change, changedIssues, WONT_FIX);
assertThat(underTest).isEqualTo(new FPOrWontFixNotification(change, changedIssues, WONT_FIX)).isEqualTo(new FPOrWontFixNotification(change, ImmutableSet.copyOf(changedIssues), WONT_FIX)).isNotEqualTo(new Object()).isNotNull().isNotEqualTo(new FPOrWontFixNotification(change, Collections.emptySet(), WONT_FIX)).isNotEqualTo(new FPOrWontFixNotification(change, ImmutableSet.of(changedIssues.iterator().next()), WONT_FIX)).isNotEqualTo(new FPOrWontFixNotification(new AnalysisChange(14), changedIssues, WONT_FIX)).isNotEqualTo(new FPOrWontFixNotification(new IssuesChangesNotificationBuilder.UserChange(12, user), changedIssues, WONT_FIX)).isNotEqualTo(new FPOrWontFixNotification(change, changedIssues, FP));
}
Aggregations