@@ -9,88 +9,117 @@ class IssueSpecs extends FlatSpec with Matchers {
9
9
val input =
10
10
"""
11
11
|{
12
- | "priority": "major",
13
- | "kind": "bug",
14
- | "repository": {
15
- | "links": {
16
- | "self": {
17
- | "href": "https://bitbucket.org/!api/2.0/repositories/mrfyda/scalatests"
18
- | },
19
- | "html": {
20
- | "href": "https://bitbucket.org/mrfyda/scalatests"
21
- | },
22
- | "avatar": {
23
- | "href": "https://bytebucket.org/ravatar/%7B75411621-5a51-4bd4-a982-1d86cedd309e%7D?ts=default"
24
- | }
25
- | },
26
- | "type": "repository",
27
- | "name": "ScalaTests",
28
- | "full_name": "mrfyda/scalatests",
29
- | "uuid": "{75411621-5a51-4bd4-a982-1d86cedd309e}"
30
- | },
31
- | "links": {
32
- | "attachments": {
33
- | "href": "https://bitbucket.org/!api/2.0/repositories/mrfyda/scalatests/issues/1/attachments"
34
- | },
35
- | "self": {
36
- | "href": "https://bitbucket.org/!api/2.0/repositories/mrfyda/scalatests/issues/1"
37
- | },
38
- | "watch": {
39
- | "href": "https://bitbucket.org/!api/2.0/repositories/mrfyda/scalatests/issues/1/watch"
40
- | },
41
- | "comments": {
42
- | "href": "https://bitbucket.org/!api/2.0/repositories/mrfyda/scalatests/issues/1/comments"
43
- | },
44
- | "html": {
45
- | "href": "https://bitbucket.org/mrfyda/scalatests/issues/1/2e95d690c2c58a72e1a0bb4cd76808a4c0c60db4"
46
- | },
47
- | "vote": {
48
- | "href": "https://bitbucket.org/!api/2.0/repositories/mrfyda/scalatests/issues/1/vote"
49
- | }
50
- | },
51
- | "reporter": {
52
- | "username": "mrfyda",
53
- | "display_name": "Rafael Cortês",
54
- | "account_id": "557058:cb3153a1-1a69-4374-a536-fefac8f1cc64",
55
- | "links": {
56
- | "self": {
57
- | "href": "https://bitbucket.org/!api/2.0/users/mrfyda"
58
- | },
59
- | "html": {
60
- | "href": "https://bitbucket.org/mrfyda/"
61
- | },
62
- | "avatar": {
63
- | "href": "https://bitbucket.org/account/mrfyda/avatar/"
64
- | }
65
- | },
66
- | "type": "user",
67
- | "uuid": "{1e960327-38ba-4100-919e-5a677e668cad}"
68
- | },
69
- | "title": "2e95d690c2c58a72e1a0bb4cd76808a4c0c60db4",
70
- | "component": null,
71
- | "votes": 0,
72
- | "watches": 1,
73
- | "content": {
74
- | "raw": "hello world",
75
- | "markup": "markdown",
76
- | "html": "<p>hello world</p>",
77
- | "type": "rendered"
78
- | },
79
- | "assignee": null,
80
- | "state": "new",
81
- | "version": null,
82
- | "edited_on": null,
83
- | "created_on": "2018-09-02T09:08:01.435083+00:00",
84
- | "milestone": null,
85
- | "updated_on": "2018-09-02T09:08:01.435083+00:00",
86
- | "type": "issue",
87
- | "id": 1
12
+ | "content": {
13
+ | "raw": "",
14
+ | "markup": "markdown",
15
+ | "html": "",
16
+ | "type": "rendered"
17
+ | },
18
+ | "kind": "task",
19
+ | "repository": {
20
+ | "name": "test",
21
+ | "type": "repository",
22
+ | "full_name": "test/test",
23
+ | "links": {
24
+ | "self": {
25
+ | "href": "https://bitbucket.org/!api/2.0/repositories/test/test"
26
+ | },
27
+ | "html": {
28
+ | "href": "https://bitbucket.org/test/test"
29
+ | },
30
+ | "avatar": {
31
+ | "href": "https://bytebucket.org/ravatar/%12345667-d7b9-41c1-9d19-35d012423d0d%7D?ts=default"
32
+ | }
33
+ | },
34
+ | "uuid": "c19f822b-0e29-433a-87a5-ec8ace58aa67"
35
+ | },
36
+ | "links": {
37
+ | "attachments": {
38
+ | "href": "https://bitbucket.org/!api/2.0/repositories/test/test/issues/7/attachments"
39
+ | },
40
+ | "self": {
41
+ | "href": "https://bitbucket.org/!api/2.0/repositories/test/test/issues/7"
42
+ | },
43
+ | "watch": {
44
+ | "href": "https://bitbucket.org/!api/2.0/repositories/test/test/issues/7/watch"
45
+ | },
46
+ | "comments": {
47
+ | "href": "https://bitbucket.org/!api/2.0/repositories/test/test/issues/7/comments"
48
+ | },
49
+ | "html": {
50
+ | "href": "https://bitbucket.org/test/test/issues/7/add-code-coverage-to-react"
51
+ | },
52
+ | "vote": {
53
+ | "href": "https://bitbucket.org/!api/2.0/repositories/test/test/issues/7/vote"
54
+ | }
55
+ | },
56
+ | "title": "Add code coverage to React",
57
+ | "reporter": {
58
+ | "username": "reporter",
59
+ | "display_name": "reporter",
60
+ | "account_id": "123abc456def789ghi101jkl",
61
+ | "links": {
62
+ | "self": {
63
+ | "href": "https://bitbucket.org/!api/2.0/users/reporter"
64
+ | },
65
+ | "html": {
66
+ | "href": "https://bitbucket.org/reporter/"
67
+ | },
68
+ | "avatar": {
69
+ | "href": "https://bitbucket.org/account/reporter/avatar/"
70
+ | }
71
+ | },
72
+ | "type": "user",
73
+ | "nickname": "reporter",
74
+ | "uuid": "c19f822b-0e29-433a-87a5-ec8ace58aa67"
75
+ | },
76
+ | "component": {
77
+ | "name": "React",
78
+ | "links": {
79
+ | "self": {
80
+ | "href": "https://bitbucket.org/!api/2.0/repositories/test/test/components/497198"
81
+ | }
82
+ | }
83
+ | },
84
+ | "votes": 0,
85
+ | "watches": 1,
86
+ | "priority": "major",
87
+ | "assignee": {
88
+ | "username": "jllopes",
89
+ | "display_name": "João Lopes",
90
+ | "account_id": "123abc456def789ghi101jkl",
91
+ | "links": {
92
+ | "self": {
93
+ | "href": "https://bitbucket.org/!api/2.0/users/jllopes"
94
+ | },
95
+ | "html": {
96
+ | "href": "https://bitbucket.org/jllopes/"
97
+ | },
98
+ | "avatar": {
99
+ | "href": "https://bitbucket.org/account/jllopes/avatar/"
100
+ | }
101
+ | },
102
+ | "type": "user",
103
+ | "nickname": "jllopes",
104
+ | "uuid": "c19f822b-0e29-433a-87a5-ec8ace58aa67"
105
+ | },
106
+ | "state": "resolved",
107
+ | "version": null,
108
+ | "edited_on": null,
109
+ | "created_on": "2018-10-01T15:25:53.034773+00:00",
110
+ | "milestone": null,
111
+ | "updated_on": "2018-10-03T13:19:06.657709+00:00",
112
+ | "type": "issue",
113
+ | "id": 7
88
114
|}
89
115
""" .stripMargin
90
116
val json = Json .parse(input)
91
117
val value = json.validate[Issue ]
92
118
93
- value.fold(e => fail(s " $e" ), r => r.id shouldBe 1 )
119
+ value.fold(e => fail(s " $e" ), r => {
120
+ r.id shouldBe 7
121
+ r.reporter.account_id shouldBe " 123abc456def789ghi101jkl"
122
+ })
94
123
}
95
124
96
125
}
0 commit comments