diff --git a/src/main/java/org/jabref/logic/bibtex/FieldContentParser.java b/src/main/java/org/jabref/logic/bibtex/FieldContentParser.java index 43c05b1a2fd..e2c3b09223b 100644 --- a/src/main/java/org/jabref/logic/bibtex/FieldContentParser.java +++ b/src/main/java/org/jabref/logic/bibtex/FieldContentParser.java @@ -28,6 +28,7 @@ public FieldContentParser(FieldContentParserPreferences prefs) { multiLineFields = new HashSet<>(); // the following two are also coded in org.jabref.logic.bibtex.LatexFieldFormatter.format(String, String) multiLineFields.add(FieldName.ABSTRACT); + multiLineFields.add(FieldName.COMMENT); multiLineFields.add(FieldName.REVIEW); // the file field should not be formatted, therefore we treat it as a multi line field multiLineFields.addAll(prefs.getNonWrappableFields()); diff --git a/src/test/java/org/jabref/logic/importer/migrations/MergeReviewIntoCommentActionMigrationTest.java b/src/test/java/org/jabref/logic/importer/migrations/MergeReviewIntoCommentActionMigrationTest.java index 2e9f09c2350..f533cdada39 100644 --- a/src/test/java/org/jabref/logic/importer/migrations/MergeReviewIntoCommentActionMigrationTest.java +++ b/src/test/java/org/jabref/logic/importer/migrations/MergeReviewIntoCommentActionMigrationTest.java @@ -57,6 +57,21 @@ public void commentField() { assertEquals(entry, actualParserResult.getDatabase().getEntryByKey("Entry1").get()); } + @Test + public void multiLineReviewField() { + String commentString = "My Review\n\nSecond Paragraph\n\nThird Paragraph"; + + BibEntry actualEntry = createMinimalBibEntry(); + actualEntry.setField(FieldName.REVIEW, commentString); + ParserResult actualParserResult = new ParserResult(Collections.singletonList(actualEntry)); + + BibEntry expectedEntry = createMinimalBibEntry(); + expectedEntry.setField(FieldName.COMMENT, commentString); + + action.performMigration(actualParserResult); + + assertEquals(expectedEntry, actualParserResult.getDatabase().getEntryByKey("Entry1").get()); + } @Test @Disabled("Re-enable if the MergeReviewIntoCommentMigration.mergeCommentFieldIfPresent() does not block and wait for user input.") diff --git a/src/test/java/org/jabref/testutils/TestUtils.java b/src/test/java/org/jabref/testutils/TestUtils.java index e0bf7b650b9..7e6c30c3f34 100644 --- a/src/test/java/org/jabref/testutils/TestUtils.java +++ b/src/test/java/org/jabref/testutils/TestUtils.java @@ -3,15 +3,9 @@ import org.jabref.JabRefGUI; import org.jabref.JabRefMain; -/** - * UtilsClass for UnitTests. - * - * @author kahlert, cordes - */ public class TestUtils { - public static final String PATH_TO_TEST_BIBTEX = "src/test/resources/org/jabref/bibtexFiles/test.bib"; - + private static final String PATH_TO_TEST_BIBTEX = "src/test/resources/org/jabref/bibtexFiles/test.bib"; /** * Initialize JabRef. Can be cleaned up with