@@ -148,11 +148,11 @@ public void testXQueryModuleCRUDBinaryFile() {
148148 String Path = "/ext/my/path/to/my/module.xqy" ;
149149
150150 // write XQuery file to the modules database
151- libsMgr .write (Path , new FileHandle (new File ("src/test/java/com/marklogic/client/functionaltest/data/binary.jpg" )).withFormat (Format .BINARY ));
151+ File fBin = new File ("src/test/java/com/marklogic/client/functionaltest/data/binary.jpg" );
152+ libsMgr .write (Path , new FileHandle (fBin ).withFormat (Format .BINARY ));
152153
153154 // read it back
154- FileHandle f = new FileHandle (new File ("src/test/java/com/marklogic/client/functionaltest/data/binary.jpg" ));
155- assertEquals (f .getByteLength (),libsMgr .read (Path , new StringHandle ()).getByteLength ());
155+ assertEquals (fBin .length (), libsMgr .read (Path , new StringHandle ()).getByteLength ());
156156
157157 // get the list of descriptors
158158 ExtensionLibraryDescriptor [] descriptors = libsMgr .list ();
@@ -170,8 +170,7 @@ public void testXQueryModuleCRUDBinaryFile() {
170170 libsMgr .read (Path , new StringHandle ()).get ();
171171 } catch (ResourceNotFoundException e ) {
172172 // pass;
173- }
174-
173+ }
175174 }
176175
177176
@@ -220,13 +219,16 @@ public void testXQueryModuleCRUDBinaryFile() {
220219 ExtensionLibrariesManager libsMgr = client .newServerConfigManager ().newExtensionLibrariesManager ();
221220
222221 String Path = "/ext/my/path/to/my/module.xqy" ;
223- FileHandle f = new FileHandle ( new File ("src/test/java/com/marklogic/client/functionaltest/data/all_well.xml" )). withFormat ( Format . XML );
224-
222+ File fXML = new File ("src/test/java/com/marklogic/client/functionaltest/data/all_well.xml" );
223+ FileHandle f = new FileHandle (). with ( fXML ). withFormat ( Format . XML );
225224 // write XQuery file to the modules database
226225 libsMgr .write (Path , f );
226+ StringHandle strHandle = new StringHandle ();
227227
228228 // read it back
229- assertEquals (f .getByteLength (), libsMgr .read (Path , new StringHandle ()).getByteLength ());
229+ assertTrue (libsMgr .read (Path , strHandle ).getByteLength ()>0 );
230+ assertTrue (strHandle .get ().contains ("All's Well That Ends Well" ));
231+ assertTrue (strHandle .get ().contains ("Exeunt" ));
230232
231233 // get the list of descriptors
232234 ExtensionLibraryDescriptor [] descriptors = libsMgr .list ();
0 commit comments