use of org.sonar.server.issue.notification.NewIssuesNotification.DetailsSupplier in project sonarqube by SonarSource.
the class NotificationFactoryTest method newNewIssuesNotification_DetailsSupplier_getComponentNameByUuid_returns_name_of_project_in_TreeRootHolder.
@Test
public void newNewIssuesNotification_DetailsSupplier_getComponentNameByUuid_returns_name_of_project_in_TreeRootHolder() {
treeRootHolder.setRoot(ReportComponent.builder(PROJECT, 1).setUuid("rootUuid").setName("root").build());
NewIssuesNotification underTest = this.underTest.newNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThat(detailsSupplier.getComponentNameByUuid("rootUuid")).contains("root");
assertThat(detailsSupplier.getComponentNameByUuid("foo")).isEmpty();
}
use of org.sonar.server.issue.notification.NewIssuesNotification.DetailsSupplier in project sonarqube by SonarSource.
the class NotificationFactoryTest method newNewIssuesNotification_DetailsSupplier_getUserNameByUuid_returns_name_of_user_from_map_argument.
@Test
public void newNewIssuesNotification_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());
NewIssuesNotification underTest = this.underTest.newNewIssuesNotification(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.NewIssuesNotification.DetailsSupplier in project sonarqube by SonarSource.
the class NotificationFactoryTest method newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_fails_with_NPE_if_uuid_is_null.
@Test
public void newMyNewIssuesNotification_DetailsSupplier_getUserNameByUuid_fails_with_NPE_if_uuid_is_null() {
MyNewIssuesNotification underTest = this.underTest.newMyNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThatThrownBy(() -> detailsSupplier.getUserNameByUuid(null)).isInstanceOf(NullPointerException.class).hasMessage("uuid can't be null");
}
use of org.sonar.server.issue.notification.NewIssuesNotification.DetailsSupplier in project sonarqube by SonarSource.
the class NotificationFactoryTest method newNewIssuesNotification_DetailsSupplier_getUserNameByUuid_fails_with_NPE_if_uuid_is_null.
@Test
public void newNewIssuesNotification_DetailsSupplier_getUserNameByUuid_fails_with_NPE_if_uuid_is_null() {
NewIssuesNotification underTest = this.underTest.newNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThatThrownBy(() -> detailsSupplier.getUserNameByUuid(null)).isInstanceOf(NullPointerException.class).hasMessage("uuid can't be null");
}
use of org.sonar.server.issue.notification.NewIssuesNotification.DetailsSupplier in project sonarqube by SonarSource.
the class NotificationFactoryTest method newNewIssuesNotification_DetailsSupplier_getUserNameByUuid_always_returns_empty_if_map_argument_is_empty.
@Test
public void newNewIssuesNotification_DetailsSupplier_getUserNameByUuid_always_returns_empty_if_map_argument_is_empty() {
NewIssuesNotification underTest = this.underTest.newNewIssuesNotification(emptyMap());
DetailsSupplier detailsSupplier = readDetailsSupplier(underTest);
assertThat(detailsSupplier.getUserNameByUuid("foo")).isEmpty();
}
Aggregations