use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class OOBibStyleTest method testGetCitationMarkerInTextUniquefiersThreeSameAuthor.
@Test
public void testGetCitationMarkerInTextUniquefiersThreeSameAuthor() throws IOException {
OOBibStyle style = new OOBibStyle(StyleLoader.DEFAULT_NUMERICAL_STYLE_PATH, layoutFormatterPreferences);
Map<BibEntry, BibDatabase> entryDBMap = new HashMap<>();
List<BibEntry> entries = new ArrayList<>();
BibDatabase database = new BibDatabase();
BibEntry entry1 = new BibEntry();
entry1.setField("author", "Alpha Beta");
entry1.setField("title", "Paper 1");
entry1.setField("year", "2000");
entries.add(entry1);
database.insertEntry(entry1);
BibEntry entry2 = new BibEntry();
entry2.setField("author", "Alpha Beta");
entry2.setField("title", "Paper 2");
entry2.setField("year", "2000");
entries.add(entry2);
database.insertEntry(entry2);
BibEntry entry3 = new BibEntry();
entry3.setField("author", "Alpha Beta");
entry3.setField("title", "Paper 3");
entry3.setField("year", "2000");
entries.add(entry3);
database.insertEntry(entry3);
for (BibEntry entry : database.getEntries()) {
entryDBMap.put(entry, database);
}
assertEquals("Beta [2000a,b,c]", style.getCitationMarker(entries, entryDBMap, false, new String[] { "a", "b", "c" }, new int[] { 1, 1, 1 }));
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class OOBibStyleTest method testNullAuthorMarker.
@Test
public void testNullAuthorMarker() throws IOException {
OOBibStyle style = new OOBibStyle(StyleLoader.DEFAULT_NUMERICAL_STYLE_PATH, layoutFormatterPreferences);
Map<BibEntry, BibDatabase> entryDBMap = new HashMap<>();
List<BibEntry> entries = new ArrayList<>();
BibDatabase database = new BibDatabase();
BibEntry entry = new BibEntry();
entry.setType("article");
entry.setField("year", "2016");
database.insertEntry(entry);
entries.add(entry);
entryDBMap.put(entry, database);
assertEquals("[, 2016]", style.getCitationMarker(entries, entryDBMap, true, null, null));
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class OOBibStyleTest method testNullYearMarker.
@Test
public void testNullYearMarker() throws IOException {
OOBibStyle style = new OOBibStyle(StyleLoader.DEFAULT_NUMERICAL_STYLE_PATH, layoutFormatterPreferences);
Map<BibEntry, BibDatabase> entryDBMap = new HashMap<>();
List<BibEntry> entries = new ArrayList<>();
BibDatabase database = new BibDatabase();
BibEntry entry = new BibEntry();
entry.setType("article");
entry.setField("author", "Alpha von Beta");
database.insertEntry(entry);
entries.add(entry);
entryDBMap.put(entry, database);
assertEquals("[von Beta, ]", style.getCitationMarker(entries, entryDBMap, true, null, null));
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class OOBibStyleTest method testVonAuthor.
@Test
public void testVonAuthor() throws IOException {
OOBibStyle style = new OOBibStyle(StyleLoader.DEFAULT_NUMERICAL_STYLE_PATH, layoutFormatterPreferences);
BibDatabase database = new BibDatabase();
Layout l = style.getReferenceFormat("article");
l.setPostFormatter(new OOPreFormatter());
BibEntry entry = new BibEntry();
entry.setType("article");
entry.setField("author", "Alpha von Beta");
entry.setField("title", "JabRef Manual");
entry.setField("year", "2016");
database.insertEntry(entry);
assertEquals("<b>von Beta, A.</b> (<b>2016</b>). <i>JabRef Manual</i>, .", l.doLayout(entry, database));
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class OOBibStyleTest method testGetCitationMarkerInParenthesisUniquefiersThreeSameAuthor.
@Test
public void testGetCitationMarkerInParenthesisUniquefiersThreeSameAuthor() throws IOException {
OOBibStyle style = new OOBibStyle(StyleLoader.DEFAULT_NUMERICAL_STYLE_PATH, layoutFormatterPreferences);
Map<BibEntry, BibDatabase> entryDBMap = new HashMap<>();
List<BibEntry> entries = new ArrayList<>();
BibDatabase database = new BibDatabase();
BibEntry entry1 = new BibEntry();
entry1.setField("author", "Alpha Beta");
entry1.setField("title", "Paper 1");
entry1.setField("year", "2000");
entries.add(entry1);
database.insertEntry(entry1);
BibEntry entry2 = new BibEntry();
entry2.setField("author", "Alpha Beta");
entry2.setField("title", "Paper 2");
entry2.setField("year", "2000");
entries.add(entry2);
database.insertEntry(entry2);
BibEntry entry3 = new BibEntry();
entry3.setField("author", "Alpha Beta");
entry3.setField("title", "Paper 3");
entry3.setField("year", "2000");
entries.add(entry3);
database.insertEntry(entry3);
for (BibEntry entry : database.getEntries()) {
entryDBMap.put(entry, database);
}
assertEquals("[Beta, 2000a,b,c]", style.getCitationMarker(entries, entryDBMap, true, new String[] { "a", "b", "c" }, new int[] { 1, 1, 1 }));
}
Aggregations