Skip to content

Commit

Permalink
Don't trim when migrating review field (#3761)
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
  • Loading branch information
LinusDietz and koppor committed Feb 21, 2018
1 parent 85acd73 commit 58c2c7a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
8 changes: 1 addition & 7 deletions src/test/java/org/jabref/testutils/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 58c2c7a

Please sign in to comment.