Skip to content

Commit 0484368

Browse files
committed
Fix #62
1 parent e9e70ec commit 0484368

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/test/java/com/transloadit/sdk/TransloaditTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,19 @@ public void cancelAssembly() throws LocalOperationException, RequestException, I
149149
* @throws RequestException if communication with the server goes wrong.
150150
* @throws IOException if Test resource "assemblies.json" is missing.
151151
*/
152+
@Test
153+
public void listAssembliesParsesItems() throws RequestException, LocalOperationException, IOException {
154+
mockServerClient.when(HttpRequest.request()
155+
.withPath("/assemblies").withMethod("GET"))
156+
.respond(HttpResponse.response().withBody(getJson("assemblies_with_items.json")));
157+
158+
ListResponse assemblies = transloadit.listAssemblies();
159+
Assertions.assertEquals(2, assemblies.size());
160+
Assertions.assertEquals(2, assemblies.getItems().length());
161+
Assertions.assertEquals("abcd1234", assemblies.getItems().getJSONObject(0).getString("assembly_id"));
162+
Assertions.assertEquals("efgh5678", assemblies.getItems().getJSONObject(1).getString("assembly_id"));
163+
}
164+
152165
@Test
153166
public void listAssemblies() throws RequestException, LocalOperationException, IOException {
154167

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"items":[{"assembly_id":"abcd1234","ok":"ASSEMBLY_COMPLETED"},{"assembly_id":"efgh5678","ok":"ASSEMBLY_UPLOADING"}],"count":2}

0 commit comments

Comments
 (0)