Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply RemoveTestPrefix (and fix some issues manually) #10799

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,6 @@ recipeList:
- org.openrewrite.staticanalysis.WhileInsteadOfFor
# - org.openrewrite.staticanalysis.WriteOctalValuesAsDecimal

- org.openrewrite.java.testing.cleanup.RemoveTestPrefix
- org.openrewrite.java.testing.junit5.CleanupAssertions
# - org.openrewrite.java.testing.junit5.JUnit5BestPractices
4 changes: 2 additions & 2 deletions src/test/java/org/jabref/IconsPropertiesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class IconsPropertiesTest {
class IconsPropertiesTest {

@Test
public void testExistenceOfIconImagesReferencedFromIconsProperties() throws IOException {
void existenceOfIconImagesReferencedFromIconsProperties() throws IOException {
String folder = "src/main/resources/images/external";
String iconsProperties = "Icons.properties";
String iconsPropertiesPath = "src/main/resources/images/" + iconsProperties;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/jabref/cli/ArgumentProcessorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void setup() {
}

@Test
void testAuxImport(@TempDir Path tempDir) throws Exception {
void auxImport(@TempDir Path tempDir) throws Exception {
String auxFile = Path.of(AuxCommandLineTest.class.getResource("paper.aux").toURI()).toAbsolutePath().toString();
String originBib = Path.of(AuxCommandLineTest.class.getResource("origin.bib").toURI()).toAbsolutePath().toString();

Expand All @@ -75,7 +75,7 @@ void testAuxImport(@TempDir Path tempDir) throws Exception {
}

@Test
void testExportMatches(@TempDir Path tempDir) throws Exception {
void exportMatches(@TempDir Path tempDir) throws Exception {
Path originBib = Path.of(Objects.requireNonNull(ArgumentProcessorTest.class.getResource("origin.bib")).toURI());
String originBibFile = originBib.toAbsolutePath().toString();

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/jabref/cli/AuxCommandLineTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.Mockito.mock;

public class AuxCommandLineTest {
class AuxCommandLineTest {

private ImportFormatPreferences importFormatPreferences;

@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS);
}

@Test
public void test() throws URISyntaxException, IOException {
void test() throws URISyntaxException, IOException {
InputStream originalStream = AuxCommandLineTest.class.getResourceAsStream("origin.bib");

File auxFile = Path.of(AuxCommandLineTest.class.getResource("paper.aux").toURI()).toFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class AppendPersonNamesStrategyTest {
class AppendPersonNamesStrategyTest {

@Test
void testWithoutParam() {
void withoutParam() {
AppendPersonNamesStrategy strategy = new AppendPersonNamesStrategy();
assertEquals(" and ", strategy.getDelimiter());
}
Expand All @@ -19,7 +19,7 @@ void testWithoutParam() {
"TRUE, ' '",
"FALSE, ' and '",
})
void testWithParam(boolean separationBySpace, String expectedResult) {
void withParam(boolean separationBySpace, String expectedResult) {
AppendPersonNamesStrategy strategy = new AppendPersonNamesStrategy(separationBySpace);
assertEquals(expectedResult, strategy.getDelimiter());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

public class ContentSelectorSuggestionProviderTest {
class ContentSelectorSuggestionProviderTest {

private ContentSelectorSuggestionProvider autoCompleter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class PersonNameStringConverterTest {
class PersonNameStringConverterTest {

/** The author. **/
private Author author;
Expand Down Expand Up @@ -38,7 +38,7 @@ void setUp() {
"FALSE, TRUE, BOTH, 'Reagle, Jr., J. M.'",
"FALSE, FALSE, BOTH, 'Reagle'"
})
void testToStringWithoutAutoCompletePreferences(boolean autoCompFF, boolean autoCompLF, AutoCompleteFirstNameMode autoCompleteFirstNameMode, String expectedResult) {
void toStringWithoutAutoCompletePreferences(boolean autoCompFF, boolean autoCompLF, AutoCompleteFirstNameMode autoCompleteFirstNameMode, String expectedResult) {
PersonNameStringConverter converter = new PersonNameStringConverter(autoCompFF, autoCompLF, autoCompleteFirstNameMode);
String formattedStr = converter.toString(author);
assertEquals(expectedResult, formattedStr);
Expand All @@ -58,7 +58,7 @@ void testToStringWithoutAutoCompletePreferences(boolean autoCompFF, boolean auto
"TRUE, ONLY_ABBREVIATED, BOTH, 'Reagle, Jr., J. M.'",
"TRUE, BOTH, BOTH, 'Reagle, Jr., J. M.'"
})
void testToStringWithAutoCompletePreferences(boolean shouldAutoComplete,
void toStringWithAutoCompletePreferences(boolean shouldAutoComplete,
AutoCompleteFirstNameMode firstNameMode,
AutoCompletePreferences.NameFormat nameFormat,
String expectedResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SuggestionProvidersTest {
private SuggestionProviders suggestionProviders;

@BeforeEach
public void initializeSuggestionProviders() {
void initializeSuggestionProviders() {
BibDatabase database = new BibDatabase();
JournalAbbreviationRepository abbreviationRepository = mock(JournalAbbreviationRepository.class);
Set<Field> completeFields = Set.of(StandardField.AUTHOR, StandardField.XREF, StandardField.XDATA, StandardField.JOURNAL, StandardField.PUBLISHER, SpecialField.PRINTED);
Expand Down Expand Up @@ -57,7 +57,7 @@ private static Stream<Arguments> getTestPairs() {

@ParameterizedTest
@MethodSource("getTestPairs")
public void testAppropriateCompleterReturned(Class<SuggestionProvider<BibEntry>> expected, Field field) {
void appropriateCompleterReturned(Class<SuggestionProvider<BibEntry>> expected, Field field) {
assertEquals(expected, suggestionProviders.getForField(field).getClass());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class BackupManagerDiscardedTest {
private Path backupDir;

@BeforeEach
public void setup(@TempDir Path tempDir) throws Exception {
void setup(@TempDir Path tempDir) throws Exception {
this.backupDir = tempDir.resolve("backups");
Files.createDirectories(backupDir);

Expand Down Expand Up @@ -85,22 +85,22 @@ private void makeBackup() {
}

@Test
public void noDiscardingAChangeLeadsToNewerBackupBeReported() throws Exception {
void noDiscardingAChangeLeadsToNewerBackupBeReported() throws Exception {
databaseModification();
makeBackup();
assertTrue(BackupManager.backupFileDiffers(testBib, backupDir));
}

@Test
public void noDiscardingASavedChange() throws Exception {
void noDiscardingASavedChange() throws Exception {
databaseModification();
makeBackup();
saveDatabase();
assertFalse(BackupManager.backupFileDiffers(testBib, backupDir));
}

@Test
public void discardingAChangeLeadsToNewerBackupToBeIgnored() throws Exception {
void discardingAChangeLeadsToNewerBackupToBeIgnored() throws Exception {
databaseModification();
makeBackup();
backupManager.discardBackup(backupDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class BackupManagerTest {
class BackupManagerTest {

Path backupDir;

Expand All @@ -43,7 +43,7 @@ void setup(@TempDir Path tempDir) {
}

@Test
public void backupFileNameIsCorrectlyGeneratedInAppDataDirectory() {
void backupFileNameIsCorrectlyGeneratedInAppDataDirectory() {
Path bibPath = Path.of("tmp", "test.bib");
backupDir = OS.getNativeDesktop().getBackupDirectory();
Path bakPath = BackupManager.getBackupPathForNewBackup(bibPath, backupDir);
Expand All @@ -53,13 +53,13 @@ public void backupFileNameIsCorrectlyGeneratedInAppDataDirectory() {
}

@Test
public void backupFileIsEqualForNonExistingBackup() throws Exception {
void backupFileIsEqualForNonExistingBackup() throws Exception {
Path originalFile = Path.of(BackupManagerTest.class.getResource("no-autosave.bib").toURI());
assertFalse(BackupManager.backupFileDiffers(originalFile, backupDir));
}

@Test
public void backupFileIsEqual() throws Exception {
void backupFileIsEqual() throws Exception {
// Prepare test: Create backup file on "right" path
Path source = Path.of(BackupManagerTest.class.getResource("no-changes.bib.bak").toURI());
Path target = BackupFileUtil.getPathForNewBackupFileAndCreateDirectory(Path.of(BackupManagerTest.class.getResource("no-changes.bib").toURI()), BackupFileType.BACKUP, backupDir);
Expand All @@ -70,7 +70,7 @@ public void backupFileIsEqual() throws Exception {
}

@Test
public void backupFileDiffers() throws Exception {
void backupFileDiffers() throws Exception {
// Prepare test: Create backup file on "right" path
Path source = Path.of(BackupManagerTest.class.getResource("changes.bib.bak").toURI());
Path target = BackupFileUtil.getPathForNewBackupFileAndCreateDirectory(Path.of(BackupManagerTest.class.getResource("changes.bib").toURI()), BackupFileType.BACKUP, backupDir);
Expand All @@ -81,7 +81,7 @@ public void backupFileDiffers() throws Exception {
}

@Test
public void correctBackupFileDeterminedForMultipleBakFiles() throws Exception {
void correctBackupFileDeterminedForMultipleBakFiles() throws Exception {
Path noChangesBib = Path.of(BackupManagerTest.class.getResource("no-changes.bib").toURI());
Path noChangesBibBak = Path.of(BackupManagerTest.class.getResource("no-changes.bib.bak").toURI());

Expand All @@ -105,7 +105,7 @@ public void correctBackupFileDeterminedForMultipleBakFiles() throws Exception {
}

@Test
public void bakFileWithNewerTimeStampLeadsToDiff() throws Exception {
void bakFileWithNewerTimeStampLeadsToDiff() throws Exception {
Path changesBib = Path.of(BackupManagerTest.class.getResource("changes.bib").toURI());
Path changesBibBak = Path.of(BackupManagerTest.class.getResource("changes.bib.bak").toURI());

Expand All @@ -116,7 +116,7 @@ public void bakFileWithNewerTimeStampLeadsToDiff() throws Exception {
}

@Test
public void bakFileWithOlderTimeStampDoesNotLeadToDiff() throws Exception {
void bakFileWithOlderTimeStampDoesNotLeadToDiff() throws Exception {
Path changesBib = Path.of(BackupManagerTest.class.getResource("changes.bib").toURI());
Path changesBibBak = Path.of(BackupManagerTest.class.getResource("changes.bib.bak").toURI());

Expand All @@ -130,7 +130,7 @@ public void bakFileWithOlderTimeStampDoesNotLeadToDiff() throws Exception {
}

@Test
public void shouldNotCreateABackup(@TempDir Path customDir) throws Exception {
void shouldNotCreateABackup(@TempDir Path customDir) throws Exception {
Path backupDir = customDir.resolve("subBackupDir");
Files.createDirectories(backupDir);

Expand All @@ -157,7 +157,7 @@ public void shouldNotCreateABackup(@TempDir Path customDir) throws Exception {
}

@Test
public void shouldCreateABackup(@TempDir Path customDir) throws Exception {
void shouldCreateABackup(@TempDir Path customDir) throws Exception {
Path backupDir = customDir.resolve("subBackupDir");
Files.createDirectories(backupDir);

Expand Down
24 changes: 12 additions & 12 deletions src/test/java/org/jabref/gui/edit/CopyMoreActionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

public class CopyMoreActionTest {
class CopyMoreActionTest {

private final DialogService dialogService = spy(DialogService.class);
private final ClipBoardManager clipBoardManager = mock(ClipBoardManager.class);
Expand All @@ -48,7 +48,7 @@ public class CopyMoreActionTest {
private BibEntry entry;

@BeforeEach
public void setUp() {
void setUp() {
String title = "A tale from the trenches";
entry = new BibEntry(StandardEntryType.Misc)
.withField(StandardField.AUTHOR, "Souti Chattopadhyay and Nicholas Nelson and Audrey Au and Natalia Morales and Christopher Sanchez and Rahul Pandita and Anita Sarma")
Expand All @@ -67,7 +67,7 @@ public void setUp() {
}

@Test
public void testExecuteOnFail() {
void executeOnFail() {
when(stateManager.getActiveDatabase()).thenReturn(Optional.empty());
when(stateManager.getSelectedEntries()).thenReturn(FXCollections.emptyObservableList());
copyMoreAction = new CopyMoreAction(StandardActions.COPY_TITLE, dialogService, stateManager, clipBoardManager, preferencesService, abbreviationRepository);
Expand All @@ -78,7 +78,7 @@ public void testExecuteOnFail() {
}

@Test
public void testExecuteCopyTitleWithNoTitle() {
void executeCopyTitleWithNoTitle() {
BibEntry entryWithNoTitle = (BibEntry) entry.clone();
entryWithNoTitle.clearField(StandardField.TITLE);
ObservableList<BibEntry> entriesWithNoTitles = FXCollections.observableArrayList(entryWithNoTitle);
Expand All @@ -94,7 +94,7 @@ public void testExecuteCopyTitleWithNoTitle() {
}

@Test
public void testExecuteCopyTitleOnPartialSuccess() {
void executeCopyTitleOnPartialSuccess() {
BibEntry entryWithNoTitle = (BibEntry) entry.clone();
entryWithNoTitle.clearField(StandardField.TITLE);
ObservableList<BibEntry> mixedEntries = FXCollections.observableArrayList(entryWithNoTitle, entry);
Expand All @@ -112,7 +112,7 @@ public void testExecuteCopyTitleOnPartialSuccess() {
}

@Test
public void testExecuteCopyTitleOnSuccess() {
void executeCopyTitleOnSuccess() {
ObservableList<BibEntry> entriesWithTitles = FXCollections.observableArrayList(entry);
BibDatabaseContext databaseContext = new BibDatabaseContext(new BibDatabase(entriesWithTitles));

Expand All @@ -128,7 +128,7 @@ public void testExecuteCopyTitleOnSuccess() {
}

@Test
public void testExecuteCopyKeyWithNoKey() {
void executeCopyKeyWithNoKey() {
BibEntry entryWithNoKey = (BibEntry) entry.clone();
entryWithNoKey.clearCiteKey();
ObservableList<BibEntry> entriesWithNoKeys = FXCollections.observableArrayList(entryWithNoKey);
Expand All @@ -144,7 +144,7 @@ public void testExecuteCopyKeyWithNoKey() {
}

@Test
public void testExecuteCopyKeyOnPartialSuccess() {
void executeCopyKeyOnPartialSuccess() {
BibEntry entryWithNoKey = (BibEntry) entry.clone();
entryWithNoKey.clearCiteKey();
ObservableList<BibEntry> mixedEntries = FXCollections.observableArrayList(entryWithNoKey, entry);
Expand All @@ -162,7 +162,7 @@ public void testExecuteCopyKeyOnPartialSuccess() {
}

@Test
public void testExecuteCopyKeyOnSuccess() {
void executeCopyKeyOnSuccess() {
ObservableList<BibEntry> entriesWithKeys = FXCollections.observableArrayList(entry);
BibDatabaseContext databaseContext = new BibDatabaseContext(new BibDatabase(entriesWithKeys));

Expand All @@ -178,7 +178,7 @@ public void testExecuteCopyKeyOnSuccess() {
}

@Test
public void testExecuteCopyDoiWithNoDoi() {
void executeCopyDoiWithNoDoi() {
BibEntry entryWithNoDoi = (BibEntry) entry.clone();
entryWithNoDoi.clearField(StandardField.DOI);
ObservableList<BibEntry> entriesWithNoDois = FXCollections.observableArrayList(entryWithNoDoi);
Expand All @@ -194,7 +194,7 @@ public void testExecuteCopyDoiWithNoDoi() {
}

@Test
public void testExecuteCopyDoiOnPartialSuccess() {
void executeCopyDoiOnPartialSuccess() {
BibEntry entryWithNoDoi = (BibEntry) entry.clone();
entryWithNoDoi.clearField(StandardField.DOI);
ObservableList<BibEntry> mixedEntries = FXCollections.observableArrayList(entryWithNoDoi, entry);
Expand All @@ -212,7 +212,7 @@ public void testExecuteCopyDoiOnPartialSuccess() {
}

@Test
public void testExecuteCopyDoiOnSuccess() {
void executeCopyDoiOnSuccess() {
ObservableList<BibEntry> entriesWithDois = FXCollections.observableArrayList(entry);
BibDatabaseContext databaseContext = new BibDatabaseContext(new BibDatabase(entriesWithDois));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;

public class CopyOrMoveFieldContentTabViewModelTest {
class CopyOrMoveFieldContentTabViewModelTest {
CopyOrMoveFieldContentTabViewModel copyOrMoveFieldContentTabViewModel;
BibEntry entryA;
BibEntry entryB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.mockito.Mockito.mock;

public class EditFieldContentTabViewModelTest {
class EditFieldContentTabViewModelTest {
EditFieldContentViewModel editFieldContentViewModel;
BibEntry entryA;
BibEntry entryB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class ManageKeywordsViewModelTest {
class ManageKeywordsViewModelTest {

private final BibEntryPreferences bibEntryPreferences = mock(BibEntryPreferences.class);
private ManageKeywordsViewModel keywordsViewModel;
Expand Down
Loading
Loading