use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class BibtexKeyPatternUtilTest method testSpecialLatexCharacterInAuthorName.
@Test
public void testSpecialLatexCharacterInAuthorName() throws ParseException {
Optional<BibEntry> entry = BibtexParser.singleFromString("@ARTICLE{kohn, author={Simon Popovi\\v{c}ov\\'{a}}}", importFormatPreferences);
assertEquals("Popovicova", BibtexKeyPatternUtil.checkLegalKey(BibtexKeyPatternUtil.makeLabel(entry.get(), "auth", ',', new BibDatabase()), true));
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class BibtexKeyPatternUtilTest method testApplyModifiers.
@Test
public void testApplyModifiers() {
BibEntry entry = new BibEntry();
entry.setField("title", "Green Scheduling of Whatever");
assertEquals("GSo", BibtexKeyPatternUtil.makeLabel(entry, "shorttitleINI", ',', new BibDatabase()));
assertEquals("GreenSchedulingof", BibtexKeyPatternUtil.makeLabel(entry, "shorttitle", ',', new BibDatabase()));
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class BibtexKeyPatternUtilTest method testDepartment.
@Test
public void testDepartment() throws ParseException {
Optional<BibEntry> entry = BibtexParser.singleFromString("@ARTICLE{kohn, author={{Link{\\\"{o}}ping University, Department of Electrical Engineering}}}", importFormatPreferences);
assertEquals("UniLinkoepingEE", BibtexKeyPatternUtil.checkLegalKey(BibtexKeyPatternUtil.makeLabel(entry.get(), "auth", ',', new BibDatabase()), true));
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class BibtexKeyPatternUtilTest method keywordsNKeywordsSeparatedBySpace.
@Test
public void keywordsNKeywordsSeparatedBySpace() {
BibEntry entry = new BibEntry();
entry.setField("keywords", "w1, w2a w2b, w3");
// all keywords
String result = BibtexKeyPatternUtil.makeLabel(entry, "keywords", ',', new BibDatabase());
assertEquals("w1w2aw2bw3", result);
// check keywords with space
result = BibtexKeyPatternUtil.makeLabel(entry, "keywords2", ',', new BibDatabase());
assertEquals("w1w2aw2b", result);
// check out of range
result = BibtexKeyPatternUtil.makeLabel(entry, "keywords55", ',', new BibDatabase());
assertEquals("w1w2aw2bw3", result);
}
use of org.jabref.model.database.BibDatabase in project jabref by JabRef.
the class BibtexKeyPatternUtilTest method testUniversity.
@Test
public void testUniversity() throws ParseException {
Optional<BibEntry> entry = BibtexParser.singleFromString("@ARTICLE{kohn, author={{Link{\\\"{o}}ping University}}}", importFormatPreferences);
assertEquals("UniLinkoeping", BibtexKeyPatternUtil.checkLegalKey(BibtexKeyPatternUtil.makeLabel(entry.get(), "auth", ',', new BibDatabase()), true));
}
Aggregations