Search in sources :

Example 16 with EmailRecipient

use of org.sonar.server.notification.NotificationManager.EmailRecipient in project sonarqube by SonarSource.

the class EmailRecipientTest method constructor_fails_with_NPE_if_login_is_null.

@Test
public void constructor_fails_with_NPE_if_login_is_null() {
    String email = randomAlphabetic(12);
    assertThatThrownBy(() -> new EmailRecipient(null, email)).isInstanceOf(NullPointerException.class).hasMessage("login can't be null");
}
Also used : EmailRecipient(org.sonar.server.notification.NotificationManager.EmailRecipient) Test(org.junit.Test)

Example 17 with EmailRecipient

use of org.sonar.server.notification.NotificationManager.EmailRecipient in project sonarqube by SonarSource.

the class EmailRecipientTest method hashcode_is_based_on_login_and_email.

@Test
public void hashcode_is_based_on_login_and_email() {
    String login = randomAlphabetic(11);
    String email = randomAlphabetic(12);
    EmailRecipient underTest = new EmailRecipient(login, email);
    assertThat(underTest.hashCode()).isEqualTo(new EmailRecipient(login, email).hashCode()).isNotEqualTo(new Object().hashCode()).isNotEqualTo(new EmailRecipient(email, login).hashCode()).isNotEqualTo(new EmailRecipient(randomAlphabetic(5), email).hashCode()).isNotEqualTo(new EmailRecipient(login, randomAlphabetic(5)).hashCode()).isNotEqualTo(new EmailRecipient(randomAlphabetic(5), randomAlphabetic(6)).hashCode());
}
Also used : EmailRecipient(org.sonar.server.notification.NotificationManager.EmailRecipient) Test(org.junit.Test)

Example 18 with EmailRecipient

use of org.sonar.server.notification.NotificationManager.EmailRecipient in project sonarqube by SonarSource.

the class EmailRecipientTest method verify_to_String.

@Test
public void verify_to_String() {
    String login = randomAlphabetic(11);
    String email = randomAlphabetic(12);
    assertThat(new EmailRecipient(login, email).toString()).isEqualTo("EmailRecipient{'" + login + "':'" + email + "'}");
}
Also used : EmailRecipient(org.sonar.server.notification.NotificationManager.EmailRecipient) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)18 EmailRecipient (org.sonar.server.notification.NotificationManager.EmailRecipient)18 Collections (java.util.Collections)9 Random (java.util.Random)9 Set (java.util.Set)9 Collectors (java.util.stream.Collectors)9 IntStream (java.util.stream.IntStream)9 RandomStringUtils.randomAlphabetic (org.apache.commons.lang.RandomStringUtils.randomAlphabetic)9 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)9 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)9 Mockito.mock (org.mockito.Mockito.mock)9 Mockito.verify (org.mockito.Mockito.verify)9 Mockito.when (org.mockito.Mockito.when)9 SubscriberPermissionsOnProject (org.sonar.server.notification.NotificationManager.SubscriberPermissionsOnProject)9 DbSession (org.sonar.db.DbSession)6 ImmutableSet (com.google.common.collect.ImmutableSet)5 Multimap (com.google.common.collect.Multimap)5 Sets.newHashSet (com.google.common.collect.Sets.newHashSet)5 InvalidClassException (java.io.InvalidClassException)5 Arrays (java.util.Arrays)5