Skip to content

Commit 62e210e

Browse files
committed
Added test.
1 parent d3788c8 commit 62e210e

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/test/java/org/gitlab4j/api/TestEventsApi.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
import static org.junit.Assert.assertNotNull;
55
import static org.junit.Assume.assumeTrue;
66

7+
import java.text.ParseException;
78
import java.util.Date;
89
import java.util.List;
910

1011
import org.gitlab4j.api.GitLabApi.ApiVersion;
1112
import org.gitlab4j.api.models.Event;
1213
import org.gitlab4j.api.models.Project;
1314
import org.gitlab4j.api.models.User;
15+
import org.gitlab4j.api.utils.ISO8601;
1416
import org.junit.Before;
1517
import org.junit.BeforeClass;
1618
import org.junit.Test;
@@ -92,12 +94,11 @@ public void beforeMethod() {
9294
assumeTrue(gitLabApi != null);
9395
}
9496

95-
// This is commented out because it was causing a "Too Many Requests" error from gitlab.com, thus causing the tests to fail
96-
// @Test
97-
// public void testGetAuthenticatedUserEvents() throws GitLabApiException {
98-
// List<Event> events = gitLabApi.getEventsApi().getAuthenticatedUserEvents(null, null, null, null, null);
99-
// assertNotNull(events);
100-
// }
97+
@Test
98+
public void testGetAuthenticatedUserEvents() throws GitLabApiException {
99+
List<Event> events = gitLabApi.getEventsApi().getAuthenticatedUserEvents(null, null, null, null, null);
100+
assertNotNull(events);
101+
}
101102

102103
@Test
103104
public void testGetAuthenticatedUserEventsWithDates() throws GitLabApiException {
@@ -117,6 +118,15 @@ public void testGetUserEvents() throws GitLabApiException {
117118
List<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), null, null, null, null, null);
118119
assertNotNull(events);
119120
}
121+
122+
public void testGetUserEvents1() throws GitLabApiException, ParseException {
123+
assertNotNull(testUser);
124+
125+
Date before = ISO8601.toDate("2018-06-02");
126+
Date after = ISO8601.toDate("2018-05-01");
127+
List<Event> events = gitLabApi.getEventsApi().getUserEvents(testUser.getId(), Constants.ActionType.CREATED, Constants.TargetType.PROJECT, before, after, Constants.SortOrder.DESC);
128+
assertNotNull(events);
129+
}
120130

121131
@Test
122132
public void testGetProjectEvents() throws GitLabApiException {

0 commit comments

Comments
 (0)