Search in sources :

Example 26 with AnalysisChange

use of org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange in project sonarqube by SonarSource.

the class IssuesChangesNotificationBuilderTest method AnalysisChange_not_equal_with_Object.

@Test
public void AnalysisChange_not_equal_with_Object() {
    AnalysisChange analysisChange1 = new AnalysisChange(1_000_000_000L);
    assertThat(analysisChange1).isNotEqualTo(new Object());
}
Also used : AnalysisChange(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange) Test(org.junit.Test)

Example 27 with AnalysisChange

use of org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange in project sonarqube by SonarSource.

the class IssuesChangesNotificationBuilderTest method AnalysisChange_isAuthorLogin.

@Test
public void AnalysisChange_isAuthorLogin() {
    AnalysisChange analysisChange1 = new AnalysisChange(1_000_000_000L);
    assertThat(analysisChange1.isAuthorLogin("login")).isFalse();
}
Also used : AnalysisChange(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange) Test(org.junit.Test)

Example 28 with AnalysisChange

use of org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange in project sonarqube by SonarSource.

the class ChangesOnMyIssuesNotificationTest method hashcode_is_based_on_change_and_issues.

@Test
public void hashcode_is_based_on_change_and_issues() {
    AnalysisChange analysisChange = new AnalysisChange(new Random().nextLong());
    ChangedIssue changedIssue = IssuesChangesNotificationBuilderTesting.newChangedIssue("doo", IssuesChangesNotificationBuilderTesting.newProject("prj"), newRandomNotAHotspotRule("rul"));
    ChangesOnMyIssuesNotification underTest = new ChangesOnMyIssuesNotification(analysisChange, ImmutableSet.of(changedIssue));
    assertThat(underTest.hashCode()).isEqualTo(new ChangesOnMyIssuesNotification(analysisChange, ImmutableSet.of(changedIssue)).hashCode()).isNotEqualTo(mock(Notification.class).hashCode()).isNotEqualTo(new ChangesOnMyIssuesNotification(new AnalysisChange(analysisChange.getDate() + 10), ImmutableSet.of(changedIssue)).hashCode()).isNotEqualTo(new ChangesOnMyIssuesNotification(analysisChange, ImmutableSet.of())).hashCode();
}
Also used : Random(java.util.Random) ChangedIssue(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.ChangedIssue) AnalysisChange(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange) Notification(org.sonar.api.notifications.Notification) Test(org.junit.Test)

Example 29 with AnalysisChange

use of org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange in project sonarqube by SonarSource.

the class FpOrWontFixEmailTemplateTest method fpOrWontFixValuesByUserOrAnalysisChange.

@DataProvider
public static Object[][] fpOrWontFixValuesByUserOrAnalysisChange() {
    AnalysisChange analysisChange = new AnalysisChange(new Random().nextLong());
    UserChange userChange = new UserChange(new Random().nextLong(), new User(randomAlphabetic(5), randomAlphabetic(6), new Random().nextBoolean() ? null : randomAlphabetic(7)));
    return new Object[][] { { analysisChange, FP }, { analysisChange, WONT_FIX }, { userChange, FP }, { userChange, WONT_FIX } };
}
Also used : UserChange(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.UserChange) User(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.User) Random(java.util.Random) AnalysisChange(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Example 30 with AnalysisChange

use of org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange in project sonarqube by SonarSource.

the class FpOrWontFixEmailTemplateTest method userOrAnalysisChange.

@DataProvider
public static Object[][] userOrAnalysisChange() {
    AnalysisChange analysisChange = new AnalysisChange(new Random().nextLong());
    UserChange userChange = new UserChange(new Random().nextLong(), new User(randomAlphabetic(5), randomAlphabetic(6), new Random().nextBoolean() ? null : randomAlphabetic(7)));
    return new Object[][] { { analysisChange }, { userChange } };
}
Also used : UserChange(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.UserChange) User(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.User) Random(java.util.Random) AnalysisChange(org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Aggregations

AnalysisChange (org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.AnalysisChange)31 Test (org.junit.Test)28 ChangedIssue (org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.ChangedIssue)19 Random (java.util.Random)17 Project (org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.Project)16 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)15 IssuesChangesNotificationBuilderTesting.newAnalysisChange (org.sonar.server.issue.notification.IssuesChangesNotificationBuilderTesting.newAnalysisChange)15 Set (java.util.Set)14 DataProvider (com.tngtech.java.junit.dataprovider.DataProvider)13 Collections (java.util.Collections)13 IntStream (java.util.stream.IntStream)13 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)13 Rule (org.sonar.server.issue.notification.IssuesChangesNotificationBuilder.Rule)13 ImmutableSet (com.google.common.collect.ImmutableSet)12 IssuesChangesNotificationBuilderTesting.newRandomNotAHotspotRule (org.sonar.server.issue.notification.IssuesChangesNotificationBuilderTesting.newRandomNotAHotspotRule)12 DataProviderRunner (com.tngtech.java.junit.dataprovider.DataProviderRunner)11 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)11 RunWith (org.junit.runner.RunWith)11 Notification (org.sonar.api.notifications.Notification)11 RuleType (org.sonar.api.rules.RuleType)11