77import com .crowdin .client .core .model .ResponseObject ;
88import com .crowdin .client .framework .RequestMock ;
99import com .crowdin .client .framework .TestClient ;
10- import com .crowdin .client .tasks .model .AssignedTeam ;
11- import com .crowdin .client .tasks .model .Assignee ;
12- import com .crowdin .client .tasks .model .AssigneeRequest ;
13- import com .crowdin .client .tasks .model .CreateTaskEnterpriseStringsBasedRequest ;
14- import com .crowdin .client .tasks .model .CreateTaskRequest ;
15- import com .crowdin .client .tasks .model .CreateTaskEnterpriseVendorRequest ;
16- import com .crowdin .client .tasks .model .CreateTaskStringsBasedRequest ;
17- import com .crowdin .client .tasks .model .Progress ;
18- import com .crowdin .client .tasks .model .Status ;
19- import com .crowdin .client .tasks .model .Task ;
20- import com .crowdin .client .tasks .model .Type ;
10+ import com .crowdin .client .tasks .model .*;
2111import com .crowdin .client .tasks .model .pending .CreateEnterprisePendingTaskRequest ;
2212import com .crowdin .client .tasks .model .pending .CreatePendingTaskRequest ;
2313import org .apache .http .client .methods .HttpDelete ;
2616import org .apache .http .client .methods .HttpPost ;
2717import org .junit .jupiter .api .Test ;
2818
29- import java .util .Arrays ;
30- import java .util .Calendar ;
31- import java .util .Date ;
32- import java .util .HashMap ;
33- import java .util .List ;
34- import java .util .Map ;
35- import java .util .TimeZone ;
19+ import java .util .*;
3620
3721import static java .util .Collections .singletonList ;
3822import static org .junit .jupiter .api .Assertions .assertEquals ;
23+ import static org .junit .jupiter .api .Assertions .assertTrue ;
3924
4025public class TasksApiTest extends TestClient {
4126
4227 private final Long projectId = 12L ;
4328 private final Long enterpriseProjectId = 13L ;
29+ private final Long multiStatusProjectId = 14L ;
4430 private final Long taskId = 2L ;
4531 private final Long prevTaskId = 1L ;
4632 private final Status status = Status .TODO ;
@@ -61,7 +47,8 @@ public List<RequestMock> getMocks() {
6147 RequestMock .build (this .url + "/projects/" + projectId + "/tasks/" + taskId , HttpDelete .METHOD_NAME ),
6248 RequestMock .build (this .url + "/projects/" + projectId + "/tasks/" + taskId , HttpPatch .METHOD_NAME , "api/tasks/editTask.json" , "api/tasks/task.json" ),
6349 RequestMock .build (this .url + "/user/tasks" , HttpGet .METHOD_NAME , "api/tasks/listTasks.json" ),
64- RequestMock .build (this .url + "/user/tasks/" + taskId , HttpPatch .METHOD_NAME , "api/tasks/editTask.json" , "api/tasks/task.json" )
50+ RequestMock .build (this .url + "/user/tasks/" + taskId , HttpPatch .METHOD_NAME , "api/tasks/editTask.json" , "api/tasks/task.json" ),
51+ RequestMock .build (this .url + "/projects/" + multiStatusProjectId + "/tasks" , HttpGet .METHOD_NAME , "api/tasks/multiStatusListTasks.json" , Map .of ("status" , "todo,done" ))
6552 );
6653 }
6754
@@ -83,6 +70,35 @@ public void listTasksTest() {
8370 assertEquals (taskResponseList .getData ().get (0 ).getData ().getAssignees ().get (0 ), assignee );
8471 }
8572
73+ @ Test
74+ public void listTasksTest_multipleStatuses () {
75+ Assignee assignee = new Assignee ();
76+ assignee .setId (1L );
77+ assignee .setUsername ("john_smith" );
78+ assignee .setFullName ("john_smith" );
79+ assignee .setAvatarUrl ("" );
80+ assignee .setWordsCount (5 );
81+ assignee .setWordsLeft (3 );
82+ TimeZone .setDefault (TimeZone .getTimeZone ("GMT" ));
83+
84+ EnumSet <Status > statuses = EnumSet .of (Status .TODO , Status .DONE );
85+
86+ ListTasksParams listTasksParams = new ListTasksParams ();
87+ listTasksParams .setStatuses (statuses );
88+
89+ ResponseList <Task > taskResponseList = this .getTasksApi ().listTasks (multiStatusProjectId , listTasksParams );
90+
91+ assertEquals (1 , taskResponseList .getData ().size ());
92+ assertEquals (taskId , taskResponseList .getData ().get (0 ).getData ().getId ());
93+ assertEquals (multiStatusProjectId , taskResponseList .getData ().get (0 ).getData ().getProjectId ());
94+
95+ Status responseProjectStatus = taskResponseList .getData ().get (0 ).getData ().getStatus ();
96+ assertTrue (statuses .contains (responseProjectStatus ));
97+
98+ assertEquals (new Date (119 , Calendar .SEPTEMBER ,27 ,7 ,0 ,14 ), taskResponseList .getData ().get (0 ).getData ().getDeadline ());
99+ assertEquals (taskResponseList .getData ().get (0 ).getData ().getAssignees ().get (0 ), assignee );
100+ }
101+
86102 @ Test
87103 public void addTaskTest () {
88104 CreateTaskRequest request = new CreateTaskRequest ();
0 commit comments