use of org.sonar.server.issue.notification.MyNewIssuesNotification in project sonarqube by SonarSource.
the class NotificationFactoryTest method newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_returns_empty_if_user_has_null_name.
@Test
public void newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_returns_empty_if_user_has_null_name() {
UserDto user = UserTesting.newUserDto().setLogin("user_noname").setName(null);
MyNewIssuesNotification underTest = this.underTest.newMyNewIssuesNotification(ImmutableMap.of(user.getUuid(), user));
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThat(detailsSupplier.getUserNameByUuid(user.getUuid())).isEmpty();
}
use of org.sonar.server.issue.notification.MyNewIssuesNotification in project sonarqube by SonarSource.
the class NotificationFactoryTest method newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_returns_name_of_user_from_map_argument.
@Test
public void newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_returns_name_of_user_from_map_argument() {
Set<UserDto> users = IntStream.range(0, 1 + new Random().nextInt(10)).mapToObj(i -> UserTesting.newUserDto().setLogin("user" + i)).collect(Collectors.toSet());
MyNewIssuesNotification underTest = this.underTest.newMyNewIssuesNotification(users.stream().collect(uniqueIndex(UserDto::getUuid)));
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThat(detailsSupplier.getUserNameByUuid("foo")).isEmpty();
users.forEach(user -> assertThat(detailsSupplier.getUserNameByUuid(user.getUuid())).contains(user.getName()));
}
use of org.sonar.server.issue.notification.MyNewIssuesNotification in project sonarqube by SonarSource.
the class NotificationFactoryTest method newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_always_returns_empty_if_map_argument_is_empty.
@Test
public void newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_always_returns_empty_if_map_argument_is_empty() {
MyNewIssuesNotification underTest = this.underTest.newMyNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThat(detailsSupplier.getUserNameByUuid("foo")).isEmpty();
}
use of org.sonar.server.issue.notification.MyNewIssuesNotification in project sonarqube by SonarSource.
the class NotificationFactoryTest method newMyNewIssuesNotification_DetailsSupplier_getComponentNameByUuid_fails_with_NPE_if_uuid_is_null.
@Test
public void newMyNewIssuesNotification_DetailsSupplier_getComponentNameByUuid_fails_with_NPE_if_uuid_is_null() {
treeRootHolder.setRoot(ReportComponent.builder(PROJECT, 1).setUuid("rootUuid").setName("root").build());
MyNewIssuesNotification underTest = this.underTest.newMyNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThatThrownBy(() -> detailsSupplier.getComponentNameByUuid(null)).isInstanceOf(NullPointerException.class).hasMessage("uuid can't be null");
}
use of org.sonar.server.issue.notification.MyNewIssuesNotification in project sonarqube by SonarSource.
the class NotificationFactoryTest method newMyNewIssuesNotification_DetailsSupplier_getRuleDefinitionByRuleKey_fails_with_NPE_if_ruleKey_is_null.
@Test
public void newMyNewIssuesNotification_DetailsSupplier_getRuleDefinitionByRuleKey_fails_with_NPE_if_ruleKey_is_null() {
MyNewIssuesNotification underTest = this.underTest.newMyNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThatThrownBy(() -> detailsSupplier.getRuleDefinitionByRuleKey(null)).isInstanceOf(NullPointerException.class).hasMessage("ruleKey can't be null");
}
Aggregations