4
4
import static org .junit .Assert .assertNotNull ;
5
5
import static org .junit .Assume .assumeTrue ;
6
6
7
+ import java .text .ParseException ;
7
8
import java .util .Date ;
8
9
import java .util .List ;
9
10
10
11
import org .gitlab4j .api .GitLabApi .ApiVersion ;
11
12
import org .gitlab4j .api .models .Event ;
12
13
import org .gitlab4j .api .models .Project ;
13
14
import org .gitlab4j .api .models .User ;
15
+ import org .gitlab4j .api .utils .ISO8601 ;
14
16
import org .junit .Before ;
15
17
import org .junit .BeforeClass ;
16
18
import org .junit .Test ;
@@ -92,12 +94,11 @@ public void beforeMethod() {
92
94
assumeTrue (gitLabApi != null );
93
95
}
94
96
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
+ }
101
102
102
103
@ Test
103
104
public void testGetAuthenticatedUserEventsWithDates () throws GitLabApiException {
@@ -117,6 +118,15 @@ public void testGetUserEvents() throws GitLabApiException {
117
118
List <Event > events = gitLabApi .getEventsApi ().getUserEvents (testUser .getId (), null , null , null , null , null );
118
119
assertNotNull (events );
119
120
}
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
+ }
120
130
121
131
@ Test
122
132
public void testGetProjectEvents () throws GitLabApiException {
0 commit comments