Skip to content

Commit

Permalink
test getStatus as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mgyucht committed Aug 28, 2023
1 parent 1ca49f3 commit f9e2188
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import com.databricks.sdk.service.files.FileInfo;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -45,6 +47,10 @@ private void writeFileAndReadFileInner(
// Write the file to DBFS.
workspace.files().upload(fileName, inputStream);

// Read file status
FileInfo fileStatus = workspace.files().getStatus(fileName);
Assertions.assertEquals(fileStatus.getPath(), fileName);

// Read the file back from DBFS.
try (InputStream readContents = workspace.files().download(fileName).getContents()) {
byte[] result = new byte[fileContents.length];
Expand Down

0 comments on commit f9e2188

Please sign in to comment.