Skip to content

Commit cf9caa6

Browse files
committed
Update test to check values
1 parent 15f7483 commit cf9caa6

10 files changed

+612
-428
lines changed

src/test/java/org/kohsuke/github/AppTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,10 @@ public void testCommitShortInfo() throws Exception {
672672
assertEquals(commit.getCommitShortInfo().getMessage(), "doc");
673673
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
674674
assertEquals(commit.getCommitShortInfo().getVerification().getReason(), GHVerification.Reason.UNSIGNED);
675+
assertThat(commit.getCommitShortInfo().getAuthor().getDate().toInstant().getEpochSecond(),
676+
equalTo(1271650361L));
677+
assertThat(commit.getCommitShortInfo().getCommitter().getDate().toInstant().getEpochSecond(),
678+
equalTo(1271650361L));
675679
}
676680

677681
@Ignore("Needs mocking check")

src/test/java/org/kohsuke/github/CommitTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import java.util.Arrays;
88
import java.util.List;
99

10+
import static org.hamcrest.Matchers.equalTo;
11+
1012
/**
1113
* @author Kohsuke Kawaguchi
1214
*/
@@ -124,9 +126,13 @@ public void commitSignatureVerification() throws Exception {
124126
@Test // issue 883
125127
public void commitDateNotNull() throws Exception {
126128
GHRepository repo = gitHub.getRepository("hub4j/github-api");
127-
GHCommit commit = repo.getCommit("ed4f9c8176866977677c99ac9668a8ce10231bc8");
128-
129-
assertNotNull(commit.getCommitShortInfo().getAuthoredDate());
130-
assertNotNull(commit.getCommitShortInfo().getAuthor().getDate());
129+
GHCommit commit = repo.getCommit("865a49d2e86c24c5777985f0f103e975c4b765b9");
130+
131+
assertThat(commit.getCommitShortInfo().getAuthoredDate().toInstant().getEpochSecond(), equalTo(1609207093L));
132+
assertThat(commit.getCommitShortInfo().getAuthoredDate(),
133+
equalTo(commit.getCommitShortInfo().getAuthor().getDate()));
134+
assertThat(commit.getCommitShortInfo().getCommitDate().toInstant().getEpochSecond(), equalTo(1609207652L));
135+
assertThat(commit.getCommitShortInfo().getCommitDate(),
136+
equalTo(commit.getCommitShortInfo().getCommitter().getDate()));
131137
}
132138
}

src/test/resources/org/kohsuke/github/CommitTest/wiremock/commitDateNotNull/__files/repos_hub4j_github-api-2.json

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,44 +65,48 @@
6565
"releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}",
6666
"deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments",
6767
"created_at": "2010-04-19T04:13:03Z",
68-
"updated_at": "2020-11-28T05:59:13Z",
69-
"pushed_at": "2020-11-27T17:23:57Z",
68+
"updated_at": "2020-12-29T03:54:49Z",
69+
"pushed_at": "2020-12-29T03:54:45Z",
7070
"git_url": "git://github.com/hub4j/github-api.git",
7171
"ssh_url": "[email protected]:hub4j/github-api.git",
7272
"clone_url": "https://github.com/hub4j/github-api.git",
7373
"svn_url": "https://github.com/hub4j/github-api",
7474
"homepage": "https://github-api.kohsuke.org/",
75-
"size": 25463,
76-
"stargazers_count": 714,
77-
"watchers_count": 714,
75+
"size": 25580,
76+
"stargazers_count": 725,
77+
"watchers_count": 725,
7878
"language": "Java",
7979
"has_issues": true,
8080
"has_projects": true,
8181
"has_downloads": true,
8282
"has_wiki": true,
8383
"has_pages": true,
84-
"forks_count": 511,
84+
"forks_count": 514,
8585
"mirror_url": null,
8686
"archived": false,
8787
"disabled": false,
88-
"open_issues_count": 79,
88+
"open_issues_count": 74,
8989
"license": {
9090
"key": "mit",
9191
"name": "MIT License",
9292
"spdx_id": "MIT",
9393
"url": "https://api.github.com/licenses/mit",
9494
"node_id": "MDc6TGljZW5zZTEz"
9595
},
96-
"forks": 511,
97-
"open_issues": 79,
98-
"watchers": 714,
96+
"forks": 514,
97+
"open_issues": 74,
98+
"watchers": 725,
9999
"default_branch": "master",
100100
"permissions": {
101-
"admin": false,
102-
"push": false,
101+
"admin": true,
102+
"push": true,
103103
"pull": true
104104
},
105105
"temp_clone_token": "",
106+
"allow_squash_merge": true,
107+
"allow_merge_commit": true,
108+
"allow_rebase_merge": true,
109+
"delete_branch_on_merge": false,
106110
"organization": {
107111
"login": "hub4j",
108112
"id": 54909825,
@@ -123,6 +127,6 @@
123127
"type": "Organization",
124128
"site_admin": false
125129
},
126-
"network_count": 511,
127-
"subscribers_count": 47
130+
"network_count": 514,
131+
"subscribers_count": 50
128132
}

