File tree Expand file tree Collapse file tree
main/java/com/spotify/github/v3/activity/events
test/java/com/spotify/github/v3/activity/events Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121package com .spotify .github .v3 .activity .events ;
2222
23+ import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
24+ import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
25+ import com .spotify .github .GithubStyle ;
2326import com .spotify .github .UpdateTracking ;
2427import com .spotify .github .v3 .repos .Branch ;
2528import com .spotify .github .v3 .repos .CommitItem ;
2629import java .net .URI ;
2730import java .util .List ;
2831import java .util .Optional ;
2932import javax .annotation .Nullable ;
33+ import org .immutables .value .Value ;
3034
3135/**
3236 * Triggered when the status of a Git commit changes.
3337 *
3438 * <p>Events of this type are not visible in timelines. These events are only used to trigger hooks.
3539 */
40+ @ Value .Immutable
41+ @ GithubStyle
42+ @ JsonSerialize (as = ImmutableStatusEvent .class )
43+ @ JsonDeserialize (as = ImmutableStatusEvent .class )
3644public interface StatusEvent extends BaseEvent , UpdateTracking {
3745
3846 /** Status event id */
Original file line number Diff line number Diff line change 3333
3434public class PullRequestEventTest {
3535
36- private String fixture ;
37-
3836 @ Test
3937 public void testDeserialization () throws IOException {
40- fixture =
38+ String fixture =
4139 Resources .toString (
4240 getResource (this .getClass (), "fixtures/pull_request_event.json" ), defaultCharset ());
4341 final PullRequestEvent prEvent = Json .create ().fromJson (fixture , PullRequestEvent .class );
Original file line number Diff line number Diff line change 1+ package com .spotify .github .v3 .activity .events ;
2+
3+ import static com .google .common .io .Resources .getResource ;
4+ import static java .nio .charset .Charset .defaultCharset ;
5+ import static org .hamcrest .MatcherAssert .assertThat ;
6+ import static org .hamcrest .core .Is .is ;
7+
8+ import com .google .common .io .Resources ;
9+ import com .spotify .github .jackson .Json ;
10+ import java .io .IOException ;
11+ import org .junit .Test ;
12+
13+ public class StatusEventTest {
14+ @ Test
15+ public void testDeserialization () throws IOException {
16+ String fixture =
17+ Resources .toString (
18+ getResource (this .getClass (), "fixtures/status_event.json" ), defaultCharset ());
19+ final StatusEvent statusEvent = Json .create ().fromJson (fixture , StatusEvent .class );
20+ assertThat (statusEvent .context (), is ("default" ));
21+ assertThat (statusEvent .sha (), is ("9049f1265b7d61be4a8904a9a27120d2064dab3b" ));
22+ assertThat (statusEvent .state (), is ("success" ));
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments