Skip to content

Commit f1fa88a

Browse files
authored
add missing nodeId to Comment (#234)
1 parent 9493ca9 commit f1fa88a

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed

src/main/java/com/spotify/github/v3/comment/Comment.java

Lines changed: 6 additions & 2 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.
@@ -75,4 +75,8 @@ public interface Comment extends UpdateTracking {
7575

7676
/** The issueURL which the comment belongs to. */
7777
Optional<URI> issueUrl();
78+
79+
/** Node ID */
80+
@Nullable
81+
String nodeId();
7882
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*-
2+
* -\-\-
3+
* github-api
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 java.io.IOException;
24+
import static java.nio.charset.Charset.defaultCharset;
25+
26+
import static org.hamcrest.MatcherAssert.assertThat;
27+
import static org.hamcrest.core.Is.is;
28+
import org.junit.jupiter.api.Test;
29+
30+
import com.google.common.io.Resources;
31+
import static com.google.common.io.Resources.getResource;
32+
import com.spotify.github.jackson.Json;
33+
34+
public class IssueCommentEventTest {
35+
36+
@Test
37+
public void testDeserialization() throws IOException {
38+
String fixture =
39+
Resources.toString(
40+
getResource(this.getClass(), "fixtures/issue_comment_event.json"), defaultCharset());
41+
final IssueCommentEvent event = Json.create().fromJson(fixture, IssueCommentEvent.class);
42+
assertThat(event.action(), is("created"));
43+
assertThat(event.issue().number(), is(2L));
44+
assertThat(event.comment().id(), is(99262140L));
45+
assertThat(event.comment().nodeId(), is("asd123"));
46+
assertThat(
47+
event.comment().body(), is("You are totally right! I'll get this fixed right away."));
48+
}
49+
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
{
3333
"url": "https://api.github.com/repos/baxterthehacker/public-repo/labels/bug",
3434
"name": "bug",
35-
"color": "fc2929"
35+
"color": "fc2929",
36+
"default": false,
37+
"id": 208045946
3638
}
3739
],
3840
"state": "open",
@@ -50,6 +52,7 @@
5052
"html_url": "https://github.com/baxterthehacker/public-repo/issues/2#issuecomment-99262140",
5153
"issue_url": "https://api.github.com/repos/baxterthehacker/public-repo/issues/2",
5254
"id": 99262140,
55+
"node_id": "asd123",
5356
"user": {
5457
"login": "baxterthehacker",
5558
"id": 6752317,

0 commit comments

Comments
 (0)