src/test/resources/org/kohsuke/github/CommitTest/wiremock/commitDateNotNull/__files/repos_hub4j_github-api_commits_865a49d2e86c24c5777985f0f103e975c4b765b9-3.json

Lines changed: 506 additions & 0 deletions
Large diffs are not rendered by default.

src/test/resources/org/kohsuke/github/CommitTest/wiremock/commitDateNotNull/__files/repos_hub4j_github-api_commits_ed4f9c8176866977677c99ac9668a8ce10231bc8-4.json

Lines changed: 0 additions & 307 deletions
This file was deleted.
Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,46 @@
11
{
2-
"login": "lower-case",
3-
"id": 8265616,
4-
"node_id": "MDQ6VXNlcjgyNjU2MTY=",
5-
"avatar_url": "https://avatars2.githubusercontent.com/u/8265616?v=4",
2+
"login": "bitwiseman",
3+
"id": 1958953,
4+
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
5+
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
66
"gravatar_id": "",
7-
"url": "https://api.github.com/users/lower-case",
8-
"html_url": "https://github.com/lower-case",
9-
"followers_url": "https://api.github.com/users/lower-case/followers",
10-
"following_url": "https://api.github.com/users/lower-case/following{/other_user}",
11-
"gists_url": "https://api.github.com/users/lower-case/gists{/gist_id}",
12-
"starred_url": "https://api.github.com/users/lower-case/starred{/owner}{/repo}",
13-
"subscriptions_url": "https://api.github.com/users/lower-case/subscriptions",
14-
"organizations_url": "https://api.github.com/users/lower-case/orgs",
15-
"repos_url": "https://api.github.com/users/lower-case/repos",
16-
"events_url": "https://api.github.com/users/lower-case/events{/privacy}",
17-
"received_events_url": "https://api.github.com/users/lower-case/received_events",
7+
"url": "https://api.github.com/users/bitwiseman",
8+
"html_url": "https://github.com/bitwiseman",
9+
"followers_url": "https://api.github.com/users/bitwiseman/followers",
10+
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
11+
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
12+
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
13+
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
14+
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
15+
"repos_url": "https://api.github.com/users/bitwiseman/repos",
16+
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
17+
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
1818
"type": "User",
1919
"site_admin": false,
20-
"name": "Lovekesh Garg",
21-
"company": "IIT Kharagpur",
20+
"name": "Liam Newman",
21+
"company": "Cloudbees, Inc.",
2222
"blog": "",
23-
"location": "Gurgaon, India",
24-
"email": null,
25-
"hireable": true,
26-
"bio": "404 NOT FOUND",
27-
"twitter_username": null,
28-
"public_repos": 3,
29-
"public_gists": 0,
30-
"followers": 14,
31-
"following": 19,
32-
"created_at": "2014-07-25T08:33:03Z",
33-
"updated_at": "2020-11-28T06:12:48Z"
23+
"location": "Seattle, WA, USA",
24+
"email": "[email protected]",
25+
"hireable": null,
26+
"bio": null,
27+
"twitter_username": "bitwiseman",
28+
"public_repos": 199,
29+
"public_gists": 7,
30+
"followers": 174,
31+
"following": 11,
32+
"created_at": "2012-07-11T20:38:33Z",
33+
"updated_at": "2020-12-23T22:23:08Z",
34+
"private_gists": 19,
35+
"total_private_repos": 17,
36+
"owned_private_repos": 0,
37+
"disk_usage": 33700,
38+
"collaborators": 0,
39+
"two_factor_authentication": true,
40+
"plan": {
41+
"name": "free",
42+
"space": 976562499,
43+
"collaborators": 0,
44+
"private_repos": 10000
45+
}
3446
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "50636dee-5323-45da-991b-65655816c2ab",
2+
"id": "87ba83b3-361d-4fbe-a4c0-1a92c73911e0",
33
"name": "repos_hub4j_github-api",
44
"request": {
55
"url": "/repos/hub4j/github-api",
@@ -14,7 +14,7 @@
1414
"status": 200,
1515
"bodyFileName": "repos_hub4j_github-api-2.json",
1616
"headers": {
17-
"Date": "Sat, 28 Nov 2020 06:55:47 GMT",
17+
"Date": "Tue, 29 Dec 2020 04:17:02 GMT",
1818
"Content-Type": "application/json; charset=utf-8",
1919
"Server": "GitHub.com",
2020
"Status": "200 OK",
@@ -24,25 +24,25 @@
2424
"Accept-Encoding, Accept, X-Requested-With",
2525
"Accept-Encoding"
2626
],
27-
"ETag": "W/\"7a660bdf9608771ebc092a07a9d0e098af6bf6d670cde3147fb3dc6f4a46e65f\"",
28-
"Last-Modified": "Sat, 28 Nov 2020 05:59:13 GMT",
29-
"X-OAuth-Scopes": "repo, workflow",
27+
"ETag": "W/\"6fc2ccdf4af0f89cf88fddff7099dd479f7a15b5551d5ced73e3e4e0384b24c6\"",
28+
"Last-Modified": "Tue, 29 Dec 2020 03:54:49 GMT",
29+
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion",
3030
"X-Accepted-OAuth-Scopes": "repo",
3131
"X-GitHub-Media-Type": "unknown, github.v3",
3232
"X-RateLimit-Limit": "5000",
33-
"X-RateLimit-Remaining": "4957",
34-
"X-RateLimit-Reset": "1606547736",
35-
"X-RateLimit-Used": "43",
33+
"X-RateLimit-Remaining": "4966",
34+
"X-RateLimit-Reset": "1609216145",
35+
"X-RateLimit-Used": "34",
3636
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
3737
"X-Frame-Options": "deny",
3838
"X-Content-Type-Options": "nosniff",
3939
"X-XSS-Protection": "1; mode=block",
4040
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
4141
"Content-Security-Policy": "default-src 'none'",
42-
"X-GitHub-Request-Id": "CD16:2B8B:308B5B:3E3446:5FC1F473"
42+
"X-GitHub-Request-Id": "DEAA:85CA:20A7397:284A8E0:5FEAADBD"
4343
}
4444
},
45-
"uuid": "50636dee-5323-45da-991b-65655816c2ab",
45+
"uuid": "87ba83b3-361d-4fbe-a4c0-1a92c73911e0",
4646
"persistent": true,
4747
"insertionIndex": 2
4848
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"id": "58ab9e92-a0cc-465f-9c04-61b15729cd30",
3-
"name": "repos_hub4j_github-api_commits_ed4f9c8176866977677c99ac9668a8ce10231bc8",
2+
"id": "5c1536ce-299a-40b4-ad5a-a21777294471",
3+
"name": "repos_hub4j_github-api_commits_865a49d2e86c24c5777985f0f103e975c4b765b9",
44
"request": {
5-
"url": "/repos/hub4j/github-api/commits/ed4f9c8176866977677c99ac9668a8ce10231bc8",
5+
"url": "/repos/hub4j/github-api/commits/865a49d2e86c24c5777985f0f103e975c4b765b9",
66
"method": "GET",
77
"headers": {
88
"Accept": {
@@ -12,9 +12,9 @@
1212
},
1313
"response": {
1414
"status": 200,
15-
"bodyFileName": "repos_hub4j_github-api_commits_ed4f9c8176866977677c99ac9668a8ce10231bc8-4.json",
15+
"bodyFileName": "repos_hub4j_github-api_commits_865a49d2e86c24c5777985f0f103e975c4b765b9-3.json",
1616
"headers": {
17-
"Date": "Sat, 28 Nov 2020 06:57:53 GMT",
17+
"Date": "Tue, 29 Dec 2020 04:17:02 GMT",
1818
"Content-Type": "application/json; charset=utf-8",
1919
"Server": "GitHub.com",
2020
"Status": "200 OK",
@@ -24,25 +24,25 @@
2424
"Accept-Encoding, Accept, X-Requested-With",
2525
"Accept-Encoding"
2626
],
27-
"ETag": "W/\"4fbc6c7518df46925561f8fa37edf044e9482be4b916416e82991493110d6001\"",
28-
"Last-Modified": "Wed, 25 Nov 2020 14:37:36 GMT",
29-
"X-OAuth-Scopes": "repo, workflow",
27+
"ETag": "W/\"329c39539737a3ce25b0c6fece22145a13b9b0d69604f0fe77d71f562a9130ab\"",
28+
"Last-Modified": "Tue, 29 Dec 2020 02:07:32 GMT",
29+
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion",
3030
"X-Accepted-OAuth-Scopes": "",
3131
"X-GitHub-Media-Type": "unknown, github.v3",
3232
"X-RateLimit-Limit": "5000",
33-
"X-RateLimit-Remaining": "4943",
34-
"X-RateLimit-Reset": "1606547736",
35-
"X-RateLimit-Used": "57",
33+
"X-RateLimit-Remaining": "4965",
34+
"X-RateLimit-Reset": "1609216145",
35+
"X-RateLimit-Used": "35",
3636
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
3737
"X-Frame-Options": "deny",
3838
"X-Content-Type-Options": "nosniff",
3939
"X-XSS-Protection": "1; mode=block",
4040
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
4141
"Content-Security-Policy": "default-src 'none'",
42-
"X-GitHub-Request-Id": "CF73:2B8A:A8D9A:E0943:5FC1F4F1"
42+
"X-GitHub-Request-Id": "DEAA:85CA:20A73A6:284A912:5FEAADBE"
4343
}
4444
},
45-
"uuid": "58ab9e92-a0cc-465f-9c04-61b15729cd30",
45+
"uuid": "5c1536ce-299a-40b4-ad5a-a21777294471",
4646
"persistent": true,
47-
"insertionIndex": 4
47+
"insertionIndex": 3
4848
}

