Search in sources :

Example 6 with AbstractBibtexKeyPattern

use of org.jabref.model.bibtexkeypattern.AbstractBibtexKeyPattern 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());
}
Also used : GlobalBibtexKeyPattern(org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern) DatabaseBibtexKeyPattern(org.jabref.model.bibtexkeypattern.DatabaseBibtexKeyPattern) AbstractBibtexKeyPattern(org.jabref.model.bibtexkeypattern.AbstractBibtexKeyPattern) Test(org.junit.Test)

Aggregations

AbstractBibtexKeyPattern (org.jabref.model.bibtexkeypattern.AbstractBibtexKeyPattern)6 DatabaseBibtexKeyPattern (org.jabref.model.bibtexkeypattern.DatabaseBibtexKeyPattern)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 GlobalBibtexKeyPattern (org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 Path (java.nio.file.Path)1 HashMap (java.util.HashMap)1 BaseAction (org.jabref.gui.actions.BaseAction)1 CleanupAction (org.jabref.gui.actions.CleanupAction)1 CopyBibTeXKeyAndLinkAction (org.jabref.gui.actions.CopyBibTeXKeyAndLinkAction)1 SearchFixDuplicateLabels (org.jabref.gui.bibtexkeypattern.SearchFixDuplicateLabels)1 ContentSelectorDialog (org.jabref.gui.contentselector.ContentSelectorDialog)1 ExportToClipboardAction (org.jabref.gui.exporter.ExportToClipboardAction)1 SaveDatabaseAction (org.jabref.gui.exporter.SaveDatabaseAction)1 FindFullTextAction (org.jabref.gui.externalfiles.FindFullTextAction)1 SynchronizeFileField (org.jabref.gui.externalfiles.SynchronizeFileField)1 WriteXMPAction (org.jabref.gui.externalfiles.WriteXMPAction)1