Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Sep 3, 2023
1 parent e1e244f commit 801b77e
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.jabref.gui.LibraryTab;
import org.jabref.logic.exporter.AtomicFileWriter;
import org.jabref.logic.exporter.BibDatabaseWriter;
import org.jabref.logic.exporter.BibWriter;
import org.jabref.logic.exporter.BibtexDatabaseWriter;
import org.jabref.logic.exporter.SelfContainedSaveConfiguration;
Expand All @@ -26,9 +27,7 @@

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
* Test for "discarded" flag
Expand All @@ -54,17 +53,13 @@ public void setup(@TempDir Path tempDir) throws Exception {
bibDatabaseContext.setDatabasePath(testBib);

bibEntryTypesManager = new BibEntryTypesManager();

saveConfiguration = mock(SelfContainedSaveConfiguration.class);
when(saveConfiguration.shouldMakeBackup()).thenReturn(false);
when(saveConfiguration.getSaveOrder()).thenReturn(SaveOrder.getDefaultSaveOrder());
when(saveConfiguration.withMakeBackup(anyBoolean())).thenReturn(saveConfiguration);

saveConfiguration = new SelfContainedSaveConfiguration(SaveOrder.getDefaultSaveOrder(), false, BibDatabaseWriter.SaveType.WITH_JABREF_META_DATA, false);
preferencesService = mock(PreferencesService.class, Answers.RETURNS_DEEP_STUBS);

saveDatabase();

backupManager = new BackupManager(mock(LibraryTab.class), bibDatabaseContext, bibEntryTypesManager, preferencesService);

makeBackup();
}

Expand Down

0 comments on commit 801b77e

Please sign in to comment.