@Test
  @Category(IntegrationTest.class)
  public void downloadFileRangeSucceeds() throws IOException {
    BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken());
    BoxFolder rootFolder = BoxFolder.getRootFolder(api);
    String fileName = "Tamme-Lauri_tamm_suvepäeval.jpg";
    URL fileURL = this.getClass().getResource("/sample-files/" + fileName);
    String filePath = URLDecoder.decode(fileURL.getFile(), "utf-8");
    long fileSize = new File(filePath).length();
    byte[] fileContent = readAllBytes(filePath);

    InputStream uploadStream = new FileInputStream(filePath);
    ProgressListener mockUploadListener = mock(ProgressListener.class);
    BoxFile.Info uploadedFileInfo =
        rootFolder.uploadFile(uploadStream, fileName, fileSize, mockUploadListener);
    BoxFile uploadedFile = uploadedFileInfo.getResource();
    long firstHalf = uploadedFileInfo.getSize() / 2;

    ByteArrayOutputStream downloadStream = new ByteArrayOutputStream();
    uploadedFile.downloadRange(downloadStream, 0, firstHalf);
    uploadedFile.downloadRange(downloadStream, firstHalf + 1);
    byte[] downloadedFileContent = downloadStream.toByteArray();

    assertThat(downloadedFileContent, is(equalTo(fileContent)));
    assertThat(
        rootFolder,
        hasItem(Matchers.<BoxItem.Info>hasProperty("ID", equalTo(uploadedFile.getID()))));
    verify(mockUploadListener, atLeastOnce())
        .onProgressChanged(anyLong(), longThat(is(equalTo(fileSize))));

    uploadedFile.delete();
  }
  @Test
  @Category(IntegrationTest.class)
  public void moveFileSucceeds() throws UnsupportedEncodingException {
    BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken());
    BoxFolder rootFolder = BoxFolder.getRootFolder(api);
    String fileName = "[moveFileSucceeds] Test File.txt";
    String fileContent = "Test file";
    byte[] fileBytes = fileContent.getBytes(StandardCharsets.UTF_8);
    String folderName = "[moveFileSucceeds] Destination Folder";

    InputStream uploadStream = new ByteArrayInputStream(fileBytes);
    BoxFile uploadedFile = rootFolder.uploadFile(uploadStream, fileName).getResource();

    BoxFolder destinationFolder = rootFolder.createFolder(folderName).getResource();
    uploadedFile.move(destinationFolder);

    assertThat(
        destinationFolder,
        hasItem(Matchers.<BoxItem.Info>hasProperty("ID", equalTo(uploadedFile.getID()))));

    uploadedFile.delete();
    destinationFolder.delete(false);
  }