1 package dst.ass1.doc.tests;
3 import static org.hamcrest.Matchers.hasItems;
4 import static org.junit.Assert.assertNotNull;
5 import static org.junit.Assert.assertThat;
6 import static org.junit.Assert.assertTrue;
10 import org.junit.ClassRule;
11 import org.junit.Rule;
12 import org.junit.Test;
14 import dst.ass1.doc.DocumentTestData;
15 import dst.ass1.doc.EmbeddedMongo;
16 import dst.ass1.doc.MongoService;
18 public class Ass1_4_2bTest {
21 public static EmbeddedMongo embeddedMongo = new EmbeddedMongo();
24 public MongoService mongo = new MongoService(new DocumentTestData());
27 public void findIdsByType_returnsCorrectMaterialIds() throws Exception {
28 List<Long> quizMaterialIds = mongo.getDocumentQuery().findIdsByType("quiz");
29 assertThat(quizMaterialIds, hasItems(1L, 2L, 3L, 5L));
33 public void findIdsByType_withNonExistingType_returnsNoMaterialIds() throws Exception {
34 List<Long> quizMaterialIds = mongo.getDocumentQuery().findIdsByType("NONEXISTING");
35 assertNotNull(quizMaterialIds);
36 assertTrue(quizMaterialIds.isEmpty());