44import static org .junit .Assert .assertNotNull ;
55import static org .junit .Assume .assumeTrue ;
66
7+ import java .text .ParseException ;
78import java .util .Date ;
89import java .util .List ;
910
1011import org .gitlab4j .api .GitLabApi .ApiVersion ;
1112import org .gitlab4j .api .models .Event ;
1213import org .gitlab4j .api .models .Project ;
1314import org .gitlab4j .api .models .User ;
15+ import org .gitlab4j .api .utils .ISO8601 ;
1416import org .junit .Before ;
1517import org .junit .BeforeClass ;
1618import 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