use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class BibDatabaseTest method addSameStringLabelTwiceThrowsKeyCollisionException.
@Test(expected = KeyCollisionException.class)
public void addSameStringLabelTwiceThrowsKeyCollisionException() {
BibtexString string = new BibtexString("DSP", "Digital Signal Processing");
database.addString(string);
string = new BibtexString("DSP", "Digital Signal Processor");
database.addString(string);
fail();
}
use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class BibDatabaseTest method removeStringUpdatesStringList.
@Test
public void removeStringUpdatesStringList() {
BibtexString string = new BibtexString("DSP", "Digital Signal Processing");
database.addString(string);
database.removeString(string.getId());
assertTrue(database.hasNoStrings());
assertEquals(database.getStringKeySet().size(), 0);
assertEquals(database.getStringCount(), 0);
assertFalse(database.getStringValues().contains(string));
assertFalse(database.getStringKeySet().contains(string.getId()));
assertNull(database.getString(string.getId()));
}
use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class BibtexParserTest method parseRecognizesStringWithWhitespace.
@Test
public void parseRecognizesStringWithWhitespace() 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.model.entry.BibtexString in project jabref by JabRef.
the class BibtexParserTest method parseRecognizesMultipleStrings.
@Test
public void parseRecognizesMultipleStrings() throws IOException {
ParserResult result = parser.parse(new StringReader("@string{bourdieu = {Bourdieu, Pierre}}" + "@string{adieu = {Adieu, Pierre}}"));
assertEquals(2, result.getDatabase().getStringCount());
Iterator<BibtexString> iterator = result.getDatabase().getStringValues().iterator();
BibtexString s = iterator.next();
BibtexString t = iterator.next();
// Sort them because we can't be sure about the order
if (s.getName().equals("adieu")) {
BibtexString tmp = s;
s = t;
t = tmp;
}
assertEquals("bourdieu", s.getName());
assertEquals("Bourdieu, Pierre", s.getContent());
assertEquals("adieu", t.getName());
assertEquals("Adieu, Pierre", t.getContent());
}
use of org.jabref.model.entry.BibtexString in project jabref by JabRef.
the class BibtexParserTest method parseRecognizesString.
@Test
public void parseRecognizesString() 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());
}
Aggregations