Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events: align field names to model #6771

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ default Optional<String> getAuthor() {
*/
@Value.Derived
@JsonIgnore
default Optional<String> getSignOff() {
return getSignOffs().stream().findFirst();
default Optional<String> getSignedOffBy() {
return getAllSignedOffBy().stream().findFirst();
}

/** The commit sign-offs. */
List<String> getSignOffs();
List<String> getAllSignedOffBy();

/** The commit message. */
String getMessage();
Expand All @@ -70,11 +70,11 @@ default Optional<String> getSignOff() {
@Value.Lazy
@JsonIgnore
default Map<String, String> getProperties() {
return getMultiProperties().entrySet().stream()
return getAllProperties().entrySet().stream()
.filter(e -> !e.getValue().isEmpty())
.collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().get(0)));
}

/** Multivalued properties of this commit. */
Map<String, List<String>> getMultiProperties();
Map<String, List<String>> getAllProperties();
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ void getAuthor() {

@Test
void getSignOff() {
CommitMeta commitMeta = builder().addSignOffs("signOff1", "signOff2").build();
assertThat(commitMeta.getSignOffs()).containsExactly("signOff1", "signOff2");
assertThat(commitMeta.getSignOff()).contains("signOff1");
CommitMeta commitMeta = builder().addAllSignedOffBy("signOff1", "signOff2").build();
assertThat(commitMeta.getAllSignedOffBy()).containsExactly("signOff1", "signOff2");
assertThat(commitMeta.getSignedOffBy()).contains("signOff1");
}

@Test
void getProperties() {
CommitMeta commitMeta =
builder()
.putMultiProperty("key1", Arrays.asList("value1a", "value1b"))
.putMultiProperty("key2", Collections.singletonList("value2a"))
.putAllProperty("key1", Arrays.asList("value1a", "value1b"))
.putAllProperty("key2", Collections.singletonList("value2a"))
.build();
assertThat(commitMeta.getProperties())
.containsOnly(entry("key1", "value1a"), entry("key2", "value2a"));
Expand Down