Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve serialization to fix #4877 #5838

Merged
merged 8 commits into from
Jan 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tests
  • Loading branch information
tobiasdiez committed Jan 17, 2020
commit 3cc259a2437af98ee06b5092b9275651cb3dc484
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
@@ -2094,10 +2094,10 @@ Special\ field\ type\ %0\ is\ unknown.\ Using\ normal\ column\ type.=Special fie
insert\ entries=insert entries
In\ JabRef=In JabRef
On\ disk=On disk

Select\ all\ changes\ on\ the\ left=Select all changes on the left
Select\ all\ changes\ on\ the\ right=Select all changes on the right

Dismiss=Dismiss
Mark\ all\ changes\ as\ accepted=Mark all changes as accepted
Unmark\ all\ changes=Unmark all changes
Normalize=newline characters=Normalize newline characters
Normalizes=all newline characters in the field content.=Normalizes all newline characters in the field content.
Original file line number Diff line number Diff line change
@@ -378,7 +378,9 @@ private BibDatabaseContext createContext(Field field, String value, MetaData met
}

private BibDatabaseContext createContext(Field field, String value) {
return createContext(field, value, new MetaData());
MetaData metaData = new MetaData();
metaData.setMode(BibDatabaseMode.BIBTEX);
return createContext(field, value, metaData);
}

private void assertWrong(BibDatabaseContext context) {
20 changes: 5 additions & 15 deletions src/test/java/org/jabref/model/BibDatabaseContextTest.java
Original file line number Diff line number Diff line change
@@ -11,18 +11,18 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class BibDatabaseContextTest {
class BibDatabaseContextTest {
@Test
public void testTypeBasedOnDefaultBibtex() {
void testTypeBasedOnDefaultBibtex() {
BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(new BibDatabase(), new MetaData());
assertEquals(BibDatabaseMode.BIBTEX, bibDatabaseContext.getMode());
assertEquals(BibDatabaseMode.BIBLATEX, bibDatabaseContext.getMode());

bibDatabaseContext.setMode(BibDatabaseMode.BIBLATEX);
assertEquals(BibDatabaseMode.BIBLATEX, bibDatabaseContext.getMode());
}

@Test
public void testTypeBasedOnDefaultBiblatex() {
void testTypeBasedOnDefaultBiblatex() {
BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(new BibDatabase(), new MetaData());
assertEquals(BibDatabaseMode.BIBLATEX, bibDatabaseContext.getMode());

@@ -31,17 +31,7 @@ public void testTypeBasedOnDefaultBiblatex() {
}

@Test
public void testTypeBasedOnInferredModeBibTeX() {
BibDatabase db = new BibDatabase();
BibEntry e1 = new BibEntry();
db.insertEntry(e1);

BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(db);
assertEquals(BibDatabaseMode.BIBTEX, bibDatabaseContext.getMode());
}

@Test
public void testTypeBasedOnInferredModeBiblatex() {
void testTypeBasedOnInferredModeBiblatex() {
BibDatabase db = new BibDatabase();
BibEntry e1 = new BibEntry(IEEETranEntryType.Electronic);
db.insertEntry(e1);