1 package dst.ass1.doc.tests;
3 import static org.junit.Assert.assertNotNull;
4 import static org.junit.Assert.assertTrue;
7 import java.util.stream.StreamSupport;
9 import org.bson.Document;
10 import org.junit.ClassRule;
11 import org.junit.Rule;
12 import org.junit.Test;
14 import dst.ass1.doc.EmbeddedMongo;
15 import dst.ass1.doc.MongoService;
16 import dst.ass1.jpa.util.Constants;
18 public class Ass1_4_3_01Test {
21 public static EmbeddedMongo embeddedMongo = new EmbeddedMongo();
24 public MongoService mongo = new MongoService(db -> {
25 boolean exists = StreamSupport.stream(db.listCollectionNames().spliterator(), false)
26 .anyMatch(Constants.COLL_MATERIAL_DATA::equalsIgnoreCase);
29 db.createCollection(Constants.COLL_MATERIAL_DATA); // make sure the empty collection exists
34 public void getDocumentStatistics_withEmptyData_returnsEmptyStatistics() throws Exception {
35 List<Document> documentStatistics = mongo.getDocumentQuery().getDocumentStatistics();
36 assertNotNull(documentStatistics);
37 assertTrue(documentStatistics.isEmpty());