src/test/resources/org/kohsuke/github/CommitTest/wiremock/commitDateNotNull/mappings/repos_hub4j_github-api_commits_86a2e245aa6d71d54923655066049d9e21a15f01-3.json

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "7aac800a-e6b0-46b9-9e6a-17bb85b6b030",
2+
"id": "2d8f404b-6b92-43f5-9edd-a0ecc00dc866",
33
"name": "user",
44
"request": {
55
"url": "/user",
@@ -14,7 +14,7 @@
1414
"status": 200,
1515
"bodyFileName": "user-1.json",
1616
"headers": {
17-
"Date": "Sat, 28 Nov 2020 06:55:47 GMT",
17+
"Date": "Tue, 29 Dec 2020 04:17:01 GMT",
1818
"Content-Type": "application/json; charset=utf-8",
1919
"Server": "GitHub.com",
2020
"Status": "200 OK",
@@ -24,25 +24,25 @@
2424
"Accept-Encoding, Accept, X-Requested-With",
2525
"Accept-Encoding"
2626
],
27-
"ETag": "W/\"14aa5672b664d3be9ebec04b4fece56643332a058e940bb5676847bb385a2b10\"",
28-
"Last-Modified": "Sat, 28 Nov 2020 06:12:48 GMT",
29-
"X-OAuth-Scopes": "repo, workflow",
27+
"ETag": "W/\"bb2babcbd8a6f75f8e5bbf778f169fdb662bf030c0f4a81ed94fde38b7c93347\"",
28+
"Last-Modified": "Wed, 23 Dec 2020 22:23:08 GMT",
29+
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion",
3030
"X-Accepted-OAuth-Scopes": "",
3131
"X-GitHub-Media-Type": "unknown, github.v3",
3232
"X-RateLimit-Limit": "5000",
33-
"X-RateLimit-Remaining": "4959",
34-
"X-RateLimit-Reset": "1606547736",
35-
"X-RateLimit-Used": "41",
33+
"X-RateLimit-Remaining": "4968",
34+
"X-RateLimit-Reset": "1609216145",
35+
"X-RateLimit-Used": "32",
3636
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
3737
"X-Frame-Options": "deny",
3838
"X-Content-Type-Options": "nosniff",
3939
"X-XSS-Protection": "1; mode=block",
4040
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
4141
"Content-Security-Policy": "default-src 'none'",
42-
"X-GitHub-Request-Id": "CD16:2B8B:308B51:3E3441:5FC1F472"
42+
"X-GitHub-Request-Id": "DEAA:85CA:20A736D:284A8D5:5FEAADBD"
4343
}
4444
},
45-
"uuid": "7aac800a-e6b0-46b9-9e6a-17bb85b6b030",
45+
"uuid": "2d8f404b-6b92-43f5-9edd-a0ecc00dc866",
4646
"persistent": true,
4747
"insertionIndex": 1
4848
}

0 commit comments

Comments
 (0)