use of org.jabref.model.bibtexkeypattern.DatabaseBibtexKeyPattern in project jabref by JabRef.
the class BibtexDatabaseWriterTest method writeCustomKeyPattern.
@Test
public void writeCustomKeyPattern() throws Exception {
AbstractBibtexKeyPattern pattern = new DatabaseBibtexKeyPattern(mock(GlobalBibtexKeyPattern.class));
pattern.setDefaultValue("test");
pattern.addBibtexKeyPattern("article", "articleTest");
metaData.setCiteKeyPattern(pattern);
StringSaveSession session = databaseWriter.savePartOfDatabase(bibtexContext, Collections.emptyList(), new SavePreferences());
assertEquals(OS.NEWLINE + "@Comment{jabref-meta: keypattern_article:articleTest;}" + OS.NEWLINE + OS.NEWLINE + "@Comment{jabref-meta: keypatterndefault:test;}" + OS.NEWLINE, session.getStringValue());
}
use of org.jabref.model.bibtexkeypattern.DatabaseBibtexKeyPattern in project jabref by JabRef.
the class BibtexDatabaseWriterTest method writeMetadataAndEncoding.
@Test
public void writeMetadataAndEncoding() throws Exception {
SavePreferences preferences = new SavePreferences().withEncoding(Charsets.US_ASCII);
DatabaseBibtexKeyPattern bibtexKeyPattern = new DatabaseBibtexKeyPattern(mock(GlobalBibtexKeyPattern.class));
bibtexKeyPattern.setDefaultValue("test");
metaData.setCiteKeyPattern(bibtexKeyPattern);
StringSaveSession session = databaseWriter.savePartOfDatabase(bibtexContext, Collections.emptyList(), preferences);
assertEquals("% Encoding: US-ASCII" + OS.NEWLINE + OS.NEWLINE + "@Comment{jabref-meta: keypatterndefault:test;}" + OS.NEWLINE, session.getStringValue());
}
Aggregations