@@ -146,6 +146,27 @@ public void getRepresentationContentSucceeds() throws InterruptedException {
146146 }
147147 }
148148
149+ @ Test
150+ public void getRepresentationContentWithExtractedTextSucceeds () throws InterruptedException {
151+ BoxAPIConnection api = jwtApiForServiceAccount ();
152+ String fileName = "text.pdf" ;
153+ BoxFile file = null ;
154+ try {
155+ file = uploadSampleFileToUniqueFolder (api , fileName );
156+ final String fileId = file .getID ();
157+ String representationHint = "[extracted_text]" ;
158+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
159+ Retry .retry (() -> {
160+ new BoxFile (api , fileId ).getRepresentationContent (representationHint , outputStream );
161+ byte [] downloadedRepresentationContent = outputStream .toByteArray ();
162+ String text = new String (downloadedRepresentationContent , StandardCharsets .UTF_8 );
163+ assertTrue (text .contains ("Lorem ipsum" ));
164+ }, 5 , 100 );
165+ } finally {
166+ deleteFile (file );
167+ }
168+ }
169+
149170 @ Test
150171 public void uploadFileStreamSucceeds () {
151172 BoxAPIConnection api = jwtApiForServiceAccount ();
@@ -156,7 +177,7 @@ public void uploadFileStreamSucceeds() {
156177
157178 BoxFile uploadedFile = null ;
158179 try {
159- InputStream uploadStream = new ByteArrayInputStream (fileContent );
180+ InputStream uploadStream = new ByteArrayInputStream (fileContent );
160181 BoxFile .Info uploadedFileInfo = folder .uploadFile (uploadStream , BoxFileIT .generateString ());
161182 uploadedFile = uploadedFileInfo .getResource ();
162183
@@ -552,11 +573,11 @@ public void canPaginateOverListOfVersions() {
552573
553574 byte [] fileBytes = "Version 2" .getBytes (StandardCharsets .UTF_8 );
554575 uploadedFile .uploadNewVersion (
555- new ByteArrayInputStream (fileBytes ), null , fileBytes .length , mock (ProgressListener .class ));
576+ new ByteArrayInputStream (fileBytes ), null , fileBytes .length , mock (ProgressListener .class ));
556577
557578 fileBytes = "Version 3" .getBytes (StandardCharsets .UTF_8 );
558579 uploadedFile .uploadNewVersion (
559- new ByteArrayInputStream (fileBytes ), null , fileBytes .length , mock (ProgressListener .class ));
580+ new ByteArrayInputStream (fileBytes ), null , fileBytes .length , mock (ProgressListener .class ));
560581
561582 Collection <BoxFileVersion > versionsPart1 = uploadedFile .getVersionsRange (0 , 1 );
562583 assertThat (versionsPart1 .size (), is (1 ));
0 commit comments