use of com.cloudogu.scm.review.pullrequest.dto.DisplayedUserDto in project scm-review-plugin by scm-manager.
the class HitEnricher method appendEmbeddedUserForAuthor.
private void appendEmbeddedUserForAuthor(HalAppender appender, Hit hit) {
Hit.Field author = hit.getFields().get("author");
Optional<DisplayUser> displayUser = userDisplayManager.get(((Hit.ValueField) author).getValue().toString());
if (displayUser.isPresent()) {
DisplayUser user = displayUser.get();
appender.appendEmbedded("user", new DisplayedUserDto(user.getId(), user.getDisplayName(), user.getMail()));
}
}
use of com.cloudogu.scm.review.pullrequest.dto.DisplayedUserDto in project scm-review-plugin by scm-manager.
the class HitEnricherTest method shouldEnrichHitWithDisplayUser.
@Test
void shouldEnrichHitWithDisplayUser() {
mockHit(ImmutableMap.of("author", new Hit.ValueField("trillian"), "pullRequestId", new Hit.ValueField("1")));
when(userDisplayManager.get("trillian")).thenReturn(Optional.of(DisplayUser.from(new User("trillian", "Tricia McMillan", "trillian@hitchhiker.org"))));
enricher.enrich(context, appender);
verify(appender, times(1)).appendEmbedded(eq("user"), (DisplayedUserDto) argThat(user -> {
assertThat(((DisplayedUserDto) user).getDisplayName()).isEqualTo("Tricia McMillan");
return true;
}));
}
Aggregations