File tree 7 files changed +22
-15
lines changed
main/java/org/kohsuke/github
test/java/org/kohsuke/github
7 files changed +22
-15
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ public GHIssueQueryBuilder since(Instant date) {
104
104
* @return the gh issue query builder
105
105
*/
106
106
public GHIssueQueryBuilder since (long timestamp ) {
107
- return since (Instant . ofEpochMilli (timestamp ));
107
+ return since (new Date (timestamp ));
108
108
}
109
109
110
110
/**
Original file line number Diff line number Diff line change @@ -60,8 +60,6 @@ public GHUser getCreator() {
60
60
*/
61
61
@ WithBridgeMethods (value = Date .class , adapterMethod = "instantToDate" )
62
62
public Instant getDueOn () {
63
- if (due_on == null )
64
- return null ;
65
63
return GitHubClient .parseInstant (due_on );
66
64
}
67
65
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public GHRelease() {
43
43
private String body ;
44
44
private boolean draft ;
45
45
private boolean prerelease ;
46
- private String published_at ;
46
+ private String publishedAt ;
47
47
private String tarball_url ;
48
48
private String zipball_url ;
49
49
private String discussion_url ;
@@ -102,16 +102,6 @@ public String getName() {
102
102
return name ;
103
103
}
104
104
105
- /**
106
- * Sets name.
107
- *
108
- * @param name
109
- * the name
110
- */
111
- public void setName (String name ) {
112
- this .name = name ;
113
- }
114
-
115
105
/**
116
106
* Gets owner.
117
107
*
@@ -135,7 +125,9 @@ public boolean isPrerelease() {
135
125
* Gets published at.
136
126
*
137
127
* @return the published at
128
+ * @deprecated Use #getPublishedAt()
138
129
*/
130
+ @ Deprecated
139
131
public Date getPublished_at () {
140
132
return Date .from (getPublishedAt ());
141
133
}
@@ -146,7 +138,7 @@ public Date getPublished_at() {
146
138
* @return the published at
147
139
*/
148
140
public Instant getPublishedAt () {
149
- return GitHubClient .parseInstant (published_at );
141
+ return GitHubClient .parseInstant (publishedAt );
150
142
}
151
143
152
144
/**
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ public void testUpdateMilestone() throws Exception {
75
75
// The time is truncated when sent to the server, but still part of the returned value
76
76
// 07:00 midnight PDT
77
77
assertThat (milestone .getDueOn (), equalTo (OUTPUT_DUE_DATE ));
78
+ assertThat (milestone .getClosedAt (), nullValue ());
78
79
assertThat (milestone .getHtmlUrl ().toString (), containsString ("/hub4j-test-org/github-api/milestone/" ));
79
80
assertThat (milestone .getUrl ().toString (), containsString ("/repos/hub4j-test-org/github-api/milestones/" ));
80
81
assertThat (milestone .getClosedIssues (), equalTo (0 ));
Original file line number Diff line number Diff line change @@ -36,7 +36,12 @@ public void testCreateSimpleRelease() throws Exception {
36
36
assertThat (releaseCheck , notNullValue ());
37
37
assertThat (releaseCheck .getTagName (), is (tagName ));
38
38
assertThat (releaseCheck .isPrerelease (), is (false ));
39
+ assertThat (releaseCheck .isDraft (), is (false ));
40
+ assertThat (releaseCheck .getAssetsUrl (), endsWith ("/assets" ));
39
41
assertThat (releaseCheck .getDiscussionUrl (), notNullValue ());
42
+ assertThat (releaseCheck .getCreatedAt (), equalTo (GitHubClient .parseInstant ("2021-06-02T21:59:14Z" )));
43
+ assertThat (releaseCheck .getPublishedAt (), equalTo (GitHubClient .parseInstant ("2021-06-11T06:56:52Z" )));
44
+
40
45
} finally {
41
46
release .delete ();
42
47
assertThat (repo .getRelease (release .getId ()), nullValue ());
Original file line number Diff line number Diff line change 12
12
import java .time .format .DateTimeFormatter ;
13
13
import java .time .format .DateTimeParseException ;
14
14
import java .time .temporal .ChronoUnit ;
15
+ import java .util .Date ;
15
16
import java .util .Locale ;
16
17
17
18
import static org .hamcrest .CoreMatchers .*;
@@ -136,6 +137,12 @@ public void timeRoundTrip() {
136
137
} catch (DateTimeParseException e ) {
137
138
assertThat (e .getMessage (), equalTo ("Text '" + instantBadFormat + "' could not be parsed at index 0" ));
138
139
}
140
+
141
+ final GitHubBridgeAdapterObject bridge = new GitHubBridgeAdapterObject () {
142
+ };
143
+ assertThat (bridge .instantToDate (null , null ), nullValue ());
144
+ assertThat (bridge .instantToDate (Instant .ofEpochMilli (stableInstantEpochMilli ), null ),
145
+ equalTo (Date .from (instantNow )));
139
146
}
140
147
141
148
/**
Original file line number Diff line number Diff line change @@ -336,6 +336,10 @@ public void getMyMarketplacePurchases() throws IOException {
336
336
assertThat (userPurchase .isOnFreeTrial (), is (false ));
337
337
assertThat (userPurchase .getFreeTrialEndsOn (), nullValue ());
338
338
assertThat (userPurchase .getBillingCycle (), equalTo ("monthly" ));
339
+ assertThat (userPurchase .getNextBillingDate (),
340
+ equalTo (GitHubClient .parseInstant ("2020-01-01T00:00:00.000+13:00" )));
341
+ assertThat (userPurchase .getUpdatedAt (),
342
+ equalTo (GitHubClient .parseInstant ("2019-12-02T00:00:00.000+13:00" )));
339
343
340
344
GHMarketplacePlan plan = userPurchase .getPlan ();
341
345
// GHMarketplacePlan - Non-nullable fields
You can’t perform that action at this time.
0 commit comments