use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class CleanupWorkerTest method setUp.
@Before
public void setUp() throws IOException {
pdfFolder = bibFolder.newFolder();
MetaData metaData = new MetaData();
metaData.setDefaultFileDirectory(pdfFolder.getAbsolutePath());
BibDatabaseContext context = new BibDatabaseContext(new BibDatabase(), metaData, new Defaults());
context.setDatabaseFile(bibFolder.newFile("test.bib"));
FileDirectoryPreferences fileDirPrefs = mock(FileDirectoryPreferences.class);
//Biblocation as Primary overwrites all other dirs
when(fileDirPrefs.isBibLocationAsPrimary()).thenReturn(true);
worker = new CleanupWorker(context, new CleanupPreferences("\\bibtexkey", //empty fileDirPattern for backwards compatibility
"", mock(LayoutFormatterPreferences.class), fileDirPrefs));
}
use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class RenamePdfCleanupTest method setUp.
@Before
public void setUp() throws Exception {
MetaData metaData = new MetaData();
context = new BibDatabaseContext(new BibDatabase(), metaData, new Defaults());
context.setDatabaseFile(testFolder.newFile("test.bib"));
fileDirPrefs = mock(FileDirectoryPreferences.class);
//Set Biblocation as Primary Directory, otherwise the tmp folders won't be cleaned up correctly
when(fileDirPrefs.isBibLocationAsPrimary()).thenReturn(true);
entry = new BibEntry();
entry.setCiteKey("Toot");
layoutFormatterPreferences = mock(LayoutFormatterPreferences.class, Answers.RETURNS_DEEP_STUBS);
}
use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class MoveFilesCleanupTest method setUp.
@Before
public void setUp() throws IOException {
MetaData metaData = new MetaData();
pdfFolder = bibFolder.newFolder();
metaData.setDefaultFileDirectory(pdfFolder.getAbsolutePath());
databaseContext = new BibDatabaseContext(new BibDatabase(), metaData, new Defaults());
databaseContext.setDatabaseFile(bibFolder.newFile("test.bib"));
entry = new BibEntry();
entry.setCiteKey("Toot");
entry.setField("title", "test title");
fileDirPrefs = mock(FileDirectoryPreferences.class);
//Biblocation as Primary overwrites all other dirs, therefore we set it to false here
when(fileDirPrefs.isBibLocationAsPrimary()).thenReturn(false);
}
use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class MetaDataSerializerTest method setUp.
@Before
public void setUp() {
metaData = new MetaData();
pattern = GlobalBibtexKeyPattern.fromPattern("[auth][year]");
}
use of org.jabref.model.metadata.MetaData in project jabref by JabRef.
the class IntegrityCheckTest method testFileChecks.
@Test
public void testFileChecks() {
MetaData metaData = mock(MetaData.class);
Mockito.when(metaData.getDefaultFileDirectory()).thenReturn(Optional.of("."));
Mockito.when(metaData.getUserFileDirectory(any(String.class))).thenReturn(Optional.empty());
// FIXME: must be set as checkBibtexDatabase only activates title checker based on database mode
Mockito.when(metaData.getMode()).thenReturn(Optional.of(BibDatabaseMode.BIBTEX));
assertCorrect(createContext("file", ":build.gradle:gradle", metaData));
assertCorrect(createContext("file", "description:build.gradle:gradle", metaData));
assertWrong(createContext("file", ":asflakjfwofja:PDF", metaData));
}
Aggregations