use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseWarnsAboutUnmatchedContentInEntryWithoutComma.
@Test
public void parseWarnsAboutUnmatchedContentInEntryWithoutComma() throws IOException {
ParserResult result = BibtexParser.parse(new StringReader("@article{test,author={author bracket } too much}"), importFormatPreferences);
List<BibEntry> entries = result.getDatabase().getEntries();
assertEquals(Optional.of("author bracket #too##much#"), entries.get(0).getField("author"));
}
use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseRecognizesDatabaseID.
@Test
public void parseRecognizesDatabaseID() throws Exception {
BibtexParser parser = this.parser;
String expectedDatabaseID = "q1w2e3r4t5z6";
StringBuilder sharedDatabaseFileContent = new StringBuilder().append("% DBID: ").append(expectedDatabaseID).append(OS.NEWLINE).append("@Article{a}");
ParserResult parserResult = parser.parse(new StringReader(sharedDatabaseFileContent.toString()));
String actualDatabaseID = parserResult.getDatabase().getSharedDatabaseID().get();
assertEquals(expectedDatabaseID, actualDatabaseID);
}
use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseRecognizesEntryWithBigNumbers.
/**
* Test for [ 1594123 ] Failure to import big numbers Issue Reported by Ulf Martin. SF Bugs #503, #495 are also
* related
*/
@Test
public void parseRecognizesEntryWithBigNumbers() throws IOException {
ParserResult result = BibtexParser.parse(new StringReader("@article{canh05," + "isbn = 1234567890123456789,\n" + "isbn2 = {1234567890123456789},\n" + "small = 1234,\n" + "}"), importFormatPreferences);
Collection<BibEntry> c = result.getDatabase().getEntries();
BibEntry e = c.iterator().next();
assertEquals("article", e.getType());
assertEquals(Optional.of("canh05"), e.getCiteKeyOptional());
assertEquals(Optional.of("1234567890123456789"), e.getField("isbn"));
assertEquals(Optional.of("1234567890123456789"), e.getField("isbn2"));
assertEquals(Optional.of("1234"), e.getField("small"));
}
use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseRecognizesStringInParenthesis.
@Test
public void parseRecognizesStringInParenthesis() throws IOException {
ParserResult result = parser.parse(new StringReader("@string(bourdieu = {Bourdieu, Pierre})"));
assertEquals(1, result.getDatabase().getStringCount());
BibtexString s = result.getDatabase().getStringValues().iterator().next();
assertEquals("bourdieu", s.getName());
assertEquals("Bourdieu, Pierre", s.getContent());
}
use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.
the class BibtexParserTest method parseAcceptsEntryWithAtSymbolInBrackets.
@Test
public void parseAcceptsEntryWithAtSymbolInBrackets() throws IOException {
ParserResult result = parser.parse(new StringReader("@article{test,author={author @ good}}"));
List<BibEntry> entries = result.getDatabase().getEntries();
assertEquals(1, entries.size());
assertEquals(Optional.of("author @ good"), entries.get(0).getField("author"));
}
Aggregations