Skip to content

Commit 8c17971

Browse files
committed
parse nodeId to PullRequestItem
1 parent 03f6e0f commit 8c17971

File tree

3 files changed

+57
-3
lines changed

3 files changed

+57
-3
lines changed

src/main/java/com/spotify/github/v3/prs/PullRequestItem.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
* Licensed under the Apache License, Version 2.0 (the "License");
88
* you may not use this file except in compliance with the License.
99
* You may obtain a copy of the License at
10-
*
10+
*
1111
* http://www.apache.org/licenses/LICENSE-2.0
12-
*
12+
*
1313
* Unless required by applicable law or agreed to in writing, software
1414
* distributed under the License is distributed on an "AS IS" BASIS,
1515
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -122,6 +122,12 @@ public interface PullRequestItem extends PartialPullRequestItem {
122122
@JsonProperty("requested_teams")
123123
List<User> requestedTeams();
124124

125-
/** @Deprecated the merge commit sha. */
125+
/**
126+
* @Deprecated the merge commit sha.
127+
*/
126128
Optional<String> mergeCommitSha();
129+
130+
/** Node ID. */
131+
@Nullable
132+
String nodeId();
127133
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*-
2+
* -\-\-
3+
* github-client
4+
* --
5+
* Copyright (C) 2016 - 2020 Spotify AB
6+
* --
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* -/-/-
19+
*/
20+
21+
package com.spotify.github.v3.activity.events;
22+
23+
import static com.google.common.io.Resources.getResource;
24+
import static java.nio.charset.Charset.defaultCharset;
25+
import static org.hamcrest.MatcherAssert.assertThat;
26+
import static org.hamcrest.core.Is.is;
27+
28+
import com.google.common.io.Resources;
29+
import com.spotify.github.jackson.Json;
30+
import java.io.IOException;
31+
import org.junit.jupiter.api.Test;
32+
33+
public class PullRequestReviewCommentEventTest {
34+
@Test
35+
public void testDeserialization() throws IOException {
36+
String fixture =
37+
Resources.toString(
38+
getResource(this.getClass(), "fixtures/pull_request_review_comment_event.json"),
39+
defaultCharset());
40+
final PullRequestReviewCommentEvent event =
41+
Json.create().fromJson(fixture, PullRequestReviewCommentEvent.class);
42+
assertThat(event.action(), is("created"));
43+
assertThat(event.comment().id(), is(29724692L));
44+
assertThat(event.pullRequest().nodeId(), is("abc123"));
45+
assertThat(event.comment().body(), is("Maybe you should use more emojji on this line."));
46+
}
47+
}

src/test/resources/com/spotify/github/v3/activity/events/fixtures/pull_request_review_comment_event.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"pull_request": {
4949
"url": "https://api.github.com/repos/baxterthehacker/public-repo/pulls/1",
5050
"id": 34778301,
51+
"node_id": "abc123",
5152
"html_url": "https://github.com/baxterthehacker/public-repo/pull/1",
5253
"diff_url": "https://github.com/baxterthehacker/public-repo/pull/1.diff",
5354
"patch_url": "https://github.com/baxterthehacker/public-repo/pull/1.patch",

0 commit comments

Comments
 (0)