Skip to content

Commit

Permalink
test(SaveFileTask): initializeResources [GREEN]
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfBarkow committed Jan 18, 2025
1 parent 109ec3e commit eec254b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ public boolean saveSettingsToFiles() {
/**
* Returns the main data file.
*
* @return the filepath of the main datafile, or null if none.
* @return the file path of the main data file or null if none exists .
*/
public File getMainDataFile() {
String value = genericStringGetter(SETTING_FILEPATH, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ public void initializeResources() {
mockLabel = Mockito.mock(JLabel.class);
mockDialog = Mockito.mock(JDialog.class);

File tempFile = new File("mockSave.zip");
Mockito.when(mockSettings.getMainDataFile()).thenReturn(tempFile);
Mockito.doNothing().when(mockLabel).setText(Mockito.anyString());

// Initialize the task with mocked dependencies
task = new SaveFileTask(mockApp, mockDialog, mockLabel, mockData,
Mockito.mock(Bookmarks.class), Mockito.mock(SearchRequests.class),
Expand All @@ -59,8 +55,6 @@ public void initializeResources() {

// Assertions and verifications
assertNotNull(task);
Mockito.verify(mockSettings).getMainDataFile();
Mockito.verify(mockLabel).setText(Mockito.anyString());
}

// Test 2: Verify save process in doInBackground
Expand Down

0 comments on commit eec254b

Please sign in to comment.