File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
driver/src/test/functional/com/mongodb/gridfs Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 3333import java .io .InputStream ;
3434import java .io .OutputStream ;
3535import java .net .URI ;
36- import java .nio .file .Files ;
37- import java .nio .file .Paths ;
36+ import java .util .Scanner ;
3837
3938import static java .nio .charset .Charset .defaultCharset ;
4039import static org .junit .Assert .assertArrayEquals ;
@@ -124,12 +123,14 @@ public void testCreateFileWithFile() throws Exception {
124123 GridFSInputFile in = gridFS .createFile (new File (fileURI ));
125124 in .save ();
126125
126+ String expectedString = new Scanner (new File (fileURI )).useDelimiter ("\\ Z" ).next ();
127+
127128 GridFSDBFile out = gridFS .findOne (new BasicDBObject ("_id" , in .getId ()));
128129 ByteArrayOutputStream bout = new ByteArrayOutputStream ();
129130 out .writeTo (bout );
130- String outString = new String (bout .toByteArray (), defaultCharset ());
131+ String outString = new String (bout .toByteArray (), defaultCharset ()). trim () ;
131132
132- assertEquals (new String ( Files . readAllBytes ( Paths . get ( fileURI ))) , outString );
133+ assertEquals (expectedString , outString );
133134 }
134135
135136 @ Test
You can’t perform that action at this time.
0 commit comments