99import org .jabref .model .database .BibDatabaseContext ;
1010import org .jabref .model .database .BibDatabaseMode ;
1111import org .jabref .model .entry .BibEntry ;
12+ import org .jabref .model .entry .BibEntryTypesManager ;
1213import org .jabref .model .entry .field .Field ;
1314import org .jabref .model .entry .field .SpecialField ;
1415import org .jabref .model .entry .field .StandardField ;
1516import org .jabref .model .entry .field .UnknownField ;
1617import org .jabref .model .entry .field .UserSpecificCommentField ;
1718import org .jabref .model .entry .types .StandardEntryType ;
1819
20+ import org .junit .jupiter .api .BeforeEach ;
1921import org .junit .jupiter .api .Test ;
2022import org .junit .jupiter .api .io .TempDir ;
2123
2224import static org .junit .jupiter .api .Assertions .assertEquals ;
2325
2426class BibliographyConsistencyCheckTest {
2527
28+ private BibEntryTypesManager entryTypesManager ;
29+
30+ @ BeforeEach
31+ void setUp () {
32+ // TODO: add some custom entry types for this manager and test with it
33+ entryTypesManager = new BibEntryTypesManager ();
34+ }
35+
2636 @ Test
2737 void checkSimpleLibrary (@ TempDir Path tempDir ) {
2838 BibEntry first = new BibEntry (StandardEntryType .Article , "first" )
@@ -34,7 +44,7 @@ void checkSimpleLibrary(@TempDir Path tempDir) {
3444 BibDatabase database = new BibDatabase (List .of (first , second ));
3545 BibDatabaseContext bibContext = new BibDatabaseContext (database );
3646 bibContext .setMode (BibDatabaseMode .BIBTEX );
37- BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ().check (bibContext , (count , total ) -> {
47+ BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ().check (bibContext , entryTypesManager , (count , total ) -> {
3848 });
3949
4050 BibliographyConsistencyCheck .EntryTypeResult entryTypeResult = new BibliographyConsistencyCheck .EntryTypeResult (Set .of (StandardField .PAGES , StandardField .PUBLISHER ), List .of (first , second ));
@@ -55,7 +65,7 @@ void checkDifferentOutputSymbols(@TempDir Path tempDir) {
5565 BibDatabase bibDatabase = new BibDatabase (List .of (first , second ));
5666 BibDatabaseContext bibContext = new BibDatabaseContext (bibDatabase );
5767 bibContext .setMode (BibDatabaseMode .BIBTEX );
58- BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ().check (bibContext , (_ , _ ) -> {
68+ BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ().check (bibContext , entryTypesManager , (_ , _ ) -> {
5969 });
6070
6171 BibliographyConsistencyCheck .EntryTypeResult entryTypeResult = new BibliographyConsistencyCheck .EntryTypeResult (Set .of (StandardField .PAGES , StandardField .TITLE , customField ), List .of (first , second ));
@@ -88,7 +98,7 @@ void checkComplexLibrary(@TempDir Path tempDir) {
8898 BibDatabase bibDatabase = new BibDatabase (List .of (first , second , third , fourth , fifth ));
8999 BibDatabaseContext bibContext = new BibDatabaseContext (bibDatabase );
90100
91- BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ().check (bibContext , (_ , _ ) -> {
101+ BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ().check (bibContext , entryTypesManager , (_ , _ ) -> {
92102 });
93103
94104 BibliographyConsistencyCheck .EntryTypeResult articleResult = new BibliographyConsistencyCheck .EntryTypeResult (Set .of (StandardField .PAGES , StandardField .PUBLISHER ), List .of (first , second ));
@@ -111,7 +121,7 @@ void checkLibraryWithoutIssues(@TempDir Path tempDir) {
111121 BibDatabase bibDatabase = new BibDatabase (List .of (first , second ));
112122 BibDatabaseContext bibContext = new BibDatabaseContext (bibDatabase );
113123
114- BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ().check (bibContext , (_ , _ ) -> {
124+ BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ().check (bibContext , entryTypesManager , (_ , _ ) -> {
115125 });
116126
117127 BibliographyConsistencyCheck .Result expected = new BibliographyConsistencyCheck .Result (Map .of ());
@@ -133,7 +143,7 @@ void filteredFieldsAreIgnored() {
133143 BibDatabaseContext bibContext = new BibDatabaseContext (bibDatabase );
134144
135145 BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ()
136- .check (bibContext , (_ , _ ) -> {
146+ .check (bibContext , entryTypesManager , (_ , _ ) -> {
137147 });
138148
139149 assertEquals (Map .of (), result .entryTypeToResultMap (),
@@ -150,7 +160,7 @@ void nonFilteredFieldDifferenceIsReported() {
150160 BibDatabaseContext bibContext = new BibDatabaseContext (bibDatabase );
151161
152162 BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ()
153- .check (bibContext , (_ , _ ) -> {
163+ .check (bibContext , entryTypesManager , (_ , _ ) -> {
154164 });
155165
156166 BibliographyConsistencyCheck .EntryTypeResult typeResult =
@@ -174,7 +184,7 @@ void unsetRequriedFieldsReported() {
174184 bibContext .setMode (BibDatabaseMode .BIBLATEX );
175185
176186 BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ()
177- .check (bibContext , (_ , _ ) -> {
187+ .check (bibContext , entryTypesManager , (_ , _ ) -> {
178188 });
179189
180190 BibliographyConsistencyCheck .EntryTypeResult typeResult =
@@ -198,7 +208,7 @@ void unsetFieldsReportedInBibtexMode() {
198208 BibDatabaseContext bibContext = new BibDatabaseContext (bibDatabase );
199209 bibContext .setMode (BibDatabaseMode .BIBTEX );
200210 BibliographyConsistencyCheck .Result result = new BibliographyConsistencyCheck ()
201- .check (bibContext , (_ , _ ) -> {
211+ .check (bibContext , entryTypesManager , (_ , _ ) -> {
202212 });
203213 BibliographyConsistencyCheck .EntryTypeResult typeResult =
204214 result .entryTypeToResultMap ().get (StandardEntryType .Online );
@@ -268,7 +278,7 @@ void checkComplexLibraryWithAdditionalEntry(@TempDir Path tempDir) {
268278 BibDatabase bibDatabase = new BibDatabase (List .of (first , second , third , fourth , fifth , sixth ));
269279 BibDatabaseContext bibContext = new BibDatabaseContext (bibDatabase );
270280
271- BibliographyConsistencyCheck .Result actualResult = new BibliographyConsistencyCheck ().check (bibContext , (_ , _ ) -> {
281+ BibliographyConsistencyCheck .Result actualResult = new BibliographyConsistencyCheck ().check (bibContext , entryTypesManager , (_ , _ ) -> {
272282 });
273283
274284 BibliographyConsistencyCheck .EntryTypeResult articleResult = new BibliographyConsistencyCheck .EntryTypeResult (Set .of (StandardField .PAGES , StandardField .PUBLISHER ), List .of (first , second ));
0 commit comments