|
4 | 4 | import static org.hamcrest.Matchers.nullValue; |
5 | 5 | import static org.junit.Assert.assertEquals; |
6 | 6 | import static org.junit.Assert.assertNotNull; |
| 7 | +import static org.junit.Assert.assertNull; |
7 | 8 | import static org.junit.Assert.assertThat; |
8 | 9 |
|
9 | 10 | import java.io.FileInputStream; |
@@ -95,6 +96,17 @@ public void givenFileWithMetadataExist_whenFindingFileById_thenFileWithMetadataI |
95 | 96 | GridFSDBFile gridFSDBFile = gridFsTemplate.findOne(new Query(Criteria.where("_id").is(id))); |
96 | 97 |
|
97 | 98 | assertNotNull(gridFSDBFile); |
| 99 | + assertNotNull(gridFSDBFile.getInputStream()); |
| 100 | + assertThat(gridFSDBFile.numChunks(), is(1)); |
| 101 | + assertThat(gridFSDBFile.containsField("filename"),is(true)); |
| 102 | + assertThat(gridFSDBFile.get("filename"),is("test.png")); |
| 103 | + assertThat(gridFSDBFile.getId(),is(id)); |
| 104 | + assertThat(gridFSDBFile.keySet().size(),is(9)); |
| 105 | + assertNotNull(gridFSDBFile.getMD5()); |
| 106 | + assertNotNull(gridFSDBFile.getUploadDate()); |
| 107 | + assertNull(gridFSDBFile.getAliases()); |
| 108 | + assertNotNull(gridFSDBFile.getChunkSize()); |
| 109 | + assertThat(gridFSDBFile.getContentType(), is("image/png")); |
98 | 110 | assertThat(gridFSDBFile.getFilename(), is("test.png")); |
99 | 111 | assertThat(gridFSDBFile.getMetaData().get("key"), is("value")); |
100 | 112 | } |
|
0 commit comments