Skip to content

Commit 8c935d8

Browse files
committed
Added more asserts for test
1 parent 8442e3c commit 8c935d8

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎spring-data-mongodb/src/test/java/org/baeldung/gridfs/GridFSIntegrationTest.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static org.hamcrest.Matchers.nullValue;
55
import static org.junit.Assert.assertEquals;
66
import static org.junit.Assert.assertNotNull;
7+
import static org.junit.Assert.assertNull;
78
import static org.junit.Assert.assertThat;
89

910
import java.io.FileInputStream;
@@ -95,6 +96,17 @@ public void givenFileWithMetadataExist_whenFindingFileById_thenFileWithMetadataI
9596
GridFSDBFile gridFSDBFile = gridFsTemplate.findOne(new Query(Criteria.where("_id").is(id)));
9697

9798
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"));
98110
assertThat(gridFSDBFile.getFilename(), is("test.png"));
99111
assertThat(gridFSDBFile.getMetaData().get("key"), is("value"));
100112
}

0 commit comments

Comments
 (0)