Skip to content

Commit

Permalink
fix: Fix Checkstyle for PushToTeXworksTest JabRef#3197
Browse files Browse the repository at this point in the history
Co-Authored-By: Vlad Dobre <29517124+vladdobre@users.noreply.github.com>
Co-Authored-By: Kr1st1an-F <100246316+kr1st1an-f@users.noreply.github.com>
  • Loading branch information
3 people committed Mar 1, 2024
1 parent ba232f5 commit 37f3bc7
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions src/test/java/org/jabref/gui/push/PushToTeXworksTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,26 @@

import java.util.Map;

import javafx.beans.property.MapProperty;
import javafx.beans.property.SimpleMapProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableMap;

import org.jabref.gui.DialogService;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.push.CitationCommandString;
import org.jabref.preferences.ExternalApplicationsPreferences;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.PushToApplicationPreferences;
import org.jabref.preferences.ExternalApplicationsPreferences;
import org.jabref.preferences.JabRefPreferences;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.Answers;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import static org.mockito.Mockito.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import org.junit.jupiter.api.Test;

import javafx.beans.property.MapProperty;
import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

// @Disabled("Needs running TeXworks in the background. Start TeXworks with &")
class PushToTeXworksTest {
Expand All @@ -37,7 +30,6 @@ class PushToTeXworksTest {

@BeforeEach
public void setup() {

// Mock the DialogService and PreferencesService
DialogService dialogService = mock(DialogService.class, Answers.RETURNS_DEEP_STUBS);
PreferencesService preferencesService = mock(PreferencesService.class);
Expand All @@ -53,7 +45,7 @@ public void setup() {
when(pushToApplicationPreferences.getCommandPaths()).thenReturn(new SimpleMapProperty<>(observableCommandPaths));
when(preferencesService.getPushToApplicationPreferences()).thenReturn(pushToApplicationPreferences);

//Mock the return value for getCiteCommand()
// Mock the return value for getCiteCommand()
CitationCommandString mockCiteCommand = mock(CitationCommandString.class);
when(mockCiteCommand.prefix()).thenReturn("");
when(mockCiteCommand.suffix()).thenReturn("");
Expand All @@ -75,9 +67,9 @@ public void setup() {
/**
* To verify that the PushToTeXworks class correctly returns its designated display name.
* The display name is used to identify the application in the GUI.
*
*
* Method: getDisplayName()
*
*
*/
@Test
void testDisplayName() {
Expand All @@ -88,9 +80,9 @@ void testDisplayName() {
/**
* To verify that the PushToTeXworks class correctly returns the command line for TeXworks.
* The command line is used to execute the application from the command line.
*
*
* Method: getCommandLine()
*
*
*/
@Test
void testGetCommandLine() {
Expand All @@ -105,10 +97,10 @@ void testGetCommandLine() {
}

/**
* This test run the external application to push the keys to be cited
*
* This test run the external application to push the keys to be cited
*
* Method: pushEntries()
*
*
* [Precondition]: TeXworks should be running in the background
*/
@Disabled("Disabled as it needs running TeXworks in the background. Start TeXworks with &")
Expand All @@ -120,12 +112,12 @@ void pushEntries() {
/**
* To verify that the PushToTeXworks class correctly returns the tooltip for TeXworks.
* The tooltip is used to display a short description of the application in the GUI.
*
*
* Method: getTooltip()
*
*
*/
@Test
void testGetTooltip() {
assertEquals("Push entries to external application (TeXworks)", pushToTeXworks.getTooltip());
}
}
}

0 comments on commit 37f3bc7

Please sign in to comment.