Skip to content

Commit 7872665

Browse files
committed
- adds a unit test for ODSP file download with custom request
1 parent 7853d37 commit 7872665

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/test/java/com/microsoft/graph/functional/OneDriveTests.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.microsoft.graph.functional;
22

3+
import static org.junit.Assert.assertTrue;
4+
35
import java.io.IOException;
46
import java.io.InputStream;
57

@@ -32,7 +34,7 @@ public void setUp() {
3234
* @throws InterruptedException if the chunked upload fails
3335
*/
3436
@Test
35-
public void testLargeFileUpload() throws IOException, InterruptedException {
37+
public void testLargeFileUpload() throws IOException, InterruptedException {
3638
String itemId = "01BQHXQL5GQVAGCFJLYRH3EAG2YHGERMQA"; //Test upload folder
3739

3840
//Get resource file from file system
@@ -67,7 +69,6 @@ public void failure(final ClientException ex) {
6769
.createUploadSession(new DriveItemUploadableProperties())
6870
.buildRequest()
6971
.post();
70-
7172
ChunkedUploadProvider<DriveItem> chunkedUploadProvider = new ChunkedUploadProvider<DriveItem>(
7273
uploadSession,
7374
testBase.graphClient,
@@ -77,5 +78,11 @@ public void failure(final ClientException ex) {
7778

7879
chunkedUploadProvider.upload(callback);
7980
}
80-
81+
@Test
82+
public void testDownloadWithCustomRequest() throws IOException {
83+
final String testDownloadFileId = "01RWFXFJG3UYRHE75RZVFYWKNUEBB53H7A";
84+
final InputStream stream = testBase.graphClient.customRequest("/me/drive/items/"+testDownloadFileId+"/content", InputStream.class).buildRequest().get();
85+
final byte[] bytes = stream.readAllBytes();
86+
assertTrue("stream should not be empty", bytes.length > 0);
87+
}
8188
}

0 commit comments

Comments
 (0)