Skip to content

Commit

Permalink
fix intitializer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wisskirchenj committed Feb 4, 2024
1 parent 254eb72 commit 7c09973
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
import org.mockito.junit.jupiter.MockitoSettings;
import org.springframework.data.mongodb.core.MongoTemplate;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@MockitoSettings
class ExampleDataInitializerTest {
@Mock
Expand Down Expand Up @@ -161,6 +161,8 @@ void whenCollectionsEmpty_insertData() throws IOException {

verify(userMapper, times(1)).toDocument(any());
verify(mongoTemplate, times(1)).insertAll(any());
verify(mongoTemplate, times(3)).insert(any(), eq("example"));
// TODO replace next line by the following as soon as 5 times load is removed
verify(mongoTemplate, times(15)).insert(any(), eq("example"));
//verify(mongoTemplate, times(3)).insert(any(), eq("example"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ void whenNewContainerStarted_insertSampleData() {
assertThat(categories).isEqualTo(1);

var flashcards = db.getCollection("example").countDocuments();
assertThat(flashcards).isEqualTo(12);
// TODO replace next line by the following as soon as 5 times load is removed
assertThat(flashcards).isEqualTo(60);
//assertThat(flashcards).isEqualTo(12);
}
}

0 comments on commit 7c09973

Please sign in to comment.