@@ -39,9 +39,9 @@ public void testClientGetWithNonEnglishCharacters() throws IOException
3939 public void testClientGetCollectionList () throws IOException
4040 {
4141 String req = "{ \" data\" : [ { \" gid\" : 1 } ]}" ;
42- dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks" ).code (200 ).content (req );
42+ dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks?limit=50&opt_pretty=false " ).code (200 ).content (req );
4343
44- List <Task > tasks = client .tasks .findByProject ("1" ).execute ();
44+ List <Task > tasks = client .tasks .getTasksForProject ("1" , null ).execute ();
4545 assertEquals (1 , tasks .size ());
4646 assertEquals ("1" , tasks .get (0 ).gid );
4747 }
@@ -50,9 +50,9 @@ public void testClientGetCollectionList() throws IOException
5050 public void testClientGetCollectionListWithNonEnglishCharacters () throws IOException
5151 {
5252 String req = "{ \" data\" : [ { \" gid\" : 1, \" name\" : \" öäüßsøθæîó\" } ]}" ;
53- dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks" ).code (200 ).content (req );
53+ dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks?limit=50&opt_pretty=false " ).code (200 ).content (req );
5454
55- List <Task > tasks = client .tasks .findByProject ("1" ).execute ();
55+ List <Task > tasks = client .tasks .getTasksForProject ("1" , null ).execute ();
5656 assertEquals (1 , tasks .size ());
5757 assertEquals ("1" , tasks .get (0 ).gid );
5858 assertEquals ("öäüßsøθæîó" , tasks .get (0 ).name );
@@ -62,9 +62,9 @@ public void testClientGetCollectionListWithNonEnglishCharacters() throws IOExcep
6262 public void testClientGetCollectionIterator () throws IOException
6363 {
6464 String req = "{ \" data\" : [ { \" gid\" : 1 } ]}" ;
65- dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks?limit=50" ).code (200 ).content (req );
65+ dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks?limit=50&opt_pretty=false " ).code (200 ).content (req );
6666
67- Iterator <Task > tasks = client .tasks .findByProject ("1" ).iterator ();
67+ Iterator <Task > tasks = client .tasks .getTasksForProject ("1" , null ).iterator ();
6868 assertEquals (true , tasks .hasNext ());
6969 assertEquals ("1" , tasks .next ().gid );
7070 assertEquals (false , tasks .hasNext ());
@@ -73,36 +73,33 @@ public void testClientGetCollectionIterator() throws IOException
7373 @ Test
7474 public void testClientPost () throws IOException
7575 {
76- dispatcher .registerResponse ("POST" , "http://app/tasks" ).code (201 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
76+ dispatcher .registerResponse ("POST" , "http://app/tasks?opt_pretty=false " ).code (201 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
7777
78- assertEquals ("1" , client .tasks .create ().execute ().gid );
78+ assertEquals ("1" , client .tasks .createTask ().execute ().gid );
7979 }
8080
8181 @ Test
8282 public void testClientPut () throws IOException
8383 {
84- dispatcher .registerResponse ("PUT" , "http://app/tasks/1" ).code (200 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
84+ dispatcher .registerResponse ("PUT" , "http://app/tasks/1?opt_pretty=false " ).code (200 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
8585
86- assertEquals ("1" , client .tasks .update ("1" ).execute ().gid );
86+ assertEquals ("1" , client .tasks .updateTask ("1" ).execute ().gid );
8787 }
8888
8989 @ Test
9090 public void testClientDelete () throws IOException
9191 {
92- dispatcher .registerResponse ("DELETE" , "http://app/tasks/1" ).code (200 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
92+ dispatcher .registerResponse ("DELETE" , "http://app/tasks/1?opt_pretty=false " ).code (200 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
9393
94- assertEquals ("1" , client .tasks .delete ("1" ).execute ().gid );
94+ assertEquals ("1" , client .tasks .deleteTask ("1" ).execute ().getAsJsonObject (). get ( " gid" ). getAsString () );
9595 }
9696
9797 @ Test
9898 public void testGetNamedParameters () throws IOException
9999 {
100- dispatcher .registerResponse ("GET" , "http://app/tasks?workspace=14916& assignee=me" ).code (200 ).content ("{ \" data\" : [{ \" gid\" : \" 1\" }]}" );
100+ dispatcher .registerResponse ("GET" , "http://app/tasks?assignee=me&limit=50&opt_pretty=false&workspace=14916 " ).code (200 ).content ("{ \" data\" : [{ \" gid\" : \" 1\" }]}" );
101101
102- Collection <Task > result = client .tasks .findAll ()
103- .query ("workspace" , "14916" )
104- .query ("assignee" , "me" )
105- .execute ();
102+ Collection <Task > result = client .tasks .getTasks (null , null , "14916" , null , null , "me" ).execute ();
106103 assertEquals ("1" , result .iterator ().next ().gid );
107104 }
108105
@@ -111,9 +108,9 @@ public void testPostNamedParameters() throws IOException
111108 {
112109 JsonElement req = parser .parse ("{ \" data\" : { \" assignee\" : \" 1235\" , \" followers\" : [\" 5678\" ],\" name\" : \" Hello, world.\" }}" );
113110
114- dispatcher .registerResponse ("POST" , "http://app/tasks" ).code (201 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
111+ dispatcher .registerResponse ("POST" , "http://app/tasks?opt_pretty=false " ).code (201 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
115112
116- Task result = client .tasks .create ()
113+ Task result = client .tasks .createTask ()
117114 .data ("assignee" , "1235" )
118115 .data ("followers" , Arrays .asList ("5678" ))
119116 .data ("name" , "Hello, world." )
@@ -127,9 +124,9 @@ public void testPutNamedParameters() throws IOException
127124 {
128125 JsonElement req = parser .parse ("{ \" data\" : {\" assignee\" : \" 1235\" , \" followers\" : [\" 5678\" ],\" name\" : \" Hello, world.\" }}" );
129126
130- dispatcher .registerResponse ("PUT" , "http://app/tasks/1001" ).code (200 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
127+ dispatcher .registerResponse ("PUT" , "http://app/tasks/1001?opt_pretty=false " ).code (200 ).content ("{ \" data\" : { \" gid\" : \" 1\" }}" );
131128
132- Task result = client .tasks .update ("1001" )
129+ Task result = client .tasks .updateTask ("1001" )
133130 .data ("assignee" , "1235" )
134131 .data ("followers" , Arrays .asList ("5678" ))
135132 .data ("name" , "Hello, world." )
@@ -144,8 +141,7 @@ public void testPagination() throws IOException
144141 String req = "{ \" data\" : [ { \" gid\" : 1 }],\" next_page\" : {\" offset\" : \" b\" ,\" path\" : \" /tasks?project=1&limit=5&offset=b\" ,\" uri\" : \" https://app.asana.com/api/1.0/tasks?project=1&limit=5&offset=b\" }}" ;
145142 dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks?limit=5&offset=a" ).code (200 ).content (req );
146143
147- ResultBodyCollection <Task > result = client .tasks .findByProject ("1" )
148- .option ("limit" , 5 ).option ("offset" , "a" )
144+ ResultBodyCollection <Task > result = client .tasks .getTasksForProject ("1" , null , "a" , 5 , null , null )
149145 .executeRaw ();
150146
151147 assertEquals ("1" , result .data .get (0 ).gid );
@@ -169,8 +165,7 @@ public void testAsanaChangeLogging() throws IOException
169165 .header ("asana-change" ,"name=string_ids;info=something;affected=true" )
170166 .header ("asana-change" , "name=new_sections;info=something;affected=true" );
171167
172- client .tasks .findByProject ("1" )
173- .option ("limit" , 5 ).option ("offset" , "a" )
168+ client .tasks .getTasksForProject ("1" , null , "a" , 5 , null , null )
174169 .executeRaw ();
175170
176171 assertEquals ("Log level as expected?" , Level .WARNING , handler .checkLevel () );
@@ -187,10 +182,10 @@ public void testAsanaChangeLoggingIgnoreCase() throws IOException
187182 logger .setLevel (Level .ALL );
188183
189184 String req = "{ \" data\" : [ { \" gid\" : 1 }],\" next_page\" : {\" offset\" : \" b\" ,\" path\" : \" /tasks?project=1&limit=5&offset=b\" ,\" uri\" : \" https://app.asana.com/api/1.0/tasks?project=1&limit=5&offset=b\" }}" ;
190- dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks?limit=5&offset=a " ).code (200 ).content (req )
185+ dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks?limit=50&opt_pretty=false " ).code (200 ).content (req )
191186 .header ("AsANa-ChaNge" ,"name=new_sections;info=something;affected=true" );
192187
193- client .tasks .findByProject ("1" )
188+ client .tasks .getTasksForProject ("1" , null )
194189 .option ("limit" , 5 ).option ("offset" , "a" )
195190 .executeRaw ();
196191
@@ -211,8 +206,7 @@ public void testAsanaChangeLoggingDontLogIfNotAffected() throws IOException
211206 dispatcher .registerResponse ("GET" , "http://app/projects/1/tasks?limit=5&offset=a" ).code (200 ).content (req )
212207 .header ("asana-change" , "name=new_sections;info=something" );
213208
214- client .tasks .findByProject ("1" )
215- .option ("limit" , 5 ).option ("offset" , "a" )
209+ client .tasks .getTasksForProject ("1" , null , "a" , 5 , null , null )
216210 .executeRaw ();
217211
218212 assertNotEquals ("Log level as expected?" , Level .WARNING , handler .checkLevel () );
0 commit comments