1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package com.jcabi.github;
31
32 import com.jcabi.http.request.FakeRequest;
33 import org.hamcrest.MatcherAssert;
34 import org.hamcrest.Matchers;
35 import org.junit.Ignore;
36 import org.junit.Test;
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 public final class RtNotificationsTest {
52
53
54
55
56
57 @Test
58 public void iterateEmpty() {
59 MatcherAssert.assertThat(
60 new RtNotifications(
61 new FakeRequest()
62 .withBody("[]")
63 ).iterate(),
64 Matchers.emptyIterable()
65 );
66 }
67
68
69
70
71 @Test
72 public void iterateNotifications() {
73 MatcherAssert.assertThat(
74 new RtNotifications(
75 new FakeRequest().withBody(
76
77
78 "[\n"
79 + " {\n"
80 + " \"id\": \"1\",\n"
81 + " \"repository\": {\n"
82 + " \"id\": 1296269,\n"
83 + " \"owner\": {\n"
84 + " \"login\": \"octocat\",\n"
85 + " \"id\": 1,\n"
86 + " \"avatar_url\": \"https://github.com/images/error/octocat_happy.gif\",\n"
87 + " \"gravatar_id\": \"\",\n"
88 + " \"url\": \"https://api.github.com/users/octocat\",\n"
89 + " \"html_url\": \"https://github.com/octocat\",\n"
90 + " \"followers_url\": \"https://api.github.com/users/octocat/followers\",\n"
91 + " \"following_url\": \"https://api.github.com/users/octocat/following{/other_user}\",\n"
92 + " \"gists_url\": \"https://api.github.com/users/octocat/gists{/gist_id}\",\n"
93 + " \"starred_url\": \"https://api.github.com/users/octocat/starred{/owner}{/repo}\",\n"
94 + " \"subscriptions_url\": \"https://api.github.com/users/octocat/subscriptions\",\n"
95 + " \"organizations_url\": \"https://api.github.com/users/octocat/orgs\",\n"
96 + " \"repos_url\": \"https://api.github.com/users/octocat/repos\",\n"
97 + " \"events_url\": \"https://api.github.com/users/octocat/events{/privacy}\",\n"
98 + " \"received_events_url\": \"https://api.github.com/users/octocat/received_events\",\n"
99 + " \"type\": \"User\",\n"
100 + " \"site_admin\": false\n"
101 + " },\n"
102 + " \"name\": \"Hello-World\",\n"
103 + " \"full_name\": \"octocat/Hello-World\",\n"
104 + " \"description\": \"This your first repo!\",\n"
105 + " \"private\": false,\n"
106 + " \"fork\": false,\n"
107 + " \"url\": \"https://api.github.com/repos/octocat/Hello-World\",\n"
108 + " \"html_url\": \"https://github.com/octocat/Hello-World\"\n"
109 + " },\n"
110 + " \"subject\": {\n"
111 + " \"title\": \"Greetings\",\n"
112 + " \"url\": \"https://api.github.com/repos/octokit/octokit.rb/issues/123\",\n"
113 + " \"latest_comment_url\": \"https://api.github.com/repos/octokit/octokit.rb/issues/comments/123\",\n"
114 + " \"type\": \"Issue\"\n"
115 + " },\n"
116 + " \"reason\": \"subscribed\",\n"
117 + " \"unread\": true,\n"
118 + " \"updated_at\": \"2014-11-07T22:01:45Z\",\n"
119 + " \"last_read_at\": \"2014-11-07T22:01:45Z\",\n"
120 + " \"url\": \"https://api.github.com/notifications/threads/1\"\n"
121 + " }\n"
122 + "]"
123 )
124 ).iterate(),
125 Matchers.not(Matchers.emptyIterable())
126 );
127 }
128
129
130
131
132 @Test
133 @Ignore
134 public void markNotificationAsRead() {
135
136 }
137 }