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 33
33
import java .io .InputStream ;
34
34
import java .io .OutputStream ;
35
35
import java .net .URI ;
36
- import java .nio .file .Files ;
37
- import java .nio .file .Paths ;
36
+ import java .util .Scanner ;
38
37
39
38
import static java .nio .charset .Charset .defaultCharset ;
40
39
import static org .junit .Assert .assertArrayEquals ;
@@ -124,12 +123,14 @@ public void testCreateFileWithFile() throws Exception {
124
123
GridFSInputFile in = gridFS .createFile (new File (fileURI ));
125
124
in .save ();
126
125
126
+ String expectedString = new Scanner (new File (fileURI )).useDelimiter ("\\ Z" ).next ();
127
+
127
128
GridFSDBFile out = gridFS .findOne (new BasicDBObject ("_id" , in .getId ()));
128
129
ByteArrayOutputStream bout = new ByteArrayOutputStream ();
129
130
out .writeTo (bout );
130
- String outString = new String (bout .toByteArray (), defaultCharset ());
131
+ String outString = new String (bout .toByteArray (), defaultCharset ()). trim () ;
131
132
132
- assertEquals (new String ( Files . readAllBytes ( Paths . get ( fileURI ))) , outString );
133
+ assertEquals (expectedString , outString );
133
134
}
134
135
135
136
@ Test
You can’t perform that action at this time.
0 commit comments