From 4f4ac59a32ed5a23620f46aa9a3f8475cdfd3bc0 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 21 Nov 2023 01:19:37 +0100 Subject: [PATCH] Enable org.openrewrite.java.testing.junit5.JUnit5BestPractices --- rewrite.yml | 2 +- .../java/org/jabref/IconsPropertiesTest.java | 4 +- .../org/jabref/cli/AuxCommandLineTest.java | 6 +- .../AppendPersonNamesStrategyTest.java | 2 +- ...ContentSelectorSuggestionProviderTest.java | 2 +- .../PersonNameStringConverterTest.java | 2 +- .../SuggestionProvidersTest.java | 4 +- .../BackupManagerDiscardedTest.java | 8 +- .../autosaveandbackup/BackupManagerTest.java | 20 +- .../jabref/gui/edit/CopyMoreActionTest.java | 24 +- ...opyOrMoveFieldContentTabViewModelTest.java | 2 +- .../EditFieldContentTabViewModelTest.java | 2 +- .../gui/edit/ManageKeywordsViewModelTest.java | 2 +- .../gui/edit/RenameFieldViewModelTest.java | 2 +- .../gui/edit/ReplaceStringViewModelTest.java | 2 +- .../gui/entryeditor/CommentsTabTest.java | 2 +- .../jabref/gui/entryeditor/SciteTabTest.java | 15 +- .../entryeditor/SciteTabViewModelTest.java | 4 +- .../FileAnnotationViewModelTest.java | 16 +- .../exporter/ExportToClipboardActionTest.java | 8 +- .../gui/exporter/SaveDatabaseActionTest.java | 12 +- .../AutoSetFileLinksUtilTest.java | 8 +- .../externalfiles/FileFilterUtilsTest.java | 30 +-- .../GitIgnoreFileFilterTest.java | 8 +- .../UnlinkedFilesCrawlerTest.java | 4 +- .../gui/importer/NewEntryActionTest.java | 8 +- .../ContentSelectorViewModelTest.java | 2 +- .../maintable/MainTableColumnModelTest.java | 14 +- .../jabref/gui/menus/FileHistoryMenuTest.java | 4 +- .../mergeentries/DiffHighlightingTest.java | 13 +- .../mergeentries/FieldRowViewModelTest.java | 32 +-- .../gui/mergeentries/GroupMergerTest.java | 4 +- .../ThreeWayMergeCellViewModelTest.java | 2 +- .../ThreeWayMergeViewModelTest.java | 2 +- .../org/jabref/gui/push/PushToEmacsTest.java | 2 +- .../gui/search/GetLastSearchHistoryTest.java | 13 +- .../gui/search/TextFlowEqualityHelper.java | 6 +- .../ManageStudyDefinitionViewModelTest.java | 4 +- .../jabref/gui/theme/ThemeManagerTest.java | 18 +- .../java/org/jabref/gui/theme/ThemeTest.java | 14 +- .../org/jabref/gui/util/ColorUtilTest.java | 8 +- .../jabref/gui/util/ControlHelperTest.java | 2 +- .../gui/util/OpenConsoleActionTest.java | 10 +- .../jabref/gui/util/TooltipTextUtilTest.java | 38 +-- .../NumericFieldComparatorTest.java | 24 +- .../RankingFieldComparatorTest.java | 16 +- .../SpecialFieldComparatorTest.java | 18 +- .../org/jabref/logic/TypedBibEntryTest.java | 12 +- .../jabref/logic/bibtex/BibEntryAssert.java | 8 +- .../logic/bibtex/FileFieldWriterTest.java | 14 +- .../bibtex/comparator/BibStringDiffTest.java | 2 +- .../BibtexStringComparatorTest.java | 4 +- .../CrossRefEntryComparatorTest.java | 14 +- .../comparator/FieldComparatorTest.java | 44 +-- .../bibtex/comparator/GroupDiffTest.java | 2 +- .../bibtex/comparator/MetaDataDiffTest.java | 4 +- .../bibtex/comparator/PreambleDiffTest.java | 2 +- .../jabref/logic/bst/BstFunctionsTest.java | 46 ++-- .../logic/bst/BstPreviewLayoutTest.java | 8 +- .../java/org/jabref/logic/bst/BstVMTest.java | 14 +- .../jabref/logic/bst/BstVMVisitorTest.java | 12 +- .../logic/bst/util/BstCaseChangersTest.java | 12 +- .../logic/bst/util/BstNameFormatterTest.java | 20 +- .../logic/bst/util/BstPurifierTest.java | 4 +- .../logic/bst/util/BstTextPrefixerTest.java | 4 +- .../bst/util/BstWidthCalculatorTest.java | 6 +- .../cleanup/ConvertToBiblatexCleanupTest.java | 16 +- .../cleanup/ConvertToBibtexCleanupTest.java | 12 +- .../jabref/logic/cleanup/DoiCleanupTest.java | 4 +- .../logic/cleanup/DoiDecodeCleanupTest.java | 4 +- .../cleanup/FieldFormatterCleanupTest.java | 14 +- .../cleanup/FieldFormatterCleanupsTest.java | 20 +- .../jabref/logic/cleanup/ISSNCleanupTest.java | 10 +- .../cleanup/TimeStampToCreationDateTest.java | 6 +- .../TimeStampToModificationDateTest.java | 4 +- .../jabref/logic/cleanup/URLCleanupTest.java | 4 +- .../org/jabref/logic/crawler/CrawlerTest.java | 4 +- .../StudyCatalogToFetcherConverterTest.java | 6 +- .../logic/crawler/StudyRepositoryTest.java | 2 +- .../logic/crawler/StudyYamlParserTest.java | 6 +- .../logic/database/DuplicateCheckTest.java | 56 ++-- .../exporter/AtomicFileOutputStreamTest.java | 4 +- .../exporter/BibtexDatabaseWriterTest.java | 2 +- .../logic/exporter/CsvExportFormatTest.java | 12 +- .../logic/exporter/DocbookExporterTest.java | 6 +- .../EmbeddedBibFilePdfExporterTest.java | 2 +- .../jabref/logic/exporter/ExporterTest.java | 6 +- .../exporter/HayagrivaYamlExporterTest.java | 12 +- .../logic/exporter/HtmlExportFormatTest.java | 6 +- .../exporter/MetaDataSerializerTest.java | 8 +- .../exporter/ModsExportFormatFilesTest.java | 8 +- .../logic/exporter/ModsExportFormatTest.java | 6 +- .../logic/exporter/MsBibExportFormatTest.java | 4 +- .../logic/exporter/XmpExporterTest.java | 12 +- .../logic/exporter/XmpPdfExporterTest.java | 2 +- .../logic/exporter/YamlExporterTest.java | 8 +- .../jabref/logic/formatter/FormatterTest.java | 2 +- .../formatter/IdentityFormatterTest.java | 6 +- .../bibtexfields/AddBracesFormatterTest.java | 26 +- .../bibtexfields/ClearFormatterTest.java | 10 +- .../HtmlToLatexFormatterTest.java | 22 +- .../HtmlToUnicodeFormatterTest.java | 4 +- .../NormalizeDateFormatterTest.java | 52 ++-- .../NormalizeEnDashesFormatterTest.java | 18 +- .../NormalizeMonthFormatterTest.java | 8 +- .../NormalizeNamesFormatterTest.java | 58 ++-- .../NormalizePagesFormatterTest.java | 6 +- .../OrdinalsToSuperscriptFormatterTest.java | 16 +- .../RemoveBracesFormatterTest.java | 28 +- .../RemoveDigitsFormatterTest.java | 10 +- ...RemoveHyphenatedNewlinesFormatterTest.java | 10 +- .../RemoveNewlinesFormatterTest.java | 14 +- .../RemoveRedundantSpacesFormatterTest.java | 12 +- .../ReplaceTabsBySpaceFormaterTest.java | 10 +- .../ReplaceWithEscapedDoubleQuotesTest.java | 14 +- .../bibtexfields/ShortenDOIFormatterTest.java | 8 +- .../TrimWhitespaceFormatterTest.java | 16 +- .../bibtexfields/UnicodeConverterTest.java | 12 +- .../UnitsToLatexFormatterTest.java | 8 +- .../casechanger/CapitalizeFormatterTest.java | 8 +- .../casechanger/LowerCaseFormatterTest.java | 8 +- .../ProtectTermsFormatterTest.java | 16 +- .../SentenceCaseFormatterTest.java | 6 +- .../casechanger/TitleCaseFormatterTest.java | 6 +- .../UnprotectTermsFormatterTest.java | 6 +- .../casechanger/UpperCaseFormatterTest.java | 6 +- .../minifier/MinifyNameListFormatterTest.java | 4 +- .../minifier/TruncateFormatterTest.java | 2 +- .../org/jabref/logic/git/GitHandlerTest.java | 2 +- .../jabref/logic/git/SlrGitHandlerTest.java | 2 +- .../logic/importer/BibDatabaseFilesTest.java | 6 +- .../logic/importer/FulltextFetchersTest.java | 10 +- .../jabref/logic/importer/ImporterTest.java | 20 +- .../logic/importer/QueryParserTest.java | 20 +- .../importer/fetcher/ArXivFetcherTest.java | 19 +- .../fetcher/AstrophysicsDataSystemTest.java | 26 +- .../fetcher/BiodiversityLibraryTest.java | 16 +- .../importer/fetcher/BvbFetcherTest.java | 14 +- ...puterScienceBibliographiesFetcherTest.java | 10 +- ...mputerScienceBibliographiesParserTest.java | 8 +- .../CompositeSearchBasedFetcherTest.java | 22 +- .../logic/importer/fetcher/CrossRefTest.java | 34 +-- .../importer/fetcher/DBLPFetcherTest.java | 10 +- .../importer/fetcher/DOABFetcherTest.java | 4 +- .../importer/fetcher/DOAJFetcherTest.java | 2 +- .../logic/importer/fetcher/DiVATest.java | 14 +- .../importer/fetcher/DoiFetcherTest.java | 22 +- .../fetcher/GrobidCitationFetcherTest.java | 10 +- .../importer/fetcher/GvkFetcherTest.java | 18 +- .../importer/fetcher/INSPIREFetcherTest.java | 4 +- .../fetcher/IacrEprintFetcherTest.java | 36 +-- .../fetcher/LibraryOfCongressTest.java | 10 +- .../importer/fetcher/MedlineFetcherTest.java | 26 +- .../logic/importer/fetcher/MedraTest.java | 10 +- .../importer/fetcher/MrDLibFetcherTest.java | 10 +- .../importer/fetcher/PicaXmlParserTest.java | 10 +- .../importer/fetcher/ResearchGateTest.java | 4 +- .../importer/fetcher/RfcFetcherTest.java | 12 +- .../fetcher/ScholarArchiveFetcherTest.java | 8 +- .../SearchBasedFetcherCapabilityTest.java | 3 +- .../importer/fetcher/SemanticScholarTest.java | 4 +- .../importer/fetcher/SpringerFetcherTest.java | 11 +- .../importer/fetcher/SpringerLinkTest.java | 12 +- .../importer/fetcher/TitleFetcherTest.java | 12 +- ...oiToBibtexConverterComIsbnFetcherTest.java | 10 +- .../isbntobibtex/EbookDeIsbnFetcherTest.java | 6 +- .../isbntobibtex/GVKIsbnFetcherTest.java | 6 +- .../OpenLibraryIsbnFetcherTest.java | 6 +- .../CiteSeerQueryTransformerTest.java | 10 +- .../IEEEQueryTransformerTest.java | 2 +- .../fileformat/ACMPortalParserTest.java | 2 +- .../BiblioscapeImporterFilesTest.java | 6 +- .../fileformat/BiblioscapeImporterTest.java | 14 +- .../BiblioscapeImporterTypesTest.java | 5 +- .../fileformat/BibtexImporterTest.java | 30 +-- .../importer/fileformat/CffImporterTest.java | 28 +- .../CitaviXmlImporterFilesTest.java | 2 +- .../fileformat/CopacImporterFilesTest.java | 8 +- .../fileformat/CopacImporterTest.java | 10 +- .../fileformat/CustomImporterTest.java | 26 +- .../fileformat/EndnoteImporterTest.java | 22 +- .../EndnoteXmlImporterFilesTest.java | 2 +- .../fileformat/ImporterTestEngine.java | 8 +- .../fileformat/InspecImporterTest.java | 22 +- .../importer/fileformat/IsiImporterTest.java | 40 +-- .../fileformat/MarcXmlParserTest.java | 4 +- .../fileformat/MedlineImporterFilesTest.java | 10 +- .../fileformat/MedlineImporterTest.java | 12 +- .../fileformat/MrDLibImporterTest.java | 16 +- .../fileformat/MsBibImporterFilesTest.java | 8 +- .../fileformat/MsBibImporterTest.java | 16 +- .../importer/fileformat/OvidImporterTest.java | 24 +- .../fileformat/PdfGrobidImporterTest.java | 14 +- .../fileformat/PdfXmpImporterTest.java | 20 +- .../importer/fileformat/RISImporterTest.java | 14 +- .../fileformat/RepecNepImporterTest.java | 18 +- .../importer/util/FileFieldParserTest.java | 4 +- .../importer/util/GrobidServiceTest.java | 14 +- .../logic/importer/util/JsonReaderTest.java | 8 +- .../logic/importer/util/MathMLParserTest.java | 2 +- .../logic/importer/util/StaxParserTest.java | 2 +- .../integrity/ASCIICharacterCheckerTest.java | 2 +- .../logic/integrity/AmpersandCheckerTest.java | 2 +- .../logic/integrity/BibStringCheckerTest.java | 2 +- .../logic/integrity/BooktitleCheckerTest.java | 2 +- .../logic/integrity/BracesCorrectorTest.java | 18 +- .../logic/integrity/BracketCheckerTest.java | 2 +- .../integrity/CitationKeyCheckerTest.java | 2 +- .../CitationKeyDeviationCheckerTest.java | 2 +- .../CitationKeyDuplicationCheckerTest.java | 2 +- .../integrity/DoiDuplicationCheckerTest.java | 8 +- .../logic/integrity/EditionCheckerTest.java | 2 +- .../integrity/HTMLCharacterCheckerTest.java | 2 +- .../integrity/HowPublishedCheckerTest.java | 4 +- .../logic/integrity/ISBNCheckerTest.java | 4 +- .../logic/integrity/ISSNCheckerTest.java | 4 +- .../JournalInAbbreviationListCheckerTest.java | 2 +- .../integrity/LatexIntegrityCheckerTest.java | 2 +- .../logic/integrity/MonthCheckerTest.java | 4 +- .../logic/integrity/NoteCheckerTest.java | 2 +- .../integrity/PersonNamesCheckerTest.java | 12 +- .../logic/integrity/TitleCheckerTest.java | 4 +- .../logic/integrity/TypeCheckerTest.java | 2 +- .../logic/integrity/UTF8CheckerTest.java | 2 +- .../logic/integrity/UrlCheckerTest.java | 2 +- .../ValidCitationKeyCheckerTest.java | 2 +- .../logic/integrity/YearCheckerTest.java | 2 +- .../journals/AbbreviationParserTest.java | 2 +- .../JournalInformationFetcherTest.java | 24 +- .../org/jabref/logic/l10n/EncodingsTest.java | 10 +- .../l10n/JavaLocalizationEntryParserTest.java | 8 +- .../logic/l10n/LocalizationKeyParamsTest.java | 6 +- .../logic/l10n/LocalizationKeyTest.java | 2 +- .../jabref/logic/l10n/LocalizationParser.java | 3 +- .../jabref/logic/layout/LayoutEntryTest.java | 4 +- .../jabref/logic/layout/LayoutHelperTest.java | 6 +- .../layout/format/AuthorAbbreviatorTest.java | 4 +- .../format/AuthorAndsCommaReplacerTest.java | 4 +- .../layout/format/AuthorAndsReplacerTest.java | 4 +- .../format/AuthorFirstAbbrLastCommasTest.java | 4 +- .../AuthorFirstAbbrLastOxfordCommasTest.java | 4 +- .../format/AuthorFirstFirstCommasTest.java | 4 +- .../layout/format/AuthorFirstFirstTest.java | 4 +- .../format/AuthorFirstLastCommasTest.java | 2 +- .../AuthorFirstLastOxfordCommasTest.java | 4 +- .../layout/format/AuthorLF_FFAbbrTest.java | 4 +- .../logic/layout/format/AuthorLF_FFTest.java | 4 +- .../format/AuthorLastFirstAbbrCommasTest.java | 4 +- .../AuthorLastFirstAbbrOxfordCommasTest.java | 4 +- .../format/AuthorLastFirstCommasTest.java | 4 +- .../AuthorLastFirstOxfordCommasTest.java | 4 +- .../layout/format/AuthorLastFirstTest.java | 4 +- .../logic/layout/format/AuthorNatBibTest.java | 2 +- .../logic/layout/format/AuthorOrgSciTest.java | 2 +- .../logic/layout/format/AuthorsTest.java | 48 ++-- .../layout/format/CompositeFormatTest.java | 8 +- .../logic/layout/format/DOICheckTest.java | 2 +- .../logic/layout/format/DOIStripTest.java | 8 +- .../layout/format/DateFormatterTest.java | 10 +- .../logic/layout/format/DefaultTest.java | 2 +- .../layout/format/EntryTypeFormatterTest.java | 2 +- .../logic/layout/format/FileLinkTest.java | 4 +- .../logic/layout/format/FirstPageTest.java | 2 +- .../logic/layout/format/HTMLCharsTest.java | 21 +- .../layout/format/HTMLParagraphsTest.java | 2 +- .../logic/layout/format/IfPluralTest.java | 14 +- .../logic/layout/format/LastPageTest.java | 2 +- .../layout/format/NameFormatterTest.java | 6 +- .../NoSpaceBetweenAbbreviationsTest.java | 2 +- .../logic/layout/format/OrdinalTest.java | 16 +- .../logic/layout/format/RTFCharsTest.java | 2 +- .../format/RemoveBracketsAddCommaTest.java | 4 +- .../layout/format/RemoveBracketsTest.java | 14 +- .../RemoveLatexCommandsFormatterTest.java | 20 +- .../logic/layout/format/RemoveTildeTest.java | 4 +- .../layout/format/RemoveWhitespaceTest.java | 12 +- .../logic/layout/format/ReplaceTest.java | 14 +- .../ReplaceUnicodeLigaturesFormatterTest.java | 12 +- .../logic/layout/format/RisKeywordsTest.java | 12 +- .../logic/layout/format/RisMonthTest.java | 10 +- .../format/ShortMonthFormatterTest.java | 8 +- .../logic/layout/format/ToLowerCaseTest.java | 6 +- .../logic/layout/format/ToUpperCaseTest.java | 2 +- .../logic/layout/format/WrapContentTest.java | 2 +- .../jabref/logic/msbib/MsBibAuthorTest.java | 14 +- .../jabref/logic/msbib/MsBibMappingTest.java | 10 +- .../java/org/jabref/logic/net/ProxyTest.java | 14 +- .../org/jabref/logic/net/URLDownloadTest.java | 30 +-- .../openoffice/style/OOPreFormatterTest.java | 16 +- .../openoffice/style/StyleLoaderTest.java | 36 +-- .../pdf/EntryAnnotationImporterTest.java | 6 +- .../logic/pdf/PdfAnnotationImporterTest.java | 34 +-- .../search/indexing/DocumentReaderTest.java | 8 +- .../pdf/search/indexing/PdfIndexerTest.java | 18 +- .../pdf/search/retrieval/PdfSearcherTest.java | 20 +- .../ProtectedTermsListTest.java | 30 +-- .../logic/remote/RemotePreferencesTest.java | 16 +- .../jabref/logic/remote/RemoteUtilTest.java | 10 +- .../logic/search/DatabaseSearcherTest.java | 22 +- .../jabref/logic/search/SearchQueryTest.java | 62 ++--- .../logic/shared/DBMSConnectionTest.java | 4 +- .../logic/shared/DBMSProcessorTest.java | 8 +- .../logic/shared/DBMSSynchronizerTest.java | 26 +- .../org/jabref/logic/shared/DBMSTypeTest.java | 44 +-- .../shared/SynchronizationSimulatorTest.java | 16 +- .../logic/texparser/DefaultTexParserTest.java | 26 +- .../logic/texparser/LatexParserTest.java | 6 +- .../texparser/TexBibEntriesResolverTest.java | 14 +- .../org/jabref/logic/util/BuildInfoTest.java | 8 +- .../logic/util/DevelopmentStageTest.java | 10 +- .../logic/util/FileNameCleanerTest.java | 10 +- .../jabref/logic/util/UpdateFieldTest.java | 56 ++-- .../org/jabref/logic/util/VersionTest.java | 86 +++--- .../logic/util/io/BackupFileUtilTest.java | 6 +- .../logic/util/io/FileNameUniquenessTest.java | 20 +- .../jabref/logic/util/io/FileUtilTest.java | 18 +- .../strings/StringLengthComparatorTest.java | 4 +- .../util/strings/StringManipulatorTest.java | 28 +- .../util/strings/StringSimilarityTest.java | 4 +- ...eReviewIntoCommentActionMigrationTest.java | 12 +- .../migrations/PreferencesMigrationsTest.java | 3 +- .../SpecialFieldsToSeparateFieldsTest.java | 10 +- .../java/org/jabref/model/TreeNodeTest.java | 144 +++++----- .../BibDatabaseModeDetectionTest.java | 14 +- .../model/database/KeyChangeListenerTest.java | 18 +- .../jabref/model/entry/AuthorListTest.java | 250 +++++++++--------- .../jabref/model/entry/BibtexStringTest.java | 26 +- .../model/entry/CanonicalBibEntryTest.java | 4 +- .../jabref/model/entry/EntryLinkListTest.java | 18 +- .../model/entry/EntryTypeFactoryTest.java | 4 +- .../jabref/model/entry/IdGeneratorTest.java | 4 +- .../jabref/model/entry/KeywordListTest.java | 38 +-- .../org/jabref/model/entry/KeywordTest.java | 6 +- .../org/jabref/model/entry/MonthTest.java | 18 +- .../model/entry/field/SpecialFieldTest.java | 6 +- .../entry/identifier/ArXivIdentifierTest.java | 24 +- .../model/entry/identifier/DOITest.java | 30 +-- .../model/entry/identifier/ISBNTest.java | 26 +- .../model/entry/identifier/ISSNTest.java | 22 +- .../entry/identifier/IacrEprintTest.java | 8 +- .../entry/identifier/MathSciNetIdTest.java | 4 +- .../jabref/model/groups/SearchGroupTest.java | 10 +- .../org/jabref/model/groups/TexGroupTest.java | 10 +- .../model/groups/WordKeywordGroupTest.java | 30 +-- .../jabref/model/metadata/MetaDataTest.java | 6 +- .../org/jabref/model/paging/PageTest.java | 12 +- .../jabref/model/pdf/FileAnnotationTest.java | 12 +- .../search/matchers/MatcherSetsTest.java | 10 +- .../rules/ContainsBasedSearchRuleTest.java | 8 +- .../search/rules/SentenceAnalyzerTest.java | 4 +- .../jabref/model/texparser/CitationTest.java | 26 +- 351 files changed, 2171 insertions(+), 2169 deletions(-) diff --git a/rewrite.yml b/rewrite.yml index bbaa6bb76ab1..57aba27e1296 100644 --- a/rewrite.yml +++ b/rewrite.yml @@ -197,5 +197,5 @@ recipeList: # - org.openrewrite.staticanalysis.WriteOctalValuesAsDecimal - org.openrewrite.java.testing.junit5.CleanupAssertions - # - org.openrewrite.java.testing.junit5.JUnit5BestPractices + - org.openrewrite.java.testing.junit5.JUnit5BestPractices # - org.openrewrite.java.testing.junit5.UpgradeOkHttpMockWebServer diff --git a/src/test/java/org/jabref/IconsPropertiesTest.java b/src/test/java/org/jabref/IconsPropertiesTest.java index c330ca4a1fe7..b36fe41e547a 100644 --- a/src/test/java/org/jabref/IconsPropertiesTest.java +++ b/src/test/java/org/jabref/IconsPropertiesTest.java @@ -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 testExistenceOfIconImagesReferencedFromIconsProperties() throws IOException { String folder = "src/main/resources/images/external"; String iconsProperties = "Icons.properties"; String iconsPropertiesPath = "src/main/resources/images/" + iconsProperties; diff --git a/src/test/java/org/jabref/cli/AuxCommandLineTest.java b/src/test/java/org/jabref/cli/AuxCommandLineTest.java index d746bffea9a0..69d8734fc9da 100644 --- a/src/test/java/org/jabref/cli/AuxCommandLineTest.java +++ b/src/test/java/org/jabref/cli/AuxCommandLineTest.java @@ -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(); diff --git a/src/test/java/org/jabref/gui/autocompleter/AppendPersonNamesStrategyTest.java b/src/test/java/org/jabref/gui/autocompleter/AppendPersonNamesStrategyTest.java index e4acf04061d4..52383dfc19d5 100644 --- a/src/test/java/org/jabref/gui/autocompleter/AppendPersonNamesStrategyTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/AppendPersonNamesStrategyTest.java @@ -6,7 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AppendPersonNamesStrategyTest { +class AppendPersonNamesStrategyTest { @Test void testWithoutParam() { diff --git a/src/test/java/org/jabref/gui/autocompleter/ContentSelectorSuggestionProviderTest.java b/src/test/java/org/jabref/gui/autocompleter/ContentSelectorSuggestionProviderTest.java index efa4139f4e34..004fa2e57ca2 100644 --- a/src/test/java/org/jabref/gui/autocompleter/ContentSelectorSuggestionProviderTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/ContentSelectorSuggestionProviderTest.java @@ -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; diff --git a/src/test/java/org/jabref/gui/autocompleter/PersonNameStringConverterTest.java b/src/test/java/org/jabref/gui/autocompleter/PersonNameStringConverterTest.java index e1fdff0f8b14..2c1940c9b4d1 100644 --- a/src/test/java/org/jabref/gui/autocompleter/PersonNameStringConverterTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/PersonNameStringConverterTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class PersonNameStringConverterTest { +class PersonNameStringConverterTest { /** The author. **/ private Author author; diff --git a/src/test/java/org/jabref/gui/autocompleter/SuggestionProvidersTest.java b/src/test/java/org/jabref/gui/autocompleter/SuggestionProvidersTest.java index 247ee476fd8e..ab86194a8e1a 100644 --- a/src/test/java/org/jabref/gui/autocompleter/SuggestionProvidersTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/SuggestionProvidersTest.java @@ -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 completeFields = Set.of(StandardField.AUTHOR, StandardField.XREF, StandardField.XDATA, StandardField.JOURNAL, StandardField.PUBLISHER, SpecialField.PRINTED); @@ -57,7 +57,7 @@ private static Stream getTestPairs() { @ParameterizedTest @MethodSource("getTestPairs") - public void testAppropriateCompleterReturned(Class> expected, Field field) { + void testAppropriateCompleterReturned(Class> expected, Field field) { assertEquals(expected, suggestionProviders.getForField(field).getClass()); } diff --git a/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerDiscardedTest.java b/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerDiscardedTest.java index a1ee0b8031e3..246f3697a441 100644 --- a/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerDiscardedTest.java +++ b/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerDiscardedTest.java @@ -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); @@ -85,14 +85,14 @@ 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(); @@ -100,7 +100,7 @@ public void noDiscardingASavedChange() throws Exception { } @Test - public void discardingAChangeLeadsToNewerBackupToBeIgnored() throws Exception { + void discardingAChangeLeadsToNewerBackupToBeIgnored() throws Exception { databaseModification(); makeBackup(); backupManager.discardBackup(backupDir); diff --git a/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java b/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java index c1a0caf267d0..ff05c8528423 100644 --- a/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java +++ b/src/test/java/org/jabref/gui/autosaveandbackup/BackupManagerTest.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class BackupManagerTest { +class BackupManagerTest { Path backupDir; @@ -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); @@ -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); @@ -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); @@ -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()); @@ -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()); @@ -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()); @@ -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); @@ -156,7 +156,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); diff --git a/src/test/java/org/jabref/gui/edit/CopyMoreActionTest.java b/src/test/java/org/jabref/gui/edit/CopyMoreActionTest.java index d5fe209a3a06..4f987005ae77 100644 --- a/src/test/java/org/jabref/gui/edit/CopyMoreActionTest.java +++ b/src/test/java/org/jabref/gui/edit/CopyMoreActionTest.java @@ -31,7 +31,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); @@ -46,7 +46,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") @@ -61,7 +61,7 @@ public void setUp() { } @Test - public void testExecuteOnFail() { + void testExecuteOnFail() { when(stateManager.getActiveDatabase()).thenReturn(Optional.empty()); when(stateManager.getSelectedEntries()).thenReturn(FXCollections.emptyObservableList()); copyMoreAction = new CopyMoreAction(StandardActions.COPY_TITLE, dialogService, stateManager, clipBoardManager, preferencesService, abbreviationRepository); @@ -72,7 +72,7 @@ public void testExecuteOnFail() { } @Test - public void testExecuteCopyTitleWithNoTitle() { + void testExecuteCopyTitleWithNoTitle() { BibEntry entryWithNoTitle = (BibEntry) entry.clone(); entryWithNoTitle.clearField(StandardField.TITLE); ObservableList entriesWithNoTitles = FXCollections.observableArrayList(entryWithNoTitle); @@ -88,7 +88,7 @@ public void testExecuteCopyTitleWithNoTitle() { } @Test - public void testExecuteCopyTitleOnPartialSuccess() { + void testExecuteCopyTitleOnPartialSuccess() { BibEntry entryWithNoTitle = (BibEntry) entry.clone(); entryWithNoTitle.clearField(StandardField.TITLE); ObservableList mixedEntries = FXCollections.observableArrayList(entryWithNoTitle, entry); @@ -106,7 +106,7 @@ public void testExecuteCopyTitleOnPartialSuccess() { } @Test - public void testExecuteCopyTitleOnSuccess() { + void testExecuteCopyTitleOnSuccess() { ObservableList entriesWithTitles = FXCollections.observableArrayList(entry); BibDatabaseContext databaseContext = new BibDatabaseContext(new BibDatabase(entriesWithTitles)); @@ -122,7 +122,7 @@ public void testExecuteCopyTitleOnSuccess() { } @Test - public void testExecuteCopyKeyWithNoKey() { + void testExecuteCopyKeyWithNoKey() { BibEntry entryWithNoKey = (BibEntry) entry.clone(); entryWithNoKey.clearCiteKey(); ObservableList entriesWithNoKeys = FXCollections.observableArrayList(entryWithNoKey); @@ -138,7 +138,7 @@ public void testExecuteCopyKeyWithNoKey() { } @Test - public void testExecuteCopyKeyOnPartialSuccess() { + void testExecuteCopyKeyOnPartialSuccess() { BibEntry entryWithNoKey = (BibEntry) entry.clone(); entryWithNoKey.clearCiteKey(); ObservableList mixedEntries = FXCollections.observableArrayList(entryWithNoKey, entry); @@ -156,7 +156,7 @@ public void testExecuteCopyKeyOnPartialSuccess() { } @Test - public void testExecuteCopyKeyOnSuccess() { + void testExecuteCopyKeyOnSuccess() { ObservableList entriesWithKeys = FXCollections.observableArrayList(entry); BibDatabaseContext databaseContext = new BibDatabaseContext(new BibDatabase(entriesWithKeys)); @@ -172,7 +172,7 @@ public void testExecuteCopyKeyOnSuccess() { } @Test - public void testExecuteCopyDoiWithNoDoi() { + void testExecuteCopyDoiWithNoDoi() { BibEntry entryWithNoDoi = (BibEntry) entry.clone(); entryWithNoDoi.clearField(StandardField.DOI); ObservableList entriesWithNoDois = FXCollections.observableArrayList(entryWithNoDoi); @@ -188,7 +188,7 @@ public void testExecuteCopyDoiWithNoDoi() { } @Test - public void testExecuteCopyDoiOnPartialSuccess() { + void testExecuteCopyDoiOnPartialSuccess() { BibEntry entryWithNoDoi = (BibEntry) entry.clone(); entryWithNoDoi.clearField(StandardField.DOI); ObservableList mixedEntries = FXCollections.observableArrayList(entryWithNoDoi, entry); @@ -206,7 +206,7 @@ public void testExecuteCopyDoiOnPartialSuccess() { } @Test - public void testExecuteCopyDoiOnSuccess() { + void testExecuteCopyDoiOnSuccess() { ObservableList entriesWithDois = FXCollections.observableArrayList(entry); BibDatabaseContext databaseContext = new BibDatabaseContext(new BibDatabase(entriesWithDois)); diff --git a/src/test/java/org/jabref/gui/edit/CopyOrMoveFieldContentTabViewModelTest.java b/src/test/java/org/jabref/gui/edit/CopyOrMoveFieldContentTabViewModelTest.java index 75a1a176597b..e8182ba5cd1b 100644 --- a/src/test/java/org/jabref/gui/edit/CopyOrMoveFieldContentTabViewModelTest.java +++ b/src/test/java/org/jabref/gui/edit/CopyOrMoveFieldContentTabViewModelTest.java @@ -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; diff --git a/src/test/java/org/jabref/gui/edit/EditFieldContentTabViewModelTest.java b/src/test/java/org/jabref/gui/edit/EditFieldContentTabViewModelTest.java index 1221580762ad..931edb84a054 100644 --- a/src/test/java/org/jabref/gui/edit/EditFieldContentTabViewModelTest.java +++ b/src/test/java/org/jabref/gui/edit/EditFieldContentTabViewModelTest.java @@ -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; diff --git a/src/test/java/org/jabref/gui/edit/ManageKeywordsViewModelTest.java b/src/test/java/org/jabref/gui/edit/ManageKeywordsViewModelTest.java index 39e9ffab57b4..ecb365d5715c 100644 --- a/src/test/java/org/jabref/gui/edit/ManageKeywordsViewModelTest.java +++ b/src/test/java/org/jabref/gui/edit/ManageKeywordsViewModelTest.java @@ -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; diff --git a/src/test/java/org/jabref/gui/edit/RenameFieldViewModelTest.java b/src/test/java/org/jabref/gui/edit/RenameFieldViewModelTest.java index bf5a246e97fc..7d3c4c3cd188 100644 --- a/src/test/java/org/jabref/gui/edit/RenameFieldViewModelTest.java +++ b/src/test/java/org/jabref/gui/edit/RenameFieldViewModelTest.java @@ -18,7 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class RenameFieldViewModelTest { +class RenameFieldViewModelTest { RenameFieldViewModel renameFieldViewModel; BibEntry entryA; BibEntry entryB; diff --git a/src/test/java/org/jabref/gui/edit/ReplaceStringViewModelTest.java b/src/test/java/org/jabref/gui/edit/ReplaceStringViewModelTest.java index 758e3a8241b8..fbc70a29a505 100644 --- a/src/test/java/org/jabref/gui/edit/ReplaceStringViewModelTest.java +++ b/src/test/java/org/jabref/gui/edit/ReplaceStringViewModelTest.java @@ -20,7 +20,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class ReplaceStringViewModelTest { +class ReplaceStringViewModelTest { private final LibraryTab libraryTab = mock(LibraryTab.class); private ReplaceStringViewModel viewModel; diff --git a/src/test/java/org/jabref/gui/entryeditor/CommentsTabTest.java b/src/test/java/org/jabref/gui/entryeditor/CommentsTabTest.java index 1d255cf75367..fdc120f17d38 100644 --- a/src/test/java/org/jabref/gui/entryeditor/CommentsTabTest.java +++ b/src/test/java/org/jabref/gui/entryeditor/CommentsTabTest.java @@ -124,7 +124,7 @@ void testDetermineFieldsToShowWorksForMultipleUsers() { } @Test - public void testDifferentiateCaseInUserName() { + void testDifferentiateCaseInUserName() { UserSpecificCommentField field1 = new UserSpecificCommentField("USER"); UserSpecificCommentField field2 = new UserSpecificCommentField("user"); assertNotEquals(field1, field2, "Two UserSpecificCommentField instances with usernames that differ only by case should be considered different"); diff --git a/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java b/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java index b1eb7af5675a..bd73729fe4a5 100644 --- a/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java +++ b/src/test/java/org/jabref/gui/entryeditor/SciteTabTest.java @@ -7,7 +7,6 @@ import org.jabref.preferences.PreferencesService; import org.jabref.testutils.category.GUITest; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -16,6 +15,8 @@ import org.mockito.MockitoAnnotations; import org.testfx.framework.junit5.ApplicationExtension; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -41,25 +42,25 @@ void setUp() { } @Test - public void testName() { - Assertions.assertEquals(SciteTab.NAME, "Scite"); + void testName() { + assertEquals(SciteTab.NAME, "Scite"); } @Test - public void testShouldShow() { + void testShouldShow() { var tab = new SciteTab(preferencesService, taskExecutor, dialogService); boolean shouldShow = tab.shouldShow(null); - Assertions.assertTrue(shouldShow); + assertTrue(shouldShow); } @Test - public void testBindNullEntry() { + void testBindNullEntry() { var tab = new SciteTab(preferencesService, taskExecutor, dialogService); tab.bindToEntry(null); } @Test - public void testBindEntry() { + void testBindEntry() { var tab = new SciteTab(preferencesService, taskExecutor, dialogService); var entry = new BibEntry() .withField(StandardField.DOI, SAMPLE_DOI); diff --git a/src/test/java/org/jabref/gui/entryeditor/SciteTabViewModelTest.java b/src/test/java/org/jabref/gui/entryeditor/SciteTabViewModelTest.java index 0b6c8349efc0..15f3fff370e5 100644 --- a/src/test/java/org/jabref/gui/entryeditor/SciteTabViewModelTest.java +++ b/src/test/java/org/jabref/gui/entryeditor/SciteTabViewModelTest.java @@ -18,7 +18,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class SciteTabViewModelTest { +class SciteTabViewModelTest { @Mock private PreferencesService preferencesService; @@ -34,7 +34,7 @@ void setUp() { } @Test - public void testSciteTallyDTO() { + void testSciteTallyDTO() { JSONObject jsonObject = new JSONObject(); jsonObject.put("total", 1); jsonObject.put("supporting", 2); diff --git a/src/test/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModelTest.java b/src/test/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModelTest.java index 91a3e8eead41..07882fcffcdf 100644 --- a/src/test/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModelTest.java +++ b/src/test/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModelTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FileAnnotationViewModelTest { +class FileAnnotationViewModelTest { private FileAnnotationViewModel annotationViewModel; private FileAnnotationViewModel annotationViewModelWithoutFileAnnotation; @@ -31,27 +31,27 @@ void setup() { } @Test - public void sameAuthor() { + void sameAuthor() { assertEquals("Jaroslav Kucha ˇr", annotationViewModel.getAuthor()); } @Test - public void retrieveCorrectPageNumberAsString() { + void retrieveCorrectPageNumberAsString() { assertEquals("1", annotationViewModel.getPage()); } @Test - public void retrieveCorrectDateAsString() { + void retrieveCorrectDateAsString() { assertEquals("2017-07-20 10:11:30", annotationViewModel.getDate()); } @Test - public void retrieveCorrectContent() { + void retrieveCorrectContent() { assertEquals("This is content", annotationViewModel.getContent()); } @Test - public void retrieveCorrectContentWithoutLinkedFileAnnotation() { + void retrieveCorrectContentWithoutLinkedFileAnnotation() { String expectedMarking = String.format("This is paragraph 1.%n" + "This is paragraph 2, and it crosses several lines, now you can see next paragraph:%n" + "This is paragraph 3."); @@ -60,7 +60,7 @@ public void retrieveCorrectContentWithoutLinkedFileAnnotation() { } @Test - public void removeOnlyLineBreaksNotPrecededByPeriodOrColon() { + void removeOnlyLineBreaksNotPrecededByPeriodOrColon() { String expectedMarking = String.format("This is paragraph 1.%n" + "This is paragraph 2, and it crosses several lines, now you can see next paragraph:%n" + "This is paragraph 3."); @@ -69,7 +69,7 @@ public void removeOnlyLineBreaksNotPrecededByPeriodOrColon() { } @Test - public void retrieveCorrectMarkingWithoutLinkedFileAnnotation() { + void retrieveCorrectMarkingWithoutLinkedFileAnnotation() { assertEquals("", annotationViewModelWithoutFileAnnotation.getMarking()); } } diff --git a/src/test/java/org/jabref/gui/exporter/ExportToClipboardActionTest.java b/src/test/java/org/jabref/gui/exporter/ExportToClipboardActionTest.java index 973247fe8f05..a117f37fb15e 100644 --- a/src/test/java/org/jabref/gui/exporter/ExportToClipboardActionTest.java +++ b/src/test/java/org/jabref/gui/exporter/ExportToClipboardActionTest.java @@ -41,7 +41,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class ExportToClipboardActionTest { +class ExportToClipboardActionTest { private ExportToClipboardAction exportToClipboardAction; private final DialogService dialogService = spy(DialogService.class); @@ -54,7 +54,7 @@ public class ExportToClipboardActionTest { private ObservableList selectedEntries; @BeforeEach - public void setUp() { + void setUp() { BibEntry 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") .withField(StandardField.TITLE, "A tale from the trenches") @@ -73,7 +73,7 @@ public void setUp() { } @Test - public void testExecuteIfNoSelectedEntries() { + void testExecuteIfNoSelectedEntries() { when(stateManager.getSelectedEntries()).thenReturn(FXCollections.emptyObservableList()); exportToClipboardAction.execute(); @@ -81,7 +81,7 @@ public void testExecuteIfNoSelectedEntries() { } @Test - public void testExecuteOnSuccess() { + void testExecuteOnSuccess() { Exporter selectedExporter = new Exporter("html", "HTML", StandardFileType.HTML) { @Override public void export(BibDatabaseContext databaseContext, Path file, List entries) { diff --git a/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java b/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java index 5752fc7afa74..b284bcc27989 100644 --- a/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java +++ b/src/test/java/org/jabref/gui/exporter/SaveDatabaseActionTest.java @@ -59,7 +59,7 @@ class SaveDatabaseActionTest { private SaveDatabaseAction saveDatabaseAction; @BeforeEach - public void setUp() { + void setUp() { when(libraryTab.frame()).thenReturn(jabRefFrame); when(libraryTab.getBibDatabaseContext()).thenReturn(dbContext); when(filePreferences.getWorkingDirectory()).thenReturn(Path.of(TEST_BIBTEX_LIBRARY_LOCATION)); @@ -70,7 +70,7 @@ public void setUp() { } @Test - public void saveAsShouldSetWorkingDirectory() { + void saveAsShouldSetWorkingDirectory() { when(dialogService.showFileSaveDialog(any(FileDialogConfiguration.class))).thenReturn(Optional.of(file)); doReturn(true).when(saveDatabaseAction).saveAs(any()); @@ -80,7 +80,7 @@ public void saveAsShouldSetWorkingDirectory() { } @Test - public void saveAsShouldNotSetWorkingDirectoryIfNotSelected() { + void saveAsShouldNotSetWorkingDirectoryIfNotSelected() { when(dialogService.showFileSaveDialog(any(FileDialogConfiguration.class))).thenReturn(Optional.empty()); doReturn(false).when(saveDatabaseAction).saveAs(any()); @@ -90,7 +90,7 @@ public void saveAsShouldNotSetWorkingDirectoryIfNotSelected() { } @Test - public void saveShouldShowSaveAsIfDatabaseNotSelected() { + void saveShouldShowSaveAsIfDatabaseNotSelected() { when(dbContext.getDatabasePath()).thenReturn(Optional.empty()); when(dbContext.getLocation()).thenReturn(DatabaseLocation.LOCAL); when(preferences.getBoolean(JabRefPreferences.LOCAL_AUTO_SAVE)).thenReturn(false); @@ -136,7 +136,7 @@ private SaveDatabaseAction createSaveDatabaseActionForBibDatabase(BibDatabase da } @Test - public void saveKeepsChangedFlag() throws Exception { + void saveKeepsChangedFlag() throws Exception { BibEntry firstEntry = new BibEntry().withField(StandardField.AUTHOR, "first"); firstEntry.setChanged(true); BibEntry secondEntry = new BibEntry().withField(StandardField.AUTHOR, "second"); @@ -153,7 +153,7 @@ public void saveKeepsChangedFlag() throws Exception { } @Test - public void saveShouldNotSaveDatabaseIfPathNotSet() { + void saveShouldNotSaveDatabaseIfPathNotSet() { when(dbContext.getDatabasePath()).thenReturn(Optional.empty()); boolean result = saveDatabaseAction.save(); assertFalse(result); diff --git a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java index b429b879454d..970b6c34ea4d 100644 --- a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java @@ -25,7 +25,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class AutoSetFileLinksUtilTest { +class AutoSetFileLinksUtilTest { private final FilePreferences filePreferences = mock(FilePreferences.class); private final AutoLinkPreferences autoLinkPrefs = new AutoLinkPreferences( @@ -38,7 +38,7 @@ public class AutoSetFileLinksUtilTest { private Path path = null; @BeforeEach - public void setUp(@TempDir Path folder) throws Exception { + void setUp(@TempDir Path folder) throws Exception { path = folder.resolve("CiteKey.pdf"); Files.createFile(path); entry.setCitationKey("CiteKey"); @@ -47,7 +47,7 @@ public void setUp(@TempDir Path folder) throws Exception { } @Test - public void testFindAssociatedNotLinkedFilesSuccess() throws Exception { + void testFindAssociatedNotLinkedFilesSuccess() throws Exception { when(databaseContext.getFileDirectories(any())).thenReturn(Collections.singletonList(path.getParent())); List expected = Collections.singletonList(new LinkedFile("", Path.of("CiteKey.pdf"), "PDF")); AutoSetFileLinksUtil util = new AutoSetFileLinksUtil(databaseContext, filePreferences, autoLinkPrefs); @@ -56,7 +56,7 @@ public void testFindAssociatedNotLinkedFilesSuccess() throws Exception { } @Test - public void testFindAssociatedNotLinkedFilesForEmptySearchDir() throws Exception { + void testFindAssociatedNotLinkedFilesForEmptySearchDir() throws Exception { when(filePreferences.shouldStoreFilesRelativeToBibFile()).thenReturn(false); AutoSetFileLinksUtil util = new AutoSetFileLinksUtil(databaseContext, filePreferences, autoLinkPrefs); List actual = util.findAssociatedNotLinkedFiles(entry); diff --git a/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java b/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java index 9deab592e8f1..a5b203438598 100755 --- a/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/FileFilterUtilsTest.java @@ -20,48 +20,48 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class FileFilterUtilsTest { +class FileFilterUtilsTest { private final FileFilterUtils fileFilterUtils = new FileFilterUtils(); private final LocalDateTime time = LocalDateTime.now(); @Test - public void isDuringLastDayNegativeTest() { + void isDuringLastDayNegativeTest() { assertFalse(fileFilterUtils.isDuringLastDay(time.minusHours(24))); } @Test - public void isDuringLastDayPositiveTest() { + void isDuringLastDayPositiveTest() { assertTrue(fileFilterUtils.isDuringLastDay(time.minusHours(23))); } @Test - public void isDuringLastWeekNegativeTest() { + void isDuringLastWeekNegativeTest() { assertFalse(fileFilterUtils.isDuringLastWeek(time.minusDays(7))); } @Test - public void isDuringLastWeekPositiveTest() { + void isDuringLastWeekPositiveTest() { assertTrue(fileFilterUtils.isDuringLastWeek(time.minusDays(6).minusHours(23))); } @Test - public void isDuringLastMonthNegativeTest() { + void isDuringLastMonthNegativeTest() { assertFalse(fileFilterUtils.isDuringLastMonth(time.minusDays(30))); } @Test - public void isDuringLastMonthPositiveTest() { + void isDuringLastMonthPositiveTest() { assertTrue(fileFilterUtils.isDuringLastMonth(time.minusDays(29).minusHours(23))); } @Test - public void isDuringLastYearNegativeTest() { + void isDuringLastYearNegativeTest() { assertFalse(fileFilterUtils.isDuringLastYear(time.minusDays(365))); } @Test - public void isDuringLastYearPositiveTest() { + void isDuringLastYearPositiveTest() { assertTrue(fileFilterUtils.isDuringLastYear(time.minusDays(364).minusHours(23))); } @@ -75,7 +75,7 @@ class SortingTests { /* Initialize the directory and files used in the sorting tests, and change their last edited dates. */ @BeforeEach - public void setUp(@TempDir Path tempDir) throws Exception { + void setUp(@TempDir Path tempDir) throws Exception { Path firstPath = tempDir.resolve("firstFile.pdf"); Path secondPath = tempDir.resolve("secondFile.pdf"); @@ -117,7 +117,7 @@ public void setUp(@TempDir Path tempDir) throws Exception { } @Test - public void sortByDateAscendingPositiveTest() { + void sortByDateAscendingPositiveTest() { List sortedPaths = fileFilterUtils .sortByDateAscending(files) .stream() @@ -127,7 +127,7 @@ public void sortByDateAscendingPositiveTest() { } @Test - public void sortByDateAscendingNegativeTest() { + void sortByDateAscendingNegativeTest() { List sortedPaths = fileFilterUtils .sortByDateAscending(files) .stream() @@ -137,7 +137,7 @@ public void sortByDateAscendingNegativeTest() { } @Test - public void sortByDateDescendingPositiveTest() { + void sortByDateDescendingPositiveTest() { List sortedPaths = fileFilterUtils .sortByDateDescending(files) .stream() @@ -147,7 +147,7 @@ public void sortByDateDescendingPositiveTest() { } @Test - public void testSortByDateDescendingNegativeTest() { + void testSortByDateDescendingNegativeTest() { List sortedPaths = fileFilterUtils .sortByDateDescending(files) .stream() @@ -164,7 +164,7 @@ class filteringTests { private final Set ignoreFileSet = new HashSet<>(); @BeforeEach - public void setUp(@TempDir Path tempDir) throws Exception { + void setUp(@TempDir Path tempDir) throws Exception { ignoreFileSet.add(".DS_Store"); ignoreFileSet.add("Thumbs.db"); diff --git a/src/test/java/org/jabref/gui/externalfiles/GitIgnoreFileFilterTest.java b/src/test/java/org/jabref/gui/externalfiles/GitIgnoreFileFilterTest.java index 2504ffb55b75..c574719bddee 100644 --- a/src/test/java/org/jabref/gui/externalfiles/GitIgnoreFileFilterTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/GitIgnoreFileFilterTest.java @@ -12,7 +12,7 @@ class GitIgnoreFileFilterTest { @Test - public void checkSimpleGitIgnore(@TempDir Path dir) throws Exception { + void checkSimpleGitIgnore(@TempDir Path dir) throws Exception { Files.writeString(dir.resolve(".gitignore"), """ *.png """); @@ -21,7 +21,7 @@ public void checkSimpleGitIgnore(@TempDir Path dir) throws Exception { } @Test - public void checkSimpleGitIgnoreWithAllowing(@TempDir Path dir) throws Exception { + void checkSimpleGitIgnoreWithAllowing(@TempDir Path dir) throws Exception { Files.writeString(dir.resolve(".gitignore"), """ !*.png """); @@ -30,7 +30,7 @@ public void checkSimpleGitIgnoreWithAllowing(@TempDir Path dir) throws Exception } @Test - public void checkSimpleGitIgnoreWithOverwritingDefs(@TempDir Path dir) throws Exception { + void checkSimpleGitIgnoreWithOverwritingDefs(@TempDir Path dir) throws Exception { Files.writeString(dir.resolve(".gitignore"), """ !*.png *.png @@ -40,7 +40,7 @@ public void checkSimpleGitIgnoreWithOverwritingDefs(@TempDir Path dir) throws Ex } @Test - public void checkDirectoryGitIgnore(@TempDir Path dir) throws Exception { + void checkDirectoryGitIgnore(@TempDir Path dir) throws Exception { Files.writeString(dir.resolve(".gitignore"), """ **/*.png """); diff --git a/src/test/java/org/jabref/gui/externalfiles/UnlinkedFilesCrawlerTest.java b/src/test/java/org/jabref/gui/externalfiles/UnlinkedFilesCrawlerTest.java index 534894b59ce6..607c30c46586 100644 --- a/src/test/java/org/jabref/gui/externalfiles/UnlinkedFilesCrawlerTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/UnlinkedFilesCrawlerTest.java @@ -22,7 +22,7 @@ class UnlinkedFilesCrawlerTest { @Test - public void minimalGitIgnore(@TempDir Path testRoot) throws Exception { + void minimalGitIgnore(@TempDir Path testRoot) throws Exception { Files.writeString(testRoot.resolve(".gitignore"), """ *.png """); @@ -41,7 +41,7 @@ public void minimalGitIgnore(@TempDir Path testRoot) throws Exception { } @Test - public void excludingTheCurrentLibraryTest(@TempDir Path testRoot) throws IOException { + void excludingTheCurrentLibraryTest(@TempDir Path testRoot) throws IOException { // Adding 3 files one of which is the database file Files.createFile(testRoot.resolve("unlinkedPdf.pdf")); Files.createFile(testRoot.resolve("another-unlinkedPdf.pdf")); diff --git a/src/test/java/org/jabref/gui/importer/NewEntryActionTest.java b/src/test/java/org/jabref/gui/importer/NewEntryActionTest.java index 079bb6c13880..0ad469b5f3ad 100644 --- a/src/test/java/org/jabref/gui/importer/NewEntryActionTest.java +++ b/src/test/java/org/jabref/gui/importer/NewEntryActionTest.java @@ -21,7 +21,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class NewEntryActionTest { +class NewEntryActionTest { private NewEntryAction newEntryAction; private LibraryTab libraryTab = mock(LibraryTab.class); @@ -31,14 +31,14 @@ public class NewEntryActionTest { private StateManager stateManager = mock(StateManager.class); @BeforeEach - public void setUp() { + void setUp() { when(jabRefFrame.getCurrentLibraryTab()).thenReturn(libraryTab); when(stateManager.activeDatabaseProperty()).thenReturn(OptionalObjectProperty.empty()); newEntryAction = new NewEntryAction(jabRefFrame, dialogService, preferencesService, stateManager); } @Test - public void testExecuteIfNoBasePanel() { + void testExecuteIfNoBasePanel() { when(jabRefFrame.getBasePanelCount()).thenReturn(0); newEntryAction.execute(); @@ -47,7 +47,7 @@ public void testExecuteIfNoBasePanel() { } @Test - public void testExecuteOnSuccessWithFixedType() { + void testExecuteOnSuccessWithFixedType() { EntryType type = StandardEntryType.Article; newEntryAction = new NewEntryAction(jabRefFrame, type, dialogService, preferencesService, stateManager); when(jabRefFrame.getBasePanelCount()).thenReturn(1); diff --git a/src/test/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModelTest.java b/src/test/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModelTest.java index 05dfbf152b97..b160cd57f5f1 100644 --- a/src/test/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModelTest.java +++ b/src/test/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModelTest.java @@ -23,7 +23,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class ContentSelectorViewModelTest { +class ContentSelectorViewModelTest { private final DialogService dialogService = mock(DialogService.class); private final List DEFAULT_FIELDS = Arrays.asList( StandardField.AUTHOR, StandardField.JOURNAL, StandardField.KEYWORDS, StandardField.PUBLISHER); diff --git a/src/test/java/org/jabref/gui/maintable/MainTableColumnModelTest.java b/src/test/java/org/jabref/gui/maintable/MainTableColumnModelTest.java index 750d92708fb2..cbb7ef70130a 100644 --- a/src/test/java/org/jabref/gui/maintable/MainTableColumnModelTest.java +++ b/src/test/java/org/jabref/gui/maintable/MainTableColumnModelTest.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class MainTableColumnModelTest { +class MainTableColumnModelTest { private static String testName = "field:author"; private static MainTableColumnModel.Type testType = MainTableColumnModel.Type.NORMALFIELD; @@ -14,42 +14,42 @@ public class MainTableColumnModelTest { private static MainTableColumnModel.Type testTypeOnlyType = MainTableColumnModel.Type.LINKED_IDENTIFIER; @Test - public void mainTableColumnModelParserRetrievesCorrectType() { + void mainTableColumnModelParserRetrievesCorrectType() { MainTableColumnModel testColumnModel = MainTableColumnModel.parse(testQualifier); assertEquals(testColumnModel.getType(), testType); } @Test - public void mainTableColumnModelParserRetrievesCorrectQualifier() { + void mainTableColumnModelParserRetrievesCorrectQualifier() { MainTableColumnModel testColumnModel = MainTableColumnModel.parse(testQualifier); assertEquals(testColumnModel.getQualifier(), testQualifier); } @Test - public void fullMainTableColumnModelParserRetrievesCorrectType() { + void fullMainTableColumnModelParserRetrievesCorrectType() { MainTableColumnModel testColumnModel = MainTableColumnModel.parse(testName); assertEquals(testColumnModel.getType(), testType); } @Test - public void fullMainTableColumnModelParserRetrievesCorrectQualifier() { + void fullMainTableColumnModelParserRetrievesCorrectQualifier() { MainTableColumnModel testColumnModel = MainTableColumnModel.parse(testName); assertEquals(testColumnModel.getQualifier(), testQualifier); } @Test - public void typeOnlyMainTableColumnModelParserRetrievesCorrectType() { + void typeOnlyMainTableColumnModelParserRetrievesCorrectType() { MainTableColumnModel testColumnModel = MainTableColumnModel.parse(testTypeOnlyName); assertEquals(testColumnModel.getType(), testTypeOnlyType); } @Test - public void typeOnlyMainTableColumnModelParserRetrievesCorrectQualifier() { + void typeOnlyMainTableColumnModelParserRetrievesCorrectQualifier() { MainTableColumnModel testColumnModel = MainTableColumnModel.parse(testTypeOnlyName); assertEquals("", testColumnModel.getQualifier()); diff --git a/src/test/java/org/jabref/gui/menus/FileHistoryMenuTest.java b/src/test/java/org/jabref/gui/menus/FileHistoryMenuTest.java index ee1529cc5128..70796daf3eaa 100644 --- a/src/test/java/org/jabref/gui/menus/FileHistoryMenuTest.java +++ b/src/test/java/org/jabref/gui/menus/FileHistoryMenuTest.java @@ -17,7 +17,7 @@ import static org.mockito.MockitoAnnotations.openMocks; @ExtendWith(ApplicationExtension.class) -public class FileHistoryMenuTest { +class FileHistoryMenuTest { private static final String BIBTEX_LIBRARY_PATH = "src/test/resources/org/jabref/"; private FileHistoryMenu fileHistoryMenu; @@ -29,7 +29,7 @@ public class FileHistoryMenuTest { private OpenDatabaseAction openDatabaseAction; @BeforeEach - public void setUp() { + void setUp() { openMocks(this); fileHistoryMenu = new FileHistoryMenu(fileHistory, dialogService, openDatabaseAction); } diff --git a/src/test/java/org/jabref/gui/mergeentries/DiffHighlightingTest.java b/src/test/java/org/jabref/gui/mergeentries/DiffHighlightingTest.java index 9ed454089464..b71506b99069 100644 --- a/src/test/java/org/jabref/gui/mergeentries/DiffHighlightingTest.java +++ b/src/test/java/org/jabref/gui/mergeentries/DiffHighlightingTest.java @@ -9,8 +9,11 @@ import org.jabref.testutils.category.GUITest; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + import org.junit.jupiter.api.extension.ExtendWith; import org.testfx.framework.junit5.ApplicationExtension; @@ -20,22 +23,22 @@ class DiffHighlightingTest { public static void assertEquals(List expected, List actual) { // Need to compare string values since Texts with the same string are not considered equal - Assertions.assertEquals(expected.toString(), actual.toString()); + assertEquals(expected.toString(), actual.toString()); // Moreover, make sure that style classes are correct List expectedStyles = expected.stream().map(text -> text.getStyleClass().toString()).collect(Collectors.toList()); List actualStyles = actual.stream().map(text -> text.getStyleClass().toString()).collect(Collectors.toList()); - Assertions.assertEquals(expectedStyles, actualStyles); + assertEquals(expectedStyles, actualStyles); } @Test void testGenerateDiffHighlightingBothNullThrowsNPE() { - Assertions.assertThrows(NullPointerException.class, () -> DiffHighlighting.generateDiffHighlighting(null, null, "")); + assertThrows(NullPointerException.class, () -> DiffHighlighting.generateDiffHighlighting(null, null, "")); } @Test void testNullSeparatorThrowsNPE() { - Assertions.assertThrows(NullPointerException.class, () -> DiffHighlighting.generateDiffHighlighting("", "", null)); + assertThrows(NullPointerException.class, () -> DiffHighlighting.generateDiffHighlighting("", "", null)); } @Test diff --git a/src/test/java/org/jabref/gui/mergeentries/FieldRowViewModelTest.java b/src/test/java/org/jabref/gui/mergeentries/FieldRowViewModelTest.java index a4802c8537ad..02a4dcd68a4b 100644 --- a/src/test/java/org/jabref/gui/mergeentries/FieldRowViewModelTest.java +++ b/src/test/java/org/jabref/gui/mergeentries/FieldRowViewModelTest.java @@ -37,7 +37,7 @@ public class FieldRowViewModelTest { BibEntryPreferences bibEntryPreferences = mock(BibEntryPreferences.class); @BeforeEach - public void setup() throws ParseException { + void setup() throws ParseException { leftEntry = new BibEntry(StandardEntryType.Article) .withCitationKey("LajnDiezScheinEtAl2012") .withField(StandardField.AUTHOR, "Lajn, A and Diez, T and Schein, F and Frenzel, H and von Wenckstern, H and Grundmann, M") @@ -78,7 +78,7 @@ public void setup() throws ParseException { } @Test - public void selectNonEmptyValueShouldSelectLeftFieldValueIfItIsNotEmpty() { + void selectNonEmptyValueShouldSelectLeftFieldValueIfItIsNotEmpty() { var numberFieldViewModel = createViewModelForField(StandardField.NUMBER); numberFieldViewModel.selectNonEmptyValue(); assertEquals(FieldRowViewModel.Selection.LEFT, numberFieldViewModel.getSelection()); @@ -89,7 +89,7 @@ public void selectNonEmptyValueShouldSelectLeftFieldValueIfItIsNotEmpty() { } @Test - public void selectNonEmptyValueShouldSelectRightFieldValueIfLeftValueIsEmpty() { + void selectNonEmptyValueShouldSelectRightFieldValueIfLeftValueIsEmpty() { var monthFieldViewModel = createViewModelForField(StandardField.MONTH); monthFieldViewModel.selectNonEmptyValue(); assertEquals(FieldRowViewModel.Selection.RIGHT, monthFieldViewModel.getSelection()); @@ -100,14 +100,14 @@ public void selectNonEmptyValueShouldSelectRightFieldValueIfLeftValueIsEmpty() { } @Test - public void hasEqualLeftAndRightValuesShouldReturnFalseIfOneOfTheValuesIsEmpty() { + void hasEqualLeftAndRightValuesShouldReturnFalseIfOneOfTheValuesIsEmpty() { var monthFieldViewModel = createViewModelForField(StandardField.MONTH); monthFieldViewModel.selectNonEmptyValue(); assertFalse(monthFieldViewModel.hasEqualLeftAndRightValues()); } @Test - public void hasEqualLeftAndRightValuesShouldReturnTrueIfLeftAndRightAreEqual() { + void hasEqualLeftAndRightValuesShouldReturnTrueIfLeftAndRightAreEqual() { var yearFieldViewModel = createViewModelForField(StandardField.YEAR); yearFieldViewModel.selectNonEmptyValue(); assertTrue(yearFieldViewModel.hasEqualLeftAndRightValues()); @@ -115,13 +115,13 @@ public void hasEqualLeftAndRightValuesShouldReturnTrueIfLeftAndRightAreEqual() { @Test @Disabled("This test is kept as a reminder to implement a different comparison logic based on the given field.") - public void hasEqualLeftAndRightValuesShouldReturnTrueIfKeywordsAreEqual() { + void hasEqualLeftAndRightValuesShouldReturnTrueIfKeywordsAreEqual() { FieldRowViewModel keywordsField = new FieldRowViewModel(StandardField.KEYWORDS, rightEntry, extraEntry, mergedEntry, fieldMergerFactory); assertTrue(keywordsField.hasEqualLeftAndRightValues()); } @Test - public void selectLeftValueShouldBeCorrect() { + void selectLeftValueShouldBeCorrect() { var monthFieldViewModel = createViewModelForField(StandardField.MONTH); monthFieldViewModel.selectLeftValue(); assertEquals(FieldRowViewModel.Selection.LEFT, monthFieldViewModel.getSelection()); @@ -134,7 +134,7 @@ public void selectLeftValueShouldBeCorrect() { } @Test - public void selectRightValueShouldBeCorrect() { + void selectRightValueShouldBeCorrect() { var monthFieldViewModel = createViewModelForField(StandardField.MONTH); monthFieldViewModel.selectRightValue(); assertEquals(FieldRowViewModel.Selection.RIGHT, monthFieldViewModel.getSelection()); @@ -147,13 +147,13 @@ public void selectRightValueShouldBeCorrect() { } @Test - public void isFieldsMergedShouldReturnTrueIfLeftAndRightValuesAreEqual() { + void isFieldsMergedShouldReturnTrueIfLeftAndRightValuesAreEqual() { var yearFieldViewModel = createViewModelForField(StandardField.YEAR); assertTrue(yearFieldViewModel.isFieldsMerged()); } @Test - public void isFieldsMergedShouldReturnFalseIfLeftAndRightValuesAreNotEqual() { + void isFieldsMergedShouldReturnFalseIfLeftAndRightValuesAreNotEqual() { var monthFieldViewModel = createViewModelForField(StandardField.MONTH); assertFalse(monthFieldViewModel.isFieldsMerged()); @@ -165,27 +165,27 @@ public void isFieldsMergedShouldReturnFalseIfLeftAndRightValuesAreNotEqual() { } @Test - public void mergeFieldsShouldResultInLeftAndRightValuesBeingEqual() { + void mergeFieldsShouldResultInLeftAndRightValuesBeingEqual() { var groupsField = createViewModelForField(StandardField.GROUPS); groupsField.mergeFields(); assertEquals(groupsField.getLeftFieldValue(), groupsField.getRightFieldValue()); } @Test - public void mergeFieldsShouldBeCorrectEvenWhenOnOfTheValuesIsEmpty() { + void mergeFieldsShouldBeCorrectEvenWhenOnOfTheValuesIsEmpty() { var keywordsField = createViewModelForField(StandardField.KEYWORDS); keywordsField.mergeFields(); assertEquals(keywordsField.getLeftFieldValue(), keywordsField.getRightFieldValue()); } @Test - public void mergeFieldsShouldThrowUnsupportedOperationExceptionIfTheGivenFieldCanBeMerged() { + void mergeFieldsShouldThrowUnsupportedOperationExceptionIfTheGivenFieldCanBeMerged() { var authorField = createViewModelForField(StandardField.AUTHOR); assertThrows(UnsupportedOperationException.class, authorField::mergeFields); } @Test - public void mergeFieldsShouldSelectLeftFieldValue() { + void mergeFieldsShouldSelectLeftFieldValue() { var groupsField = createViewModelForField(StandardField.GROUPS); groupsField.mergeFields(); @@ -193,7 +193,7 @@ public void mergeFieldsShouldSelectLeftFieldValue() { } @Test - public void unmergeFieldsShouldBeCorrect() { + void unmergeFieldsShouldBeCorrect() { var groupsField = createViewModelForField(StandardField.GROUPS); var oldLeftGroups = groupsField.getLeftFieldValue(); var oldRightGroups = groupsField.getRightFieldValue(); @@ -205,7 +205,7 @@ public void unmergeFieldsShouldBeCorrect() { } @Test - public void unmergeFieldsShouldDoNothingIfFieldsAreNotMerged() { + void unmergeFieldsShouldDoNothingIfFieldsAreNotMerged() { var groupsField = createViewModelForField(StandardField.GROUPS); var oldLeftGroups = groupsField.getLeftFieldValue(); var oldRightGroups = groupsField.getRightFieldValue(); diff --git a/src/test/java/org/jabref/gui/mergeentries/GroupMergerTest.java b/src/test/java/org/jabref/gui/mergeentries/GroupMergerTest.java index 4f1c6824062d..025ecc61b94c 100644 --- a/src/test/java/org/jabref/gui/mergeentries/GroupMergerTest.java +++ b/src/test/java/org/jabref/gui/mergeentries/GroupMergerTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class GroupMergerTest { +class GroupMergerTest { GroupMerger groupMerger; @@ -35,7 +35,7 @@ private static Stream mergeShouldMergeGroupsCorrectly() { @ParameterizedTest @MethodSource - public void mergeShouldMergeGroupsCorrectly(String groupsA, String groupsB, String expected) { + void mergeShouldMergeGroupsCorrectly(String groupsA, String groupsB, String expected) { assertEquals(expected, groupMerger.merge(groupsA, groupsB)); } } diff --git a/src/test/java/org/jabref/gui/mergeentries/ThreeWayMergeCellViewModelTest.java b/src/test/java/org/jabref/gui/mergeentries/ThreeWayMergeCellViewModelTest.java index 929e0e56db07..d71da42cd277 100644 --- a/src/test/java/org/jabref/gui/mergeentries/ThreeWayMergeCellViewModelTest.java +++ b/src/test/java/org/jabref/gui/mergeentries/ThreeWayMergeCellViewModelTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ThreeWayMergeCellViewModelTest { +class ThreeWayMergeCellViewModelTest { ThreeWayMergeCellViewModel viewModel; diff --git a/src/test/java/org/jabref/gui/mergeentries/ThreeWayMergeViewModelTest.java b/src/test/java/org/jabref/gui/mergeentries/ThreeWayMergeViewModelTest.java index fed09e4e0dc5..924b13755691 100644 --- a/src/test/java/org/jabref/gui/mergeentries/ThreeWayMergeViewModelTest.java +++ b/src/test/java/org/jabref/gui/mergeentries/ThreeWayMergeViewModelTest.java @@ -19,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ThreeWayMergeViewModelTest { +class ThreeWayMergeViewModelTest { ThreeWayMergeViewModel viewModel; BibEntry leftEntry; diff --git a/src/test/java/org/jabref/gui/push/PushToEmacsTest.java b/src/test/java/org/jabref/gui/push/PushToEmacsTest.java index 830cfff46b57..6ffe069235e9 100644 --- a/src/test/java/org/jabref/gui/push/PushToEmacsTest.java +++ b/src/test/java/org/jabref/gui/push/PushToEmacsTest.java @@ -25,7 +25,7 @@ class PushToEmacsTest { PushToEmacs pushToEmacs; @BeforeEach - public void setup() { + void setup() { DialogService dialogService = mock(DialogService.class, Answers.RETURNS_DEEP_STUBS); PreferencesService preferencesService = mock(PreferencesService.class); diff --git a/src/test/java/org/jabref/gui/search/GetLastSearchHistoryTest.java b/src/test/java/org/jabref/gui/search/GetLastSearchHistoryTest.java index 390c9c815059..004908acaedf 100644 --- a/src/test/java/org/jabref/gui/search/GetLastSearchHistoryTest.java +++ b/src/test/java/org/jabref/gui/search/GetLastSearchHistoryTest.java @@ -7,15 +7,16 @@ import org.jabref.gui.StateManager; import org.jabref.testutils.category.GUITest; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.extension.ExtendWith; import org.testfx.framework.junit5.ApplicationExtension; import org.testfx.framework.junit5.Start; @GUITest @ExtendWith(ApplicationExtension.class) -public class GetLastSearchHistoryTest { +class GetLastSearchHistoryTest { @Start void onStart(Stage stage) { // Needed to init JavaFX thread @@ -31,7 +32,7 @@ void testGetLastSearchHistory() { List lastSearchHistory = stateManager.getLastSearchHistory(2); List expected = List.of("test2", "test3"); - Assertions.assertEquals(expected, lastSearchHistory); + assertEquals(expected, lastSearchHistory); } @Test @@ -44,7 +45,7 @@ void testduplicateSearchHistory() { List lastSearchHistory = stateManager.getWholeSearchHistory(); List expected = List.of("test2", "test3", "test1"); - Assertions.assertEquals(expected, lastSearchHistory); + assertEquals(expected, lastSearchHistory); } @Test @@ -55,10 +56,10 @@ void testclearSearchHistory() { stateManager.addSearchHistory("test3"); List lastSearchHistory = stateManager.getWholeSearchHistory(); List expected = List.of("test1", "test2", "test3"); - Assertions.assertEquals(expected, lastSearchHistory); + assertEquals(expected, lastSearchHistory); stateManager.clearSearchHistory(); lastSearchHistory = stateManager.getWholeSearchHistory(); expected = List.of(); - Assertions.assertEquals(expected, lastSearchHistory); + assertEquals(expected, lastSearchHistory); } } diff --git a/src/test/java/org/jabref/gui/search/TextFlowEqualityHelper.java b/src/test/java/org/jabref/gui/search/TextFlowEqualityHelper.java index 15246db46816..043f5b131f6e 100644 --- a/src/test/java/org/jabref/gui/search/TextFlowEqualityHelper.java +++ b/src/test/java/org/jabref/gui/search/TextFlowEqualityHelper.java @@ -5,13 +5,13 @@ import javafx.scene.text.Text; import javafx.scene.text.TextFlow; -import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; public class TextFlowEqualityHelper { public static void assertEquals(List expectedTexts, TextFlow description) { if (expectedTexts.size() != description.getChildren().size()) { - Assertions.assertEquals(expectedTexts, description.getChildren()); + assertEquals(expectedTexts, description.getChildren()); return; } Text expectedText; @@ -21,7 +21,7 @@ public static void assertEquals(List expectedTexts, TextFlow description) // so comparing them compares the Text object as a whole // the equals method is not implemented... if (!expectedText.toString().equals(description.getChildren().get(i).toString())) { - Assertions.assertEquals(expectedTexts, description.getChildren()); + assertEquals(expectedTexts, description.getChildren()); return; } } diff --git a/src/test/java/org/jabref/gui/slr/ManageStudyDefinitionViewModelTest.java b/src/test/java/org/jabref/gui/slr/ManageStudyDefinitionViewModelTest.java index cc84f39e266a..29245c7091f1 100644 --- a/src/test/java/org/jabref/gui/slr/ManageStudyDefinitionViewModelTest.java +++ b/src/test/java/org/jabref/gui/slr/ManageStudyDefinitionViewModelTest.java @@ -31,7 +31,7 @@ void setUp() { } @Test - public void emptyStudyConstructorFillsDatabasesCorrectly() { + void emptyStudyConstructorFillsDatabasesCorrectly() { ManageStudyDefinitionViewModel manageStudyDefinitionViewModel = new ManageStudyDefinitionViewModel(importFormatPreferences, importerPreferences, dialogService); assertEquals(List.of( new StudyCatalogItem("ACM Portal", true), @@ -59,7 +59,7 @@ public void emptyStudyConstructorFillsDatabasesCorrectly() { } @Test - public void studyConstructorFillsDatabasesCorrectly(@TempDir Path tempDir) { + void studyConstructorFillsDatabasesCorrectly(@TempDir Path tempDir) { ManageStudyDefinitionViewModel manageStudyDefinitionViewModel = getManageStudyDefinitionViewModel(tempDir); assertEquals(List.of( new StudyCatalogItem("ACM Portal", true), diff --git a/src/test/java/org/jabref/gui/theme/ThemeManagerTest.java b/src/test/java/org/jabref/gui/theme/ThemeManagerTest.java index 87e1d1a654c3..59f2f55b58c0 100644 --- a/src/test/java/org/jabref/gui/theme/ThemeManagerTest.java +++ b/src/test/java/org/jabref/gui/theme/ThemeManagerTest.java @@ -17,7 +17,6 @@ import org.jabref.model.util.DummyFileUpdateMonitor; import org.jabref.preferences.WorkspacePreferences; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -26,6 +25,7 @@ import org.mockito.Answers; import org.testfx.framework.junit5.ApplicationExtension; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; @@ -49,7 +49,7 @@ void setUp(@TempDir Path tempFolder) { } @Test - public void themeManagerUsesProvidedTheme() throws IOException { + void themeManagerUsesProvidedTheme() throws IOException { Path testCss = tempFolder.resolve("test.css"); Files.writeString(testCss, TEST_CSS_CONTENT, StandardOpenOption.CREATE); WorkspacePreferences workspacePreferences = mock(WorkspacePreferences.class, Answers.RETURNS_DEEP_STUBS); @@ -67,7 +67,7 @@ public void themeManagerUsesProvidedTheme() throws IOException { } @Test - public void customThemeAvailableEvenWhenDeleted() throws IOException { + void customThemeAvailableEvenWhenDeleted() throws IOException { /* Create a temporary custom theme that is just a small snippet of CSS. There is no CSS validation (at the moment) but by making a valid CSS block we don't preclude adding validation later */ Path testCss = tempFolder.resolve("test.css"); @@ -98,7 +98,7 @@ public void customThemeAvailableEvenWhenDeleted() throws IOException { */ @Disabled @Test - public void customThemeBecomesAvailableAfterFileIsCreated() throws IOException { + void customThemeBecomesAvailableAfterFileIsCreated() throws IOException { Path testCss = tempFolder.resolve("test.css"); WorkspacePreferences workspacePreferences = mock(WorkspacePreferences.class); when(workspacePreferences.getTheme()).thenReturn(new Theme(testCss.toString())); @@ -120,7 +120,7 @@ public void customThemeBecomesAvailableAfterFileIsCreated() throws IOException { } @Test - public void largeCustomThemeNotHeldInMemory() throws IOException { + void largeCustomThemeNotHeldInMemory() throws IOException { /* Create a temporary custom theme that is just a large comment over 48 kilobytes in size. There is no CSS validation (at the moment) but by making a valid CSS comment we don't preclude adding validation later */ Path largeCssTestFile = tempFolder.resolve("test.css"); @@ -157,7 +157,7 @@ public void largeCustomThemeNotHeldInMemory() throws IOException { } @Test - public void installThemeOnScene() throws IOException { + void installThemeOnScene() throws IOException { Scene scene = mock(Scene.class); when(scene.getStylesheets()).thenReturn(FXCollections.observableArrayList()); when(scene.getRoot()).thenReturn(mock(Parent.class)); @@ -176,7 +176,7 @@ public void installThemeOnScene() throws IOException { } @Test - public void installThemeOnWebEngine() throws IOException { + void installThemeOnWebEngine() throws IOException { Path testCss = tempFolder.resolve("reload.css"); Files.writeString(testCss, TEST_CSS_CONTENT, StandardOpenOption.CREATE); WorkspacePreferences workspacePreferences = mock(WorkspacePreferences.class, Answers.RETURNS_DEEP_STUBS); @@ -193,7 +193,7 @@ public void installThemeOnWebEngine() throws IOException { webEngineStyleSheetLocation.complete(webEngine.getUserStyleSheetLocation()); }); - Assertions.assertDoesNotThrow(() -> { + assertDoesNotThrow(() -> { assertEquals(TEST_CSS_DATA, webEngineStyleSheetLocation.get()); }); } @@ -203,7 +203,7 @@ public void installThemeOnWebEngine() throws IOException { * for the thread to start up and the changed css to reload. */ @Test - public void liveReloadCssDataUrl() throws IOException, InterruptedException { + void liveReloadCssDataUrl() throws IOException, InterruptedException { Path testCss = tempFolder.resolve("reload.css"); Files.writeString(testCss, TEST_CSS_CONTENT, StandardOpenOption.CREATE); WorkspacePreferences workspacePreferences = mock(WorkspacePreferences.class, Answers.RETURNS_DEEP_STUBS); diff --git a/src/test/java/org/jabref/gui/theme/ThemeTest.java b/src/test/java/org/jabref/gui/theme/ThemeTest.java index b568d33430ad..c9a6489bd726 100644 --- a/src/test/java/org/jabref/gui/theme/ThemeTest.java +++ b/src/test/java/org/jabref/gui/theme/ThemeTest.java @@ -7,9 +7,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ThemeTest { +class ThemeTest { @Test - public void lightThemeUsedWhenPathIsBlank() { + void lightThemeUsedWhenPathIsBlank() { Theme theme = new Theme(""); assertEquals(Theme.Type.DEFAULT, theme.getType()); @@ -18,7 +18,7 @@ public void lightThemeUsedWhenPathIsBlank() { } @Test - public void lightThemeUsedWhenPathIsBaseCss() { + void lightThemeUsedWhenPathIsBaseCss() { Theme theme = new Theme("Base.css"); assertEquals(Theme.Type.DEFAULT, theme.getType()); @@ -27,7 +27,7 @@ public void lightThemeUsedWhenPathIsBaseCss() { } @Test - public void darkThemeUsedWhenPathIsDarkCss() { + void darkThemeUsedWhenPathIsDarkCss() { Theme theme = new Theme("Dark.css"); assertEquals(Theme.Type.EMBEDDED, theme.getType()); @@ -37,7 +37,7 @@ public void darkThemeUsedWhenPathIsDarkCss() { } @Test - public void customThemeIgnoredIfDirectory() { + void customThemeIgnoredIfDirectory() { Theme theme = new Theme("."); assertEquals(Theme.Type.DEFAULT, theme.getType()); @@ -46,7 +46,7 @@ public void customThemeIgnoredIfDirectory() { } @Test - public void customThemeIgnoredIfInvalidPath() { + void customThemeIgnoredIfInvalidPath() { Theme theme = new Theme("\0\0\0"); assertEquals(Theme.Type.DEFAULT, theme.getType()); @@ -55,7 +55,7 @@ public void customThemeIgnoredIfInvalidPath() { } @Test - public void customThemeIfFileNotFound() { + void customThemeIfFileNotFound() { Theme theme = new Theme("Idonotexist.css"); assertEquals(Theme.Type.CUSTOM, theme.getType()); diff --git a/src/test/java/org/jabref/gui/util/ColorUtilTest.java b/src/test/java/org/jabref/gui/util/ColorUtilTest.java index a04489ac9089..16ba90b7de3d 100644 --- a/src/test/java/org/jabref/gui/util/ColorUtilTest.java +++ b/src/test/java/org/jabref/gui/util/ColorUtilTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ColorUtilTest { +class ColorUtilTest { private static final Color C1 = Color.color(0.2, 0.4, 1); private static final Color C2 = Color.rgb(255, 255, 255); @@ -22,14 +22,14 @@ public class ColorUtilTest { private ColorUtil colorUtil = new ColorUtil(); @Test - public void toRGBCodeTest() { + void toRGBCodeTest() { assertEquals("#3366FF", ColorUtil.toRGBCode(C1)); assertEquals("#FFFFFF", ColorUtil.toRGBCode(C2)); } @ParameterizedTest @MethodSource("provideToRGBACodeTest") - public void toRGBACodeTest(Color color, String expected) { + void toRGBACodeTest(Color color, String expected) { assertEquals(expected, ColorUtil.toRGBACode(color)); } @@ -44,7 +44,7 @@ private static Stream provideToRGBACodeTest() { } @Test - public void toHexTest() { + void toHexTest() { assertEquals("#000001", ColorUtil.toHex(C1)); assertEquals("#010101", ColorUtil.toHex(C2)); } diff --git a/src/test/java/org/jabref/gui/util/ControlHelperTest.java b/src/test/java/org/jabref/gui/util/ControlHelperTest.java index 1707604d04cc..291893af7d11 100644 --- a/src/test/java/org/jabref/gui/util/ControlHelperTest.java +++ b/src/test/java/org/jabref/gui/util/ControlHelperTest.java @@ -8,7 +8,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -public class ControlHelperTest { +class ControlHelperTest { private final String TEXT = "abcdef"; private final int MAX_CHARACTERS = 5; diff --git a/src/test/java/org/jabref/gui/util/OpenConsoleActionTest.java b/src/test/java/org/jabref/gui/util/OpenConsoleActionTest.java index 5ec37c2ee0ea..ff84b9e35c1e 100644 --- a/src/test/java/org/jabref/gui/util/OpenConsoleActionTest.java +++ b/src/test/java/org/jabref/gui/util/OpenConsoleActionTest.java @@ -16,7 +16,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class OpenConsoleActionTest { +class OpenConsoleActionTest { private final StateManager stateManager = mock(StateManager.class); private final PreferencesService preferences = mock(PreferencesService.class); @@ -24,13 +24,13 @@ public class OpenConsoleActionTest { private final BibDatabaseContext other = mock(BibDatabaseContext.class); @BeforeEach - public void setup() { + void setup() { when(stateManager.activeDatabaseProperty()).thenReturn(OptionalObjectProperty.empty()); when(stateManager.getActiveDatabase()).thenReturn(Optional.of(current)); } @Test - public void newActionGetsCurrentDatabase() { + void newActionGetsCurrentDatabase() { OpenConsoleAction action = new OpenConsoleAction(stateManager, preferences, null); action.execute(); verify(stateManager, times(1)).getActiveDatabase(); @@ -38,7 +38,7 @@ public void newActionGetsCurrentDatabase() { } @Test - public void newActionGetsSuppliedDatabase() { + void newActionGetsSuppliedDatabase() { OpenConsoleAction action = new OpenConsoleAction(() -> other, stateManager, preferences, null); action.execute(); verify(stateManager, never()).getActiveDatabase(); @@ -46,7 +46,7 @@ public void newActionGetsSuppliedDatabase() { } @Test - public void actionDefaultsToCurrentDatabase() { + void actionDefaultsToCurrentDatabase() { OpenConsoleAction action = new OpenConsoleAction(() -> null, stateManager, preferences, null); action.execute(); verify(stateManager, times(1)).getActiveDatabase(); diff --git a/src/test/java/org/jabref/gui/util/TooltipTextUtilTest.java b/src/test/java/org/jabref/gui/util/TooltipTextUtilTest.java index a181178c1d30..f73efe44bd45 100644 --- a/src/test/java/org/jabref/gui/util/TooltipTextUtilTest.java +++ b/src/test/java/org/jabref/gui/util/TooltipTextUtilTest.java @@ -12,12 +12,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class TooltipTextUtilTest { +class TooltipTextUtilTest { private String testText = "this is a test text"; @Test - public void retrieveCorrectTextStyleNormal() { + void retrieveCorrectTextStyleNormal() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.NORMAL); String textStyle = "Regular"; @@ -25,14 +25,14 @@ public void retrieveCorrectTextStyleNormal() { } @Test - public void stringRemainsTheSameAfterTransformationToNormal() { + void stringRemainsTheSameAfterTransformationToNormal() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.NORMAL); assertEquals(testText, text.getText()); } @Test - public void retrieveCorrectTextStyleBold() { + void retrieveCorrectTextStyleBold() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.BOLD); String textStyle = "tooltip-text-bold"; @@ -40,14 +40,14 @@ public void retrieveCorrectTextStyleBold() { } @Test - public void stringRemainsTheSameAfterTransformationToBold() { + void stringRemainsTheSameAfterTransformationToBold() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.BOLD); assertEquals(testText, text.getText()); } @Test - public void retrieveCorrectTextStyleItalic() { + void retrieveCorrectTextStyleItalic() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.ITALIC); String textStyle = "tooltip-text-italic"; @@ -55,21 +55,21 @@ public void retrieveCorrectTextStyleItalic() { } @Test - public void stringRemainsTheSameAfterTransformationToItalic() { + void stringRemainsTheSameAfterTransformationToItalic() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.ITALIC); assertEquals(testText, text.getText()); } @Test - public void testCreateTextMonospaced() { + void testCreateTextMonospaced() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.MONOSPACED); assertEquals("tooltip-text-monospaced", text.getStyleClass().toString()); assertEquals(testText, text.getText()); } @Test - public void retrieveCorrectStyleMonospaced() { + void retrieveCorrectStyleMonospaced() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.MONOSPACED); String textStyle = "tooltip-text-monospaced"; @@ -77,14 +77,14 @@ public void retrieveCorrectStyleMonospaced() { } @Test - public void stringRemainsTheSameAfterTransformationToMonospaced() { + void stringRemainsTheSameAfterTransformationToMonospaced() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.MONOSPACED); assertEquals(testText, text.getText()); } @Test - public void transformTextToHtmlStringBold() { + void transformTextToHtmlStringBold() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.BOLD); String htmlString = TooltipTextUtil.textToHtmlString(text); String expectedString = "" + testText + ""; @@ -93,7 +93,7 @@ public void transformTextToHtmlStringBold() { } @Test - public void transformTextToHtmlStringItalic() { + void transformTextToHtmlStringItalic() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.ITALIC); String htmlString = TooltipTextUtil.textToHtmlString(text); String expectedString = "" + testText + ""; @@ -102,7 +102,7 @@ public void transformTextToHtmlStringItalic() { } @Test - public void transformTextToHtmlStringMonospaced() { + void transformTextToHtmlStringMonospaced() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.MONOSPACED); String htmlString = TooltipTextUtil.textToHtmlString(text); String expectedString = "" + testText + ""; @@ -111,7 +111,7 @@ public void transformTextToHtmlStringMonospaced() { } @Test - public void transformTextToHtmlStringMonospacedBold() { + void transformTextToHtmlStringMonospacedBold() { Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.MONOSPACED); text.getStyleClass().add("tooltip-text-bold"); String htmlString = TooltipTextUtil.textToHtmlString(text); @@ -121,7 +121,7 @@ public void transformTextToHtmlStringMonospacedBold() { } @Test - public void transformTextToHtmlStringWithLinebreaks() { + void transformTextToHtmlStringWithLinebreaks() { String testText = "this\nis a\ntest text"; Text text = TooltipTextUtil.createText(testText, TooltipTextUtil.TextType.NORMAL); String htmlString = TooltipTextUtil.textToHtmlString(text); @@ -131,7 +131,7 @@ public void transformTextToHtmlStringWithLinebreaks() { } @Test - public void formatToTextsNoReplacements() { + void formatToTextsNoReplacements() { List expectedTextList = new ArrayList<>(); expectedTextList.add(TooltipTextUtil.createText("This search contains entries in which any field contains the regular expression ")); String test = "This search contains entries in which any field contains the regular expression "; @@ -141,7 +141,7 @@ public void formatToTextsNoReplacements() { } @Test - public void formatToTextsEnd() { + void formatToTextsEnd() { List expectedTextList = new ArrayList<>(); expectedTextList.add(TooltipTextUtil.createText("This search contains entries in which any field contains the regular expression ")); expectedTextList.add(TooltipTextUtil.createText("replacing text", TooltipTextUtil.TextType.BOLD)); @@ -152,7 +152,7 @@ public void formatToTextsEnd() { } @Test - public void formatToTextsBegin() { + void formatToTextsBegin() { List expectedTextList = new ArrayList<>(); expectedTextList.add(TooltipTextUtil.createText("replacing text", TooltipTextUtil.TextType.BOLD)); expectedTextList.add(TooltipTextUtil.createText(" This search contains entries in which any field contains the regular expression")); @@ -163,7 +163,7 @@ public void formatToTextsBegin() { } @Test - public void formatToTextsMiddle() { + void formatToTextsMiddle() { List expectedTextList = new ArrayList<>(); expectedTextList.add(TooltipTextUtil.createText("This search contains entries ")); expectedTextList.add(TooltipTextUtil.createText("replacing text", TooltipTextUtil.TextType.BOLD)); diff --git a/src/test/java/org/jabref/gui/util/comparator/NumericFieldComparatorTest.java b/src/test/java/org/jabref/gui/util/comparator/NumericFieldComparatorTest.java index 4f3770512015..9fb3048f302a 100644 --- a/src/test/java/org/jabref/gui/util/comparator/NumericFieldComparatorTest.java +++ b/src/test/java/org/jabref/gui/util/comparator/NumericFieldComparatorTest.java @@ -4,62 +4,62 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class NumericFieldComparatorTest { +class NumericFieldComparatorTest { private final NumericFieldComparator comparator = new NumericFieldComparator(); @Test - public void compareTwoNumericInputs() { + void compareTwoNumericInputs() { assertEquals(2, comparator.compare("4", "2")); } @Test - public void compareTwoNullInputs() { + void compareTwoNullInputs() { assertEquals(0, comparator.compare(null, null)); } @Test - public void compareTwoInputsWithFirstNull() { + void compareTwoInputsWithFirstNull() { assertEquals(-1, comparator.compare(null, "2")); } @Test - public void compareTwoInputsWithSecondNull() { + void compareTwoInputsWithSecondNull() { assertEquals(1, comparator.compare("4", null)); } @Test - public void compareTwoNotNumericInputs() { + void compareTwoNotNumericInputs() { assertEquals(-32, comparator.compare("HELLO", "hello")); } @Test - public void compareStringWithInteger() { + void compareStringWithInteger() { assertEquals(-1, comparator.compare("hi", "2")); } @Test - public void compareIntegerWithString() { + void compareIntegerWithString() { assertEquals(1, comparator.compare("4", "hi")); } @Test - public void compareNegativeInteger() { + void compareNegativeInteger() { assertEquals(1, comparator.compare("-4", "-5")); } @Test - public void compareWithMinusString() { + void compareWithMinusString() { assertEquals(-1, comparator.compare("-", "-5")); } @Test - public void compareWithPlusString() { + void compareWithPlusString() { assertEquals(-1, comparator.compare("+", "-5")); } @Test - public void compareWordWithMinus() { + void compareWordWithMinus() { assertEquals(-1, comparator.compare("-abc", "-5")); } diff --git a/src/test/java/org/jabref/gui/util/comparator/RankingFieldComparatorTest.java b/src/test/java/org/jabref/gui/util/comparator/RankingFieldComparatorTest.java index 2ac2d37f5396..b6fcbc268fac 100644 --- a/src/test/java/org/jabref/gui/util/comparator/RankingFieldComparatorTest.java +++ b/src/test/java/org/jabref/gui/util/comparator/RankingFieldComparatorTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RankingFieldComparatorTest { +class RankingFieldComparatorTest { private RankingFieldComparator comparator; private final SpecialFieldValue value1 = SpecialFieldValue.RANK_1; @@ -21,39 +21,39 @@ public class RankingFieldComparatorTest { private final Optional rank3 = Optional.of(new SpecialFieldValueViewModel(value3)); @BeforeEach - public void setUp() { + void setUp() { comparator = new RankingFieldComparator(); } @Test - public void compareHigherRankFirst() { + void compareHigherRankFirst() { assertEquals(-2, comparator.compare(rank3, rank1)); assertEquals(-1, comparator.compare(rank2, rank1)); } @Test - public void compareLowerRankFirst() { + void compareLowerRankFirst() { assertEquals(1, comparator.compare(rank1, rank2)); assertEquals(2, comparator.compare(rank1, rank3)); } @Test - public void compareSameRank() { + void compareSameRank() { assertEquals(0, comparator.compare(rank1, rank1)); } @Test - public void compareTwoEmptyInputs() { + void compareTwoEmptyInputs() { assertEquals(0, comparator.compare(Optional.empty(), Optional.empty())); } @Test - public void compareTwoInputsWithFirstEmpty() { + void compareTwoInputsWithFirstEmpty() { assertEquals(1, comparator.compare(Optional.empty(), rank1)); } @Test - public void compareTwoInputsWithSecondEmpty() { + void compareTwoInputsWithSecondEmpty() { assertEquals(-1, comparator.compare(rank1, Optional.empty())); } } diff --git a/src/test/java/org/jabref/gui/util/comparator/SpecialFieldComparatorTest.java b/src/test/java/org/jabref/gui/util/comparator/SpecialFieldComparatorTest.java index b62731b7b38c..1a7e23497ce4 100644 --- a/src/test/java/org/jabref/gui/util/comparator/SpecialFieldComparatorTest.java +++ b/src/test/java/org/jabref/gui/util/comparator/SpecialFieldComparatorTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class SpecialFieldComparatorTest { +class SpecialFieldComparatorTest { private SpecialFieldComparator comparator; private final SpecialFieldValue value1 = SpecialFieldValue.PRIORITY_HIGH; @@ -21,42 +21,42 @@ public class SpecialFieldComparatorTest { private final Optional read = Optional.of(new SpecialFieldValueViewModel(value3)); @BeforeEach - public void setUp() { + void setUp() { comparator = new SpecialFieldComparator(); } @Test - public void compareHigherPriorityFirst() { + void compareHigherPriorityFirst() { assertEquals(-2, comparator.compare(prio1, prio3)); } @Test - public void compareLowerPriorityFirst() { + void compareLowerPriorityFirst() { assertEquals(2, comparator.compare(prio3, prio1)); } @Test - public void compareSamePriority() { + void compareSamePriority() { assertEquals(0, comparator.compare(prio1, prio1)); } @Test - public void compareUnrelatedFields() { + void compareUnrelatedFields() { assertEquals(-11, comparator.compare(prio1, read)); } @Test - public void compareTwoEmptyInputs() { + void compareTwoEmptyInputs() { assertEquals(0, comparator.compare(Optional.empty(), Optional.empty())); } @Test - public void compareTwoInputsWithFirstEmpty() { + void compareTwoInputsWithFirstEmpty() { assertEquals(1, comparator.compare(Optional.empty(), prio1)); } @Test - public void compareTwoInputsWithSecondEmpty() { + void compareTwoInputsWithSecondEmpty() { assertEquals(-1, comparator.compare(prio1, Optional.empty())); } } diff --git a/src/test/java/org/jabref/logic/TypedBibEntryTest.java b/src/test/java/org/jabref/logic/TypedBibEntryTest.java index 683d636e7c2c..366ec81fe382 100644 --- a/src/test/java/org/jabref/logic/TypedBibEntryTest.java +++ b/src/test/java/org/jabref/logic/TypedBibEntryTest.java @@ -14,7 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class TypedBibEntryTest { +class TypedBibEntryTest { private BibEntryTypesManager entryTypesManager; @BeforeEach @@ -23,7 +23,7 @@ void setUp() { } @Test - public void hasAllRequiredFieldsFail() { + void hasAllRequiredFieldsFail() { BibEntry e = new BibEntry(StandardEntryType.Article); e.setField(StandardField.AUTHOR, "abc"); e.setField(StandardField.TITLE, "abc"); @@ -34,7 +34,7 @@ public void hasAllRequiredFieldsFail() { } @Test - public void hasAllRequiredFields() { + void hasAllRequiredFields() { BibEntry e = new BibEntry(StandardEntryType.Article); e.setField(StandardField.AUTHOR, "abc"); e.setField(StandardField.TITLE, "abc"); @@ -46,7 +46,7 @@ public void hasAllRequiredFields() { } @Test - public void hasAllRequiredFieldsForUnknownTypeReturnsTrue() { + void hasAllRequiredFieldsForUnknownTypeReturnsTrue() { BibEntry e = new BibEntry(new UnknownEntryType("articlllleeeee")); TypedBibEntry typedEntry = new TypedBibEntry(e, BibDatabaseMode.BIBTEX); @@ -54,7 +54,7 @@ public void hasAllRequiredFieldsForUnknownTypeReturnsTrue() { } @Test - public void getTypeForDisplayReturnsTypeName() { + void getTypeForDisplayReturnsTypeName() { BibEntry e = new BibEntry(StandardEntryType.InProceedings); TypedBibEntry typedEntry = new TypedBibEntry(e, BibDatabaseMode.BIBTEX); @@ -62,7 +62,7 @@ public void getTypeForDisplayReturnsTypeName() { } @Test - public void getTypeForDisplayForUnknownTypeCapitalizeFirstLetter() { + void getTypeForDisplayForUnknownTypeCapitalizeFirstLetter() { BibEntry e = new BibEntry(new UnknownEntryType("articlllleeeee")); TypedBibEntry typedEntry = new TypedBibEntry(e, BibDatabaseMode.BIBTEX); diff --git a/src/test/java/org/jabref/logic/bibtex/BibEntryAssert.java b/src/test/java/org/jabref/logic/bibtex/BibEntryAssert.java index 55b9ed985607..9e6f88b3ef80 100644 --- a/src/test/java/org/jabref/logic/bibtex/BibEntryAssert.java +++ b/src/test/java/org/jabref/logic/bibtex/BibEntryAssert.java @@ -17,9 +17,9 @@ import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.model.entry.BibEntry; -import org.junit.jupiter.api.Assertions; import org.mockito.Answers; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; @@ -85,7 +85,7 @@ public static void assertEquals(InputStream expectedInputStream, List assertNotNull(actualEntries); // explicit reference of Assertions is needed here to disambiguate from the methods defined by this class List expectedEntries = getListFromInputStream(expectedInputStream); - Assertions.assertEquals(expectedEntries, actualEntries); + assertEquals(expectedEntries, actualEntries); } public static void assertEquals(List expectedEntries, InputStream actualInputStream) @@ -93,7 +93,7 @@ public static void assertEquals(List expectedEntries, InputStream actu assertNotNull(actualInputStream); assertNotNull(expectedEntries); // explicit reference of Assertions is needed here to disambiguate from the methods defined by this class - Assertions.assertEquals(expectedEntries, getListFromInputStream(actualInputStream)); + assertEquals(expectedEntries, getListFromInputStream(actualInputStream)); } /** @@ -141,7 +141,7 @@ public static void assertEquals(List expected, Path fileToImport, Impo List actualEntries = importer.importDatabase(fileToImport) .getDatabase().getEntries(); // explicit reference of Assertions is needed here to disambiguate from the methods defined by this class - Assertions.assertEquals(expected, actualEntries); + assertEquals(expected, actualEntries); } public static void assertEquals(List expected, URL fileToImport, Importer importer) diff --git a/src/test/java/org/jabref/logic/bibtex/FileFieldWriterTest.java b/src/test/java/org/jabref/logic/bibtex/FileFieldWriterTest.java index 34032fb78596..a4b7202b3ea5 100644 --- a/src/test/java/org/jabref/logic/bibtex/FileFieldWriterTest.java +++ b/src/test/java/org/jabref/logic/bibtex/FileFieldWriterTest.java @@ -13,25 +13,25 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -public class FileFieldWriterTest { +class FileFieldWriterTest { @Test - public void testQuoteStandard() { + void testQuoteStandard() { assertEquals("a", FileFieldWriter.quote("a")); } @Test - public void testQuoteAllCharacters() { + void testQuoteAllCharacters() { assertEquals("a\\:\\;\\\\", FileFieldWriter.quote("a:;\\")); } @Test - public void testQuoteEmpty() { + void testQuoteEmpty() { assertEquals("", FileFieldWriter.quote("")); } @Test - public void testQuoteNull() { + void testQuoteNull() { assertNull(FileFieldWriter.quote(null)); } @@ -46,12 +46,12 @@ private static Stream getEncodingTestData() { @ParameterizedTest @MethodSource("getEncodingTestData") - public void testEncodeStringArray(String expected, String[][] values) { + void testEncodeStringArray(String expected, String[][] values) { assertEquals(expected, FileFieldWriter.encodeStringArray(values)); } @Test - public void testFileFieldWriterGetStringRepresentation() { + void testFileFieldWriterGetStringRepresentation() { LinkedFile file = new LinkedFile("test", Path.of("X:\\Users\\abc.pdf"), "PDF"); assertEquals("test:X\\:/Users/abc.pdf:PDF", FileFieldWriter.getStringRepresentation(file)); } diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/BibStringDiffTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/BibStringDiffTest.java index 03527cb43870..ebaf8579473f 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/BibStringDiffTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/BibStringDiffTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class BibStringDiffTest { +class BibStringDiffTest { private final BibDatabase originalDataBase = mock(BibDatabase.class); private final BibDatabase newDataBase = mock(BibDatabase.class); diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/BibtexStringComparatorTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/BibtexStringComparatorTest.java index e4bd1f9c5fef..9edb4229ff6a 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/BibtexStringComparatorTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/BibtexStringComparatorTest.java @@ -7,13 +7,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class BibtexStringComparatorTest { +class BibtexStringComparatorTest { private final BibtexStringComparator bsc1 = new BibtexStringComparator(false); private final BibtexStringComparator bsc2 = new BibtexStringComparator(true); @Test - public void test() { + void test() { BibtexString bs1 = new BibtexString("VLSI", "Very Large Scale Integration"); BibtexString bs2 = new BibtexString("DSP", "Digital Signal Processing"); BibtexString bs3 = new BibtexString("DSP", "Digital Signal Processing"); diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/CrossRefEntryComparatorTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/CrossRefEntryComparatorTest.java index 5bf856aeeb77..70a040459f04 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/CrossRefEntryComparatorTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/CrossRefEntryComparatorTest.java @@ -9,28 +9,28 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class CrossRefEntryComparatorTest { +class CrossRefEntryComparatorTest { private CrossRefEntryComparator comparator; @BeforeEach - public void setUp() { + void setUp() { comparator = new CrossRefEntryComparator(); } @AfterEach - public void tearDown() { + void tearDown() { comparator = null; } @Test - public void isEqualForEntriesWithoutCrossRef() { + void isEqualForEntriesWithoutCrossRef() { BibEntry e1 = new BibEntry(); BibEntry e2 = new BibEntry(); assertEquals(0, comparator.compare(e1, e2)); } @Test - public void isEqualForEntriesWithCrossRef() { + void isEqualForEntriesWithCrossRef() { BibEntry e1 = new BibEntry(); e1.setField(StandardField.CROSSREF, "1"); BibEntry e2 = new BibEntry(); @@ -39,7 +39,7 @@ public void isEqualForEntriesWithCrossRef() { } @Test - public void isGreaterForEntriesWithoutCrossRef() { + void isGreaterForEntriesWithoutCrossRef() { BibEntry e1 = new BibEntry(); BibEntry e2 = new BibEntry(); e2.setField(StandardField.CROSSREF, "1"); @@ -47,7 +47,7 @@ public void isGreaterForEntriesWithoutCrossRef() { } @Test - public void isSmallerForEntriesWithCrossRef() { + void isSmallerForEntriesWithCrossRef() { BibEntry e1 = new BibEntry(); e1.setField(StandardField.CROSSREF, "1"); BibEntry e2 = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/FieldComparatorTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/FieldComparatorTest.java index 447f038fa743..bbe85f3e60ac 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/FieldComparatorTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/FieldComparatorTest.java @@ -15,9 +15,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FieldComparatorTest { +class FieldComparatorTest { @Test - public void compareMonthFieldIdentity() throws Exception { + void compareMonthFieldIdentity() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.MONTH); BibEntry equal = new BibEntry() .withField(StandardField.MONTH, "1"); @@ -26,7 +26,7 @@ public void compareMonthFieldIdentity() throws Exception { } @Test - public void compareMonthFieldEquality() throws Exception { + void compareMonthFieldEquality() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.MONTH); BibEntry equal = new BibEntry() .withField(StandardField.MONTH, "1"); @@ -37,7 +37,7 @@ public void compareMonthFieldEquality() throws Exception { } @Test - public void compareMonthFieldBiggerAscending() throws Exception { + void compareMonthFieldBiggerAscending() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.MONTH); BibEntry smaller = new BibEntry() .withField(StandardField.MONTH, "jan"); @@ -48,7 +48,7 @@ public void compareMonthFieldBiggerAscending() throws Exception { } @Test - public void compareMonthFieldBiggerDescending() throws Exception { + void compareMonthFieldBiggerDescending() throws Exception { FieldComparator comparator = new FieldComparator(new OrFields(StandardField.MONTH), true); BibEntry smaller = new BibEntry() .withField(StandardField.MONTH, "feb"); @@ -59,7 +59,7 @@ public void compareMonthFieldBiggerDescending() throws Exception { } @Test - public void compareYearFieldIdentity() throws Exception { + void compareYearFieldIdentity() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.YEAR); BibEntry equal = new BibEntry() .withField(StandardField.YEAR, "2016"); @@ -68,7 +68,7 @@ public void compareYearFieldIdentity() throws Exception { } @Test - public void compareYearFieldEquality() throws Exception { + void compareYearFieldEquality() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.YEAR); BibEntry equal = new BibEntry() .withField(StandardField.YEAR, "2016"); @@ -79,7 +79,7 @@ public void compareYearFieldEquality() throws Exception { } @Test - public void compareYearFieldBiggerAscending() throws Exception { + void compareYearFieldBiggerAscending() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.YEAR); BibEntry smaller = new BibEntry() .withField(StandardField.YEAR, "2000"); @@ -90,7 +90,7 @@ public void compareYearFieldBiggerAscending() throws Exception { } @Test - public void compareYearFieldBiggerDescending() throws Exception { + void compareYearFieldBiggerDescending() throws Exception { FieldComparator comparator = new FieldComparator(new OrFields(StandardField.YEAR), true); BibEntry smaller = new BibEntry() .withField(StandardField.YEAR, "2016"); @@ -101,7 +101,7 @@ public void compareYearFieldBiggerDescending() throws Exception { } @Test - public void compareTypeFieldIdentity() throws Exception { + void compareTypeFieldIdentity() throws Exception { FieldComparator comparator = new FieldComparator(InternalField.TYPE_HEADER); BibEntry equal = new BibEntry(StandardEntryType.Article); @@ -109,7 +109,7 @@ public void compareTypeFieldIdentity() throws Exception { } @Test - public void compareTypeFieldEquality() throws Exception { + void compareTypeFieldEquality() throws Exception { FieldComparator comparator = new FieldComparator(InternalField.TYPE_HEADER); BibEntry equal = new BibEntry(StandardEntryType.Article); equal.setId("1"); @@ -120,7 +120,7 @@ public void compareTypeFieldEquality() throws Exception { } @Test - public void compareTypeFieldBiggerAscending() throws Exception { + void compareTypeFieldBiggerAscending() throws Exception { FieldComparator comparator = new FieldComparator(InternalField.TYPE_HEADER); BibEntry smaller = new BibEntry(StandardEntryType.Article); BibEntry bigger = new BibEntry(StandardEntryType.Book); @@ -129,7 +129,7 @@ public void compareTypeFieldBiggerAscending() throws Exception { } @Test - public void compareTypeFieldBiggerDescending() throws Exception { + void compareTypeFieldBiggerDescending() throws Exception { FieldComparator comparator = new FieldComparator(new OrFields(InternalField.TYPE_HEADER), true); BibEntry bigger = new BibEntry(StandardEntryType.Article); BibEntry smaller = new BibEntry(StandardEntryType.Book); @@ -138,7 +138,7 @@ public void compareTypeFieldBiggerDescending() throws Exception { } @Test - public void compareStringFieldsIdentity() throws Exception { + void compareStringFieldsIdentity() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.TITLE); BibEntry equal = new BibEntry() .withField(StandardField.TITLE, "title"); @@ -147,7 +147,7 @@ public void compareStringFieldsIdentity() throws Exception { } @Test - public void compareStringFieldsEquality() throws Exception { + void compareStringFieldsEquality() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.TITLE); BibEntry equal = new BibEntry() .withField(StandardField.TITLE, "title"); @@ -158,7 +158,7 @@ public void compareStringFieldsEquality() throws Exception { } @Test - public void compareStringFieldsBiggerAscending() throws Exception { + void compareStringFieldsBiggerAscending() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.TITLE); BibEntry bigger = new BibEntry() .withField(StandardField.TITLE, "b"); @@ -169,7 +169,7 @@ public void compareStringFieldsBiggerAscending() throws Exception { } @Test - public void compareStringFieldsBiggerDescending() throws Exception { + void compareStringFieldsBiggerDescending() throws Exception { FieldComparator comparator = new FieldComparator(new OrFields(StandardField.TITLE), true); BibEntry bigger = new BibEntry() .withField(StandardField.TITLE, "a"); @@ -180,7 +180,7 @@ public void compareStringFieldsBiggerDescending() throws Exception { } @Test - public void compareNumericFieldsBiggerDescending() throws Exception { + void compareNumericFieldsBiggerDescending() throws Exception { FieldComparator comparator = new FieldComparator(new OrFields(StandardField.PMID), true); BibEntry smaller = new BibEntry() .withField(StandardField.PMID, "234567"); @@ -191,7 +191,7 @@ public void compareNumericFieldsBiggerDescending() throws Exception { } @Test - public void compareParsableWithNonParsableNumericFieldDescending() throws Exception { + void compareParsableWithNonParsableNumericFieldDescending() throws Exception { FieldComparator comparator = new FieldComparator(new OrFields(StandardField.PMID), true); BibEntry parsable = new BibEntry() .withField(StandardField.PMID, "123456"); @@ -203,7 +203,7 @@ public void compareParsableWithNonParsableNumericFieldDescending() throws Except @ParameterizedTest @MethodSource - public void compareNumericalValues(int comparisonResult, String id1, String id2, String message) { + void compareNumericalValues(int comparisonResult, String id1, String id2, String message) { FieldComparator comparator = new FieldComparator(StandardField.PMID); BibEntry entry1 = new BibEntry() .withField(StandardField.PMID, id1); @@ -226,7 +226,7 @@ private static Stream compareNumericalValues() { @ParameterizedTest @MethodSource - public void nullTests(int comparisonResult, String firstValue, String secondValue) { + void nullTests(int comparisonResult, String firstValue, String secondValue) { FieldComparator comparator = new FieldComparator(StandardField.TITLE); BibEntry entry1 = new BibEntry(); @@ -252,7 +252,7 @@ private static Stream nullTests() { } @Test - public void compareAuthorField() throws Exception { + void compareAuthorField() throws Exception { FieldComparator comparator = new FieldComparator(StandardField.AUTHOR); BibEntry bigger = new BibEntry() .withField(StandardField.AUTHOR, "Freund, Lucas"); diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/GroupDiffTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/GroupDiffTest.java index 9fded7c78024..1153b498ced4 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/GroupDiffTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/GroupDiffTest.java @@ -15,7 +15,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class GroupDiffTest { +class GroupDiffTest { private final MetaData originalMetaData = mock(MetaData.class); private final MetaData newMetaData = mock(MetaData.class); diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/MetaDataDiffTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/MetaDataDiffTest.java index 8e7e11473ce3..e1068cbba1a9 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/MetaDataDiffTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/MetaDataDiffTest.java @@ -10,9 +10,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class MetaDataDiffTest { +class MetaDataDiffTest { @Test - public void compareWithSameContentSelectorsDoesNotReportAnyDiffs() throws Exception { + void compareWithSameContentSelectorsDoesNotReportAnyDiffs() throws Exception { MetaData one = new MetaData(); one.addContentSelector(new ContentSelector(StandardField.AUTHOR, "first", "second")); MetaData two = new MetaData(); diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/PreambleDiffTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/PreambleDiffTest.java index b868a4e26bf1..f8007dd96b3c 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/PreambleDiffTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/PreambleDiffTest.java @@ -12,7 +12,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class PreambleDiffTest { +class PreambleDiffTest { private final BibDatabaseContext originalDataBaseContext = mock(BibDatabaseContext.class); private final BibDatabaseContext newDataBaseContext = mock(BibDatabaseContext.class); diff --git a/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java b/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java index 1b63e26cbb39..01d5b1363f39 100644 --- a/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java +++ b/src/test/java/org/jabref/logic/bst/BstFunctionsTest.java @@ -34,7 +34,7 @@ */ class BstFunctionsTest { @Test - public void testCompareFunctions() throws RecognitionException { + void testCompareFunctions() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test.compare } { #5 #5 = % TRUE @@ -67,7 +67,7 @@ public void testCompareFunctions() throws RecognitionException { } @Test - public void testArithmeticFunctions() throws RecognitionException { + void testArithmeticFunctions() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test } { #1 #1 + % 2 @@ -84,7 +84,7 @@ public void testArithmeticFunctions() throws RecognitionException { } @Test - public void testArithmeticFunctionTypeMismatch() throws RecognitionException { + void testArithmeticFunctionTypeMismatch() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test } { #1 "HELLO" + % Should throw exception @@ -96,7 +96,7 @@ public void testArithmeticFunctionTypeMismatch() throws RecognitionException { } @Test - public void testStringOperations() throws RecognitionException { + void testStringOperations() throws RecognitionException { // Test for concat (*) and add.period BstVM vm = new BstVM(""" FUNCTION { test } { @@ -128,7 +128,7 @@ public void testStringOperations() throws RecognitionException { } @Test - public void testMissing() throws RecognitionException { + void testMissing() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { title } { } { } FUNCTION { presort } { cite$ 'sort.key$ := } @@ -154,7 +154,7 @@ public void testMissing() throws RecognitionException { } @Test - public void testNumNames() throws RecognitionException { + void testNumNames() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test } { "Johnny Foo { and } Mary Bar" num.names$ @@ -171,7 +171,7 @@ public void testNumNames() throws RecognitionException { } @Test - public void testSubstring() throws RecognitionException { + void testSubstring() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test } { "123456789" #2 #1 substring$ % 2 @@ -201,7 +201,7 @@ public void testSubstring() throws RecognitionException { } @Test - public void testEmpty() throws RecognitionException { + void testEmpty() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { title } { } { } READ @@ -228,7 +228,7 @@ public void testEmpty() throws RecognitionException { } @Test - public void testFormatNameStatic() throws RecognitionException { + void testFormatNameStatic() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { format }{ "Charles Louis Xavier Joseph de la Vall{\\'e}e Poussin" #1 "{vv~}{ll}{, jj}{, f}?" format.name$ } EXECUTE { format } @@ -242,7 +242,7 @@ public void testFormatNameStatic() throws RecognitionException { } @Test - public void testFormatNameInEntries() throws RecognitionException { + void testFormatNameInEntries() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { author } { } { } FUNCTION { presort } { cite$ 'sort.key$ := } @@ -266,7 +266,7 @@ public void testFormatNameInEntries() throws RecognitionException { } @Test - public void testChangeCase() throws RecognitionException { + void testChangeCase() throws RecognitionException { BstVM vm = new BstVM(""" STRINGS { title } READ @@ -296,7 +296,7 @@ public void testChangeCase() throws RecognitionException { } @Test - public void testTextLength() throws RecognitionException { + void testTextLength() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test } { "hello world" text.length$ % 11 @@ -325,7 +325,7 @@ public void testTextLength() throws RecognitionException { } @Test - public void testIntToStr() throws RecognitionException { + void testIntToStr() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test } { #3 int.to.str$ #9999 int.to.str$ } EXECUTE { test } @@ -339,7 +339,7 @@ public void testIntToStr() throws RecognitionException { } @Test - public void testChrToInt() throws RecognitionException { + void testChrToInt() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test } { "H" chr.to.int$ } EXECUTE { test } @@ -352,7 +352,7 @@ public void testChrToInt() throws RecognitionException { } @Test - public void testChrToIntIntToChr() throws RecognitionException { + void testChrToIntIntToChr() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { test } { "H" chr.to.int$ int.to.chr$ } EXECUTE {test} @@ -365,7 +365,7 @@ public void testChrToIntIntToChr() throws RecognitionException { } @Test - public void testType() throws RecognitionException { + void testType() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { } { } { } FUNCTION { presort } { cite$ 'sort.key$ := } @@ -390,7 +390,7 @@ public void testType() throws RecognitionException { } @Test - public void testCallType() throws RecognitionException { + void testCallType() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { title } { } { } FUNCTION { presort } { cite$ 'sort.key$ := } @@ -417,7 +417,7 @@ public void testCallType() throws RecognitionException { } @Test - public void testSwap() throws RecognitionException { + void testSwap() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { a } { #3 "Hallo" swap$ } EXECUTE { a } @@ -492,7 +492,7 @@ void testSimpleWhile() { } @Test - public void testNestedControlFunctions() throws RecognitionException { + void testNestedControlFunctions() throws RecognitionException { BstVM vm = new BstVM(""" STRINGS { t } FUNCTION { not } { { #0 } { #1 } if$ } @@ -537,7 +537,7 @@ public void testNestedControlFunctions() throws RecognitionException { } @Test - public void testLogic() throws RecognitionException { + void testLogic() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { not } { { #0 } { #1 } if$ } FUNCTION { and } { 'skip$ { pop$ #0 } if$ } @@ -577,7 +577,7 @@ public void testLogic() throws RecognitionException { */ @Test - public void testWidth() throws RecognitionException { + void testWidth() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { address author title type } { } { label } STRINGS { longest.label } @@ -619,7 +619,7 @@ public void testWidth() throws RecognitionException { } @Test - public void testDuplicateEmptyPopSwapIf() throws RecognitionException { + void testDuplicateEmptyPopSwapIf() throws RecognitionException { BstVM vm = new BstVM(""" FUNCTION { emphasize } { duplicate$ empty$ @@ -642,7 +642,7 @@ public void testDuplicateEmptyPopSwapIf() throws RecognitionException { } @Test - public void testPreambleWriteNewlineQuote() { + void testPreambleWriteNewlineQuote() { BstVM vm = new BstVM(""" FUNCTION { test } { preamble$ diff --git a/src/test/java/org/jabref/logic/bst/BstPreviewLayoutTest.java b/src/test/java/org/jabref/logic/bst/BstPreviewLayoutTest.java index f65b8f0f0a8c..ccd2ff2bb795 100644 --- a/src/test/java/org/jabref/logic/bst/BstPreviewLayoutTest.java +++ b/src/test/java/org/jabref/logic/bst/BstPreviewLayoutTest.java @@ -18,7 +18,7 @@ class BstPreviewLayoutTest { private final BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(); @Test - public void generatePreviewForSimpleEntryUsingAbbr() throws Exception { + void generatePreviewForSimpleEntryUsingAbbr() throws Exception { BstPreviewLayout bstPreviewLayout = new BstPreviewLayout(Path.of(BstPreviewLayoutTest.class.getResource("abbrv.bst").toURI())); BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "Oliver Kopp") .withField(StandardField.TITLE, "Thoughts on Development"); @@ -28,7 +28,7 @@ public void generatePreviewForSimpleEntryUsingAbbr() throws Exception { } @Test - public void monthMayIsCorrectlyRendered() throws Exception { + void monthMayIsCorrectlyRendered() throws Exception { BstPreviewLayout bstPreviewLayout = new BstPreviewLayout(Path.of(BstPreviewLayoutTest.class.getResource("abbrv.bst").toURI())); BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "Oliver Kopp") .withField(StandardField.TITLE, "Thoughts on Development") @@ -39,14 +39,14 @@ public void monthMayIsCorrectlyRendered() throws Exception { } @Test - public void generatePreviewForSliceTheoremPaperUsingAbbr() throws Exception { + void generatePreviewForSliceTheoremPaperUsingAbbr() throws Exception { BstPreviewLayout bstPreviewLayout = new BstPreviewLayout(Path.of(BstPreviewLayoutTest.class.getResource("abbrv.bst").toURI())); String preview = bstPreviewLayout.generatePreview(getSliceTheoremPaper(), bibDatabaseContext); assertEquals("T. Diez. Slice theorem for fréchet group actions and covariant symplectic field theory. May 2014.", preview); } @Test - public void generatePreviewForSliceTheoremPaperUsingIEEE() throws Exception { + void generatePreviewForSliceTheoremPaperUsingIEEE() throws Exception { BstPreviewLayout bstPreviewLayout = new BstPreviewLayout(Path.of(ClassLoader.getSystemResource("bst/IEEEtran.bst").toURI())); String preview = bstPreviewLayout.generatePreview(getSliceTheoremPaper(), bibDatabaseContext); assertEquals("T. Diez, \"Slice theorem for fréchet group actions and covariant symplectic field theory\" May 2014.", preview); diff --git a/src/test/java/org/jabref/logic/bst/BstVMTest.java b/src/test/java/org/jabref/logic/bst/BstVMTest.java index 52a36b987d0f..116e54a86d9d 100644 --- a/src/test/java/org/jabref/logic/bst/BstVMTest.java +++ b/src/test/java/org/jabref/logic/bst/BstVMTest.java @@ -30,7 +30,7 @@ public static BibEntry defaultTestEntry() { } @Test - public void testAbbrv() throws RecognitionException, IOException { + void testAbbrv() throws RecognitionException, IOException { BstVM vm = new BstVM(Path.of("src/test/resources/org/jabref/logic/bst/abbrv.bst")); List testEntries = List.of(defaultTestEntry()); @@ -43,7 +43,7 @@ public void testAbbrv() throws RecognitionException, IOException { } @Test - public void testSimple() throws RecognitionException { + void testSimple() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { address author title type } { } { label } INTEGERS { output.state before.all mid.sentence after.sentence after.block } @@ -68,7 +68,7 @@ public void testSimple() throws RecognitionException { } @Test - public void testLabel() throws RecognitionException { + void testLabel() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { title } {} { label } FUNCTION { test } { @@ -88,7 +88,7 @@ public void testLabel() throws RecognitionException { } @Test - public void testQuote() throws RecognitionException { + void testQuote() throws RecognitionException { BstVM vm = new BstVM("FUNCTION { a }{ quote$ quote$ * } EXECUTE { a }"); vm.render(Collections.emptyList()); @@ -96,7 +96,7 @@ public void testQuote() throws RecognitionException { } @Test - public void testBuildIn() throws RecognitionException { + void testBuildIn() throws RecognitionException { BstVM vm = new BstVM("EXECUTE { global.max$ }"); vm.render(Collections.emptyList()); @@ -106,7 +106,7 @@ public void testBuildIn() throws RecognitionException { } @Test - public void testVariables() throws RecognitionException { + void testVariables() throws RecognitionException { BstVM vm = new BstVM(""" STRINGS { t } FUNCTION { not } { @@ -125,7 +125,7 @@ public void testVariables() throws RecognitionException { } @Test - public void testHypthenatedName() throws RecognitionException, IOException { + void testHypthenatedName() throws RecognitionException, IOException { BstVM vm = new BstVM(Path.of("src/test/resources/org/jabref/logic/bst/abbrv.bst")); List testEntries = List.of( new BibEntry(StandardEntryType.Article) diff --git a/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java b/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java index abbfd8aaf3f3..14b020082f04 100644 --- a/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java +++ b/src/test/java/org/jabref/logic/bst/BstVMVisitorTest.java @@ -21,7 +21,7 @@ class BstVMVisitorTest { @Test - public void testVisitStringsCommand() { + void testVisitStringsCommand() { BstVM vm = new BstVM("STRINGS { test.string1 test.string2 test.string3 }"); vm.render(Collections.emptyList()); @@ -36,7 +36,7 @@ public void testVisitStringsCommand() { } @Test - public void testVisitIntegersCommand() { + void testVisitIntegersCommand() { BstVM vm = new BstVM("INTEGERS { variable.a variable.b variable.c }"); vm.render(Collections.emptyList()); @@ -118,7 +118,7 @@ void testVisitReadCommand() { } @Test - public void testVisitExecuteCommand() throws RecognitionException { + void testVisitExecuteCommand() throws RecognitionException { BstVM vm = new BstVM(""" INTEGERS { variable.a } FUNCTION { init.state.consts } { #5 'variable.a := } @@ -131,7 +131,7 @@ public void testVisitExecuteCommand() throws RecognitionException { } @Test - public void testVisitIterateCommand() throws RecognitionException { + void testVisitIterateCommand() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { } { } { } FUNCTION { test } { cite$ } @@ -151,7 +151,7 @@ public void testVisitIterateCommand() throws RecognitionException { } @Test - public void testVisitReverseCommand() throws RecognitionException { + void testVisitReverseCommand() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { } { } { } FUNCTION { test } { cite$ } @@ -171,7 +171,7 @@ public void testVisitReverseCommand() throws RecognitionException { } @Test - public void testVisitSortCommand() throws RecognitionException { + void testVisitSortCommand() throws RecognitionException { BstVM vm = new BstVM(""" ENTRY { } { } { } FUNCTION { presort } { cite$ 'sort.key$ := } diff --git a/src/test/java/org/jabref/logic/bst/util/BstCaseChangersTest.java b/src/test/java/org/jabref/logic/bst/util/BstCaseChangersTest.java index 3bf615093e4d..cf5015a3796a 100644 --- a/src/test/java/org/jabref/logic/bst/util/BstCaseChangersTest.java +++ b/src/test/java/org/jabref/logic/bst/util/BstCaseChangersTest.java @@ -12,11 +12,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class BstCaseChangersTest { +class BstCaseChangersTest { @ParameterizedTest @MethodSource("provideStringsForTitleLowers") - public void testChangeCaseTitleLowers(String expected, String toBeFormatted) { + void testChangeCaseTitleLowers(String expected, String toBeFormatted) { assertEquals(expected, BstCaseChanger.changeCase(toBeFormatted, FormatMode.TITLE_LOWERS)); } @@ -58,7 +58,7 @@ private static Stream provideStringsForTitleLowers() { @ParameterizedTest @MethodSource("provideStringsForAllLowers") - public void testChangeCaseAllLowers(String expected, String toBeFormatted) { + void testChangeCaseAllLowers(String expected, String toBeFormatted) { assertEquals(expected, BstCaseChanger.changeCase(toBeFormatted, FormatMode.ALL_LOWERS)); } @@ -89,7 +89,7 @@ private static Stream provideStringsForAllLowers() { @ParameterizedTest @MethodSource("provideStringsForAllUppers") - public void testChangeCaseAllUppers(String expected, String toBeFormatted) { + void testChangeCaseAllUppers(String expected, String toBeFormatted) { assertEquals(expected, BstCaseChanger.changeCase(toBeFormatted, FormatMode.ALL_UPPERS)); } @@ -120,7 +120,7 @@ private static Stream provideStringsForAllUppers() { @ParameterizedTest @MethodSource("provideTitleCaseAllLowers") - public void testTitleCaseAllLowers(String expected, String toBeFormatted) { + void testTitleCaseAllLowers(String expected, String toBeFormatted) { assertEquals(expected, BstCaseChanger.changeCase(toBeFormatted, FormatMode.ALL_LOWERS)); } @@ -138,7 +138,7 @@ private static Stream provideTitleCaseAllLowers() { @Disabled @Test - public void testTitleCaseAllUppers() { + void testTitleCaseAllUppers() { /* the real test would look like as follows. Also from the comment of issue 176, order reversed as the "should be" comes first */ // assertCaseChangerTitleUppers("This is a Simple Example {TITLE}", "This is a simple example {TITLE}"); // assertCaseChangerTitleUppers("This {IS} Another Simple Example Tit{LE}", "This {IS} another simple example tit{LE}"); diff --git a/src/test/java/org/jabref/logic/bst/util/BstNameFormatterTest.java b/src/test/java/org/jabref/logic/bst/util/BstNameFormatterTest.java index 4912af099bf6..332b23ba29d4 100644 --- a/src/test/java/org/jabref/logic/bst/util/BstNameFormatterTest.java +++ b/src/test/java/org/jabref/logic/bst/util/BstNameFormatterTest.java @@ -6,10 +6,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class BstNameFormatterTest { +class BstNameFormatterTest { @Test - public void testUmlautsFullNames() { + void testUmlautsFullNames() { AuthorList list = AuthorList.parse("Charles Louis Xavier Joseph de la Vall{\\'e}e Poussin"); assertEquals("de~laVall{\\'e}e~PoussinCharles Louis Xavier~Joseph", @@ -17,7 +17,7 @@ public void testUmlautsFullNames() { } @Test - public void testUmlautsAbbreviations() { + void testUmlautsAbbreviations() { AuthorList list = AuthorList.parse("Charles Louis Xavier Joseph de la Vall{\\'e}e Poussin"); assertEquals("de~la Vall{\\'e}e~Poussin, C.~L. X.~J.", @@ -25,7 +25,7 @@ public void testUmlautsAbbreviations() { } @Test - public void testUmlautsAbbreviationsWithQuestionMark() { + void testUmlautsAbbreviationsWithQuestionMark() { AuthorList list = AuthorList.parse("Charles Louis Xavier Joseph de la Vall{\\'e}e Poussin"); assertEquals("de~la Vall{\\'e}e~Poussin, C.~L. X.~J?", @@ -33,7 +33,7 @@ public void testUmlautsAbbreviationsWithQuestionMark() { } @Test - public void testFormatName() { + void testFormatName() { AuthorList list = AuthorList.parse("Charles Louis Xavier Joseph de la Vall{\\'e}e Poussin"); assertEquals("dlVP", BstNameFormatter.formatName(list.getAuthor(0), "{v{}}{l{}}")); @@ -70,28 +70,28 @@ private void assertNameFormatA(String string, String string2) { } @Test - public void matchingBraceConsumedForCompleteWords() { + void matchingBraceConsumedForCompleteWords() { StringBuilder sb = new StringBuilder(); assertEquals(6, BstNameFormatter.consumeToMatchingBrace(sb, "{HELLO} {WORLD}".toCharArray(), 0)); assertEquals("{HELLO}", sb.toString()); } @Test - public void matchingBraceConsumedForBracesInWords() { + void matchingBraceConsumedForBracesInWords() { StringBuilder sb = new StringBuilder(); assertEquals(18, BstNameFormatter.consumeToMatchingBrace(sb, "{HE{L{}L}O} {WORLD}".toCharArray(), 12)); assertEquals("{WORLD}", sb.toString()); } @Test - public void testConsumeToMatchingBrace() { + void testConsumeToMatchingBrace() { StringBuilder sb = new StringBuilder(); assertEquals(10, BstNameFormatter.consumeToMatchingBrace(sb, "{HE{L{}L}O} {WORLD}".toCharArray(), 0)); assertEquals("{HE{L{}L}O}", sb.toString()); } @Test - public void testGetFirstCharOfString() { + void testGetFirstCharOfString() { assertEquals("C", BstNameFormatter.getFirstCharOfString("Charles")); assertEquals("V", BstNameFormatter.getFirstCharOfString("Vall{\\'e}e")); assertEquals("{\\'e}", BstNameFormatter.getFirstCharOfString("{\\'e}")); @@ -100,7 +100,7 @@ public void testGetFirstCharOfString() { } @Test - public void testNumberOfChars() { + void testNumberOfChars() { assertEquals(6, BstNameFormatter.numberOfChars("Vall{\\'e}e", -1)); assertEquals(2, BstNameFormatter.numberOfChars("Vall{\\'e}e", 2)); assertEquals(1, BstNameFormatter.numberOfChars("Vall{\\'e}e", 1)); diff --git a/src/test/java/org/jabref/logic/bst/util/BstPurifierTest.java b/src/test/java/org/jabref/logic/bst/util/BstPurifierTest.java index 295b735fd376..d0d64c13fd14 100644 --- a/src/test/java/org/jabref/logic/bst/util/BstPurifierTest.java +++ b/src/test/java/org/jabref/logic/bst/util/BstPurifierTest.java @@ -8,11 +8,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class BstPurifierTest { +class BstPurifierTest { @ParameterizedTest @MethodSource("provideTestStrings") - public void testPurify(String expected, String toBePurified) { + void testPurify(String expected, String toBePurified) { assertEquals(expected, BstPurifier.purify(toBePurified)); } diff --git a/src/test/java/org/jabref/logic/bst/util/BstTextPrefixerTest.java b/src/test/java/org/jabref/logic/bst/util/BstTextPrefixerTest.java index cc8571018220..1be62f168e6c 100644 --- a/src/test/java/org/jabref/logic/bst/util/BstTextPrefixerTest.java +++ b/src/test/java/org/jabref/logic/bst/util/BstTextPrefixerTest.java @@ -4,10 +4,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class BstTextPrefixerTest { +class BstTextPrefixerTest { @Test - public void testPrefix() { + void testPrefix() { assertPrefix("i", "i"); assertPrefix("0I~ ", "0I~ "); assertPrefix("Hi Hi", "Hi Hi "); diff --git a/src/test/java/org/jabref/logic/bst/util/BstWidthCalculatorTest.java b/src/test/java/org/jabref/logic/bst/util/BstWidthCalculatorTest.java index 30f2f6770e56..118d62d38680 100644 --- a/src/test/java/org/jabref/logic/bst/util/BstWidthCalculatorTest.java +++ b/src/test/java/org/jabref/logic/bst/util/BstWidthCalculatorTest.java @@ -35,11 +35,11 @@ * \bibcite{canh05}{CMM{$^{+}$}05} * */ -public class BstWidthCalculatorTest { +class BstWidthCalculatorTest { @ParameterizedTest @MethodSource("provideTestWidth") - public void testWidth(int i, String str) { + void testWidth(int i, String str) { assertEquals(i, BstWidthCalculator.width(str)); } @@ -59,7 +59,7 @@ private static Stream provideTestWidth() { @ParameterizedTest @MethodSource("provideTestGetCharWidth") - public void testGetCharWidth(int i, Character c) { + void testGetCharWidth(int i, Character c) { assertEquals(i, BstWidthCalculator.getCharWidth(c)); } diff --git a/src/test/java/org/jabref/logic/cleanup/ConvertToBiblatexCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/ConvertToBiblatexCleanupTest.java index 2208a000130e..396c53225e99 100644 --- a/src/test/java/org/jabref/logic/cleanup/ConvertToBiblatexCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/ConvertToBiblatexCleanupTest.java @@ -10,17 +10,17 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ConvertToBiblatexCleanupTest { +class ConvertToBiblatexCleanupTest { private ConvertToBiblatexCleanup worker; @BeforeEach - public void setUp() { + void setUp() { worker = new ConvertToBiblatexCleanup(); } @Test - public void cleanupMovesYearMonthToDate() { + void cleanupMovesYearMonthToDate() { BibEntry entry = new BibEntry(); entry.setField(StandardField.YEAR, "2011"); entry.setField(StandardField.MONTH, "#jan#"); @@ -33,7 +33,7 @@ public void cleanupMovesYearMonthToDate() { } @Test - public void cleanupWithDateAlreadyPresentAndDifferentFromYearDoesNothing() { + void cleanupWithDateAlreadyPresentAndDifferentFromYearDoesNothing() { BibEntry entry = new BibEntry(); entry.setField(StandardField.YEAR, "2011"); entry.setField(StandardField.MONTH, "#jan#"); @@ -47,7 +47,7 @@ public void cleanupWithDateAlreadyPresentAndDifferentFromYearDoesNothing() { } @Test - public void cleanupWithDateAlreadyPresentAndDifferentFromMonthDoesNothing() { + void cleanupWithDateAlreadyPresentAndDifferentFromMonthDoesNothing() { BibEntry entry = new BibEntry(); entry.setField(StandardField.YEAR, "2011"); entry.setField(StandardField.MONTH, "#jan#"); @@ -61,7 +61,7 @@ public void cleanupWithDateAlreadyPresentAndDifferentFromMonthDoesNothing() { } @Test - public void cleanupWithEmptyDateDoesNothing() { + void cleanupWithEmptyDateDoesNothing() { BibEntry entry = new BibEntry(); entry.setField(StandardField.YEAR, ""); entry.setField(StandardField.MONTH, ""); @@ -75,7 +75,7 @@ public void cleanupWithEmptyDateDoesNothing() { } @Test - public void cleanupWithDateAlreadyPresentAndEqualsToYearAndMonth() { + void cleanupWithDateAlreadyPresentAndEqualsToYearAndMonth() { BibEntry entry = new BibEntry(); entry.setField(StandardField.YEAR, "2011"); entry.setField(StandardField.MONTH, "#jan#"); @@ -89,7 +89,7 @@ public void cleanupWithDateAlreadyPresentAndEqualsToYearAndMonth() { } @Test - public void cleanupMovesJournalToJournaltitle() { + void cleanupMovesJournalToJournaltitle() { BibEntry entry = new BibEntry().withField(StandardField.JOURNAL, "Best of JabRef"); worker.cleanup(entry); diff --git a/src/test/java/org/jabref/logic/cleanup/ConvertToBibtexCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/ConvertToBibtexCleanupTest.java index 38259aaef2f6..06a4a1df5d54 100644 --- a/src/test/java/org/jabref/logic/cleanup/ConvertToBibtexCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/ConvertToBibtexCleanupTest.java @@ -10,17 +10,17 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ConvertToBibtexCleanupTest { +class ConvertToBibtexCleanupTest { private ConvertToBibtexCleanup worker; @BeforeEach - public void setUp() { + void setUp() { worker = new ConvertToBibtexCleanup(); } @Test - public void cleanupMovesDateToYearAndMonth() { + void cleanupMovesDateToYearAndMonth() { BibEntry entry = new BibEntry().withField(StandardField.DATE, "2011-01"); worker.cleanup(entry); @@ -31,7 +31,7 @@ public void cleanupMovesDateToYearAndMonth() { } @Test - public void cleanupWithYearAlreadyPresentDoesNothing() { + void cleanupWithYearAlreadyPresentDoesNothing() { BibEntry entry = new BibEntry(); entry.setField(StandardField.YEAR, "2011"); entry.setField(StandardField.DATE, "2012"); @@ -43,7 +43,7 @@ public void cleanupWithYearAlreadyPresentDoesNothing() { } @Test - public void cleanupMovesJournaltitleToJournal() { + void cleanupMovesJournaltitleToJournal() { BibEntry entry = new BibEntry().withField(StandardField.JOURNALTITLE, "Best of JabRef"); worker.cleanup(entry); @@ -53,7 +53,7 @@ public void cleanupMovesJournaltitleToJournal() { } @Test - public void cleanUpDoesntMoveFileField() { + void cleanUpDoesntMoveFileField() { String fileField = ":Ambriola2006 - On the Systematic Analysis of Natural Language Requirements with CIRCE.pdf:PDF"; BibEntry entry = new BibEntry().withField(StandardField.FILE, fileField); diff --git a/src/test/java/org/jabref/logic/cleanup/DoiCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/DoiCleanupTest.java index 103738087189..b14e5f64f103 100644 --- a/src/test/java/org/jabref/logic/cleanup/DoiCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/DoiCleanupTest.java @@ -12,11 +12,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class DoiCleanupTest { +class DoiCleanupTest { @ParameterizedTest @MethodSource("provideDoiForAllLowers") - public void testChangeDoi(BibEntry expected, BibEntry doiInfoField) { + void testChangeDoi(BibEntry expected, BibEntry doiInfoField) { DoiCleanup cleanUp = new DoiCleanup(); cleanUp.cleanup(doiInfoField); diff --git a/src/test/java/org/jabref/logic/cleanup/DoiDecodeCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/DoiDecodeCleanupTest.java index b07904b27199..b3e17470fa91 100644 --- a/src/test/java/org/jabref/logic/cleanup/DoiDecodeCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/DoiDecodeCleanupTest.java @@ -12,11 +12,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class DoiDecodeCleanupTest { +class DoiDecodeCleanupTest { @ParameterizedTest @MethodSource("provideDoiForAllLowers") - public void testChangeDoi(BibEntry expected, BibEntry doiInfoField) { + void testChangeDoi(BibEntry expected, BibEntry doiInfoField) { DoiCleanup cleanUp = new DoiCleanup(); cleanUp.cleanup(doiInfoField); diff --git a/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java index 27cbd8d322d9..28371e62273b 100644 --- a/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java @@ -16,13 +16,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FieldFormatterCleanupTest { +class FieldFormatterCleanupTest { private BibEntry entry; private Map fieldMap; @BeforeEach - public void setUp() { + void setUp() { fieldMap = new HashMap<>(); entry = new BibEntry(); @@ -38,7 +38,7 @@ public void setUp() { } @Test - public void testInternalAllField() throws Exception { + void testInternalAllField() throws Exception { FieldFormatterCleanup cleanup = new FieldFormatterCleanup(InternalField.INTERNAL_ALL_FIELD, new UpperCaseFormatter()); cleanup.cleanup(entry); @@ -52,7 +52,7 @@ public void testInternalAllField() throws Exception { } @Test - public void testInternalAllTextFieldsField() throws Exception { + void testInternalAllTextFieldsField() throws Exception { FieldFormatterCleanup cleanup = new FieldFormatterCleanup(InternalField.INTERNAL_ALL_TEXT_FIELDS_FIELD, new UpperCaseFormatter()); cleanup.cleanup(entry); @@ -66,7 +66,7 @@ public void testInternalAllTextFieldsField() throws Exception { } @Test - public void testCleanupAllFieldsIgnoresKeyField() throws Exception { + void testCleanupAllFieldsIgnoresKeyField() throws Exception { FieldFormatterCleanup cleanup = new FieldFormatterCleanup(InternalField.INTERNAL_ALL_FIELD, new UnicodeToLatexFormatter()); entry.setField(InternalField.KEY_FIELD, "François-Marie Arouet"); // Contains ç, not in Basic Latin cleanup.cleanup(entry); @@ -75,7 +75,7 @@ public void testCleanupAllFieldsIgnoresKeyField() throws Exception { } @Test - public void testCleanupAllTextFieldsIgnoresKeyField() throws Exception { + void testCleanupAllTextFieldsIgnoresKeyField() throws Exception { FieldFormatterCleanup cleanup = new FieldFormatterCleanup(InternalField.INTERNAL_ALL_TEXT_FIELDS_FIELD, new UnicodeToLatexFormatter()); entry.setField(InternalField.KEY_FIELD, "François-Marie Arouet"); // Contains ç, not in Basic Latin cleanup.cleanup(entry); @@ -84,7 +84,7 @@ public void testCleanupAllTextFieldsIgnoresKeyField() throws Exception { } @Test - public void testCleanupKeyFieldCleansUpKeyField() throws Exception { + void testCleanupKeyFieldCleansUpKeyField() throws Exception { FieldFormatterCleanup cleanup = new FieldFormatterCleanup(InternalField.KEY_FIELD, new UnicodeToLatexFormatter()); entry.setField(InternalField.KEY_FIELD, "François-Marie Arouet"); // Contains ç, not in Basic Latin cleanup.cleanup(entry); diff --git a/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java b/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java index b6737e8c9248..8acc2ac38831 100644 --- a/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java +++ b/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java @@ -26,12 +26,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FieldFormatterCleanupsTest { +class FieldFormatterCleanupsTest { private BibEntry entry; @BeforeEach - public void setUp() { + void setUp() { entry = new BibEntry(StandardEntryType.InProceedings) .withCitationKey("6055279") .withField(StandardField.TITLE, "Educational session 1") @@ -45,7 +45,7 @@ public void setUp() { } @Test - public void checkSimpleUseCase() { + void checkSimpleUseCase() { FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title[identity]")); FieldFormatterCleanup identityInTitle = new FieldFormatterCleanup(StandardField.TITLE, new IdentityFormatter()); @@ -57,7 +57,7 @@ public void checkSimpleUseCase() { } @Test - public void invalidSaveActionSting() { + void invalidSaveActionSting() { FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title")); assertEquals(Collections.emptyList(), actions.getConfiguredActions()); @@ -68,7 +68,7 @@ public void invalidSaveActionSting() { } @Test - public void checkLowerCaseSaveAction() { + void checkLowerCaseSaveAction() { FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title[lower_case]")); FieldFormatterCleanup lowerCaseTitle = new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()); @@ -80,7 +80,7 @@ public void checkLowerCaseSaveAction() { } @Test - public void checkTwoSaveActionsForOneField() { + void checkTwoSaveActionsForOneField() { FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title[lower_case,identity]")); FieldFormatterCleanup lowerCaseTitle = new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()); @@ -93,7 +93,7 @@ public void checkTwoSaveActionsForOneField() { } @Test - public void checkThreeSaveActionsForOneField() { + void checkThreeSaveActionsForOneField() { FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("title[lower_case,identity,normalize_date]")); FieldFormatterCleanup lowerCaseTitle = new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()); @@ -107,7 +107,7 @@ public void checkThreeSaveActionsForOneField() { } @Test - public void checkMultipleSaveActions() { + void checkMultipleSaveActions() { FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("pages[normalize_page_numbers]title[lower_case]")); List formatterCleanups = actions.getConfiguredActions(); @@ -122,7 +122,7 @@ public void checkMultipleSaveActions() { } @Test - public void checkMultipleSaveActionsWithMultipleFormatters() { + void checkMultipleSaveActionsWithMultipleFormatters() { FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("pages[normalize_page_numbers,normalize_date]title[lower_case]")); List formatterCleanups = actions.getConfiguredActions(); @@ -139,7 +139,7 @@ public void checkMultipleSaveActionsWithMultipleFormatters() { } @Test - public void clearFormatterRemovesField() { + void clearFormatterRemovesField() { FieldFormatterCleanups actions = new FieldFormatterCleanups(true, FieldFormatterCleanups.parse("month[clear]")); actions.applySaveActions(entry); diff --git a/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java index f9745fdfcb90..9493d20df5c3 100644 --- a/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java @@ -15,12 +15,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class ISSNCleanupTest { +class ISSNCleanupTest { private CleanupWorker worker; @BeforeEach - public void setUp() { + void setUp() { worker = new CleanupWorker( mock(BibDatabaseContext.class), mock(FilePreferences.class), @@ -28,7 +28,7 @@ public void setUp() { } @Test - public void cleanupISSNReturnsCorrectISSN() { + void cleanupISSNReturnsCorrectISSN() { CleanupPreferences preset = new CleanupPreferences(CleanupPreferences.CleanupStep.CLEAN_UP_ISSN); BibEntry entry = new BibEntry(); entry.setField(StandardField.ISSN, "0123-4567"); @@ -38,7 +38,7 @@ public void cleanupISSNReturnsCorrectISSN() { } @Test - public void cleanupISSNAddsMissingDash() { + void cleanupISSNAddsMissingDash() { CleanupPreferences preset = new CleanupPreferences(CleanupPreferences.CleanupStep.CLEAN_UP_ISSN); BibEntry entry = new BibEntry(); entry.setField(StandardField.ISSN, "01234567"); @@ -48,7 +48,7 @@ public void cleanupISSNAddsMissingDash() { } @Test - public void cleanupISSNJunkStaysJunk() { + void cleanupISSNJunkStaysJunk() { CleanupPreferences preset = new CleanupPreferences(CleanupPreferences.CleanupStep.CLEAN_UP_ISSN); BibEntry entry = new BibEntry(); entry.setField(StandardField.ISSN, "Banana"); diff --git a/src/test/java/org/jabref/logic/cleanup/TimeStampToCreationDateTest.java b/src/test/java/org/jabref/logic/cleanup/TimeStampToCreationDateTest.java index 67027811cf1f..e6ddf0aff33c 100644 --- a/src/test/java/org/jabref/logic/cleanup/TimeStampToCreationDateTest.java +++ b/src/test/java/org/jabref/logic/cleanup/TimeStampToCreationDateTest.java @@ -53,7 +53,7 @@ public static Stream standardFieldToCreationDate() { */ @ParameterizedTest @MethodSource("standardFieldToCreationDate") - public void withStandardFieldToCreationDate(BibEntry expected, BibEntry input) { + void withStandardFieldToCreationDate(BibEntry expected, BibEntry input) { makeMockReturnStandardField(); TimeStampToCreationDate migrator = new TimeStampToCreationDate(timestampPreferences); migrator.cleanup(input); @@ -82,7 +82,7 @@ public static Stream customFieldToCreationDate() { */ @ParameterizedTest @MethodSource("customFieldToCreationDate") - public void withCustomFieldToCreationDate(BibEntry expected, BibEntry input) { + void withCustomFieldToCreationDate(BibEntry expected, BibEntry input) { makeMockReturnCustomField(); TimeStampToCreationDate migrator = new TimeStampToCreationDate(timestampPreferences); migrator.cleanup(input); @@ -169,7 +169,7 @@ public static Stream entriesMigratedToCreationDateFromDifferentFormat */ @ParameterizedTest @MethodSource("entriesMigratedToCreationDateFromDifferentFormats") - public void withDifferentFormats(BibEntry expected, BibEntry input) { + void withDifferentFormats(BibEntry expected, BibEntry input) { makeMockReturnStandardField(); TimeStampToCreationDate migrator = new TimeStampToCreationDate(timestampPreferences); ParserResult parserResult = new ParserResult(List.of(input)); diff --git a/src/test/java/org/jabref/logic/cleanup/TimeStampToModificationDateTest.java b/src/test/java/org/jabref/logic/cleanup/TimeStampToModificationDateTest.java index 79f3fbc8438a..092e8f3a565e 100644 --- a/src/test/java/org/jabref/logic/cleanup/TimeStampToModificationDateTest.java +++ b/src/test/java/org/jabref/logic/cleanup/TimeStampToModificationDateTest.java @@ -51,7 +51,7 @@ public static Stream standardFieldToModificationDate() { */ @ParameterizedTest @MethodSource("standardFieldToModificationDate") - public void withStandardFieldToModificationDate(BibEntry expected, BibEntry input) { + void withStandardFieldToModificationDate(BibEntry expected, BibEntry input) { makeMockReturnStandardField(); TimeStampToModificationDate migrator = new TimeStampToModificationDate(timestampPreferences); migrator.cleanup(input); @@ -80,7 +80,7 @@ public static Stream customFieldToModificationDate() { */ @ParameterizedTest @MethodSource("customFieldToModificationDate") - public void withCustomFieldToModificationDate(BibEntry expected, BibEntry input) { + void withCustomFieldToModificationDate(BibEntry expected, BibEntry input) { makeMockReturnCustomField(); TimeStampToModificationDate migrator = new TimeStampToModificationDate(timestampPreferences); migrator.cleanup(input); diff --git a/src/test/java/org/jabref/logic/cleanup/URLCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/URLCleanupTest.java index 0a75b64b3598..96117a51e445 100644 --- a/src/test/java/org/jabref/logic/cleanup/URLCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/URLCleanupTest.java @@ -11,11 +11,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class URLCleanupTest { +class URLCleanupTest { @ParameterizedTest @MethodSource("provideURL") - public void testChangeURL(BibEntry expected, BibEntry urlInputField) { + void testChangeURL(BibEntry expected, BibEntry urlInputField) { URLCleanup cleanUp = new URLCleanup(); cleanUp.cleanup(urlInputField); diff --git a/src/test/java/org/jabref/logic/crawler/CrawlerTest.java b/src/test/java/org/jabref/logic/crawler/CrawlerTest.java index 3bb915cf5686..bd8a7006e1a5 100644 --- a/src/test/java/org/jabref/logic/crawler/CrawlerTest.java +++ b/src/test/java/org/jabref/logic/crawler/CrawlerTest.java @@ -53,7 +53,7 @@ class CrawlerTest { * Set up mocks and copies the study definition file into the test repository */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { setUpRepository(); CitationKeyPatternPreferences citationKeyPatternPreferences = new CitationKeyPatternPreferences( @@ -101,7 +101,7 @@ private void setUpTestStudyDefinitionFile() throws Exception { } @Test - public void testWhetherAllFilesAreCreated() throws Exception { + void testWhetherAllFilesAreCreated() throws Exception { Crawler testCrawler = new Crawler(getPathToStudyDefinitionFile(), gitHandler, preferencesService, diff --git a/src/test/java/org/jabref/logic/crawler/StudyCatalogToFetcherConverterTest.java b/src/test/java/org/jabref/logic/crawler/StudyCatalogToFetcherConverterTest.java index eb039b6815f0..11da7e00dd4b 100644 --- a/src/test/java/org/jabref/logic/crawler/StudyCatalogToFetcherConverterTest.java +++ b/src/test/java/org/jabref/logic/crawler/StudyCatalogToFetcherConverterTest.java @@ -18,12 +18,12 @@ import org.jabref.model.util.DummyFileUpdateMonitor; import org.jabref.preferences.PreferencesService; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.mockito.Answers; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -48,7 +48,7 @@ void setUpMocks() { } @Test - public void getActiveFetcherInstances() throws Exception { + void getActiveFetcherInstances() throws Exception { Path studyDefinition = tempRepositoryDirectory.resolve(StudyRepository.STUDY_DEFINITION_FILE_NAME); copyTestStudyDefinitionFileIntoDirectory(studyDefinition); @@ -64,7 +64,7 @@ public void getActiveFetcherInstances() throws Exception { mock(ImporterPreferences.class, Answers.RETURNS_DEEP_STUBS)); List result = converter.getActiveFetchers(); - Assertions.assertEquals( + assertEquals( List.of("Springer", "ArXiv", "Medline/PubMed"), result.stream().map(SearchBasedFetcher::getName).collect(Collectors.toList()) ); diff --git a/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java b/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java index 5ca6c35200cb..c5ebf94d17be 100644 --- a/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java +++ b/src/test/java/org/jabref/logic/crawler/StudyRepositoryTest.java @@ -63,7 +63,7 @@ class StudyRepositoryTest { * Set up mocks */ @BeforeEach - public void setUpMocks() throws Exception { + void setUpMocks() throws Exception { libraryPreferences = mock(LibraryPreferences.class, Answers.RETURNS_DEEP_STUBS); saveConfiguration = mock(SaveConfiguration.class, Answers.RETURNS_DEEP_STUBS); importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); diff --git a/src/test/java/org/jabref/logic/crawler/StudyYamlParserTest.java b/src/test/java/org/jabref/logic/crawler/StudyYamlParserTest.java index db2fb4f45e0b..1b82eae5741d 100644 --- a/src/test/java/org/jabref/logic/crawler/StudyYamlParserTest.java +++ b/src/test/java/org/jabref/logic/crawler/StudyYamlParserTest.java @@ -38,20 +38,20 @@ void setupStudy() throws Exception { } @Test - public void parseStudyFileSuccessfully() throws Exception { + void parseStudyFileSuccessfully() throws Exception { Study study = new StudyYamlParser().parseStudyYamlFile(testDirectory.resolve(StudyRepository.STUDY_DEFINITION_FILE_NAME)); assertEquals(expectedStudy, study); } @Test - public void writeStudyFileSuccessfully() throws Exception { + void writeStudyFileSuccessfully() throws Exception { new StudyYamlParser().writeStudyYamlFile(expectedStudy, testDirectory.resolve(StudyRepository.STUDY_DEFINITION_FILE_NAME)); Study study = new StudyYamlParser().parseStudyYamlFile(testDirectory.resolve(StudyRepository.STUDY_DEFINITION_FILE_NAME)); assertEquals(expectedStudy, study); } @Test - public void readsJabRef57StudySuccessfully() throws Exception { + void readsJabRef57StudySuccessfully() throws Exception { // The field "last-search-date" was removed // If the field is "just" removed from the datamodel, one gets following exception: // com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "last-search-date" (class org.jabref.model.study.Study), not marked as ignorable (5 known properties: "authors", "research-questions", "queries", "title", "databases"]) diff --git a/src/test/java/org/jabref/logic/database/DuplicateCheckTest.java b/src/test/java/org/jabref/logic/database/DuplicateCheckTest.java index 8c644ab40f23..47f6c8a6104b 100644 --- a/src/test/java/org/jabref/logic/database/DuplicateCheckTest.java +++ b/src/test/java/org/jabref/logic/database/DuplicateCheckTest.java @@ -62,7 +62,7 @@ private static BibEntry getUnrelatedArticle() { } @BeforeEach - public void setUp() { + void setUp() { simpleArticle = getSimpleArticle(); unrelatedArticle = getUnrelatedArticle(); simpleInbook = getSimpleInbook(); @@ -71,7 +71,7 @@ public void setUp() { } @Test - public void testDuplicateDetectionWithSameAuthor() { + void testDuplicateDetectionWithSameAuthor() { BibEntry one = new BibEntry(StandardEntryType.Article).withField(StandardField.AUTHOR, "Billy Bob"); BibEntry two = new BibEntry(StandardEntryType.Article).withField(StandardField.AUTHOR, "Billy Bob"); @@ -79,7 +79,7 @@ public void testDuplicateDetectionWithSameAuthor() { } @Test - public void testDuplicateDetectionWithDifferentAuthors() { + void testDuplicateDetectionWithDifferentAuthors() { BibEntry one = new BibEntry(StandardEntryType.Article).withField(StandardField.AUTHOR, "Billy Bob"); BibEntry two = new BibEntry(StandardEntryType.Article).withField(StandardField.AUTHOR, "James Joyce"); @@ -87,7 +87,7 @@ public void testDuplicateDetectionWithDifferentAuthors() { } @Test - public void testDuplicateDetectionWithDifferentTypes() { + void testDuplicateDetectionWithDifferentTypes() { BibEntry one = new BibEntry(StandardEntryType.Article).withField(StandardField.AUTHOR, "Billy Bob"); BibEntry two = new BibEntry(StandardEntryType.Book).withField(StandardField.AUTHOR, "Billy Bob"); @@ -95,7 +95,7 @@ public void testDuplicateDetectionWithDifferentTypes() { } @Test - public void testDuplicateDetectionWithSameYearTitleJournal() { + void testDuplicateDetectionWithSameYearTitleJournal() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -113,7 +113,7 @@ public void testDuplicateDetectionWithSameYearTitleJournal() { } @Test - public void testDuplicateDetectionWithDifferentJournal() { + void testDuplicateDetectionWithDifferentJournal() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -131,7 +131,7 @@ public void testDuplicateDetectionWithDifferentJournal() { } @Test - public void testDuplicateDetectionWithDifferentVolume() { + void testDuplicateDetectionWithDifferentVolume() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -152,7 +152,7 @@ public void testDuplicateDetectionWithDifferentVolume() { } @Test - public void testDuplicateDetectionWithDifferentTitleSameVolume() { + void testDuplicateDetectionWithDifferentTitleSameVolume() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -173,7 +173,7 @@ public void testDuplicateDetectionWithDifferentTitleSameVolume() { } @Test - public void testDuplicateDetectionWithSamePages() { + void testDuplicateDetectionWithSamePages() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -196,7 +196,7 @@ public void testDuplicateDetectionWithSamePages() { } @Test - public void testDuplicateDetectionWithSamePagesOneEntryNoVolume() { + void testDuplicateDetectionWithSamePagesOneEntryNoVolume() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -218,7 +218,7 @@ public void testDuplicateDetectionWithSamePagesOneEntryNoVolume() { } @Test - public void testDuplicateDetectionDifferentVolumeNoJournal() { + void testDuplicateDetectionDifferentVolumeNoJournal() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -239,7 +239,7 @@ public void testDuplicateDetectionDifferentVolumeNoJournal() { } @Test - public void testDuplicateDetectionDifferentTitleNoJournal() { + void testDuplicateDetectionDifferentTitleNoJournal() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -260,7 +260,7 @@ public void testDuplicateDetectionDifferentTitleNoJournal() { } @Test - public void testDuplicateDetectionDifferentVolumeAllOthersEqual() { + void testDuplicateDetectionDifferentVolumeAllOthersEqual() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -283,7 +283,7 @@ public void testDuplicateDetectionDifferentVolumeAllOthersEqual() { } @Test - public void testDuplicateDetectionDifferentVolumeDifferentJournalAllOthersEqual() { + void testDuplicateDetectionDifferentVolumeDifferentJournalAllOthersEqual() { BibEntry one = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Billy Bob") .withField(StandardField.YEAR, "2005") @@ -306,7 +306,7 @@ public void testDuplicateDetectionDifferentVolumeDifferentJournalAllOthersEqual( } @Test - public void testWordCorrelation() { + void testWordCorrelation() { String d1 = "Characterization of Calanus finmarchicus habitat in the North Sea"; String d2 = "Characterization of Calunus finmarchicus habitat in the North Sea"; String d3 = "Characterization of Calanus glacialissss habitat in the South Sea"; @@ -317,12 +317,12 @@ public void testWordCorrelation() { } @Test - public void twoUnrelatedEntriesAreNoDuplicates() { + void twoUnrelatedEntriesAreNoDuplicates() { assertFalse(duplicateChecker.isDuplicate(simpleArticle, unrelatedArticle, BibDatabaseMode.BIBTEX)); } @Test - public void twoUnrelatedEntriesWithDifferentDoisAreNoDuplicates() { + void twoUnrelatedEntriesWithDifferentDoisAreNoDuplicates() { simpleArticle.setField(StandardField.DOI, "10.1016/j.is.2004.02.002"); unrelatedArticle.setField(StandardField.DOI, "10.1016/j.is.2004.02.00X"); @@ -330,7 +330,7 @@ public void twoUnrelatedEntriesWithDifferentDoisAreNoDuplicates() { } @Test - public void twoUnrelatedEntriesWithEqualDoisAreDuplicates() { + void twoUnrelatedEntriesWithEqualDoisAreDuplicates() { simpleArticle.setField(StandardField.DOI, "10.1016/j.is.2004.02.002"); unrelatedArticle.setField(StandardField.DOI, "10.1016/j.is.2004.02.002"); @@ -338,7 +338,7 @@ public void twoUnrelatedEntriesWithEqualDoisAreDuplicates() { } @Test - public void twoUnrelatedEntriesWithEqualPmidAreDuplicates() { + void twoUnrelatedEntriesWithEqualPmidAreDuplicates() { simpleArticle.setField(StandardField.PMID, "12345678"); unrelatedArticle.setField(StandardField.PMID, "12345678"); @@ -346,7 +346,7 @@ public void twoUnrelatedEntriesWithEqualPmidAreDuplicates() { } @Test - public void twoUnrelatedEntriesWithEqualEprintAreDuplicates() { + void twoUnrelatedEntriesWithEqualEprintAreDuplicates() { simpleArticle.setField(StandardField.EPRINT, "12345678"); unrelatedArticle.setField(StandardField.EPRINT, "12345678"); @@ -354,7 +354,7 @@ public void twoUnrelatedEntriesWithEqualEprintAreDuplicates() { } @Test - public void twoEntriesWithSameDoiButDifferentTypesAreDuplicates() { + void twoEntriesWithSameDoiButDifferentTypesAreDuplicates() { simpleArticle.setField(StandardField.DOI, "10.1016/j.is.2004.02.002"); BibEntry duplicateWithDifferentType = (BibEntry) simpleArticle.clone(); duplicateWithDifferentType.setType(StandardEntryType.InCollection); @@ -363,7 +363,7 @@ public void twoEntriesWithSameDoiButDifferentTypesAreDuplicates() { } @Test - public void twoEntriesWithDoiContainingUnderscoresAreNotEqual() { + void twoEntriesWithDoiContainingUnderscoresAreNotEqual() { simpleArticle.setField(StandardField.DOI, "10.1016/j.is.2004.02.002"); // An underscore in a DOI can indicate a totally different DOI unrelatedArticle.setField(StandardField.DOI, "10.1016/j.is.2004.02.0_02"); @@ -374,7 +374,7 @@ public void twoEntriesWithDoiContainingUnderscoresAreNotEqual() { } @Test - public void twoEntriesWithSameISBNButDifferentTypesAreDuplicates() { + void twoEntriesWithSameISBNButDifferentTypesAreDuplicates() { simpleArticle.setField(StandardField.ISBN, "0-123456-47-9"); unrelatedArticle.setField(StandardField.ISBN, "0-123456-47-9"); BibEntry duplicateWithDifferentType = unrelatedArticle; @@ -410,14 +410,14 @@ private void twoEntriesWithDifferentSpecificFieldsAreNotDuplicates(final BibEntr } @Test - public void inbookWithoutChapterCouldBeDuplicateOfInbookWithChapter() { + void inbookWithoutChapterCouldBeDuplicateOfInbookWithChapter() { final BibEntry inbook2 = ((BibEntry) simpleInbook.clone()).withField(StandardField.CHAPTER, ""); assertTrue(duplicateChecker.isDuplicate(simpleInbook, inbook2, BibDatabaseMode.BIBTEX)); } @Test - public void twoBooksWithDifferentEditionsAreNotDuplicates() { + void twoBooksWithDifferentEditionsAreNotDuplicates() { BibEntry editionOne = new BibEntry(StandardEntryType.Book) .withField(StandardField.TITLE, "Effective Java") .withField(StandardField.AUTHOR, "Bloch, Joshua") @@ -436,7 +436,7 @@ public void twoBooksWithDifferentEditionsAreNotDuplicates() { } @Test - public void sameBooksWithMissingEditionAreDuplicates() { + void sameBooksWithMissingEditionAreDuplicates() { BibEntry editionOne = new BibEntry(StandardEntryType.Book) .withField(StandardField.TITLE, "Effective Java") .withField(StandardField.AUTHOR, "Bloch, Joshua") @@ -453,7 +453,7 @@ public void sameBooksWithMissingEditionAreDuplicates() { } @Test - public void sameBooksWithPartiallyMissingEditionAreDuplicates() { + void sameBooksWithPartiallyMissingEditionAreDuplicates() { BibEntry editionOne = new BibEntry(StandardEntryType.Book) .withField(StandardField.TITLE, "Effective Java") .withField(StandardField.AUTHOR, "Bloch, Joshua") @@ -471,7 +471,7 @@ public void sameBooksWithPartiallyMissingEditionAreDuplicates() { } @Test - public void sameBooksWithDifferentEditionsAreNotDuplicates() { + void sameBooksWithDifferentEditionsAreNotDuplicates() { BibEntry editionTwo = new BibEntry(StandardEntryType.Book) .withCitationKey("Sutton17reinfLrnIntroBook") .withField(StandardField.TITLE, "Reinforcement learning:An introduction") diff --git a/src/test/java/org/jabref/logic/exporter/AtomicFileOutputStreamTest.java b/src/test/java/org/jabref/logic/exporter/AtomicFileOutputStreamTest.java index 80086d77db9c..af6058d17e95 100644 --- a/src/test/java/org/jabref/logic/exporter/AtomicFileOutputStreamTest.java +++ b/src/test/java/org/jabref/logic/exporter/AtomicFileOutputStreamTest.java @@ -24,7 +24,7 @@ class AtomicFileOutputStreamTest { private static final String FIVE_THOUSAND_CHARS = Strings.repeat("A", 5_000); @Test - public void normalSaveWorks(@TempDir Path tempDir) throws Exception { + void normalSaveWorks(@TempDir Path tempDir) throws Exception { Path out = tempDir.resolve("normal-save.txt"); Files.writeString(out, FIFTY_CHARS); @@ -38,7 +38,7 @@ public void normalSaveWorks(@TempDir Path tempDir) throws Exception { } @Test - public void originalContentExistsAtWriteError(@TempDir Path tempDir) throws Exception { + void originalContentExistsAtWriteError(@TempDir Path tempDir) throws Exception { Path pathToTestFile = tempDir.resolve("error-during-save.txt"); Files.writeString(pathToTestFile, FIFTY_CHARS); diff --git a/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java b/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java index be277db4e5be..a7c78b6624f5 100644 --- a/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java +++ b/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java @@ -65,7 +65,7 @@ /** * Tests for reading can be found at {@link org.jabref.logic.importer.fileformat.BibtexImporterTest} */ -public class BibtexDatabaseWriterTest { +class BibtexDatabaseWriterTest { private BibtexDatabaseWriter databaseWriter; private BibDatabase database; diff --git a/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java index 53342e7d7fa7..525ad4b676b4 100644 --- a/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java @@ -27,7 +27,7 @@ public class CsvExportFormatTest { private Exporter exportFormat; @BeforeEach - public void setUp() { + void setUp() { exportFormat = new TemplateExporter( "OpenOffice/LibreOffice CSV", "oocsv", @@ -41,12 +41,12 @@ public void setUp() { } @AfterEach - public void tearDown() { + void tearDown() { exportFormat = null; } @Test - public void testPerformExportForSingleAuthor(@TempDir Path testFolder) throws Exception { + void testPerformExportForSingleAuthor(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "Someone, Van Something"); @@ -62,7 +62,7 @@ public void testPerformExportForSingleAuthor(@TempDir Path testFolder) throws Ex } @Test - public void testPerformExportForMultipleAuthors(@TempDir Path testFolder) throws Exception { + void testPerformExportForMultipleAuthors(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "von Neumann, John and Smith, John and Black Brown, Peter"); @@ -78,7 +78,7 @@ public void testPerformExportForMultipleAuthors(@TempDir Path testFolder) throws } @Test - public void testPerformExportForSingleEditor(@TempDir Path testFolder) throws Exception { + void testPerformExportForSingleEditor(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); File tmpFile = path.toFile(); BibEntry entry = new BibEntry().withField(StandardField.EDITOR, "Someone, Van Something"); @@ -94,7 +94,7 @@ public void testPerformExportForSingleEditor(@TempDir Path testFolder) throws Ex } @Test - public void testPerformExportForMultipleEditors(@TempDir Path testFolder) throws Exception { + void testPerformExportForMultipleEditors(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); File tmpFile = path.toFile(); BibEntry entry = new BibEntry() diff --git a/src/test/java/org/jabref/logic/exporter/DocbookExporterTest.java b/src/test/java/org/jabref/logic/exporter/DocbookExporterTest.java index 23221d0311ab..2e92551224fe 100644 --- a/src/test/java/org/jabref/logic/exporter/DocbookExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/DocbookExporterTest.java @@ -30,7 +30,7 @@ public class DocbookExporterTest { private Exporter exportFormat; @BeforeEach - public void setUp() { + void setUp() { exportFormat = new TemplateExporter( "DocBook 4", "docbook4", @@ -42,7 +42,7 @@ public void setUp() { } @Test - public void testCorruptedTitleBraces(@TempDir Path testFolder) throws Exception { + void testCorruptedTitleBraces(@TempDir Path testFolder) throws Exception { Path tmpFile = testFolder.resolve("testBraces"); BibEntry entry = new BibEntry(); @@ -58,7 +58,7 @@ public void testCorruptedTitleBraces(@TempDir Path testFolder) throws Exception } @Test - public void testCorruptedTitleUnicode(@TempDir Path testFolder) throws Exception { + void testCorruptedTitleUnicode(@TempDir Path testFolder) throws Exception { Path tmpFile = testFolder.resolve("testBraces"); BibEntry entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/exporter/EmbeddedBibFilePdfExporterTest.java b/src/test/java/org/jabref/logic/exporter/EmbeddedBibFilePdfExporterTest.java index ef821bc66386..dbd2273d969b 100644 --- a/src/test/java/org/jabref/logic/exporter/EmbeddedBibFilePdfExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/EmbeddedBibFilePdfExporterTest.java @@ -190,7 +190,7 @@ private static LinkedFile createDefaultLinkedFile(String fileName, Path tempDir) @ParameterizedTest @MethodSource("providePathToNewPDFs") - public void testRoundtripExportImport(Path path) throws Exception { + void testRoundtripExportImport(Path path) throws Exception { BibEntry expected = new BibEntry(StandardEntryType.Misc) .withCitationKey("test") .withField(StandardField.AUTHOR, "Test Author") diff --git a/src/test/java/org/jabref/logic/exporter/ExporterTest.java b/src/test/java/org/jabref/logic/exporter/ExporterTest.java index b6e4c026e9b8..f5d683de53b9 100644 --- a/src/test/java/org/jabref/logic/exporter/ExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/ExporterTest.java @@ -33,7 +33,7 @@ public class ExporterTest { public List entries; @BeforeEach - public void setUp() { + void setUp() { databaseContext = new BibDatabaseContext(); entries = Collections.emptyList(); } @@ -56,7 +56,7 @@ private static Stream exportFormats() { @ParameterizedTest @MethodSource("exportFormats") - public void testExportingEmptyDatabaseYieldsEmptyFile(Exporter exportFormat, String name, @TempDir Path testFolder) throws Exception { + void testExportingEmptyDatabaseYieldsEmptyFile(Exporter exportFormat, String name, @TempDir Path testFolder) throws Exception { Path tmpFile = testFolder.resolve("ARandomlyNamedFile"); Files.createFile(tmpFile); exportFormat.export(databaseContext, tmpFile, entries); @@ -65,7 +65,7 @@ public void testExportingEmptyDatabaseYieldsEmptyFile(Exporter exportFormat, Str @ParameterizedTest @MethodSource("exportFormats") - public void testExportingNullDatabaseThrowsNPE(Exporter exportFormat, String name, @TempDir Path testFolder) { + void testExportingNullDatabaseThrowsNPE(Exporter exportFormat, String name, @TempDir Path testFolder) { assertThrows(NullPointerException.class, () -> { Path tmpFile = testFolder.resolve("ARandomlyNamedFile"); Files.createFile(tmpFile); diff --git a/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java b/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java index 0b6356906e96..7244d96a326a 100644 --- a/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java @@ -21,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class HayagrivaYamlExporterTest { +class HayagrivaYamlExporterTest { private static Exporter hayagrivaYamlExporter; private static BibDatabaseContext databaseContext; @@ -42,7 +42,7 @@ static void setUp() { } @Test - public final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws Exception { + final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws Exception { Path file = tempFile.resolve("ThisIsARandomlyNamedFile"); Files.createFile(file); hayagrivaYamlExporter.export(databaseContext, tempFile, Collections.emptyList()); @@ -50,7 +50,7 @@ public final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws } @Test - public final void exportsCorrectContent(@TempDir Path tempFile) throws Exception { + final void exportsCorrectContent(@TempDir Path tempFile) throws Exception { BibEntry entry = new BibEntry(StandardEntryType.Article) .withCitationKey("test") .withField(StandardField.AUTHOR, "Test Author") @@ -77,7 +77,7 @@ public final void exportsCorrectContent(@TempDir Path tempFile) throws Exception } @Test - public final void exportsCorrectMultipleAuthors(@TempDir Path tempFile) throws Exception { + final void exportsCorrectMultipleAuthors(@TempDir Path tempFile) throws Exception { BibEntry entry = new BibEntry(StandardEntryType.Article) .withCitationKey("test") .withField(StandardField.AUTHOR, "Test Author and Other One") @@ -105,7 +105,7 @@ public final void exportsCorrectMultipleAuthors(@TempDir Path tempFile) throws E } @Test - public final void formatsContentCorrect(@TempDir Path tempFile) throws Exception { + final void formatsContentCorrect(@TempDir Path tempFile) throws Exception { BibEntry entry = new BibEntry(StandardEntryType.Misc) .withCitationKey("test") .withField(StandardField.AUTHOR, "Test Author") @@ -185,7 +185,7 @@ void passesModifiedCharsetNull(@TempDir Path tempFile) throws Exception { } @Test - public final void exportsCorrectParentField(@TempDir Path tempFile) throws Exception { + final void exportsCorrectParentField(@TempDir Path tempFile) throws Exception { BibEntry entry = new BibEntry(StandardEntryType.Article) .withCitationKey("test") .withField(StandardField.AUTHOR, "Test Author") diff --git a/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java index b684e84a2e48..677934ae83fa 100644 --- a/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java @@ -29,7 +29,7 @@ public class HtmlExportFormatTest { private Exporter exportFormat; @BeforeEach - public void setUp() { + void setUp() { exportFormat = new TemplateExporter("HTML", "html", "html", @@ -48,12 +48,12 @@ public void setUp() { } @AfterEach - public void tearDown() { + void tearDown() { exportFormat = null; } @Test - public void emitWellFormedHtml(@TempDir Path testFolder) throws Exception { + void emitWellFormedHtml(@TempDir Path testFolder) throws Exception { Path path = testFolder.resolve("ThisIsARandomlyNamedFile"); exportFormat.export(databaseContext, path, entries); List lines = Files.readAllLines(path); diff --git a/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java b/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java index ebff3f7815ea..1b8efbe00697 100644 --- a/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java +++ b/src/test/java/org/jabref/logic/exporter/MetaDataSerializerTest.java @@ -42,7 +42,7 @@ public class MetaDataSerializerTest { private BibEntryType newCustomType; @BeforeEach - public void setUp() { + void setUp() { metaData = new MetaData(); pattern = GlobalCitationKeyPattern.fromPattern("[auth][year]"); newCustomType = new BibEntryType( @@ -52,12 +52,12 @@ public void setUp() { } @Test - public void serializeNewMetadataReturnsEmptyMap() { + void serializeNewMetadataReturnsEmptyMap() { assertEquals(Collections.emptyMap(), MetaDataSerializer.getSerializedStringMap(metaData, pattern)); } @Test - public void serializeSingleSaveAction() { + void serializeSingleSaveAction() { FieldFormatterCleanups saveActions = new FieldFormatterCleanups(true, Collections.singletonList(new FieldFormatterCleanup(StandardField.TITLE, new LowerCaseFormatter()))); metaData.setSaveActions(saveActions); @@ -69,7 +69,7 @@ public void serializeSingleSaveAction() { } @Test - public void serializeSingleContentSelectors() { + void serializeSingleContentSelectors() { List values = List.of( "approved", "captured", diff --git a/src/test/java/org/jabref/logic/exporter/ModsExportFormatFilesTest.java b/src/test/java/org/jabref/logic/exporter/ModsExportFormatFilesTest.java index 7fe416c513d7..6e0aceccf6d0 100644 --- a/src/test/java/org/jabref/logic/exporter/ModsExportFormatFilesTest.java +++ b/src/test/java/org/jabref/logic/exporter/ModsExportFormatFilesTest.java @@ -52,7 +52,7 @@ public static Stream fileNames() throws Exception { } @BeforeEach - public void setUp(@TempDir Path testFolder) throws Exception { + void setUp(@TempDir Path testFolder) throws Exception { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); when(importFormatPreferences.bibEntryPreferences()).thenReturn(mock(BibEntryPreferences.class)); when(importFormatPreferences.bibEntryPreferences().getKeywordSeparator()).thenReturn(','); @@ -70,7 +70,7 @@ public void setUp(@TempDir Path testFolder) throws Exception { @ParameterizedTest @MethodSource("fileNames") - public final void testPerformExport(String filename) throws Exception { + final void testPerformExport(String filename) throws Exception { importFile = Path.of(ModsExportFormatFilesTest.class.getResource(filename).toURI()); String xmlFileName = filename.replace(".bib", ".xml"); List entries = bibtexImporter.importDatabase(importFile).getDatabase().getEntries(); @@ -85,7 +85,7 @@ public final void testPerformExport(String filename) throws Exception { @ParameterizedTest @MethodSource("fileNames") - public final void testExportAsModsAndThenImportAsMods(String filename) throws Exception { + final void testExportAsModsAndThenImportAsMods(String filename) throws Exception { importFile = Path.of(ModsExportFormatFilesTest.class.getResource(filename).toURI()); List entries = bibtexImporter.importDatabase(importFile).getDatabase().getEntries(); @@ -95,7 +95,7 @@ public final void testExportAsModsAndThenImportAsMods(String filename) throws Ex @ParameterizedTest @MethodSource("fileNames") - public final void testImportAsModsAndExportAsMods(String filename) throws Exception { + final void testImportAsModsAndExportAsMods(String filename) throws Exception { importFile = Path.of(ModsExportFormatFilesTest.class.getResource(filename).toURI()); String xmlFileName = filename.replace(".bib", ".xml"); Path xmlFile = Path.of(ModsExportFormatFilesTest.class.getResource(xmlFileName).toURI()); diff --git a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java index cf98c1764aff..c08f76582c4e 100644 --- a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTest.java @@ -17,13 +17,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class ModsExportFormatTest { +class ModsExportFormatTest { private ModsExporter modsExportFormat; private BibDatabaseContext databaseContext; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { databaseContext = new BibDatabaseContext(); modsExportFormat = new ModsExporter(); new BibtexImporter(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS), new DummyFileUpdateMonitor()); @@ -31,7 +31,7 @@ public void setUp() throws Exception { } @Test - public final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws Exception { + final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws Exception { Path file = tempFile.resolve("ThisIsARandomlyNamedFile"); Files.createFile(file); modsExportFormat.export(databaseContext, tempFile, Collections.emptyList()); diff --git a/src/test/java/org/jabref/logic/exporter/MsBibExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/MsBibExportFormatTest.java index 7be464fc9a69..fd714a05ffbe 100644 --- a/src/test/java/org/jabref/logic/exporter/MsBibExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/MsBibExportFormatTest.java @@ -21,13 +21,13 @@ public class MsBibExportFormatTest { public MSBibExporter msBibExportFormat; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { databaseContext = new BibDatabaseContext(); msBibExportFormat = new MSBibExporter(); } @Test - public final void testPerformExportWithNoEntry(@TempDir Path tempFile) throws IOException, SaveException { + final void testPerformExportWithNoEntry(@TempDir Path tempFile) throws IOException, SaveException { Path path = tempFile.resolve("ThisIsARandomlyNamedFile"); Files.createFile(path); List entries = Collections.emptyList(); diff --git a/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java b/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java index 05266a60aac1..64eae6945a7b 100644 --- a/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java @@ -21,19 +21,19 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class XmpExporterTest { +class XmpExporterTest { private Exporter exporter; private final BibDatabaseContext databaseContext = new BibDatabaseContext(); private final XmpPreferences xmpPreferences = mock(XmpPreferences.class); @BeforeEach - public void setUp() { + void setUp() { exporter = new XmpExporter(xmpPreferences); } @Test - public void exportSingleEntry(@TempDir Path testFolder) throws Exception { + void exportSingleEntry(@TempDir Path testFolder) throws Exception { Path file = testFolder.resolve("ThisIsARandomlyNamedFile"); Files.createFile(file); @@ -63,7 +63,7 @@ public void exportSingleEntry(@TempDir Path testFolder) throws Exception { } @Test - public void writeMultipleEntriesInASingleFile(@TempDir Path testFolder) throws Exception { + void writeMultipleEntriesInASingleFile(@TempDir Path testFolder) throws Exception { Path file = testFolder.resolve("ThisIsARandomlyNamedFile"); Files.createFile(file); @@ -117,7 +117,7 @@ public void writeMultipleEntriesInASingleFile(@TempDir Path testFolder) throws E } @Test - public void writeMultipleEntriesInDifferentFiles(@TempDir Path testFolder) throws Exception { + void writeMultipleEntriesInDifferentFiles(@TempDir Path testFolder) throws Exception { // set path to the one where the exporter produces several files Path file = testFolder.resolve(XmpExporter.XMP_SPLIT_DIRECTORY_INDICATOR); Files.createFile(file); @@ -187,7 +187,7 @@ public void writeMultipleEntriesInDifferentFiles(@TempDir Path testFolder) throw } @Test - public void exportSingleEntryWithPrivacyFilter(@TempDir Path testFolder) throws Exception { + void exportSingleEntryWithPrivacyFilter(@TempDir Path testFolder) throws Exception { when(xmpPreferences.getXmpPrivacyFilter()).thenReturn(FXCollections.observableSet(Collections.singleton(StandardField.AUTHOR))); when(xmpPreferences.shouldUseXmpPrivacyFilter()).thenReturn(true); diff --git a/src/test/java/org/jabref/logic/exporter/XmpPdfExporterTest.java b/src/test/java/org/jabref/logic/exporter/XmpPdfExporterTest.java index afa5b3dad603..d195d6a66db3 100644 --- a/src/test/java/org/jabref/logic/exporter/XmpPdfExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/XmpPdfExporterTest.java @@ -174,7 +174,7 @@ void unsuccessfulExportToFileByPath(Path path) throws Exception { @ParameterizedTest @MethodSource("providePathToNewPDFs") - public void testRoundtripExportImport(Path path) throws Exception { + void testRoundtripExportImport(Path path) throws Exception { try (PDDocument document = new PDDocument()) { PDPage page = new PDPage(); document.addPage(page); diff --git a/src/test/java/org/jabref/logic/exporter/YamlExporterTest.java b/src/test/java/org/jabref/logic/exporter/YamlExporterTest.java index db42e79dbbc6..88de5983f995 100644 --- a/src/test/java/org/jabref/logic/exporter/YamlExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/YamlExporterTest.java @@ -21,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class YamlExporterTest { +class YamlExporterTest { private static Exporter yamlExporter; private static BibDatabaseContext databaseContext; @@ -42,7 +42,7 @@ static void setUp() { } @Test - public final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws Exception { + final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws Exception { Path file = tempFile.resolve("ThisIsARandomlyNamedFile"); Files.createFile(file); yamlExporter.export(databaseContext, tempFile, Collections.emptyList()); @@ -50,7 +50,7 @@ public final void exportForNoEntriesWritesNothing(@TempDir Path tempFile) throws } @Test - public final void exportsCorrectContent(@TempDir Path tempFile) throws Exception { + final void exportsCorrectContent(@TempDir Path tempFile) throws Exception { BibEntry entry = new BibEntry(StandardEntryType.Article) .withCitationKey("test") .withField(StandardField.AUTHOR, "Test Author") @@ -78,7 +78,7 @@ public final void exportsCorrectContent(@TempDir Path tempFile) throws Exception } @Test - public final void formatsContentCorrect(@TempDir Path tempFile) throws Exception { + final void formatsContentCorrect(@TempDir Path tempFile) throws Exception { BibEntry entry = new BibEntry(StandardEntryType.Misc) .withCitationKey("test") .withField(StandardField.AUTHOR, "Test Author") diff --git a/src/test/java/org/jabref/logic/formatter/FormatterTest.java b/src/test/java/org/jabref/logic/formatter/FormatterTest.java index d93606c7a1fa..d0d516941f11 100644 --- a/src/test/java/org/jabref/logic/formatter/FormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/FormatterTest.java @@ -38,7 +38,7 @@ static void setUp() { * method is not adapted. This results in duplicate keys, which this test tests for. */ @Test - public void allFormatterKeysAreUnique() { + void allFormatterKeysAreUnique() { // idea for uniqueness checking by https://stackoverflow.com/a/44032568/873282 assertEquals(Collections.emptyList(), getFormatters().collect(Collectors.groupingBy( diff --git a/src/test/java/org/jabref/logic/formatter/IdentityFormatterTest.java b/src/test/java/org/jabref/logic/formatter/IdentityFormatterTest.java index 8fb9eadf9596..3a702a2ca7b3 100644 --- a/src/test/java/org/jabref/logic/formatter/IdentityFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/IdentityFormatterTest.java @@ -8,17 +8,17 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class IdentityFormatterTest { +class IdentityFormatterTest { private IdentityFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new IdentityFormatter(); } @Test - public void formatExample() { + void formatExample() { assertEquals("JabRef", formatter.format(formatter.getExampleInput())); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatterTest.java index e2003e250343..9511fbeeb02c 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatterTest.java @@ -13,68 +13,68 @@ class AddBracesFormatterTest { private AddBracesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new AddBracesFormatter(); } @Test - public void formatAddsSingleEnclosingBraces() { + void formatAddsSingleEnclosingBraces() { assertEquals("{test}", formatter.format("test")); } @Test - public void formatKeepsUnmatchedBracesAtBeginning() { + void formatKeepsUnmatchedBracesAtBeginning() { assertEquals("{test", formatter.format("{test")); } @Test - public void formatKeepsUnmatchedBracesAtEnd() { + void formatKeepsUnmatchedBracesAtEnd() { assertEquals("test}", formatter.format("test}")); } @Test - public void formatKeepsShortString() { + void formatKeepsShortString() { assertEquals("t", formatter.format("t")); } @Test - public void formatKeepsEmptyString() { + void formatKeepsEmptyString() { assertEquals("", formatter.format("")); } @Test - public void formatKeepsDoubleEnclosingBraces() { + void formatKeepsDoubleEnclosingBraces() { assertEquals("{{test}}", formatter.format("{{test}}")); } @Test - public void formatKeepsTripleEnclosingBraces() { + void formatKeepsTripleEnclosingBraces() { assertEquals("{{{test}}}", formatter.format("{{{test}}}")); } @Test - public void formatKeepsNonMatchingBraces() { + void formatKeepsNonMatchingBraces() { assertEquals("{A} and {B}", formatter.format("{A} and {B}")); } @Test - public void formatKeepsOnlyMatchingBraces() { + void formatKeepsOnlyMatchingBraces() { assertEquals("{{A} and {B}}", formatter.format("{{A} and {B}}")); } @Test - public void formatDoesNotRemoveBracesInBrokenString() { + void formatDoesNotRemoveBracesInBrokenString() { // We opt here for a conservative approach although one could argue that "A} and {B}" is also a valid return assertEquals("{A} and {B}}", formatter.format("{A} and {B}}")); } @Test - public void formatExample() { + void formatExample() { assertEquals("{In CDMA}", formatter.format(formatter.getExampleInput())); } @Test - public void formatStringWithMinimalRequiredLength() { + void formatStringWithMinimalRequiredLength() { assertEquals("{AB}", formatter.format("AB")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/ClearFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/ClearFormatterTest.java index e1c759ac635d..a83f67d5a195 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/ClearFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/ClearFormatterTest.java @@ -8,12 +8,12 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class ClearFormatterTest { +class ClearFormatterTest { private ClearFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new ClearFormatter(); } @@ -21,7 +21,7 @@ public void setUp() { * Check whether the clear formatter really returns the empty string for the empty string */ @Test - public void formatReturnsEmptyForEmptyString() throws Exception { + void formatReturnsEmptyForEmptyString() throws Exception { assertEquals("", formatter.format("")); } @@ -29,12 +29,12 @@ public void formatReturnsEmptyForEmptyString() throws Exception { * Check whether the clear formatter really returns the empty string for some string */ @Test - public void formatReturnsEmptyForSomeString() throws Exception { + void formatReturnsEmptyForSomeString() throws Exception { assertEquals("", formatter.format("test")); } @Test - public void formatExample() { + void formatExample() { assertEquals("", formatter.format(formatter.getExampleInput())); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatterTest.java index 3ecd073a9173..77e4e96594d2 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToLatexFormatterTest.java @@ -8,37 +8,37 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class HtmlToLatexFormatterTest { +class HtmlToLatexFormatterTest { private HtmlToLatexFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new HtmlToLatexFormatter(); } @Test - public void formatWithoutHtmlCharactersReturnsSameString() { + void formatWithoutHtmlCharactersReturnsSameString() { assertEquals("abc", formatter.format("abc")); } @Test - public void formatMultipleHtmlCharacters() { + void formatMultipleHtmlCharacters() { assertEquals("{{\\aa}}{\\\"{a}}{\\\"{o}}", formatter.format("åäö")); } @Test - public void formatCombinedAccent() { + void formatCombinedAccent() { assertEquals("{\\'{\\i}}", formatter.format("í")); } @Test - public void testBasic() { + void testBasic() { assertEquals("aaa", formatter.format("aaa")); } @Test - public void testHTML() { + void testHTML() { assertEquals("{\\\"{a}}", formatter.format("ä")); assertEquals("{\\\"{a}}", formatter.format("ä")); assertEquals("{\\\"{a}}", formatter.format("ä")); @@ -46,12 +46,12 @@ public void testHTML() { } @Test - public void testHTMLRemoveTags() { + void testHTMLRemoveTags() { assertEquals("aaa", formatter.format("aaa")); } @Test - public void testHTMLCombiningAccents() { + void testHTMLCombiningAccents() { assertEquals("{\\\"{a}}", formatter.format("ä")); assertEquals("{\\\"{a}}", formatter.format("ä")); assertEquals("{\\\"{a}}b", formatter.format("äb")); @@ -59,13 +59,13 @@ public void testHTMLCombiningAccents() { } @Test - public void keepsSingleLessThan() { + void keepsSingleLessThan() { String text = "(p < 0.01)"; assertEquals(text, formatter.format(text)); } @Test - public void formatExample() { + void formatExample() { assertEquals("JabRef", formatter.format(formatter.getExampleInput())); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatterTest.java index 64f14737bb9a..db724bf28feb 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatterTest.java @@ -9,7 +9,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class HtmlToUnicodeFormatterTest { +class HtmlToUnicodeFormatterTest { private HtmlToUnicodeFormatter formatter; @@ -28,7 +28,7 @@ private static Stream data() { } @BeforeEach - public void setUp() { + void setUp() { formatter = new HtmlToUnicodeFormatter(); } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatterTest.java index 92ddc83ebf37..858dac6691fd 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeDateFormatterTest.java @@ -8,132 +8,132 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class NormalizeDateFormatterTest { +class NormalizeDateFormatterTest { private NormalizeDateFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new NormalizeDateFormatter(); } @Test - public void formatDateYYYYMM0D() { + void formatDateYYYYMM0D() { assertEquals("2015-11-08", formatter.format("2015-11-08")); } @Test - public void formatDateYYYYM0D() { + void formatDateYYYYM0D() { assertEquals("2015-01-08", formatter.format("2015-1-08")); } @Test - public void formatDateYYYYMD() { + void formatDateYYYYMD() { assertEquals("2015-01-08", formatter.format("2015-1-8")); } @Test - public void formatDateYYYYMM() { + void formatDateYYYYMM() { assertEquals("2015-11", formatter.format("2015-11")); } @Test - public void formatDateYYYYM() { + void formatDateYYYYM() { assertEquals("2015-01", formatter.format("2015-1")); } @Test - public void formatDateMMYY() { + void formatDateMMYY() { assertEquals("2015-11", formatter.format("11/15")); } @Test - public void formatDateMYY() { + void formatDateMYY() { assertEquals("2015-01", formatter.format("1/15")); } @Test - public void formatDate0MYY() { + void formatDate0MYY() { assertEquals("2015-01", formatter.format("01/15")); } @Test - public void formatDateMMYYYY() { + void formatDateMMYYYY() { assertEquals("2015-11", formatter.format("11/2015")); } @Test - public void formatDateMYYYY() { + void formatDateMYYYY() { assertEquals("2015-01", formatter.format("1/2015")); } @Test - public void formatDate0MYYYY() { + void formatDate0MYYYY() { assertEquals("2015-01", formatter.format("01/2015")); } @Test - public void formatDateMMMDDCommaYYYY() { + void formatDateMMMDDCommaYYYY() { assertEquals("2015-11-08", formatter.format("November 08, 2015")); } @Test - public void formatDateMMMDCommaYYYY() { + void formatDateMMMDCommaYYYY() { assertEquals("2015-11-08", formatter.format("November 8, 2015")); } @Test - public void formatDateMMMCommaYYYY() { + void formatDateMMMCommaYYYY() { assertEquals("2015-11", formatter.format("November, 2015")); } @Test - public void formatDate0DdotMMdotYYYY() { + void formatDate0DdotMMdotYYYY() { assertEquals("2015-11-08", formatter.format("08.11.2015")); } @Test - public void formatDateDdotMMdotYYYY() { + void formatDateDdotMMdotYYYY() { assertEquals("2015-11-08", formatter.format("8.11.2015")); } @Test - public void formatDateDDdotMMdotYYYY() { + void formatDateDDdotMMdotYYYY() { assertEquals("2015-11-15", formatter.format("15.11.2015")); } @Test - public void formatDate0Ddot0MdotYYYY() { + void formatDate0Ddot0MdotYYYY() { assertEquals("2015-01-08", formatter.format("08.01.2015")); } @Test - public void formatDateDdot0MdotYYYY() { + void formatDateDdot0MdotYYYY() { assertEquals("2015-01-08", formatter.format("8.01.2015")); } @Test - public void formatDateDDdot0MdotYYYY() { + void formatDateDDdot0MdotYYYY() { assertEquals("2015-01-15", formatter.format("15.01.2015")); } @Test - public void formatDate0DdotMdotYYYY() { + void formatDate0DdotMdotYYYY() { assertEquals("2015-01-08", formatter.format("08.1.2015")); } @Test - public void formatDateDdotMdotYYYY() { + void formatDateDdotMdotYYYY() { assertEquals("2015-01-08", formatter.format("8.1.2015")); } @Test - public void formatDateDDdotMdotYYYY() { + void formatDateDDdotMdotYYYY() { assertEquals("2015-01-15", formatter.format("15.1.2015")); } @Test - public void formatExample() { + void formatExample() { assertEquals("2003-11-29", formatter.format(formatter.getExampleInput())); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatterTest.java index ace49c023987..810e6acfc5a4 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeEnDashesFormatterTest.java @@ -8,47 +8,47 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class NormalizeEnDashesFormatterTest { +class NormalizeEnDashesFormatterTest { private NormalizeEnDashesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new NormalizeEnDashesFormatter(); } @Test - public void formatExample() { + void formatExample() { assertEquals("Winery -- A Modeling Tool for TOSCA-based Cloud Applications", formatter.format(formatter.getExampleInput())); } @Test - public void formatExampleOfChangelog() { + void formatExampleOfChangelog() { assertEquals("Example -- illustrative", formatter.format("Example - illustrative")); } @Test - public void dashesWithinWordsAreKept() { + void dashesWithinWordsAreKept() { assertEquals("Example-illustrative", formatter.format("Example-illustrative")); } @Test - public void dashesPreceededByASpaceAreKept() { + void dashesPreceededByASpaceAreKept() { assertEquals("Example -illustrative", formatter.format("Example -illustrative")); } @Test - public void dashesFollowedByASpaceAreKept() { + void dashesFollowedByASpaceAreKept() { assertEquals("Example- illustrative", formatter.format("Example- illustrative")); } @Test - public void dashAtTheBeginningIsKept() { + void dashAtTheBeginningIsKept() { assertEquals("- illustrative", formatter.format("- illustrative")); } @Test - public void dashAtTheEndIsKept() { + void dashAtTheEndIsKept() { assertEquals("Example-", formatter.format("Example-")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatterTest.java index 32d196bcc2ad..4c110af58aca 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatterTest.java @@ -8,22 +8,22 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class NormalizeMonthFormatterTest { +class NormalizeMonthFormatterTest { private NormalizeMonthFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new NormalizeMonthFormatter(); } @Test - public void formatExample() { + void formatExample() { assertEquals("#dec#", formatter.format(formatter.getExampleInput())); } @Test - public void plainAprilShouldBeApril() { + void plainAprilShouldBeApril() { assertEquals("#apr#", formatter.format("#apr#")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatterTest.java index c2f74c4d5607..d4c74a70872f 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeNamesFormatterTest.java @@ -8,17 +8,17 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class NormalizeNamesFormatterTest { +class NormalizeNamesFormatterTest { private NormalizeNamesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new NormalizeNamesFormatter(); } @Test - public void testNormalizeAuthorList() { + void testNormalizeAuthorList() { assertEquals("Bilbo, Staci D.", formatter.format("Staci D Bilbo")); assertEquals("Bilbo, Staci D.", formatter.format("Staci D. Bilbo")); @@ -40,141 +40,141 @@ public void testNormalizeAuthorList() { } @Test - public void twoAuthorsSeperatedByColon() { + void twoAuthorsSeperatedByColon() { assertEquals("Bilbo, Staci and Alver, Morten", formatter.format("Staci Bilbo; Morten Alver")); } @Test - public void threeAuthorsSeperatedByColon() { + void threeAuthorsSeperatedByColon() { assertEquals("Bilbo, Staci and Alver, Morten and Name, Test", formatter.format("Staci Bilbo; Morten Alver; Test Name")); } // Test for https://github.com/JabRef/jabref/issues/318 @Test - public void threeAuthorsSeperatedByAnd() { + void threeAuthorsSeperatedByAnd() { assertEquals("Kolb, Stefan and Lenhard, J{\\\"o}rg and Wirtz, Guido", formatter.format("Stefan Kolb and J{\\\"o}rg Lenhard and Guido Wirtz")); } // Test for https://github.com/JabRef/jabref/issues/318 @Test - public void threeAuthorsSeperatedByAndWithDash() { + void threeAuthorsSeperatedByAndWithDash() { assertEquals("Jian, Heng-Yu and Xu, Z. and Chang, M.-C. F.", formatter.format("Heng-Yu Jian and Xu, Z. and Chang, M.-C.F.")); } // Test for https://github.com/JabRef/jabref/issues/318 @Test - public void threeAuthorsSeperatedByAndWithLatex() { + void threeAuthorsSeperatedByAndWithLatex() { assertEquals("Gustafsson, Oscar and DeBrunner, Linda S. and DeBrunner, Victor and Johansson, H{\\aa}kan", formatter.format("Oscar Gustafsson and Linda S. DeBrunner and Victor DeBrunner and H{\\aa}kan Johansson")); } @Test - public void lastThenInitial() { + void lastThenInitial() { assertEquals("Smith, S.", formatter.format("Smith S")); } @Test - public void lastThenInitials() { + void lastThenInitials() { assertEquals("Smith, S. H.", formatter.format("Smith SH")); } @Test - public void initialThenLast() { + void initialThenLast() { assertEquals("Smith, S.", formatter.format("S Smith")); } @Test - public void initialDotThenLast() { + void initialDotThenLast() { assertEquals("Smith, S.", formatter.format("S. Smith")); } @Test - public void initialsThenLast() { + void initialsThenLast() { assertEquals("Smith, S. H.", formatter.format("SH Smith")); } @Test - public void lastThenJuniorThenFirst() { + void lastThenJuniorThenFirst() { assertEquals("Name, della, first", formatter.format("Name, della, first")); } @Test - public void testConcatenationOfAuthorsWithCommas() { + void testConcatenationOfAuthorsWithCommas() { assertEquals("Ali Babar, M. and Dingsøyr, T. and Lago, P. and van der Vliet, H.", formatter.format("Ali Babar, M., Dingsøyr, T., Lago, P., van der Vliet, H.")); assertEquals("Ali Babar, M.", formatter.format("Ali Babar, M.")); } @Test - public void testOddCountOfCommas() { + void testOddCountOfCommas() { assertEquals("Ali Babar, M., Dingsøyr T. Lago P.", formatter.format("Ali Babar, M., Dingsøyr, T., Lago P.")); } @Test - public void formatExample() { + void formatExample() { assertEquals("Einstein, Albert and Turing, Alan", formatter.format(formatter.getExampleInput())); } @Test - public void testNameAffixe() { + void testNameAffixe() { assertEquals("Surname, jr, First and Surname2, First2", formatter.format("Surname, jr, First, Surname2, First2")); } @Test - public void testAvoidSpecialCharacter() { + void testAvoidSpecialCharacter() { assertEquals("Surname, {, First; Surname2, First2", formatter.format("Surname, {, First; Surname2, First2")); } @Test - public void testAndInName() { + void testAndInName() { assertEquals("Surname and , First, Surname2 First2", formatter.format("Surname, and , First, Surname2, First2")); } @Test - public void testMultipleNameAffixes() { + void testMultipleNameAffixes() { assertEquals("Mair, Jr, Daniel and Brühl, Sr, Daniel", formatter.format("Mair, Jr, Daniel, Brühl, Sr, Daniel")); } @Test - public void testCommaSeperatedNames() { + void testCommaSeperatedNames() { assertEquals("Bosoi, Cristina and Oliveira, Mariana and Sanchez, Rafael Ochoa and Tremblay, Mélanie and TenHave, Gabrie and Deutz, Nicoolas and Rose, Christopher F. and Bemeur, Chantal", formatter.format("Cristina Bosoi, Mariana Oliveira, Rafael Ochoa Sanchez, Mélanie Tremblay, Gabrie TenHave, Nicoolas Deutz, Christopher F. Rose, Chantal Bemeur")); } @Test - public void testMultipleSpaces() { + void testMultipleSpaces() { assertEquals("Bosoi, Cristina and Oliveira, Mariana and Sanchez, Rafael Ochoa and Tremblay, Mélanie and TenHave, Gabrie and Deutz, Nicoolas and Rose, Christopher F. and Bemeur, Chantal", formatter.format("Cristina Bosoi, Mariana Oliveira, Rafael Ochoa Sanchez , Mélanie Tremblay , Gabrie TenHave, Nicoolas Deutz, Christopher F. Rose, Chantal Bemeur")); } @Test - public void testAvoidPreposition() { + void testAvoidPreposition() { assertEquals("von Zimmer, Hans and van Oberbergern, Michael and zu Berger, Kevin", formatter.format("Hans von Zimmer, Michael van Oberbergern, Kevin zu Berger")); } @Test - public void testPreposition() { + void testPreposition() { assertEquals("von Zimmer, Hans and van Oberbergern, Michael and zu Berger, Kevin", formatter.format("Hans von Zimmer, Michael van Oberbergern, Kevin zu Berger")); } @Test - public void testOneCommaUntouched() { + void testOneCommaUntouched() { assertEquals("Canon der Barbar, Alexander der Große", formatter.format("Canon der Barbar, Alexander der Große")); } @Test - public void testAvoidNameAffixes() { + void testAvoidNameAffixes() { assertEquals("der Barbar, Canon and der Große, Alexander and der Alexander, Peter", formatter.format("Canon der Barbar, Alexander der Große, Peter der Alexander")); } @Test - public void testUpperCaseSensitiveList() { + void testUpperCaseSensitiveList() { assertEquals("der Barbar, Canon and der Große, Alexander", formatter.format("Canon der Barbar AND Alexander der Große")); assertEquals("der Barbar, Canon and der Große, Alexander", formatter.format("Canon der Barbar aNd Alexander der Große")); assertEquals("der Barbar, Canon and der Große, Alexander", formatter.format("Canon der Barbar AnD Alexander der Große")); } @Test - public void testSemiCorrectNamesWithSemicolon() { + void testSemiCorrectNamesWithSemicolon() { assertEquals("Last, First and Last2, First2 and Last3, First3", formatter.format("Last, First; Last2, First2; Last3, First3")); assertEquals("Last, Jr, First and Last2, First2", formatter.format("Last, Jr, First; Last2, First2")); assertEquals("Last, First and Last2, First2 and Last3, First3 and Last4, First4", formatter.format("Last, First; Last2, First2; Last3, First3; First4 Last4")); diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatterTest.java index e789d2002ecb..e37409e45942 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatterTest.java @@ -12,12 +12,12 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class NormalizePagesFormatterTest { +class NormalizePagesFormatterTest { private NormalizePagesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new NormalizePagesFormatter(); } @@ -108,7 +108,7 @@ private static Stream tests() { @ParameterizedTest @MethodSource("tests") - public void test(String expected, String input) { + void test(String expected, String input) { assertEquals(expected, formatter.format(input)); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatterTest.java index 6fffcf6ee307..a573cf4545c0 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/OrdinalsToSuperscriptFormatterTest.java @@ -8,17 +8,17 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class OrdinalsToSuperscriptFormatterTest { +class OrdinalsToSuperscriptFormatterTest { private OrdinalsToSuperscriptFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new OrdinalsToSuperscriptFormatter(); } @Test - public void replacesSuperscript() { + void replacesSuperscript() { expectCorrect("1st", "1\\textsuperscript{st}"); expectCorrect("2nd", "2\\textsuperscript{nd}"); expectCorrect("3rd", "3\\textsuperscript{rd}"); @@ -27,14 +27,14 @@ public void replacesSuperscript() { } @Test - public void replaceSuperscriptsIgnoresCase() { + void replaceSuperscriptsIgnoresCase() { expectCorrect("1st", "1\\textsuperscript{st}"); expectCorrect("1ST", "1\\textsuperscript{ST}"); expectCorrect("1sT", "1\\textsuperscript{sT}"); } @Test - public void replaceSuperscriptsInMultilineStrings() { + void replaceSuperscriptsInMultilineStrings() { expectCorrect( "replace on 1st line\nand on 2nd line.", "replace on 1\\textsuperscript{st} line\nand on 2\\textsuperscript{nd} line." @@ -42,7 +42,7 @@ public void replaceSuperscriptsInMultilineStrings() { } @Test - public void replaceAllSuperscripts() { + void replaceAllSuperscripts() { expectCorrect( "1st 2nd 3rd 4th", "1\\textsuperscript{st} 2\\textsuperscript{nd} 3\\textsuperscript{rd} 4\\textsuperscript{th}" @@ -50,12 +50,12 @@ public void replaceAllSuperscripts() { } @Test - public void ignoreSuperscriptsInsideWords() { + void ignoreSuperscriptsInsideWords() { expectCorrect("1st 1stword words1st inside1stwords", "1\\textsuperscript{st} 1stword words1st inside1stwords"); } @Test - public void formatExample() { + void formatExample() { assertEquals("11\\textsuperscript{th}", formatter.format(formatter.getExampleInput())); } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatterTest.java index 45a418094bce..9d3ca96b32c4 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatterTest.java @@ -8,73 +8,73 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class RemoveBracesFormatterTest { +class RemoveBracesFormatterTest { private RemoveBracesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveBracesFormatter(); } @Test - public void formatRemovesSingleEnclosingBraces() { + void formatRemovesSingleEnclosingBraces() { assertEquals("test", formatter.format("{test}")); } @Test - public void formatKeepsUnmatchedBracesAtBeginning() { + void formatKeepsUnmatchedBracesAtBeginning() { assertEquals("{test", formatter.format("{test")); } @Test - public void formatKeepsUnmatchedBracesAtEnd() { + void formatKeepsUnmatchedBracesAtEnd() { assertEquals("test}", formatter.format("test}")); } @Test - public void formatKeepsShortString() { + void formatKeepsShortString() { assertEquals("t", formatter.format("t")); } @Test - public void formatRemovesBracesOnly() { + void formatRemovesBracesOnly() { assertEquals("", formatter.format("{}")); } @Test - public void formatKeepsEmptyString() { + void formatKeepsEmptyString() { assertEquals("", formatter.format("")); } @Test - public void formatRemovesDoubleEnclosingBraces() { + void formatRemovesDoubleEnclosingBraces() { assertEquals("test", formatter.format("{{test}}")); } @Test - public void formatRemovesTripleEnclosingBraces() { + void formatRemovesTripleEnclosingBraces() { assertEquals("test", formatter.format("{{{test}}}")); } @Test - public void formatKeepsNonMatchingBraces() { + void formatKeepsNonMatchingBraces() { assertEquals("{A} and {B}", formatter.format("{A} and {B}")); } @Test - public void formatRemovesOnlyMatchingBraces() { + void formatRemovesOnlyMatchingBraces() { assertEquals("{A} and {B}", formatter.format("{{A} and {B}}")); } @Test - public void formatDoesNotRemoveBracesInBrokenString() { + void formatDoesNotRemoveBracesInBrokenString() { // We opt here for a conservative approach although one could argue that "A} and {B}" is also a valid return assertEquals("{A} and {B}}", formatter.format("{A} and {B}}")); } @Test - public void formatExample() { + void formatExample() { assertEquals("In CDMA", formatter.format(formatter.getExampleInput())); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatterTest.java index 4eed8b2c31d0..5421cc8d162d 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveDigitsFormatterTest.java @@ -5,27 +5,27 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RemoveDigitsFormatterTest { +class RemoveDigitsFormatterTest { private RemoveDigitsFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveDigitsFormatter(); } @Test - public void doNothingIfSingleSpace() { + void doNothingIfSingleSpace() { assertEquals("one digit", formatter.format("one 1 digit")); } @Test - public void doNothingIfNoSpace() { + void doNothingIfNoSpace() { assertEquals("two digits", formatter.format("two 01 digits")); } @Test - public void removeAllButOneSpacesIfTwo() { + void removeAllButOneSpacesIfTwo() { assertEquals("no digits", formatter.format("no digits")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatterTest.java index a96b37ae1c67..3d2cf8208c70 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveHyphenatedNewlinesFormatterTest.java @@ -5,29 +5,29 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RemoveHyphenatedNewlinesFormatterTest { +class RemoveHyphenatedNewlinesFormatterTest { private RemoveHyphenatedNewlinesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveHyphenatedNewlinesFormatter(); } @Test - public void removeHyphensBeforeNewlines() { + void removeHyphensBeforeNewlines() { assertEquals("water", formatter.format("wa-\nter")); assertEquals("water", formatter.format("wa-\r\nter")); assertEquals("water", formatter.format("wa-\rter")); } @Test - public void withoutHyphensUnmodified() { + void withoutHyphensUnmodified() { assertEquals("water", formatter.format("water")); } @Test - public void removeHyphensBeforePlatformSpecificNewlines() { + void removeHyphensBeforePlatformSpecificNewlines() { String newLine = String.format("%n"); assertEquals("water", formatter.format("wa-" + newLine + "ter")); } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java index f3a887838fe4..1cbed0a3db8e 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatterTest.java @@ -6,37 +6,37 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RemoveNewlinesFormatterTest { +class RemoveNewlinesFormatterTest { private RemoveNewlinesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveNewlinesFormatter(); } @Test - public void removeCarriageReturnLineFeed() { + void removeCarriageReturnLineFeed() { assertEquals("rn linebreak", formatter.format("rn\r\nlinebreak")); } @Test - public void removeCarriageReturn() { + void removeCarriageReturn() { assertEquals("r linebreak", formatter.format("r\rlinebreak")); } @Test - public void removeLineFeed() { + void removeLineFeed() { assertEquals("n linebreak", formatter.format("n\nlinebreak")); } @Test - public void withoutNewLineUnmodified() { + void withoutNewLineUnmodified() { assertEquals("no linebreak", formatter.format("no linebreak")); } @Test - public void removePlatformSpecificNewLine() { + void removePlatformSpecificNewLine() { String newLine = String.format("%n"); assertEquals("linebreak on current platform", formatter.format("linebreak on" + newLine + "current platform")); } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatterTest.java index b4b4d1e24611..17cf9721f1d3 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveRedundantSpacesFormatterTest.java @@ -5,32 +5,32 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RemoveRedundantSpacesFormatterTest { +class RemoveRedundantSpacesFormatterTest { private RemoveRedundantSpacesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveRedundantSpacesFormatter(); } @Test - public void doNothingIfSingleSpace() { + void doNothingIfSingleSpace() { assertEquals("single space", formatter.format("single space")); } @Test - public void doNothingIfNoSpace() { + void doNothingIfNoSpace() { assertEquals("nospace", formatter.format("nospace")); } @Test - public void removeAllButOneSpacesIfTwo() { + void removeAllButOneSpacesIfTwo() { assertEquals("two spaces", formatter.format("two spaces")); } @Test - public void removeAllButOneSpacesIfThree() { + void removeAllButOneSpacesIfThree() { assertEquals("three spaces", formatter.format("three spaces")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java index cf902fdd3ee9..b6e233c846ae 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceTabsBySpaceFormaterTest.java @@ -6,27 +6,27 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ReplaceTabsBySpaceFormaterTest { +class ReplaceTabsBySpaceFormaterTest { private ReplaceTabsBySpaceFormater formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new ReplaceTabsBySpaceFormater(); } @Test - public void removeSingleTab() { + void removeSingleTab() { assertEquals("single tab", formatter.format("single\ttab")); } @Test - public void removeMultipleTabs() { + void removeMultipleTabs() { assertEquals("multiple tabs", formatter.format("multiple\t\ttabs")); } @Test - public void doNothingIfNoTab() { + void doNothingIfNoTab() { assertEquals("notab", formatter.format("notab")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceWithEscapedDoubleQuotesTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceWithEscapedDoubleQuotesTest.java index ed1f6bcf5bd3..7ba7ec2bb093 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceWithEscapedDoubleQuotesTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/ReplaceWithEscapedDoubleQuotesTest.java @@ -7,32 +7,32 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ReplaceWithEscapedDoubleQuotesTest { +class ReplaceWithEscapedDoubleQuotesTest { private ReplaceWithEscapedDoubleQuotes formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new ReplaceWithEscapedDoubleQuotes(); } @Test - public void replacingSingleDoubleQuote() { + void replacingSingleDoubleQuote() { assertEquals("single \"\"double quote", formatter.format("single \"double quote")); } @Test - public void replacingMultipleDoubleQuote() { + void replacingMultipleDoubleQuote() { assertEquals("multiple \"\"double\"\" quote", formatter.format("multiple \"double\" quote")); } - + @Test - public void replacingSingleDoubleQuoteHavingCommas() { + void replacingSingleDoubleQuoteHavingCommas() { assertEquals("this \"\"is\"\", a test", formatter.format("this \"is\", a test")); } @Test - public void doNothing() { + void doNothing() { assertEquals("this is a test", formatter.format("this is a test")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatterTest.java index 15ea80819089..950774f8fc0b 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/ShortenDOIFormatterTest.java @@ -13,22 +13,22 @@ class ShortenDOIFormatterTest { private ShortenDOIFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new ShortenDOIFormatter(); } @Test - public void formatDoi() { + void formatDoi() { assertEquals("10/adc", formatter.format("10.1006/jmbi.1998.2354")); } @Test - public void invalidDoiIsKept() { + void invalidDoiIsKept() { assertEquals("invalid-doi", formatter.format("invalid-doi")); } @Test - public void shortDoi() { + void shortDoi() { assertEquals("10/adc", formatter.format("10/adc")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java index 3154a1a91fbc..48798526272c 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java @@ -6,52 +6,52 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class TrimWhitespaceFormatterTest { +class TrimWhitespaceFormatterTest { private TrimWhitespaceFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new TrimWhitespaceFormatter(); } @Test - public void removeHorizontalTabulations() { + void removeHorizontalTabulations() { assertEquals("whitespace", formatter.format("\twhitespace")); assertEquals("whitespace", formatter.format("whitespace\t")); assertEquals("whitespace", formatter.format("\twhitespace\t\t")); } @Test - public void removeLineFeeds() { + void removeLineFeeds() { assertEquals("whitespace", formatter.format("\nwhitespace")); assertEquals("whitespace", formatter.format("whitespace\n")); assertEquals("whitespace", formatter.format("\nwhitespace\n\n")); } @Test - public void removeFormFeeds() { + void removeFormFeeds() { assertEquals("whitespace", formatter.format("\fwhitespace")); assertEquals("whitespace", formatter.format("whitespace\f")); assertEquals("whitespace", formatter.format("\fwhitespace\f\f")); } @Test - public void removeCarriageReturnFeeds() { + void removeCarriageReturnFeeds() { assertEquals("whitespace", formatter.format("\rwhitespace")); assertEquals("whitespace", formatter.format("whitespace\r")); assertEquals("whitespace", formatter.format("\rwhitespace\r\r")); } @Test - public void removeSeparatorSpaces() { + void removeSeparatorSpaces() { assertEquals("whitespace", formatter.format(" whitespace")); assertEquals("whitespace", formatter.format("whitespace ")); assertEquals("whitespace", formatter.format(" whitespace ")); } @Test - public void removeMixedWhitespaceChars() { + void removeMixedWhitespaceChars() { assertEquals("whitespace", formatter.format(" \r\t\fwhitespace")); assertEquals("whitespace", formatter.format("whitespace \n \r")); assertEquals("whitespace", formatter.format(" \f\t whitespace \r \n")); diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/UnicodeConverterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/UnicodeConverterTest.java index a4d7f3fa7cb5..3bb8dea457ad 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/UnicodeConverterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/UnicodeConverterTest.java @@ -8,34 +8,34 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class UnicodeConverterTest { +class UnicodeConverterTest { private UnicodeToLatexFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new UnicodeToLatexFormatter(); } @Test - public void testBasic() { + void testBasic() { assertEquals("aaa", formatter.format("aaa")); } @Test - public void testUnicodeCombiningAccents() { + void testUnicodeCombiningAccents() { assertEquals("{\\\"{a}}", formatter.format("a\u0308")); assertEquals("{\\\"{a}}b", formatter.format("a\u0308b")); } @Test - public void testUnicode() { + void testUnicode() { assertEquals("{\\\"{a}}", formatter.format("ä")); assertEquals("{{$\\Epsilon$}}", formatter.format("\u0395")); } @Test - public void testUnicodeSingle() { + void testUnicodeSingle() { assertEquals("a", formatter.format("a")); } } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatterTest.java index 292a79b78691..7ee0ce1899c9 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatterTest.java @@ -8,23 +8,23 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class UnitsToLatexFormatterTest { +class UnitsToLatexFormatterTest { private UnitsToLatexFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new UnitsToLatexFormatter(); } @Test - public void test() { + void test() { assertEquals("1~{A}", formatter.format("1 A")); assertEquals("1\\mbox{-}{mA}", formatter.format("1-mA")); } @Test - public void formatExample() { + void formatExample() { assertEquals("1~{Hz}", formatter.format(formatter.getExampleInput())); } } diff --git a/src/test/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatterTest.java b/src/test/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatterTest.java index d662162c5209..0c1e35f0781e 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatterTest.java @@ -10,17 +10,17 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class CapitalizeFormatterTest { +class CapitalizeFormatterTest { private CapitalizeFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new CapitalizeFormatter(); } @Test - public void formatExample() { + void formatExample() { assertEquals("I Have {a} Dream", formatter.format(formatter.getExampleInput())); } @@ -51,7 +51,7 @@ public void formatExample() { "-upper, -Upper", // single word with - "-{u}pper, -{u}pper", // single word with {} and - }) - public void testInputs(String input, String expectedResult) { + void testInputs(String input, String expectedResult) { String formattedStr = formatter.format(input); assertEquals(expectedResult, formattedStr); } diff --git a/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java b/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java index 55eb22e6451d..531ab2c9b303 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java @@ -13,18 +13,18 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class LowerCaseFormatterTest { +class LowerCaseFormatterTest { private LowerCaseFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new LowerCaseFormatter(); } @ParameterizedTest @MethodSource("provideStringsForFormat") - public void test(String expected, String input) { + void test(String expected, String input) { assertEquals(expected, formatter.format(input)); } @@ -38,7 +38,7 @@ private static Stream provideStringsForFormat() { } @Test - public void formatExample() { + void formatExample() { assertEquals("kde {Amarok}", formatter.format(formatter.getExampleInput())); } } diff --git a/src/test/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatterTest.java b/src/test/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatterTest.java index f0b5e71811b0..f36b77a16430 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatterTest.java @@ -13,44 +13,44 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class ProtectTermsFormatterTest { +class ProtectTermsFormatterTest { private ProtectTermsFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new ProtectTermsFormatter( new ProtectedTermsLoader(new ProtectedTermsPreferences(ProtectedTermsLoader.getInternalLists(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList()))); } @Test - public void testSingleWord() { + void testSingleWord() { assertEquals("{VLSI}", formatter.format("VLSI")); } @Test - public void testDoNotProtectAlreadyProtected() { + void testDoNotProtectAlreadyProtected() { assertEquals("{VLSI}", formatter.format("{VLSI}")); } @Test - public void testCaseSensitivity() { + void testCaseSensitivity() { assertEquals("VLsI", formatter.format("VLsI")); } @Test - public void formatExample() { + void formatExample() { assertEquals("In {CDMA}", formatter.format(formatter.getExampleInput())); } @Test - public void testCorrectOrderingOfTerms() { + void testCorrectOrderingOfTerms() { assertEquals("{3GPP} {3G}", formatter.format("3GPP 3G")); } @Test - public void test() { + void test() { assertEquals("{VLSI} {VLSI}", formatter.format("VLSI {VLSI}")); assertEquals("{BPEL}", formatter.format("{BPEL}")); assertEquals("{Testing {BPEL} Engine Performance: A Survey}", diff --git a/src/test/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatterTest.java b/src/test/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatterTest.java index 38bea3eca234..e3bf31a964c7 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatterTest.java @@ -12,12 +12,12 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class SentenceCaseFormatterTest { +class SentenceCaseFormatterTest { private SentenceCaseFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new SentenceCaseFormatter(); } @@ -44,7 +44,7 @@ private static Stream testData() { @ParameterizedTest @MethodSource("testData") - public void test(String expected, String input) { + void test(String expected, String input) { assertEquals(expected, formatter.format(input)); } } diff --git a/src/test/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatterTest.java b/src/test/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatterTest.java index 2538af947a25..0c7906a75f7d 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatterTest.java @@ -12,12 +12,12 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class TitleCaseFormatterTest { +class TitleCaseFormatterTest { private TitleCaseFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new TitleCaseFormatter(); } @@ -65,7 +65,7 @@ private static Stream testData() { @ParameterizedTest @MethodSource("testData") - public void test(String expected, String input) { + void test(String expected, String input) { assertEquals(expected, formatter.format(input)); } } diff --git a/src/test/java/org/jabref/logic/formatter/casechanger/UnprotectTermsFormatterTest.java b/src/test/java/org/jabref/logic/formatter/casechanger/UnprotectTermsFormatterTest.java index 5c7e09797894..8d0b07ba838b 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/UnprotectTermsFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/UnprotectTermsFormatterTest.java @@ -13,12 +13,12 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class UnprotectTermsFormatterTest { +class UnprotectTermsFormatterTest { private UnprotectTermsFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new UnprotectTermsFormatter(); } @@ -40,7 +40,7 @@ private static Stream terms() throws IOException { @ParameterizedTest @MethodSource("terms") - public void test(String expected, String toFormat) { + void test(String expected, String toFormat) { assertEquals(expected, formatter.format(toFormat)); } } diff --git a/src/test/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatterTest.java b/src/test/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatterTest.java index c1397603348e..0a4cde56fb9b 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatterTest.java @@ -12,13 +12,13 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class UpperCaseFormatterTest { +class UpperCaseFormatterTest { private UpperCaseFormatter formatter = new UpperCaseFormatter(); @ParameterizedTest @MethodSource("upperCaseTests") - public void upperCaseTest(String expectedFormat, String inputFormat) { + void upperCaseTest(String expectedFormat, String inputFormat) { assertEquals(expectedFormat, formatter.format(inputFormat)); } @@ -35,7 +35,7 @@ private static Stream upperCaseTests() { } @Test - public void formatExample() { + void formatExample() { assertEquals("KDE {Amarok}", formatter.format(formatter.getExampleInput())); } } diff --git a/src/test/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatterTest.java b/src/test/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatterTest.java index eccff6f9f15c..d3d8f9a24cc8 100644 --- a/src/test/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatterTest.java @@ -12,12 +12,12 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class MinifyNameListFormatterTest { +class MinifyNameListFormatterTest { private MinifyNameListFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new MinifyNameListFormatter(); } diff --git a/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java b/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java index e6a5f50b1f31..deb94603f281 100644 --- a/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/minifier/TruncateFormatterTest.java @@ -8,7 +8,7 @@ /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ -public class TruncateFormatterTest { +class TruncateFormatterTest { private final String TITLE = "A Title"; @Test diff --git a/src/test/java/org/jabref/logic/git/GitHandlerTest.java b/src/test/java/org/jabref/logic/git/GitHandlerTest.java index d5dd4c694c3b..fb3ff026bf14 100644 --- a/src/test/java/org/jabref/logic/git/GitHandlerTest.java +++ b/src/test/java/org/jabref/logic/git/GitHandlerTest.java @@ -22,7 +22,7 @@ class GitHandlerTest { private GitHandler gitHandler; @BeforeEach - public void setUpGitHandler() { + void setUpGitHandler() { gitHandler = new GitHandler(repositoryPath); } diff --git a/src/test/java/org/jabref/logic/git/SlrGitHandlerTest.java b/src/test/java/org/jabref/logic/git/SlrGitHandlerTest.java index af4b13a1f1bc..c73ec6823fd3 100644 --- a/src/test/java/org/jabref/logic/git/SlrGitHandlerTest.java +++ b/src/test/java/org/jabref/logic/git/SlrGitHandlerTest.java @@ -23,7 +23,7 @@ class SlrGitHandlerTest { private SlrGitHandler gitHandler; @BeforeEach - public void setUpGitHandler() { + void setUpGitHandler() { gitHandler = new SlrGitHandler(repositoryPath); } diff --git a/src/test/java/org/jabref/logic/importer/BibDatabaseFilesTest.java b/src/test/java/org/jabref/logic/importer/BibDatabaseFilesTest.java index e7301dcc9055..fe4a73946ba4 100644 --- a/src/test/java/org/jabref/logic/importer/BibDatabaseFilesTest.java +++ b/src/test/java/org/jabref/logic/importer/BibDatabaseFilesTest.java @@ -15,17 +15,17 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class BibDatabaseFilesTest { +class BibDatabaseFilesTest { private ImportFormatPreferences importFormatPreferences; @BeforeEach - public void setUp() { + void setUp() { importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); } @Test - public void resolveStrings() throws IOException { + void resolveStrings() throws IOException { try (FileInputStream stream = new FileInputStream("src/test/resources/org/jabref/util/twente.bib"); InputStreamReader fr = new InputStreamReader(stream, StandardCharsets.UTF_8)) { ParserResult result = new BibtexParser(importFormatPreferences).parse(fr); diff --git a/src/test/java/org/jabref/logic/importer/FulltextFetchersTest.java b/src/test/java/org/jabref/logic/importer/FulltextFetchersTest.java index a8aa3b7628dc..c7e7a9bb7b99 100644 --- a/src/test/java/org/jabref/logic/importer/FulltextFetchersTest.java +++ b/src/test/java/org/jabref/logic/importer/FulltextFetchersTest.java @@ -18,12 +18,12 @@ import static org.mockito.Mockito.when; @FetcherTest -public class FulltextFetchersTest { +class FulltextFetchersTest { private BibEntry entry = new BibEntry(); @Test - public void acceptPdfUrls() throws MalformedURLException { + void acceptPdfUrls() throws MalformedURLException { URL pdfUrl = new URL("http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.pdf"); FulltextFetcher finder = e -> Optional.of(pdfUrl); FulltextFetchers fetcher = new FulltextFetchers(Set.of(finder)); @@ -31,7 +31,7 @@ public void acceptPdfUrls() throws MalformedURLException { } @Test - public void rejectNonPdfUrls() throws MalformedURLException { + void rejectNonPdfUrls() throws MalformedURLException { URL pdfUrl = new URL("https://github.com/JabRef/jabref/blob/master/README.md"); FulltextFetcher finder = e -> Optional.of(pdfUrl); FulltextFetchers fetcher = new FulltextFetchers(Set.of(finder)); @@ -40,7 +40,7 @@ public void rejectNonPdfUrls() throws MalformedURLException { } @Test - public void noTrustLevel() throws MalformedURLException { + void noTrustLevel() throws MalformedURLException { URL pdfUrl = new URL("http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.pdf"); FulltextFetcher finder = e -> Optional.of(pdfUrl); FulltextFetchers fetcher = new FulltextFetchers(Set.of(finder)); @@ -49,7 +49,7 @@ public void noTrustLevel() throws MalformedURLException { } @Test - public void higherTrustLevelWins() throws IOException, FetcherException { + void higherTrustLevelWins() throws IOException, FetcherException { FulltextFetcher finderHigh = mock(FulltextFetcher.class); when(finderHigh.getTrustLevel()).thenReturn(TrustLevel.SOURCE); final URL highUrl = new URL("http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.pdf"); diff --git a/src/test/java/org/jabref/logic/importer/ImporterTest.java b/src/test/java/org/jabref/logic/importer/ImporterTest.java index 4db39bf1635f..53f2a1e24a22 100644 --- a/src/test/java/org/jabref/logic/importer/ImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/ImporterTest.java @@ -40,56 +40,56 @@ public class ImporterTest { @ParameterizedTest @MethodSource("instancesToTest") - public void isRecognizedFormatWithNullForBufferedReaderThrowsException(Importer format) { + void isRecognizedFormatWithNullForBufferedReaderThrowsException(Importer format) { assertThrows(NullPointerException.class, () -> format.isRecognizedFormat((BufferedReader) null)); } @ParameterizedTest @MethodSource("instancesToTest") - public void isRecognizedFormatWithNullForStringThrowsException(Importer format) { + void isRecognizedFormatWithNullForStringThrowsException(Importer format) { assertThrows(NullPointerException.class, () -> format.isRecognizedFormat((String) null)); } @ParameterizedTest @MethodSource("instancesToTest") - public void importDatabaseWithNullForBufferedReaderThrowsException(Importer format) { + void importDatabaseWithNullForBufferedReaderThrowsException(Importer format) { assertThrows(NullPointerException.class, () -> format.importDatabase((BufferedReader) null)); } @ParameterizedTest @MethodSource("instancesToTest") - public void importDatabaseWithNullForStringThrowsException(Importer format) { + void importDatabaseWithNullForStringThrowsException(Importer format) { assertThrows(NullPointerException.class, () -> format.importDatabase((String) null)); } @ParameterizedTest @MethodSource("instancesToTest") - public void getFormatterNameDoesNotReturnNull(Importer format) { + void getFormatterNameDoesNotReturnNull(Importer format) { assertNotNull(format.getName()); } @ParameterizedTest @MethodSource("instancesToTest") - public void getFileTypeDoesNotReturnNull(Importer format) { + void getFileTypeDoesNotReturnNull(Importer format) { assertNotNull(format.getFileType()); } @ParameterizedTest @MethodSource("instancesToTest") - public void getIdDoesNotReturnNull(Importer format) { + void getIdDoesNotReturnNull(Importer format) { assertNotNull(format.getId()); } @ParameterizedTest @MethodSource("instancesToTest") - public void getIdDoesNotContainWhitespace(Importer format) { + void getIdDoesNotContainWhitespace(Importer format) { Pattern whitespacePattern = Pattern.compile("\\s"); assertFalse(whitespacePattern.matcher(format.getId()).find()); } @ParameterizedTest @MethodSource("instancesToTest") - public void getIdStripsSpecialCharactersAndConvertsToLowercase(Importer format) { + void getIdStripsSpecialCharactersAndConvertsToLowercase(Importer format) { Importer importer = mock(Importer.class, Mockito.CALLS_REAL_METHODS); when(importer.getName()).thenReturn("*Test-Importer"); assertEquals("testimporter", importer.getId()); @@ -97,7 +97,7 @@ public void getIdStripsSpecialCharactersAndConvertsToLowercase(Importer format) @ParameterizedTest @MethodSource("instancesToTest") - public void getDescriptionDoesNotReturnNull(Importer format) { + void getDescriptionDoesNotReturnNull(Importer format) { assertNotNull(format.getDescription()); } diff --git a/src/test/java/org/jabref/logic/importer/QueryParserTest.java b/src/test/java/org/jabref/logic/importer/QueryParserTest.java index acb8c41a40c3..9ad2f8fe371d 100644 --- a/src/test/java/org/jabref/logic/importer/QueryParserTest.java +++ b/src/test/java/org/jabref/logic/importer/QueryParserTest.java @@ -6,67 +6,67 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class QueryParserTest { +class QueryParserTest { QueryParser parser = new QueryParser(); @Test - public void convertAuthorField() { + void convertAuthorField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("author:\"Igor Steinmacher\"").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().author("\"Igor Steinmacher\"").build(); assertEquals(expectedQuery, searchQuery); } @Test - public void convertDefaultField() { + void convertDefaultField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("\"default value\"").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().defaultFieldPhrase("\"default value\"").build(); assertEquals(expectedQuery, searchQuery); } @Test - public void convertExplicitDefaultField() { + void convertExplicitDefaultField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("default:\"default value\"").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().defaultFieldPhrase("\"default value\"").build(); assertEquals(expectedQuery, searchQuery); } @Test - public void convertJournalField() { + void convertJournalField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("journal:Nature").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().journal("\"Nature\"").build(); assertEquals(expectedQuery, searchQuery); } @Test - public void convertAlphabeticallyFirstJournalField() { + void convertAlphabeticallyFirstJournalField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("journal:Nature journal:\"Complex Networks\"").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().journal("\"Complex Networks\"").build(); assertEquals(expectedQuery, searchQuery); } @Test - public void convertYearField() { + void convertYearField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("year:2015").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().singleYear(2015).build(); assertEquals(expectedQuery, searchQuery); } @Test - public void convertNumericallyFirstYearField() { + void convertNumericallyFirstYearField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("year:2015 year:2014").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().singleYear(2014).build(); assertEquals(expectedQuery, searchQuery); } @Test - public void convertYearRangeField() { + void convertYearRangeField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("year-range:2012-2015").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().fromYearAndToYear(2012, 2015).build(); assertEquals(expectedQuery, searchQuery); } @Test - public void convertMultipleValuesWithTheSameField() { + void convertMultipleValuesWithTheSameField() { ComplexSearchQuery searchQuery = parser.parseQueryStringIntoComplexQuery("author:\"Igor Steinmacher\" author:\"Christoph Treude\"").get(); ComplexSearchQuery expectedQuery = ComplexSearchQuery.builder().author("\"Igor Steinmacher\"").author("\"Christoph Treude\"").build(); assertEquals(expectedQuery, searchQuery); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java index 65d3c2bcfc95..8b98d808014c 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ArXivFetcherTest.java @@ -25,7 +25,6 @@ import org.jabref.model.entry.types.StandardEntryType; import org.jabref.testutils.category.FetcherTest; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; @@ -189,12 +188,12 @@ public void supportsAuthorSearch() throws FetcherException { String author = bibEntry.getField(StandardField.AUTHOR).orElse(""); // The co-authors differ, thus we check for the author present at all papers - getTestAuthors().forEach(expectedAuthor -> Assertions.assertTrue(author.contains(expectedAuthor.replace("\"", "")))); + getTestAuthors().forEach(expectedAuthor -> assertTrue(author.contains(expectedAuthor.replace("\"", "")))); }); } @Test - public void noSupportsAuthorSearchWithLastFirstName() throws FetcherException { + void noSupportsAuthorSearchWithLastFirstName() throws FetcherException { StringJoiner queryBuilder = new StringJoiner("\" AND author:\"", "author:\"", "\""); getTestAuthors().forEach(queryBuilder::add); @@ -432,7 +431,7 @@ public void supportsYearRangeSearch() throws Exception { * Only documents that contain exactly this sequence are returned. */ @Test - public void supportsPhraseSearch() throws Exception { + void supportsPhraseSearch() throws Exception { List resultWithPhraseSearch = fetcher.performSearch("title:\"Taxonomy of Distributed\""); List resultWithOutPhraseSearch = fetcher.performSearch("title:Taxonomy AND title:of AND title:Distributed"); // Phrase search result has to be subset of the default search result @@ -444,7 +443,7 @@ public void supportsPhraseSearch() throws Exception { * Only documents that contain exactly this sequence are returned. */ @Test - public void supportsPhraseSearchAndMatchesExact() throws Exception { + void supportsPhraseSearchAndMatchesExact() throws Exception { BibEntry expected = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Rafrastara, Fauzi Adi and Deyu, Qi") .withField(StandardField.TITLE, "A Survey and Taxonomy of Distributed Data Mining Research Studies: A Systematic Literature Review") @@ -468,7 +467,7 @@ public void supportsPhraseSearchAndMatchesExact() throws Exception { } @Test - public void supportsBooleanANDSearch() throws Exception { + void supportsBooleanANDSearch() throws Exception { BibEntry expected = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Büscher, Tobias and Diez, Angel L. and Gompper, Gerhard and Elgeti, Jens") .withField(StandardField.TITLE, "Instability and fingering of interfaces in growing tissue") @@ -497,7 +496,7 @@ public void supportsBooleanANDSearch() throws Exception { } @Test - public void retrievePureArxivEntryWhenAllDOIFetchingFails() throws FetcherException { + void retrievePureArxivEntryWhenAllDOIFetchingFails() throws FetcherException { BibEntry expected = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Hai Zheng and Po-Yi Ho and Meiling Jiang and Bin Tang and Weirong Liu and Dengjin Li and Xuefeng Yu and Nancy E. Kleckner and Ariel Amir and Chenli Liu") .withField(StandardField.TITLE, "Interrogating the Escherichia coli cell cycle by cell dimension perturbations") @@ -520,7 +519,7 @@ public void retrievePureArxivEntryWhenAllDOIFetchingFails() throws FetcherExcept } @Test - public void canReplicateArXivOnlySearchByPassingNullParameter() throws FetcherException { + void canReplicateArXivOnlySearchByPassingNullParameter() throws FetcherException { BibEntry expected = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Hai Zheng and Po-Yi Ho and Meiling Jiang and Bin Tang and Weirong Liu and Dengjin Li and Xuefeng Yu and Nancy E. Kleckner and Ariel Amir and Chenli Liu") .withField(StandardField.TITLE, "Interrogating the Escherichia coli cell cycle by cell dimension perturbations") @@ -539,7 +538,7 @@ public void canReplicateArXivOnlySearchByPassingNullParameter() throws FetcherEx } @Test - public void retrievePartialResultWhenCannotGetInformationFromUserAssignedDOI() throws FetcherException { + void retrievePartialResultWhenCannotGetInformationFromUserAssignedDOI() throws FetcherException { BibEntry expected = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Zheng, Hai and Ho, Po-Yi and Jiang, Meiling and Tang, Bin and Liu, Weirong and Li, Dengjin and Yu, Xuefeng and Kleckner, Nancy E. and Amir, Ariel and Liu, Chenli") .withField(StandardField.TITLE, "Interrogating the Escherichia coli cell cycle by cell dimension perturbations") @@ -565,7 +564,7 @@ public void retrievePartialResultWhenCannotGetInformationFromUserAssignedDOI() t } @Test - public void retrievePartialResultWhenCannotGetInformationFromArXivAssignedDOI() throws FetcherException { + void retrievePartialResultWhenCannotGetInformationFromArXivAssignedDOI() throws FetcherException { BibEntry expected = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Hai Zheng and Po-Yi Ho and Meiling Jiang and Bin Tang and Weirong Liu and Dengjin Li and Xuefeng Yu and Nancy E. Kleckner and Ariel Amir and Chenli Liu") .withField(StandardField.TITLE, "Interrogating the Escherichia coli cell cycle by cell dimension perturbations") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java index ad0fb8400307..1baf78383a1f 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java @@ -36,7 +36,7 @@ public class AstrophysicsDataSystemTest implements PagedSearchFetcherTest { private BibEntry luceyPaulEntry; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); ImporterPreferences importerPreferences = mock(ImporterPreferences.class); when(importerPreferences.getApiKeys()).thenReturn(FXCollections.emptyObservableSet()); @@ -138,19 +138,19 @@ public void setUp() throws Exception { } @Test - public void testGetName() { + void testGetName() { assertEquals("SAO/NASA ADS", fetcher.getName()); } @Test - public void searchByQueryFindsEntry() throws Exception { + void searchByQueryFindsEntry() throws Exception { List fetchedEntries = fetcher.performSearch("Diez slice theorem Lie"); assertFalse(fetchedEntries.isEmpty()); assertTrue(fetchedEntries.contains(diezSliceTheoremEntry)); } @Test - public void searchByEntryFindsEntry() throws Exception { + void searchByEntryFindsEntry() throws Exception { BibEntry searchEntry = new BibEntry() .withField(StandardField.TITLE, "slice theorem") .withField(StandardField.AUTHOR, "Diez"); @@ -163,56 +163,56 @@ public void searchByEntryFindsEntry() throws Exception { } @Test - public void testPerformSearchByFamaeyMcGaughEntry() throws Exception { + void testPerformSearchByFamaeyMcGaughEntry() throws Exception { Optional fetchedEntry = fetcher.performSearchById("10.12942/lrr-2012-10"); fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT)); // Remove abstract due to copyright assertEquals(Optional.of(famaeyMcGaughEntry), fetchedEntry); } @Test - public void testPerformSearchByIdEmptyDOI() throws Exception { + void testPerformSearchByIdEmptyDOI() throws Exception { Optional fetchedEntry = fetcher.performSearchById(""); assertEquals(Optional.empty(), fetchedEntry); } @Test - public void testPerformSearchByIdInvalidDoi() throws Exception { + void testPerformSearchByIdInvalidDoi() throws Exception { assertEquals(Optional.empty(), fetcher.performSearchById("this.doi.will.fail")); } @Test - public void testPerformSearchBySunWelchEntry() throws Exception { + void testPerformSearchBySunWelchEntry() throws Exception { Optional fetchedEntry = fetcher.performSearchById("10.1038/nmat3160"); fetchedEntry.ifPresent(entry -> entry.clearField(StandardField.ABSTRACT)); // Remove abstract due to copyright assertEquals(Optional.of(sunWelchEntry), fetchedEntry); } @Test - public void testPerformSearchByXiongSunEntry() throws Exception { + void testPerformSearchByXiongSunEntry() throws Exception { Optional fetchedEntry = fetcher.performSearchById("10.1109/TGRS.2006.890567"); assertEquals(Optional.of(xiongSunEntry), fetchedEntry); } @Test - public void testPerformSearchByIngersollPollardEntry() throws Exception { + void testPerformSearchByIngersollPollardEntry() throws Exception { Optional fetchedEntry = fetcher.performSearchById("10.1016/0019-1035(82)90169-5"); assertEquals(Optional.of(ingersollPollardEntry), fetchedEntry); } @Test - public void testPerformSearchByLuceyPaulEntry() throws Exception { + void testPerformSearchByLuceyPaulEntry() throws Exception { Optional fetchedEntry = fetcher.performSearchById("2000JGR...10520297L"); assertEquals(Optional.of(luceyPaulEntry), fetchedEntry); } @Test - public void performSearchByQueryPaged_searchLimitsSize() throws Exception { + void performSearchByQueryPaged_searchLimitsSize() throws Exception { Page page = fetcher.performSearchPaged("author:\"A\"", 0); assertEquals(fetcher.getPageSize(), page.getSize(), "fetcher return wrong page size"); } @Test - public void performSearchByQueryPaged_invalidAuthorsReturnEmptyPages() throws Exception { + void performSearchByQueryPaged_invalidAuthorsReturnEmptyPages() throws Exception { Page page = fetcher.performSearchPaged("author:\"ThisAuthorWillNotBeFound\"", 0); Page page5 = fetcher.performSearchPaged("author:\"ThisAuthorWillNotBeFound\"", 5); assertEquals(0, page.getSize(), "fetcher doesnt return empty pages for invalid author"); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java index 84936dd4e26e..26182884c376 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/BiodiversityLibraryTest.java @@ -26,7 +26,7 @@ import static org.mockito.Mockito.when; @FetcherTest -public class BiodiversityLibraryTest { +class BiodiversityLibraryTest { private final String BASE_URL = "https://www.biodiversitylibrary.org/api3?"; private final String RESPONSE_FORMAT = "&format=json"; private final BuildInfo buildInfo = new BuildInfo(); @@ -41,20 +41,20 @@ void setUp() { } @Test - public void testGetName() { + void testGetName() { assertEquals("Biodiversity Heritage", fetcher.getName()); assertNotEquals("Biodiversity Heritage Library", fetcher.getName()); assertNotEquals("Biodiversity Library", fetcher.getName()); } @Test - public void biodiversityHeritageApiKeyIsNotEmpty() { + void biodiversityHeritageApiKeyIsNotEmpty() { BuildInfo buildInfo = new BuildInfo(); assertNotNull(buildInfo.biodiversityHeritageApiKey); } @Test - public void baseURLConstruction() throws MalformedURLException, URISyntaxException { + void baseURLConstruction() throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() .concat(buildInfo.biodiversityHeritageApiKey) @@ -65,7 +65,7 @@ public void baseURLConstruction() throws MalformedURLException, URISyntaxExcepti @ParameterizedTest @ValueSource(strings = {"1234", "331", "121"}) - public void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxException { + void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() .concat(buildInfo.biodiversityHeritageApiKey) @@ -78,7 +78,7 @@ public void getPartMetadaUrl(String id) throws MalformedURLException, URISyntaxE @ParameterizedTest @ValueSource(strings = {"1234", "4321", "331"}) - public void getItemMetadaUrl(String id) throws MalformedURLException, URISyntaxException { + void getItemMetadaUrl(String id) throws MalformedURLException, URISyntaxException { String expected = fetcher .getTestUrl() .concat(buildInfo.biodiversityHeritageApiKey) @@ -90,7 +90,7 @@ public void getItemMetadaUrl(String id) throws MalformedURLException, URISyntaxE } @Test - public void testPerformSearch() throws FetcherException { + void testPerformSearch() throws FetcherException { BibEntry expected = new BibEntry(StandardEntryType.Article) .withField(StandardField.AUTHOR, "Clark, John L. (John Littner) and Neill, David A. ") .withField(StandardField.JOURNALTITLE, "PhytoKeys") @@ -107,7 +107,7 @@ public void testPerformSearch() throws FetcherException { } @Test - public void jsonResultToBibEntry() { + void jsonResultToBibEntry() { JSONObject input = new JSONObject("{\n\"BHLType\": \"Part\",\n\"FoundIn\": \"Metadata\",\n\"Volume\": \"3\",\n\"Authors\": [\n{\n\"Name\": \"Dimmock, George,\"\n}\n],\n\"PartUrl\": \"https://www.biodiversitylibrary.org/part/181199\",\n\"PartID\": \"181199\",\n\"Genre\": \"Article\",\n\"Title\": \"The Cocoons of Cionus Scrophulariae\",\n\"ContainerTitle\": \"Psyche.\",\n\"Date\": \"1882\",\n\"PageRange\": \"411--413\"\n}"); BibEntry expected = new BibEntry(StandardEntryType.Article) .withField(StandardField.TITLE, "The Cocoons of Cionus Scrophulariae") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/BvbFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/BvbFetcherTest.java index eab59ad81925..70dd8e6cdd1d 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/BvbFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/BvbFetcherTest.java @@ -20,7 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; @FetcherTest -public class BvbFetcherTest { +class BvbFetcherTest { BvbFetcher fetcher = new BvbFetcher(); BibEntry bibEntryISBN0134685997; @@ -39,7 +39,7 @@ void testPerformTest() throws Exception { } @BeforeEach - public void setUp() { + void setUp() { fetcher = new BvbFetcher(); bibEntryISBN9783960886402 = new BibEntry(StandardEntryType.Misc) @@ -69,12 +69,12 @@ public void setUp() { } @Test - public void testGetName() { + void testGetName() { assertEquals("Bibliotheksverbund Bayern (Experimental)", fetcher.getName()); } @Test - public void simpleSearchQueryURLCorrect() throws Exception { + void simpleSearchQueryURLCorrect() throws Exception { String query = "java jdk"; QueryNode luceneQuery = new StandardSyntaxParser().parse(query, NO_EXPLICIT_FIELD); URL url = fetcher.getURLForQuery(luceneQuery); @@ -82,7 +82,7 @@ public void simpleSearchQueryURLCorrect() throws Exception { } @Test - public void complexSearchQueryURLCorrect() throws Exception { + void complexSearchQueryURLCorrect() throws Exception { String query = "title:jdk"; QueryNode luceneQuery = new StandardSyntaxParser().parse(query, NO_EXPLICIT_FIELD); URL url = fetcher.getURLForQuery(luceneQuery); @@ -90,14 +90,14 @@ public void complexSearchQueryURLCorrect() throws Exception { } @Test - public void testPerformSearchMatchingMultipleEntries() throws FetcherException { + void testPerformSearchMatchingMultipleEntries() throws FetcherException { List searchResult = fetcher.performSearch("effective java bloch"); assertEquals(bibEntryISBN9783960886402, searchResult.get(0)); assertEquals(bibEntryISBN0134685997, searchResult.get(1)); } @Test - public void testPerformSearchEmpty() throws FetcherException { + void testPerformSearchEmpty() throws FetcherException { List searchResult = fetcher.performSearch(""); assertEquals(Collections.emptyList(), searchResult); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesFetcherTest.java index c48e3119642d..39359444faef 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesFetcherTest.java @@ -34,26 +34,26 @@ class CollectionOfComputerScienceBibliographiesFetcherTest { private CollectionOfComputerScienceBibliographiesFetcher fetcher; @BeforeEach - public void setUp() { + void setUp() { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); when(importFormatPreferences.bibEntryPreferences().getKeywordSeparator()).thenReturn(','); fetcher = new CollectionOfComputerScienceBibliographiesFetcher(importFormatPreferences); } @Test - public void getNameReturnsCorrectName() { + void getNameReturnsCorrectName() { assertEquals("Collection of Computer Science Bibliographies", fetcher.getName()); } @Test - public void getUrlForQueryReturnsCorrectUrl() throws MalformedURLException, URISyntaxException, FetcherException, QueryNodeParseException { + void getUrlForQueryReturnsCorrectUrl() throws MalformedURLException, URISyntaxException, FetcherException, QueryNodeParseException { String query = "java jdk"; URL url = fetcher.getURLForQuery(new StandardSyntaxParser().parse(query, AbstractQueryTransformer.NO_EXPLICIT_FIELD)); assertEquals("http://liinwww.ira.uka.de/bibliography/rss?query=java+jdk&sort=score", url.toString()); } @Test - public void performSearchReturnsMatchingMultipleEntries() throws FetcherException { + void performSearchReturnsMatchingMultipleEntries() throws FetcherException { List searchResult = fetcher.performSearch("jabref"); BibEntry secondBibEntry = new BibEntry(StandardEntryType.Article) @@ -107,7 +107,7 @@ public void performSearchReturnsMatchingMultipleEntries() throws FetcherExceptio } @Test - public void performSearchReturnsEmptyListForEmptySearch() throws FetcherException { + void performSearchReturnsEmptyListForEmptySearch() throws FetcherException { List searchResult = fetcher.performSearch(""); assertEquals(Collections.emptyList(), searchResult); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java index 79f529e91d8d..af33cdfca8dd 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CollectionOfComputerScienceBibliographiesParserTest.java @@ -21,21 +21,21 @@ @FetcherTest @Disabled -public class CollectionOfComputerScienceBibliographiesParserTest { +class CollectionOfComputerScienceBibliographiesParserTest { @Test - public void parseEntriesReturnsEmptyListIfXmlHasNoResults() throws Exception { + void parseEntriesReturnsEmptyListIfXmlHasNoResults() throws Exception { parseXmlAndCheckResults("collection_of_computer_science_bibliographies_empty_result.xml", Collections.emptyList()); } @Disabled("Parse/fetcher remote side does not return anything valid for the link") @Test - public void parseEntriesReturnsOneBibEntryInListIfXmlHasSingleResult() throws Exception { + void parseEntriesReturnsOneBibEntryInListIfXmlHasSingleResult() throws Exception { parseXmlAndCheckResults("collection_of_computer_science_bibliographies_single_result.xml", Collections.singletonList("collection_of_computer_science_bibliographies_single_result.bib")); } @Test - public void parseEntriesReturnsMultipleBibEntriesInListIfXmlHasMultipleResults() throws Exception { + void parseEntriesReturnsMultipleBibEntriesInListIfXmlHasMultipleResults() throws Exception { parseXmlAndCheckResults("collection_of_computer_science_bibliographies_multiple_results.xml", Arrays.asList("collection_of_computer_science_bibliographies_multiple_results_first_result.bib", "collection_of_computer_science_bibliographies_multiple_results_second_result.bib")); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java index 5d00d34b3562..390d7b537a70 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CompositeSearchBasedFetcherTest.java @@ -19,7 +19,6 @@ import org.jabref.support.DisabledOnCIServer; import org.jabref.testutils.category.FetcherTest; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -28,47 +27,50 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @FetcherTest @DisabledOnCIServer("Produces to many requests on CI") -public class CompositeSearchBasedFetcherTest { +class CompositeSearchBasedFetcherTest { private static final Logger LOGGER = LoggerFactory.getLogger(CompositeSearchBasedFetcherTest.class); private ImporterPreferences importerPreferences = mock(ImporterPreferences.class, Answers.RETURNS_DEEP_STUBS); @Test - public void createCompositeFetcherWithNullSet() { - Assertions.assertThrows(IllegalArgumentException.class, + void createCompositeFetcherWithNullSet() { + assertThrows(IllegalArgumentException.class, () -> new CompositeSearchBasedFetcher(null, importerPreferences, 0)); } @Test - public void performSearchWithoutFetchers() throws Exception { + void performSearchWithoutFetchers() throws Exception { Set empty = new HashSet<>(); CompositeSearchBasedFetcher fetcher = new CompositeSearchBasedFetcher(empty, importerPreferences, Integer.MAX_VALUE); List result = fetcher.performSearch("quantum"); - Assertions.assertEquals(result, Collections.emptyList()); + assertEquals(result, Collections.emptyList()); } @ParameterizedTest(name = "Perform Search on empty query.") @MethodSource("performSearchParameters") - public void performSearchOnEmptyQuery(Set fetchers) throws Exception { + void performSearchOnEmptyQuery(Set fetchers) throws Exception { CompositeSearchBasedFetcher compositeFetcher = new CompositeSearchBasedFetcher(fetchers, importerPreferences, Integer.MAX_VALUE); List queryResult = compositeFetcher.performSearch(""); - Assertions.assertEquals(queryResult, Collections.emptyList()); + assertEquals(queryResult, Collections.emptyList()); } @ParameterizedTest(name = "Perform search on query \"quantum\". Using the CompositeFetcher of the following " + "Fetchers: {arguments}") @MethodSource("performSearchParameters") - public void performSearchOnNonEmptyQuery(Set fetchers) throws Exception { + void performSearchOnNonEmptyQuery(Set fetchers) throws Exception { CompositeSearchBasedFetcher compositeFetcher = new CompositeSearchBasedFetcher(fetchers, importerPreferences, Integer.MAX_VALUE); ImportCleanup cleanup = ImportCleanup.targeting(BibDatabaseMode.BIBTEX); @@ -77,7 +79,7 @@ public void performSearchOnNonEmptyQuery(Set fetchers) throw try { List fetcherResult = fetcher.performSearch("quantum"); fetcherResult.forEach(cleanup::doPostCleanup); - Assertions.assertTrue(compositeResult.containsAll(fetcherResult)); + assertTrue(compositeResult.containsAll(fetcherResult)); } catch (FetcherException e) { /* We catch the Fetcher exception here, since the failing fetcher also fails in the CompositeFetcher * and just leads to no additional results in the returned list. Therefore, the test should not fail diff --git a/src/test/java/org/jabref/logic/importer/fetcher/CrossRefTest.java b/src/test/java/org/jabref/logic/importer/fetcher/CrossRefTest.java index a0bd0bfc64ed..bacbee0a2718 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/CrossRefTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/CrossRefTest.java @@ -18,13 +18,13 @@ import static org.junit.jupiter.api.Assertions.assertThrows; @FetcherTest -public class CrossRefTest { +class CrossRefTest { private CrossRef fetcher; private BibEntry barrosEntry; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { fetcher = new CrossRef(); barrosEntry = new BibEntry(); @@ -38,7 +38,7 @@ public void setUp() throws Exception { } @Test - public void findExactData() throws Exception { + void findExactData() throws Exception { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Service Interaction Patterns"); entry.setField(StandardField.AUTHOR, "Barros, Alistair and Dumas, Marlon and Arthur H.M. ter Hofstede"); @@ -47,7 +47,7 @@ public void findExactData() throws Exception { } @Test - public void findMissingAuthor() throws Exception { + void findMissingAuthor() throws Exception { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Towards Application Portability in Platform as a Service"); entry.setField(StandardField.AUTHOR, "Stefan Kolb"); @@ -55,14 +55,14 @@ public void findMissingAuthor() throws Exception { } @Test - public void findTitleOnly() throws Exception { + void findTitleOnly() throws Exception { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Towards Application Portability in Platform as a Service"); assertEquals("10.1109/sose.2014.26", fetcher.findIdentifier(entry).get().getDOI().toLowerCase(Locale.ENGLISH)); } @Test - public void notFindIncompleteTitle() throws Exception { + void notFindIncompleteTitle() throws Exception { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Towards Application Portability"); entry.setField(StandardField.AUTHOR, "Stefan Kolb and Guido Wirtz"); @@ -70,7 +70,7 @@ public void notFindIncompleteTitle() throws Exception { } @Test - public void acceptTitleUnderThreshold() throws Exception { + void acceptTitleUnderThreshold() throws Exception { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Towards Application Portability in Platform as a Service----"); entry.setField(StandardField.AUTHOR, "Stefan Kolb and Guido Wirtz"); @@ -78,7 +78,7 @@ public void acceptTitleUnderThreshold() throws Exception { } @Test - public void notAcceptTitleOverThreshold() throws Exception { + void notAcceptTitleOverThreshold() throws Exception { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Towards Application Portability in Platform as a Service-----"); entry.setField(StandardField.AUTHOR, "Stefan Kolb and Guido Wirtz"); @@ -86,7 +86,7 @@ public void notAcceptTitleOverThreshold() throws Exception { } @Test - public void findWrongAuthor() throws Exception { + void findWrongAuthor() throws Exception { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Towards Application Portability in Platform as a Service"); entry.setField(StandardField.AUTHOR, "Stefan Kolb and Simon Harrer"); @@ -94,7 +94,7 @@ public void findWrongAuthor() throws Exception { } @Test - public void findWithSubtitle() throws Exception { + void findWithSubtitle() throws Exception { BibEntry entry = new BibEntry(); // CrossRef entry will only include { "title": "A break in the clouds", "subtitle": "towards a cloud definition" } entry.setField(StandardField.TITLE, "A break in the clouds: towards a cloud definition"); @@ -102,17 +102,17 @@ public void findWithSubtitle() throws Exception { } @Test - public void findByDOI() throws Exception { + void findByDOI() throws Exception { assertEquals(Optional.of(barrosEntry), fetcher.performSearchById("10.1007/11538394_20")); } @Test - public void findByAuthors() throws Exception { + void findByAuthors() throws Exception { assertEquals(Optional.of(barrosEntry), fetcher.performSearch("\"Barros, Alistair\" AND \"Dumas, Marlon\" AND \"Arthur H.M. ter Hofstede\"").stream().findFirst()); } @Test - public void findByEntry() throws Exception { + void findByEntry() throws Exception { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "Service Interaction Patterns"); entry.setField(StandardField.AUTHOR, "Barros, Alistair and Dumas, Marlon and Arthur H.M. ter Hofstede"); @@ -121,7 +121,7 @@ public void findByEntry() throws Exception { } @Test - public void performSearchByIdFindsPaperWithoutTitle() throws Exception { + void performSearchByIdFindsPaperWithoutTitle() throws Exception { BibEntry entry = new BibEntry(StandardEntryType.Article); entry.setField(StandardField.AUTHOR, "Dominik Wujastyk"); entry.setField(StandardField.DOI, "10.1023/a:1003473214310"); @@ -138,12 +138,12 @@ public void performSearchByIdFindsPaperWithoutTitle() throws Exception { } @Test - public void performSearchByEmptyId() throws Exception { + void performSearchByEmptyId() throws Exception { assertEquals(Optional.empty(), fetcher.performSearchById("")); } @Test - public void performSearchByEmptyQuery() throws Exception { + void performSearchByEmptyQuery() throws Exception { assertEquals(Collections.emptyList(), fetcher.performSearch("")); } @@ -151,7 +151,7 @@ public void performSearchByEmptyQuery() throws Exception { * reveal fetching error on crossref performSearchById */ @Test - public void testPerformSearchValidReturnNothingDOI() throws FetcherException { + void testPerformSearchValidReturnNothingDOI() throws FetcherException { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("10.1392/BC1.0")); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/DBLPFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/DBLPFetcherTest.java index 5e051e483941..162651d09865 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DBLPFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DBLPFetcherTest.java @@ -19,13 +19,13 @@ import static org.mockito.Mockito.mock; @FetcherTest -public class DBLPFetcherTest { +class DBLPFetcherTest { private DBLPFetcher dblpFetcher; private BibEntry entry; @BeforeEach - public void setUp() { + void setUp() { dblpFetcher = new DBLPFetcher(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); entry = new BibEntry(); @@ -45,7 +45,7 @@ public void setUp() { } @Test - public void findSingleEntry() throws FetcherException { + void findSingleEntry() throws FetcherException { // In Lucene curly brackets are used for range queries, therefore they have to be escaped using "". See https://lucene.apache.org/core/5_4_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html String query = "Process Engine Benchmarking with Betsy in the Context of \"{ISO/IEC}\" Quality Standards"; List result = dblpFetcher.performSearch(query); @@ -54,7 +54,7 @@ public void findSingleEntry() throws FetcherException { } @Test - public void findSingleEntryUsingComplexOperators() throws FetcherException { + void findSingleEntryUsingComplexOperators() throws FetcherException { String query = "geiger harrer betsy$ softw.trends"; // -wirtz Negative operators do no longer work, see issue https://github.com/JabRef/jabref/issues/2890 List result = dblpFetcher.performSearch(query); @@ -62,7 +62,7 @@ public void findSingleEntryUsingComplexOperators() throws FetcherException { } @Test - public void findNothing() throws Exception { + void findNothing() throws Exception { assertEquals(Collections.emptyList(), dblpFetcher.performSearch("")); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/DOABFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/DOABFetcherTest.java index 024e6e0dffb8..988f5d741c51 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DOABFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DOABFetcherTest.java @@ -23,7 +23,7 @@ public class DOABFetcherTest { private final DOABFetcher fetcher = new DOABFetcher(); @Test - public void testGetName() { + void testGetName() { assertEquals("DOAB", fetcher.getName()); } @@ -106,7 +106,7 @@ public static Stream testPerformSearch() { @ParameterizedTest @MethodSource - public void testPerformSearch(BibEntry expected, String query) throws FetcherException { + void testPerformSearch(BibEntry expected, String query) throws FetcherException { List entries = fetcher.performSearch(query); // We must not contain abstracts in our code base; thus we remove the abstracts from the fetched results entries.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/DOAJFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/DOAJFetcherTest.java index 1c7fec0b3528..6b903b8e543f 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DOAJFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DOAJFetcherTest.java @@ -68,7 +68,7 @@ void testBibJSONConverter() { } @Test - public void searchByEmptyQuery() throws Exception { + void searchByEmptyQuery() throws Exception { assertEquals(Collections.emptyList(), fetcher.performSearch("")); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/DiVATest.java b/src/test/java/org/jabref/logic/importer/fetcher/DiVATest.java index bd00f6d1627b..20264c149c21 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DiVATest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DiVATest.java @@ -18,22 +18,22 @@ import static org.mockito.Mockito.mock; @FetcherTest -public class DiVATest { +class DiVATest { private DiVA fetcher; @BeforeEach - public void setUp() { + void setUp() { fetcher = new DiVA(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); } @Test - public void testGetName() { + void testGetName() { assertEquals("DiVA", fetcher.getName()); } @Test - public void testPerformSearchById() throws Exception { + void testPerformSearchById() throws Exception { BibEntry entry = new BibEntry(); entry.setType(StandardEntryType.Article); entry.setCitationKey("Gustafsson260746"); @@ -53,17 +53,17 @@ public void testPerformSearchById() throws Exception { } @Test - public void testValidIdentifier() { + void testValidIdentifier() { assertTrue(fetcher.isValidId("diva2:260746")); } @Test - public void testInvalidIdentifier() { + void testInvalidIdentifier() { assertFalse(fetcher.isValidId("banana")); } @Test - public void testEmptyId() throws Exception { + void testEmptyId() throws Exception { assertEquals(Optional.empty(), fetcher.performSearchById("")); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java index da157b423471..1d5290dac11d 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java @@ -17,7 +17,7 @@ import static org.mockito.Mockito.mock; @FetcherTest -public class DoiFetcherTest { +class DoiFetcherTest { private final DoiFetcher fetcher = new DoiFetcher(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); @@ -69,56 +69,56 @@ public class DoiFetcherTest { .withField(StandardField.NUMBER, "2"); @Test - public void testGetName() { + void testGetName() { assertEquals("DOI", fetcher.getName()); } @Test - public void testPerformSearchBurd2011() throws FetcherException { + void testPerformSearchBurd2011() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("10.1002/9781118257517"); assertEquals(Optional.of(bibEntryBurd2011), fetchedEntry); } @Test - public void testPerformSearchDecker2007() throws FetcherException { + void testPerformSearchDecker2007() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("10.1109/ICWS.2007.59"); assertEquals(Optional.of(bibEntryDecker2007), fetchedEntry); } @Test - public void testPerformSearchIannarelli2019() throws FetcherException { + void testPerformSearchIannarelli2019() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("10.3303/CET1977146"); assertEquals(Optional.of(bibEntryIannarelli2019), fetchedEntry); } @Test - public void testPerformSearchEmptyDOI() { + void testPerformSearchEmptyDOI() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("")); } @Test - public void testPerformSearchInvalidDOI() { + void testPerformSearchInvalidDOI() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("10.1002/9781118257517F")); } @Test - public void testPerformSearchInvalidDOIClientResultsinFetcherClientException() { + void testPerformSearchInvalidDOIClientResultsinFetcherClientException() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("10.1002/9781118257517F")); } @Test - public void testPerformSearchInvalidDOIClientResultsinFetcherClientException2() { + void testPerformSearchInvalidDOIClientResultsinFetcherClientException2() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("10.1002/9781517F")); } @Test - public void testPerformSearchNonTrimmedDOI() throws FetcherException { + void testPerformSearchNonTrimmedDOI() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("http s://doi.org/ 10.1109 /ICWS .2007.59 "); assertEquals(Optional.of(bibEntryDecker2007), fetchedEntry); } @Test - public void testAPSJournalCopiesArticleIdToPageField() throws FetcherException { + void testAPSJournalCopiesArticleIdToPageField() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("10.1103/physreva.102.023315"); assertEquals(Optional.of(bibEntryStenzel2020), fetchedEntry); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/GrobidCitationFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/GrobidCitationFetcherTest.java index 99f5a8159784..0b345927de38 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/GrobidCitationFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/GrobidCitationFetcherTest.java @@ -102,32 +102,32 @@ public static Stream provideInvalidInput() { @ParameterizedTest(name = "{0}") @MethodSource("provideExamplesForCorrectResultTest") - public void grobidPerformSearchCorrectResultTest(String testName, BibEntry expectedBibEntry, String searchQuery) throws FetcherException { + void grobidPerformSearchCorrectResultTest(String testName, BibEntry expectedBibEntry, String searchQuery) throws FetcherException { List entries = grobidCitationFetcher.performSearch(searchQuery); assertEquals(List.of(expectedBibEntry), entries); } @Test - public void grobidPerformSearchCorrectlySplitsStringTest() throws FetcherException { + void grobidPerformSearchCorrectlySplitsStringTest() throws FetcherException { List entries = grobidCitationFetcher.performSearch(example1 + "\n\n" + example2 + "\r\n\r\n" + example3 + "\r\r" + example4); assertEquals(List.of(example1AsBibEntry, example2AsBibEntry, example3AsBibEntry, example4AsBibEntry), entries); } @Test - public void grobidPerformSearchWithEmptyStringsTest() throws FetcherException { + void grobidPerformSearchWithEmptyStringsTest() throws FetcherException { List entries = grobidCitationFetcher.performSearch(" \n "); assertEquals(Collections.emptyList(), entries); } @ParameterizedTest @MethodSource("provideInvalidInput") - public void grobidPerformSearchWithInvalidDataTest(String invalidInput) throws FetcherException { + void grobidPerformSearchWithInvalidDataTest(String invalidInput) throws FetcherException { List entries = grobidCitationFetcher.performSearch(invalidInput); assertEquals(Collections.emptyList(), entries); } @Test - public void performSearchThrowsExceptionInCaseOfConnectionIssues() throws IOException, ParseException { + void performSearchThrowsExceptionInCaseOfConnectionIssues() throws IOException, ParseException { GrobidService grobidServiceMock = mock(GrobidService.class); when(grobidServiceMock.processCitation(anyString(), any(), any())).thenThrow(new SocketTimeoutException("Timeout")); grobidCitationFetcher = new GrobidCitationFetcher(importFormatPreferences, grobidServiceMock); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java index 7ba45ee9aadf..f9fd9017cebc 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/GvkFetcherTest.java @@ -24,14 +24,14 @@ import static org.mockito.Mockito.mock; @FetcherTest -public class GvkFetcherTest { +class GvkFetcherTest { private GvkFetcher fetcher; private BibEntry bibEntryPPN591166003; private BibEntry bibEntryPPN66391437X; @BeforeEach - public void setUp() { + void setUp() { fetcher = new GvkFetcher(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); bibEntryPPN591166003 = new BibEntry(StandardEntryType.Book) @@ -61,12 +61,12 @@ public void setUp() { } @Test - public void testGetName() { + void testGetName() { assertEquals("GVK", fetcher.getName()); } @Test - public void simpleSearchQueryURLCorrect() throws Exception { + void simpleSearchQueryURLCorrect() throws Exception { String query = "java jdk"; QueryNode luceneQuery = new StandardSyntaxParser().parse(query, AbstractQueryTransformer.NO_EXPLICIT_FIELD); URL url = fetcher.getURLForQuery(luceneQuery); @@ -74,7 +74,7 @@ public void simpleSearchQueryURLCorrect() throws Exception { } @Test - public void complexSearchQueryURLCorrect() throws Exception { + void complexSearchQueryURLCorrect() throws Exception { String query = "kon:java tit:jdk"; QueryNode luceneQuery = new StandardSyntaxParser().parse(query, AbstractQueryTransformer.NO_EXPLICIT_FIELD); URL url = fetcher.getURLForQuery(luceneQuery); @@ -82,26 +82,26 @@ public void complexSearchQueryURLCorrect() throws Exception { } @Test - public void testPerformSearchMatchingMultipleEntries() throws FetcherException { + void testPerformSearchMatchingMultipleEntries() throws FetcherException { List searchResult = fetcher.performSearch("title:\"effective java\""); assertTrue(searchResult.contains(bibEntryPPN591166003)); assertTrue(searchResult.contains(bibEntryPPN66391437X)); } @Test - public void testPerformSearch591166003() throws FetcherException { + void testPerformSearch591166003() throws FetcherException { List searchResult = fetcher.performSearch("ppn:591166003"); assertEquals(Collections.singletonList(bibEntryPPN591166003), searchResult); } @Test - public void testPerformSearch66391437X() throws FetcherException { + void testPerformSearch66391437X() throws FetcherException { List searchResult = fetcher.performSearch("ppn:66391437X"); assertEquals(Collections.singletonList(bibEntryPPN66391437X), searchResult); } @Test - public void testPerformSearchEmpty() throws FetcherException { + void testPerformSearchEmpty() throws FetcherException { List searchResult = fetcher.performSearch(""); assertEquals(Collections.emptyList(), searchResult); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/INSPIREFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/INSPIREFetcherTest.java index 9d73958d2bc5..dfb4608e1ea9 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/INSPIREFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/INSPIREFetcherTest.java @@ -44,7 +44,7 @@ void searchByQueryFindsEntry() throws Exception { } @Test - public void searchByIdentifierFindsEntry() throws Exception { + void searchByIdentifierFindsEntry() throws Exception { BibEntry article = new BibEntry(StandardEntryType.Article) .withCitationKey("Melnikov:1998pr") .withField(StandardField.AUTHOR, "Melnikov, Kirill and Yelkhovsky, Alexander") @@ -62,7 +62,7 @@ public void searchByIdentifierFindsEntry() throws Exception { } @Test - public void searchByExistingEntry() throws Exception { + void searchByExistingEntry() throws Exception { BibEntry article = new BibEntry(StandardEntryType.Article) .withCitationKey("Melnikov:1998pr") .withField(StandardField.AUTHOR, "Melnikov, Kirill and Yelkhovsky, Alexander") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java index c168c4bceb70..d3aa6b29349e 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java @@ -34,7 +34,7 @@ @FetcherTest @DisabledOnCIServer("eprint.iacr.org blocks with 500 when there are too many calls from the same IP address.") -public class IacrEprintFetcherTest { +class IacrEprintFetcherTest { private IacrEprintFetcher fetcher; private BibEntry abram2017; @@ -43,7 +43,7 @@ public class IacrEprintFetcherTest { private BibEntry delgado2017; @BeforeEach - public void setUp() { + void setUp() { fetcher = new IacrEprintFetcher(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); abram2017 = new BibEntry(StandardEntryType.Misc) @@ -96,7 +96,7 @@ public void setUp() { } @Test - public void searchByIdWithValidId1() throws FetcherException { + void searchByIdWithValidId1() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("Report 2017/1118 "); assertFalse(fetchedEntry.get().getField(StandardField.ABSTRACT).get().isEmpty()); fetchedEntry.get().setField(StandardField.ABSTRACT, "dummy"); @@ -104,7 +104,7 @@ public void searchByIdWithValidId1() throws FetcherException { } @Test - public void searchByIdWithValidId2() throws FetcherException { + void searchByIdWithValidId2() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("iacr ePrint 2016/119"); assertFalse(fetchedEntry.get().getField(StandardField.ABSTRACT).get().isEmpty()); fetchedEntry.get().setField(StandardField.ABSTRACT, "dummy"); @@ -112,7 +112,7 @@ public void searchByIdWithValidId2() throws FetcherException { } @Test - public void searchByIdWithValidIdAndNonAsciiChars() throws FetcherException { + void searchByIdWithValidIdAndNonAsciiChars() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("some random 2017/1095 stuff around the id"); assertFalse(fetchedEntry.get().getField(StandardField.ABSTRACT).get().isEmpty()); fetchedEntry.get().setField(StandardField.ABSTRACT, "dummy"); @@ -120,42 +120,42 @@ public void searchByIdWithValidIdAndNonAsciiChars() throws FetcherException { } @Test - public void searchByIdWithEmptyIdFails() { + void searchByIdWithEmptyIdFails() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("")); } @Test - public void searchByIdWithInvalidReportNumberFails() { + void searchByIdWithInvalidReportNumberFails() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("2016/1")); } @Test - public void searchByIdWithInvalidYearFails() { + void searchByIdWithInvalidYearFails() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("16/115")); } @Test - public void searchByIdWithInvalidIdFails() { + void searchByIdWithInvalidIdFails() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("asdf")); } @Test - public void searchForNonexistentIdFails() { + void searchForNonexistentIdFails() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("2016/6425")); } @Test - public void testGetName() { + void testGetName() { assertEquals(IacrEprintFetcher.NAME, fetcher.getName()); } @Test - public void searchByIdForWithdrawnPaperFails() { + void searchByIdForWithdrawnPaperFails() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("1998/016")); } @Test - public void searchByIdWithOldHtmlFormatAndCheckDate() throws FetcherException { + void searchByIdWithOldHtmlFormatAndCheckDate() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("1997/006"); assertEquals(Optional.of("1997-05-04"), fetchedEntry.get().getField(StandardField.DATE)); } @@ -164,7 +164,7 @@ public void searchByIdWithOldHtmlFormatAndCheckDate() throws FetcherException { @ParameterizedTest(name = "Fetch for id: {0}") @MethodSource("allNonWithdrawnIdsWithOldHtmlFormat") @Disabled("Takes a lot of time - should only be called manually") - public void searchByIdWithOldHtmlFormatWithoutDateCheck(String id) throws FetcherException { + void searchByIdWithOldHtmlFormatWithoutDateCheck(String id) throws FetcherException { Optional fetchedEntry = fetcher.performSearchById(id); assertTrue(fetchedEntry.isPresent(), "Expected to get an entry for id " + id); assertNotEquals(Optional.empty(), fetchedEntry.get().getField(StandardField.DATE), "Expected non empty date field, entry is\n" + fetchedEntry.toString()); @@ -201,19 +201,19 @@ private static Stream allNonWithdrawnIdsWithOldHtmlFormat() { } @Test - public void getFulltextWithVersion() throws FetcherException, IOException { + void getFulltextWithVersion() throws FetcherException, IOException { Optional pdfUrl = fetcher.findFullText(abram2017); assertEquals(Optional.of("https://eprint.iacr.org/archive/2017/1118/1511505927.pdf"), pdfUrl.map(URL::toString)); } @Test - public void getFulltextWithoutVersion() throws FetcherException, IOException { + void getFulltextWithoutVersion() throws FetcherException, IOException { Optional pdfUrl = fetcher.findFullText(abram2017noVersion); assertEquals(Optional.of("https://eprint.iacr.org/2017/1118.pdf"), pdfUrl.map(URL::toString)); } @Test - public void getFulltextWithoutUrl() throws FetcherException, IOException { + void getFulltextWithoutUrl() throws FetcherException, IOException { BibEntry abram2017WithoutUrl = abram2017; abram2017WithoutUrl.clearField(StandardField.URL); Optional pdfUrl = fetcher.findFullText(abram2017WithoutUrl); @@ -221,7 +221,7 @@ public void getFulltextWithoutUrl() throws FetcherException, IOException { } @Test - public void getFulltextWithNonIACRUrl() throws IOException { + void getFulltextWithNonIACRUrl() throws IOException { BibEntry abram2017WithNonIACRUrl = abram2017; abram2017WithNonIACRUrl.setField(StandardField.URL, "https://example.com"); assertThrows(FetcherException.class, () -> fetcher.findFullText(abram2017WithNonIACRUrl)); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/LibraryOfCongressTest.java b/src/test/java/org/jabref/logic/importer/fetcher/LibraryOfCongressTest.java index b995165689be..53911234bd37 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/LibraryOfCongressTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/LibraryOfCongressTest.java @@ -19,12 +19,12 @@ import static org.mockito.Mockito.when; @FetcherTest -public class LibraryOfCongressTest { +class LibraryOfCongressTest { private LibraryOfCongress fetcher; @BeforeEach - public void setUp() { + void setUp() { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class); when(importFormatPreferences.bibEntryPreferences()).thenReturn(mock(BibEntryPreferences.class)); when(importFormatPreferences.bibEntryPreferences().getKeywordSeparator()).thenReturn(','); @@ -33,7 +33,7 @@ public void setUp() { } @Test - public void performSearchById() throws Exception { + void performSearchById() throws Exception { BibEntry expected = new BibEntry() .withField(StandardField.ADDRESS, "mau, Burlington, MA") .withField(StandardField.AUTHOR, "West, Matthew") @@ -53,12 +53,12 @@ public void performSearchById() throws Exception { } @Test - public void performSearchByEmptyId() throws Exception { + void performSearchByEmptyId() throws Exception { assertEquals(Optional.empty(), fetcher.performSearchById("")); } @Test - public void performSearchByInvalidId() { + void performSearchByInvalidId() { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("xxx")); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java index 65573de7c5e5..7fa8cc3628d3 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MedlineFetcherTest.java @@ -19,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @FetcherTest -public class MedlineFetcherTest { +class MedlineFetcherTest { private MedlineFetcher fetcher; private BibEntry entryWijedasa; @@ -28,7 +28,7 @@ public class MedlineFetcherTest { private BibEntry bibEntrySari; @BeforeEach - public void setUp() throws InterruptedException { + void setUp() throws InterruptedException { // pause between runs to avoid 403 and 429 at Medline Thread.sleep(1000); @@ -127,12 +127,12 @@ public void setUp() throws InterruptedException { } @Test - public void testGetName() { + void testGetName() { assertEquals("Medline/PubMed", fetcher.getName()); } @Test - public void testSearchByIDWijedasa() throws Exception { + void testSearchByIDWijedasa() throws Exception { Optional fetchedEntry = fetcher.performSearchById("27670948"); assertTrue(fetchedEntry.isPresent()); @@ -141,7 +141,7 @@ public void testSearchByIDWijedasa() throws Exception { } @Test - public void testSearchByIDEndharti() throws Exception { + void testSearchByIDEndharti() throws Exception { Optional fetchedEntry = fetcher.performSearchById("27670445"); assertTrue(fetchedEntry.isPresent()); @@ -150,7 +150,7 @@ public void testSearchByIDEndharti() throws Exception { } @Test - public void testSearchByIDIchikawa() throws Exception { + void testSearchByIDIchikawa() throws Exception { Optional fetchedEntry = fetcher.performSearchById("26197440"); assertTrue(fetchedEntry.isPresent()); @@ -159,7 +159,7 @@ public void testSearchByIDIchikawa() throws Exception { } @Test - public void testSearchByIDSari() throws Exception { + void testSearchByIDSari() throws Exception { Optional fetchedEntry = fetcher.performSearchById("26867355"); assertTrue(fetchedEntry.isPresent()); @@ -168,39 +168,39 @@ public void testSearchByIDSari() throws Exception { } @Test - public void testMultipleEntries() throws Exception { + void testMultipleEntries() throws Exception { List entryList = fetcher.performSearch("java"); entryList.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); // Remove abstract due to copyright); assertEquals(50, entryList.size()); } @Test - public void testWithLuceneQueryAuthorDate() throws Exception { + void testWithLuceneQueryAuthorDate() throws Exception { List entryList = fetcher.performSearch("author:vigmond AND year:2021"); entryList.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); // Remove abstract due to copyright); assertEquals(18, entryList.size()); } @Test - public void testWithLuceneQueryAuthorDateRange() throws Exception { + void testWithLuceneQueryAuthorDateRange() throws Exception { List entryList = fetcher.performSearch("author:vigmond AND year-range:2020-2021"); entryList.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); // Remove abstract due to copyright); assertEquals(28, entryList.size()); } @Test - public void testInvalidSearchTerm() throws Exception { + void testInvalidSearchTerm() throws Exception { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("this.is.a.invalid.search.term.for.the.medline.fetcher")); } @Test - public void testEmptyEntryList() throws Exception { + void testEmptyEntryList() throws Exception { List entryList = fetcher.performSearch("java is fantastic and awesome "); assertEquals(Collections.emptyList(), entryList); } @Test - public void testEmptyInput() throws Exception { + void testEmptyInput() throws Exception { assertEquals(Collections.emptyList(), fetcher.performSearch("")); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MedraTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MedraTest.java index 3d940312fa10..ae7b84f0d23d 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MedraTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MedraTest.java @@ -19,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; @FetcherTest -public class MedraTest { +class MedraTest { private final Medra fetcher = new Medra(); @@ -72,23 +72,23 @@ private static Stream getDoiBibEntryPairs() { } @Test - public void testGetName() { + void testGetName() { assertEquals("mEDRA", fetcher.getName()); } @Test - public void testPerformSearchEmptyDOI() throws FetcherException { + void testPerformSearchEmptyDOI() throws FetcherException { assertEquals(Optional.empty(), fetcher.performSearchById("")); } @Test - public void testPerformNonExistent() throws FetcherException { + void testPerformNonExistent() throws FetcherException { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("10.1016/j.bjoms.2007.08.004")); } @ParameterizedTest @MethodSource("getDoiBibEntryPairs") - public void testDoiBibEntryPairs(String identifier, Optional expected) throws FetcherException { + void testDoiBibEntryPairs(String identifier, Optional expected) throws FetcherException { Optional fetchedEntry = fetcher.performSearchById(identifier); assertEquals(expected, fetchedEntry); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java index 830cc5f67b1c..e7cbc5d0cd4b 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java @@ -16,12 +16,12 @@ import static org.junit.jupiter.api.Assertions.assertFalse; @FetcherTest -public class MrDLibFetcherTest { +class MrDLibFetcherTest { private MrDLibFetcher fetcher; @BeforeEach - public void setUp() { + void setUp() { MrDlibPreferences mrDlibPreferences = new MrDlibPreferences( true, false, @@ -31,7 +31,7 @@ public void setUp() { } @Test - public void testPerformSearch() throws FetcherException { + void testPerformSearch() throws FetcherException { BibEntry bibEntry = new BibEntry(); bibEntry.setField(StandardField.TITLE, "lernen"); List bibEntrys = fetcher.performSearch(bibEntry); @@ -39,7 +39,7 @@ public void testPerformSearch() throws FetcherException { } @Test - public void testPerformSearchForHornecker2006() throws FetcherException { + void testPerformSearchForHornecker2006() throws FetcherException { BibEntry bibEntry = new BibEntry(); bibEntry.setCitationKey("Hornecker:2006:GGT:1124772.1124838"); bibEntry.setField(StandardField.ADDRESS, "New York, NY, USA"); @@ -60,7 +60,7 @@ public void testPerformSearchForHornecker2006() throws FetcherException { } @Test - public void testGetName() { + void testGetName() { assertEquals("MDL_FETCHER", fetcher.getName()); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java b/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java index 5c04b29d7ec7..03e1fd9810e4 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/PicaXmlParserTest.java @@ -18,7 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; @FetcherTest -public class PicaXmlParserTest { +class PicaXmlParserTest { private void doTest(String xmlName, int expectedSize, List resourceNames) throws Exception { try (InputStream is = PicaXmlParserTest.class.getResourceAsStream(xmlName)) { @@ -35,22 +35,22 @@ private void doTest(String xmlName, int expectedSize, List resourceNames } @Test - public void emptyResult() throws Exception { + void emptyResult() throws Exception { doTest("gvk_empty_result_because_of_bad_query.xml", 0, Collections.emptyList()); } @Test - public void resultFor797485368() throws Exception { + void resultFor797485368() throws Exception { doTest("gvk_result_for_797485368.xml", 1, Collections.singletonList("gvk_result_for_797485368.bib")); } @Test - public void testGMP() throws Exception { + void testGMP() throws Exception { doTest("gvk_gmp.xml", 2, Arrays.asList("gvk_gmp.1.bib", "gvk_gmp.2.bib")); } @Test - public void subTitleTest() throws Exception { + void subTitleTest() throws Exception { try (InputStream is = PicaXmlParserTest.class.getResourceAsStream("gvk_artificial_subtitle_test.xml")) { PicaXmlParser parser = new PicaXmlParser(); List entries = parser.parseEntries(is); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ResearchGateTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ResearchGateTest.java index 5fdccc287c65..11bafc226e91 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ResearchGateTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ResearchGateTest.java @@ -27,7 +27,7 @@ @FetcherTest @DisabledOnCIServer("Blocked by Cloudflare") -public class ResearchGateTest { +class ResearchGateTest { private static final String URL_PDF = "https://www.researchgate.net/profile/Abdurrazzak-Gehani/publication/4207355_Paranoid_a_global_secure_file_access_control_system/links/5457747d0cf2cf516480995e/Paranoid-a-global-secure-file-access-control-system.pdf"; private final String URL_PAGE = "https://www.researchgate.net/publication/4207355_Paranoid_a_global_secure_file_access_control_system"; @@ -35,7 +35,7 @@ public class ResearchGateTest { private BibEntry entry; @BeforeEach - public void setUp() { + void setUp() { fetcher = new ResearchGate(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); entry = new BibEntry(StandardEntryType.InProceedings); entry.setField(StandardField.DOI, "10.1109/CSAC.2005.42"); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/RfcFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/RfcFetcherTest.java index ac5b57c55875..e89e028129db 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/RfcFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/RfcFetcherTest.java @@ -20,7 +20,7 @@ import static org.mockito.Mockito.mock; @FetcherTest -public class RfcFetcherTest { +class RfcFetcherTest { private RfcFetcher fetcher = new RfcFetcher(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); private BibEntry bibEntry = new BibEntry(StandardEntryType.Misc) @@ -39,12 +39,12 @@ public class RfcFetcherTest { .withField(StandardField.ABSTRACT, "The Hypertext Transfer Protocol (HTTP) is an application-level protocol with the lightness and speed necessary for distributed, collaborative, hypermedia information systems. This memo provides information for the Internet community. This memo does not specify an Internet standard of any kind."); @Test - public void getNameReturnsEqualIdName() { + void getNameReturnsEqualIdName() { assertEquals("RFC", fetcher.getName()); } @Test - public void performSearchByIdFindsEntryWithDraftIdentifier() throws Exception { + void performSearchByIdFindsEntryWithDraftIdentifier() throws Exception { BibEntry bibDraftEntry = new BibEntry(StandardEntryType.TechReport) .withField(InternalField.KEY_FIELD, "fielding-http-spec-01") .withField(StandardField.AUTHOR, "Henrik Nielsen and Roy T. Fielding and Tim Berners-Lee") @@ -67,12 +67,12 @@ public void performSearchByIdFindsEntryWithDraftIdentifier() throws Exception { @ParameterizedTest @CsvSource({"rfc1945", "RFC1945", "1945"}) - public void performSearchByIdFindsEntry(String identifier) throws Exception { + void performSearchByIdFindsEntry(String identifier) throws Exception { assertEquals(Optional.of(bibEntry), fetcher.performSearchById(identifier)); } @Test - public void performSearchByIdFindsNothingWithoutIdentifier() throws Exception { + void performSearchByIdFindsNothingWithoutIdentifier() throws Exception { assertEquals(Optional.empty(), fetcher.performSearchById("")); } @@ -83,7 +83,7 @@ public void performSearchByIdFindsNothingWithoutIdentifier() throws Exception { "RFC9999", // invalid identifier "banana"}) - public void performSearchByIdFindsNothingWithValidDraftIdentifier(String identifier) throws Exception { + void performSearchByIdFindsNothingWithValidDraftIdentifier(String identifier) throws Exception { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById(identifier)); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcherTest.java index 0af2c4f0eb45..a412d4f82e35 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ScholarArchiveFetcherTest.java @@ -15,12 +15,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @FetcherTest -public class ScholarArchiveFetcherTest { +class ScholarArchiveFetcherTest { private ScholarArchiveFetcher fetcher; private BibEntry bibEntry; @BeforeEach - public void setUp() { + void setUp() { fetcher = new ScholarArchiveFetcher(); bibEntry = new BibEntry(StandardEntryType.InCollection) .withField(StandardField.TITLE, "Query expansion using associated queries") @@ -35,12 +35,12 @@ public void setUp() { } @Test - public void getNameReturnsCorrectName() { + void getNameReturnsCorrectName() { assertEquals("ScholarArchive", fetcher.getName()); } @Test - public void performSearchReturnsExpectedResults() throws FetcherException { + void performSearchReturnsExpectedResults() throws FetcherException { List fetchedEntries = fetcher.performSearch("query"); fetchedEntries.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); assertTrue(fetchedEntries.contains(bibEntry), "Found the following entries " + fetchedEntries); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SearchBasedFetcherCapabilityTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SearchBasedFetcherCapabilityTest.java index a93f73bed17d..9140d652aa31 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SearchBasedFetcherCapabilityTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SearchBasedFetcherCapabilityTest.java @@ -12,7 +12,6 @@ import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.field.StandardField; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -43,7 +42,7 @@ default void supportsAuthorSearch() throws Exception { String author = bibEntry.getField(StandardField.AUTHOR).orElse(""); // The co-authors differ, thus we check for the author present at all papers - getTestAuthors().forEach(expectedAuthor -> Assertions.assertTrue(author.contains(expectedAuthor.replace("\"", "")))); + getTestAuthors().forEach(expectedAuthor -> assertTrue(author.contains(expectedAuthor.replace("\"", "")))); }); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SemanticScholarTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SemanticScholarTest.java index 806f400009c1..81d116190f55 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SemanticScholarTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SemanticScholarTest.java @@ -160,12 +160,12 @@ void searchByQuotedQueryFindsEntry() throws Exception { } @Test - public void performSearchByEmptyQuery() throws Exception { + void performSearchByEmptyQuery() throws Exception { assertEquals(Collections.emptyList(), fetcher.performSearch("")); } @Test - public void findByEntry() throws Exception { + void findByEntry() throws Exception { BibEntry barrosEntry = new BibEntry(StandardEntryType.Article) .withField(StandardField.TITLE, "Formalising BPMN Service Interaction Patterns") .withField(StandardField.AUTHOR, "Chiara Muzi and Luise Pufahl and Lorenzo Rossi and M. Weske and F. Tiezzi") diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java index 275642794f38..f7b4d4dd426f 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SpringerFetcherTest.java @@ -15,7 +15,6 @@ import org.jabref.testutils.category.FetcherTest; import kong.unirest.json.JSONObject; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -168,7 +167,7 @@ public void supportsYearRangeSearch() { } @Test - public void supportsPhraseSearch() throws Exception { + void supportsPhraseSearch() throws Exception { // Normal search should match due to Redmiles, Elissa M., phrase search on the other hand should not find it. BibEntry expected = new BibEntry(StandardEntryType.InCollection) .withField(StandardField.AUTHOR, "Booth, Kayla M. and Dosono, Bryan and Redmiles, Elissa M. and Morales, Miraida and Depew, Michael and Farzan, Rosta and Herman, Everett and Trahan, Keith and Tananis, Cindy") @@ -187,17 +186,17 @@ public void supportsPhraseSearch() throws Exception { List result = fetcher.performSearch("author:Redmiles David"); // Phrase search should be a subset of the normal search result. - Assertions.assertTrue(result.containsAll(resultPhrase)); + assertTrue(result.containsAll(resultPhrase)); result.removeAll(resultPhrase); - Assertions.assertEquals(Collections.singletonList(expected), result); + assertEquals(Collections.singletonList(expected), result); } @Test - public void supportsBooleanANDSearch() throws Exception { + void supportsBooleanANDSearch() throws Exception { List resultJustByAuthor = fetcher.performSearch("author:\"Redmiles, David\""); List result = fetcher.performSearch("author:\"Redmiles, David\" AND journal:\"Computer Supported Cooperative Work\""); - Assertions.assertTrue(resultJustByAuthor.containsAll(result)); + assertTrue(resultJustByAuthor.containsAll(result)); List allEntriesFromCSCW = result.stream() .filter(bibEntry -> "Computer Supported Cooperative Work (CSCW)" .equals(bibEntry.getField(StandardField.JOURNAL) diff --git a/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java b/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java index 67663cc27e66..2be3a5746ec4 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/SpringerLinkTest.java @@ -21,32 +21,32 @@ import static org.mockito.Mockito.when; @FetcherTest -public class SpringerLinkTest { +class SpringerLinkTest { private final ImporterPreferences importerPreferences = mock(ImporterPreferences.class); private SpringerLink finder; private BibEntry entry; @BeforeEach - public void setUp() { + void setUp() { when(importerPreferences.getApiKeys()).thenReturn(FXCollections.emptyObservableSet()); finder = new SpringerLink(importerPreferences); entry = new BibEntry(); } @Test - public void rejectNullParameter() { + void rejectNullParameter() { assertThrows(NullPointerException.class, () -> finder.findFullText(null)); } @Test - public void doiNotPresent() throws IOException { + void doiNotPresent() throws IOException { assertEquals(Optional.empty(), finder.findFullText(entry)); } @DisabledOnCIServer("Disable on CI Server to not hit the API call limit") @Test - public void findByDOI() throws IOException { + void findByDOI() throws IOException { entry.setField(StandardField.DOI, "10.1186/s13677-015-0042-8"); assertEquals( Optional.of(new URL("http://link.springer.com/content/pdf/10.1186/s13677-015-0042-8.pdf")), @@ -55,7 +55,7 @@ public void findByDOI() throws IOException { @DisabledOnCIServer("Disable on CI Server to not hit the API call limit") @Test - public void notFoundByDOI() throws IOException { + void notFoundByDOI() throws IOException { entry.setField(StandardField.DOI, "10.1186/unknown-doi"); assertEquals(Optional.empty(), finder.findFullText(entry)); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java index 9a4d229c0e27..522f17c81a53 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java @@ -17,13 +17,13 @@ import static org.mockito.Mockito.mock; @FetcherTest -public class TitleFetcherTest { +class TitleFetcherTest { private TitleFetcher fetcher; private BibEntry bibEntryBischof2009; @BeforeEach - public void setUp() { + void setUp() { fetcher = new TitleFetcher(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); bibEntryBischof2009 = new BibEntry(); @@ -39,24 +39,24 @@ public void setUp() { } @Test - public void testGetName() { + void testGetName() { assertEquals("Title", fetcher.getName()); } @Test - public void testPerformSearchKopp2007() throws FetcherException { + void testPerformSearchKopp2007() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("BPELscript: A simplified script syntax for WS-BPEL 2.0"); assertEquals(Optional.of(bibEntryBischof2009), fetchedEntry); } @Test - public void testPerformSearchEmptyTitle() throws FetcherException { + void testPerformSearchEmptyTitle() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById(""); assertEquals(Optional.empty(), fetchedEntry); } @Test - public void testPerformSearchInvalidTitle() throws FetcherException { + void testPerformSearchInvalidTitle() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("An unknown title where noi DOI can be determined"); assertEquals(Optional.empty(), fetchedEntry); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/DoiToBibtexConverterComIsbnFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/DoiToBibtexConverterComIsbnFetcherTest.java index 17f079edacdf..3d123018a629 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/DoiToBibtexConverterComIsbnFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/DoiToBibtexConverterComIsbnFetcherTest.java @@ -22,10 +22,10 @@ @Disabled("Page https://doi-to-bibtex-converter.herokuapp.com is down") @FetcherTest -public class DoiToBibtexConverterComIsbnFetcherTest extends AbstractIsbnFetcherTest { +class DoiToBibtexConverterComIsbnFetcherTest extends AbstractIsbnFetcherTest { @BeforeEach - public void setUp() { + void setUp() { bibEntryEffectiveJava = new BibEntry(StandardEntryType.Book) .withField(StandardField.TITLE, "Effective Java(TM) Programming Language Guide (2nd Edition) (The Java Series)") .withField(StandardField.PUBLISHER, "Prentice Hall PTR") @@ -73,17 +73,17 @@ public void authorsAreCorrectlyFormatted() throws Exception { } @Test - public void testIsbnNeitherAvailable() { + void testIsbnNeitherAvailable() { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("9785646216541")); } @Test - public void searchByIdFailedWithLongISBN() { + void searchByIdFailedWithLongISBN() { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("9780321356680")); } @Test - public void searchByIdFailedWithShortISBN() throws FetcherException { + void searchByIdFailedWithShortISBN() throws FetcherException { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("0321356683")); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/EbookDeIsbnFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/EbookDeIsbnFetcherTest.java index 842cae00daa6..985602bcdecc 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/EbookDeIsbnFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/EbookDeIsbnFetcherTest.java @@ -23,10 +23,10 @@ @Disabled @FetcherTest -public class EbookDeIsbnFetcherTest extends AbstractIsbnFetcherTest { +class EbookDeIsbnFetcherTest extends AbstractIsbnFetcherTest { @BeforeEach - public void setUp() { + void setUp() { bibEntryEffectiveJava = new BibEntry(StandardEntryType.Book) .withCitationKey("9780134685991") .withField(StandardField.TITLE, "Effective Java") @@ -85,7 +85,7 @@ public void authorsAreCorrectlyFormatted() throws Exception { * not available on ebook.de. */ @Test - public void searchForValidButNotFoundISBN() throws Exception { + void searchForValidButNotFoundISBN() throws Exception { assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("3728128155")); } } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/GVKIsbnFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/GVKIsbnFetcherTest.java index fbdd60630a72..0b00db3203f3 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/GVKIsbnFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/GVKIsbnFetcherTest.java @@ -18,12 +18,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class GVKIsbnFetcherTest extends AbstractIsbnFetcherTest { +class GVKIsbnFetcherTest extends AbstractIsbnFetcherTest { private BibEntry bibEntryEffectiveJavaLongISBN; @BeforeEach - public void setUp() { + void setUp() { bibEntryEffectiveJava = new BibEntry(StandardEntryType.Book) .withField(StandardField.TITLE, "Effective Java(TM) Programming Language Guide (2nd Edition) (The Java Series)") .withField(StandardField.PUBLISHER, "Prentice Hall PTR") @@ -95,7 +95,7 @@ public void authorsAreCorrectlyFormatted() throws Exception { * Checks whether the given ISBN is NOT available at any ISBN fetcher */ @Test - public void testIsbnNeitherAvailableOnEbookDeNorOrViaOpenLibrary() throws Exception { + void testIsbnNeitherAvailableOnEbookDeNorOrViaOpenLibrary() throws Exception { // In this test, the ISBN needs to be a valid (syntax+checksum) ISBN number // However, the ISBN number must not be assigned to a real book assertEquals(Optional.empty(), fetcher.performSearchById("9785646216541")); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/OpenLibraryIsbnFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/OpenLibraryIsbnFetcherTest.java index 1253ebab4644..fab75ea7797f 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/OpenLibraryIsbnFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/isbntobibtex/OpenLibraryIsbnFetcherTest.java @@ -18,10 +18,10 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; -public class OpenLibraryIsbnFetcherTest extends AbstractIsbnFetcherTest { +class OpenLibraryIsbnFetcherTest extends AbstractIsbnFetcherTest { @BeforeEach - public void setUp() { + void setUp() { bibEntryEffectiveJava = new BibEntry(StandardEntryType.Book) .withField(StandardField.TITLE, "Effective Java(TM) Programming Language Guide (2nd Edition) (The Java Series)") .withField(StandardField.PUBLISHER, "Prentice Hall PTR") @@ -71,7 +71,7 @@ public void authorsAreCorrectlyFormatted() throws Exception { * Checks whether the given ISBN is NOT available at any ISBN fetcher */ @Test - public void testIsbnNeitherAvailableOnEbookDeNorOrViaOpenLibrary() throws Exception { + void testIsbnNeitherAvailableOnEbookDeNorOrViaOpenLibrary() throws Exception { // In this test, the ISBN needs to be a valid (syntax+checksum) ISBN number // However, the ISBN number must not be assigned to a real book assertThrows(FetcherClientException.class, () -> fetcher.performSearchById("9785646216541")); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/transformers/CiteSeerQueryTransformerTest.java b/src/test/java/org/jabref/logic/importer/fetcher/transformers/CiteSeerQueryTransformerTest.java index f2ba8266284f..c858e3563a56 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/transformers/CiteSeerQueryTransformerTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/transformers/CiteSeerQueryTransformerTest.java @@ -54,7 +54,7 @@ public void convertYearRangeField() throws Exception { } @Test - public void convertPageField() throws Exception { + void convertPageField() throws Exception { String queryString = "page:2"; QueryNode luceneQuery = new StandardSyntaxParser().parse(queryString, AbstractQueryTransformer.NO_EXPLICIT_FIELD); CiteSeerQueryTransformer transformer = getTransformer(); @@ -65,7 +65,7 @@ public void convertPageField() throws Exception { } @Test - public void convertPageSizeField() throws Exception { + void convertPageSizeField() throws Exception { String queryString = "pageSize:20"; QueryNode luceneQuery = new StandardSyntaxParser().parse(queryString, AbstractQueryTransformer.NO_EXPLICIT_FIELD); CiteSeerQueryTransformer transformer = getTransformer(); @@ -76,7 +76,7 @@ public void convertPageSizeField() throws Exception { } @Test - public void convertSortByField() throws Exception { + void convertSortByField() throws Exception { String queryString = "sortBy:relevance"; QueryNode luceneQuery = new StandardSyntaxParser().parse(queryString, AbstractQueryTransformer.NO_EXPLICIT_FIELD); CiteSeerQueryTransformer transformer = getTransformer(); @@ -87,7 +87,7 @@ public void convertSortByField() throws Exception { } @Test - public void convertMultipleAuthors() throws Exception { + void convertMultipleAuthors() throws Exception { String queryString = "author:\"Wang Wei\" author:\"Zhang Pingwen\" author:\"Zhang Zhifei\""; QueryNode luceneQuery = new StandardSyntaxParser().parse(queryString, AbstractQueryTransformer.NO_EXPLICIT_FIELD); CiteSeerQueryTransformer transformer = getTransformer(); @@ -134,7 +134,7 @@ private static Stream getJSONWithYearVariations() throws FetcherExcep @ParameterizedTest @MethodSource("getJSONWithYearVariations") - public void compareJSONRequestsWithYearVariations(JSONObject expected, Integer yearStart, Integer yearEnd, JSONObject actual) throws Exception { + void compareJSONRequestsWithYearVariations(JSONObject expected, Integer yearStart, Integer yearEnd, JSONObject actual) throws Exception { expected.put("yearStart", yearStart); expected.put("yearEnd", yearEnd); assertEquals(expected, actual); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/transformers/IEEEQueryTransformerTest.java b/src/test/java/org/jabref/logic/importer/fetcher/transformers/IEEEQueryTransformerTest.java index 91f2fccce281..b932ccb82dee 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/transformers/IEEEQueryTransformerTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/transformers/IEEEQueryTransformerTest.java @@ -86,7 +86,7 @@ private static Stream getTitleTestData() { @ParameterizedTest @MethodSource("getTitleTestData") - public void testStopWordRemoval(String expected, String queryString) throws Exception { + void testStopWordRemoval(String expected, String queryString) throws Exception { QueryNode luceneQuery = new StandardSyntaxParser().parse(queryString, AbstractQueryTransformer.NO_EXPLICIT_FIELD); Optional result = getTransformer().transformLuceneQuery(luceneQuery); assertEquals(Optional.ofNullable(expected), result); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/ACMPortalParserTest.java b/src/test/java/org/jabref/logic/importer/fileformat/ACMPortalParserTest.java index 07dc0f82d101..b66bba6745c3 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/ACMPortalParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/ACMPortalParserTest.java @@ -26,7 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; @FetcherTest -public class ACMPortalParserTest { +class ACMPortalParserTest { ACMPortalParser parser; List searchEntryList; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterFilesTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterFilesTest.java index db9ad71e6133..7c4c3e97d999 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterFilesTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterFilesTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class BiblioscapeImporterFilesTest { +class BiblioscapeImporterFilesTest { private static final String FILE_ENDING = ".txt"; @@ -19,13 +19,13 @@ private static Stream fileNames() throws IOException { @ParameterizedTest @MethodSource("fileNames") - public void testIsRecognizedFormat(String fileName) throws IOException { + void testIsRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsRecognizedFormat(new BiblioscapeImporter(), fileName); } @ParameterizedTest @MethodSource("fileNames") - public void testImportEntries(String fileName) throws Exception { + void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(new BiblioscapeImporter(), fileName, FILE_ENDING); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTest.java index d83d80e5a0d9..9c21e2ab7c05 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTest.java @@ -10,38 +10,38 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class BiblioscapeImporterTest { +class BiblioscapeImporterTest { private BiblioscapeImporter importer; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { importer = new BiblioscapeImporter(); } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("Biblioscape", importer.getName()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.TXT, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Imports a Biblioscape Tag File.\n" + "Several Biblioscape field types are ignored. Others are only included in the BibTeX field \"comment\".", importer.getDescription()); } @Test - public void testGetCLIID() { + void testGetCLIID() { assertEquals("biblioscape", importer.getId()); } @Test - public void testImportEntriesAbortion() throws Throwable { + void testImportEntriesAbortion() throws Throwable { Path file = Path.of(BiblioscapeImporter.class.getResource("BiblioscapeImporterTestCorrupt.txt").toURI()); assertEquals(Collections.emptyList(), importer.importDatabase(file).getDatabase().getEntries()); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTypesTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTypesTest.java index e0aaded5a0cd..5aadf0309fe7 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTypesTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTypesTest.java @@ -12,8 +12,9 @@ import org.jabref.model.entry.types.EntryType; import org.jabref.model.entry.types.StandardEntryType; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; + +import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -49,6 +50,6 @@ void importConvertsToCorrectBibType(String biblioscapeType, EntryType bibtexType entry.setField(StandardField.YEAR, "1999"); entry.setType(bibtexType); - Assertions.assertEquals(Collections.singletonList(entry), bibEntries); + assertEquals(Collections.singletonList(entry), bibEntries); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java index d95eb7382c9c..3196e33b0fe6 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java @@ -37,23 +37,23 @@ * Tests for writing can be found at {@link org.jabref.logic.exporter.BibtexDatabaseWriterTest}. * Tests for parsing single entry BibTeX can be found at {@link BibtexParserTest} */ -public class BibtexImporterTest { +class BibtexImporterTest { private BibtexImporter importer; @BeforeEach - public void setUp() { + void setUp() { importer = new BibtexImporter(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS), new DummyFileUpdateMonitor()); } @Test - public void testIsRecognizedFormat() throws IOException, URISyntaxException { + void testIsRecognizedFormat() throws IOException, URISyntaxException { Path file = Path.of(BibtexImporterTest.class.getResource("BibtexImporter.examples.bib").toURI()); assertTrue(importer.isRecognizedFormat(file)); } @Test - public void testImportEntries() throws IOException, URISyntaxException { + void testImportEntries() throws IOException, URISyntaxException { Path file = Path.of(BibtexImporterTest.class.getResource("BibtexImporter.examples.bib").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); @@ -112,24 +112,24 @@ public void testImportEntries() throws IOException, URISyntaxException { } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("BibTeX", importer.getName()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.BIBTEX_DB, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals( "This importer enables `--importToOpen someEntry.bib`", importer.getDescription()); } @Test - public void testRecognizesDatabaseID() throws Exception { + void testRecognizesDatabaseID() throws Exception { Path file = Path.of(BibtexImporterTest.class.getResource("AutosavedSharedDatabase.bib").toURI()); String sharedDatabaseID = importer.importDatabase(file).getDatabase().getSharedDatabaseID().get(); assertEquals("13ceoc8dm42f5g1iitao3dj2ap", sharedDatabaseID); @@ -147,7 +147,7 @@ static Stream testParsingOfEncodedFileWithHeader() { @ParameterizedTest @MethodSource - public void testParsingOfEncodedFileWithHeader(Charset charset, String fileName) throws Exception { + void testParsingOfEncodedFileWithHeader(Charset charset, String fileName) throws Exception { ParserResult parserResult = importer.importDatabase( Path.of(BibtexImporterTest.class.getResource(fileName).toURI())); assertEquals(Optional.of(charset), parserResult.getMetaData().getEncoding()); @@ -155,7 +155,7 @@ public void testParsingOfEncodedFileWithHeader(Charset charset, String fileName) @ParameterizedTest @CsvSource({"encoding-windows-1252-with-header.bib", "encoding-windows-1252-without-header.bib"}) - public void testParsingOfWindows1252EncodedFileReadsDegreeCharacterCorrectly(String filename) throws Exception { + void testParsingOfWindows1252EncodedFileReadsDegreeCharacterCorrectly(String filename) throws Exception { ParserResult parserResult = importer.importDatabase( Path.of(BibtexImporterTest.class.getResource(filename).toURI())); assertEquals( @@ -165,8 +165,8 @@ public void testParsingOfWindows1252EncodedFileReadsDegreeCharacterCorrectly(Str @ParameterizedTest @CsvSource({"encoding-utf-8-with-header.bib", "encoding-utf-8-without-header.bib", - "encoding-utf-16BE-with-header.bib", "encoding-utf-16BE-without-header.bib"}) - public void testParsingFilesReadsUmlautCharacterCorrectly(String filename) throws Exception { + "encoding-utf-16BE-with-header.bib", "encoding-utf-16BE-without-header.bib"}) + void testParsingFilesReadsUmlautCharacterCorrectly(String filename) throws Exception { ParserResult parserResult = importer.importDatabase( Path.of(BibtexImporterTest.class.getResource(filename).toURI())); assertEquals( @@ -185,14 +185,14 @@ private static Stream encodingExplicitlySuppliedCorrectlyDetermined() @ParameterizedTest @MethodSource - public void encodingExplicitlySuppliedCorrectlyDetermined(String filename, boolean encodingExplicitlySupplied) throws Exception { + void encodingExplicitlySuppliedCorrectlyDetermined(String filename, boolean encodingExplicitlySupplied) throws Exception { ParserResult parserResult = importer.importDatabase( Path.of(BibtexImporterTest.class.getResource(filename).toURI())); assertEquals(encodingExplicitlySupplied, parserResult.getMetaData().getEncodingExplicitlySupplied()); } @Test - public void wrongEncodingSupplied() throws Exception { + void wrongEncodingSupplied() throws Exception { ParserResult parserResult = importer.importDatabase( Path.of(BibtexImporterTest.class.getResource("encoding-windows-1252-but-utf-8-declared--decoding-fails.bib").toURI())); @@ -203,7 +203,7 @@ public void wrongEncodingSupplied() throws Exception { } @Test - public void encodingNotSupplied() throws Exception { + void encodingNotSupplied() throws Exception { ParserResult parserResult = importer.importDatabase( Path.of(BibtexImporterTest.class.getResource("encoding-utf-8-without-header.bib").toURI())); assertFalse(parserResult.getMetaData().getEncodingExplicitlySupplied()); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/CffImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/CffImporterTest.java index cc3e27cae1f3..0be6bb444c30 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/CffImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/CffImporterTest.java @@ -25,39 +25,39 @@ public class CffImporterTest { private CffImporter importer; @BeforeEach - public void setUp() { + void setUp() { importer = new CffImporter(); } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("CFF", importer.getName()); } @Test - public void testGetCLIId() { + void testGetCLIId() { assertEquals("cff", importer.getId()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.CFF, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Importer for the CFF format. Is only used to cite software, one entry per file.", importer.getDescription()); } @Test - public void testIsRecognizedFormat() throws IOException, URISyntaxException { + void testIsRecognizedFormat() throws IOException, URISyntaxException { Path file = Path.of(CffImporterTest.class.getResource("CffImporterTestValid.cff").toURI()); assertTrue(importer.isRecognizedFormat(file)); } @Test - public void testIsRecognizedFormatReject() throws IOException, URISyntaxException { + void testIsRecognizedFormatReject() throws IOException, URISyntaxException { List list = Arrays.asList("CffImporterTestInvalid1.cff", "CffImporterTestInvalid2.cff"); for (String string : list) { @@ -67,7 +67,7 @@ public void testIsRecognizedFormatReject() throws IOException, URISyntaxExceptio } @Test - public void testImportEntriesBasic() throws IOException, URISyntaxException { + void testImportEntriesBasic() throws IOException, URISyntaxException { Path file = Path.of(CffImporterTest.class.getResource("CffImporterTestValid.cff").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = bibEntries.get(0); @@ -78,7 +78,7 @@ public void testImportEntriesBasic() throws IOException, URISyntaxException { } @Test - public void testImportEntriesMultipleAuthors() throws IOException, URISyntaxException { + void testImportEntriesMultipleAuthors() throws IOException, URISyntaxException { Path file = Path.of(CffImporterTest.class.getResource("CffImporterTestValidMultAuthors.cff").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = bibEntries.get(0); @@ -89,7 +89,7 @@ public void testImportEntriesMultipleAuthors() throws IOException, URISyntaxExce } @Test - public void testImportEntriesSwhIdSelect1() throws IOException, URISyntaxException { + void testImportEntriesSwhIdSelect1() throws IOException, URISyntaxException { Path file = Path.of(CffImporterTest.class.getResource("CffImporterTestValidSwhIdSelect1.cff").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = bibEntries.get(0); @@ -100,7 +100,7 @@ public void testImportEntriesSwhIdSelect1() throws IOException, URISyntaxExcepti } @Test - public void testImportEntriesSwhIdSelect2() throws IOException, URISyntaxException { + void testImportEntriesSwhIdSelect2() throws IOException, URISyntaxException { Path file = Path.of(CffImporterTest.class.getResource("CffImporterTestValidSwhIdSelect2.cff").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = bibEntries.get(0); @@ -111,7 +111,7 @@ public void testImportEntriesSwhIdSelect2() throws IOException, URISyntaxExcepti } @Test - public void testImportEntriesDataset() throws IOException, URISyntaxException { + void testImportEntriesDataset() throws IOException, URISyntaxException { Path file = Path.of(CffImporterTest.class.getResource("CffImporterTestDataset.cff").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = bibEntries.get(0); @@ -123,7 +123,7 @@ public void testImportEntriesDataset() throws IOException, URISyntaxException { } @Test - public void testImportEntriesDoiSelect() throws IOException, URISyntaxException { + void testImportEntriesDoiSelect() throws IOException, URISyntaxException { Path file = Path.of(CffImporterTest.class.getResource("CffImporterTestDoiSelect.cff").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = bibEntries.get(0); @@ -134,7 +134,7 @@ public void testImportEntriesDoiSelect() throws IOException, URISyntaxException } @Test - public void testImportEntriesUnknownFields() throws IOException, URISyntaxException { + void testImportEntriesUnknownFields() throws IOException, URISyntaxException { Path file = Path.of(CffImporterTest.class.getResource("CffImporterTestUnknownFields.cff").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = bibEntries.get(0); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/CitaviXmlImporterFilesTest.java b/src/test/java/org/jabref/logic/importer/fileformat/CitaviXmlImporterFilesTest.java index 4f59c86b0d56..f9f353889630 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/CitaviXmlImporterFilesTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/CitaviXmlImporterFilesTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class CitaviXmlImporterFilesTest { +class CitaviXmlImporterFilesTest { private static final String FILE_ENDING = ".ctv6bak"; private final CitaviXmlImporter citaviXmlImporter = new CitaviXmlImporter(); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterFilesTest.java b/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterFilesTest.java index c35b0c4c9019..007343d47758 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterFilesTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterFilesTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class CopacImporterFilesTest { +class CopacImporterFilesTest { private static final String FILE_ENDING = ".txt"; @@ -24,19 +24,19 @@ private static Stream nonCopacfileNames() throws IOException { @ParameterizedTest @MethodSource("fileNames") - public void testIsRecognizedFormat(String fileName) throws IOException { + void testIsRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsRecognizedFormat(new CopacImporter(), fileName); } @ParameterizedTest @MethodSource("nonCopacfileNames") - public void testIsNotRecognizedFormat(String fileName) throws IOException { + void testIsNotRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsNotRecognizedFormat(new CopacImporter(), fileName); } @ParameterizedTest @MethodSource("fileNames") - public void testImportEntries(String fileName) throws Exception { + void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(new CopacImporter(), fileName, FILE_ENDING); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTest.java index 3ecf3760a493..552be6a2ea85 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTest.java @@ -12,27 +12,27 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class CopacImporterTest { +class CopacImporterTest { private CopacImporter importer; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { importer = new CopacImporter(); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.TXT, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Importer for COPAC format.", importer.getDescription()); } @Test - public void testImportEmptyEntries() throws Exception { + void testImportEmptyEntries() throws Exception { Path path = Path.of(CopacImporterTest.class.getResource("Empty.txt").toURI()); List entries = importer.importDatabase(path).getDatabase().getEntries(); assertEquals(Collections.emptyList(), entries); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/CustomImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/CustomImporterTest.java index 52108a8097d1..a0723605e9b1 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/CustomImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/CustomImporterTest.java @@ -11,72 +11,72 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class CustomImporterTest { +class CustomImporterTest { private CustomImporter importer; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { importer = asCustomImporter(new CopacImporter()); } @Test - public void testGetName() { + void testGetName() { assertEquals("Copac", importer.getName()); } @Test - public void testGetId() { + void testGetId() { assertEquals("cpc", importer.getId()); } @Test - public void testGetClassName() { + void testGetClassName() { assertEquals("org.jabref.logic.importer.fileformat.CopacImporter", importer.getClassName()); } @Test - public void testGetBasePath() { + void testGetBasePath() { assertEquals(Path.of("src/main/java/org/jabref/logic/importer/fileformat/CopacImporter.java"), importer.getBasePath()); } @Test - public void testGetAsStringList() { + void testGetAsStringList() { assertEquals(Arrays.asList("src/main/java/org/jabref/logic/importer/fileformat/CopacImporter.java", "org.jabref.logic.importer.fileformat.CopacImporter"), importer.getAsStringList()); } @Test - public void equalsWithSameReference() { + void equalsWithSameReference() { assertEquals(importer, importer); } @Test - public void equalsIsBasedOnName() { + void equalsIsBasedOnName() { // noinspection AssertEqualsBetweenInconvertibleTypes assertEquals(new CopacImporter(), importer); } @Test - public void testCompareToSmaller() throws Exception { + void testCompareToSmaller() throws Exception { CustomImporter ovidImporter = asCustomImporter(new OvidImporter()); assertTrue(importer.compareTo(ovidImporter) < 0); } @Test - public void testCompareToEven() throws Exception { + void testCompareToEven() throws Exception { assertEquals(0, importer.compareTo(asCustomImporter(new CopacImporter()))); } @Test - public void testToString() { + void testToString() { assertEquals("Copac", importer.toString()); } @Test - public void testClassicConstructor() throws Exception { + void testClassicConstructor() throws Exception { CustomImporter customImporter = new CustomImporter( "src/main/java/org/jabref/logic/importer/fileformat/CopacImporter.java", "org.jabref.logic.importer.fileformat.CopacImporter"); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java index 19fc7c8e63ea..7f44e20ba166 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java @@ -21,38 +21,38 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class EndnoteImporterTest { +class EndnoteImporterTest { private EndnoteImporter importer; @BeforeEach - public void setUp() { + void setUp() { importer = new EndnoteImporter(); } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("Refer/Endnote", importer.getName()); } @Test - public void testGetCLIId() { + void testGetCLIId() { assertEquals("refer", importer.getId()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.ENDNOTE, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Importer for the Refer/Endnote format." + " Modified to use article number for pages if pages are missing.", importer.getDescription()); } @Test - public void testIsRecognizedFormat() throws IOException, URISyntaxException { + void testIsRecognizedFormat() throws IOException, URISyntaxException { List list = Arrays.asList("Endnote.pattern.A.enw", "Endnote.pattern.E.enw", "Endnote.book.example.enw"); for (String string : list) { @@ -62,7 +62,7 @@ public void testIsRecognizedFormat() throws IOException, URISyntaxException { } @Test - public void testIsRecognizedFormatReject() throws IOException, URISyntaxException { + void testIsRecognizedFormatReject() throws IOException, URISyntaxException { List list = Arrays.asList("IEEEImport1.txt", "IsiImporterTest1.isi", "IsiImporterTestInspec.isi", "IsiImporterTestWOS.isi", "IsiImporterTestMedline.isi", "RisImporterTest1.ris", "Endnote.pattern.no_enw", "empty.pdf", "annotated.pdf"); @@ -74,7 +74,7 @@ public void testIsRecognizedFormatReject() throws IOException, URISyntaxExceptio } @Test - public void testImportEntries0() throws IOException, URISyntaxException { + void testImportEntries0() throws IOException, URISyntaxException { Path file = Path.of(EndnoteImporterTest.class.getResource("Endnote.entries.enw").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); @@ -119,7 +119,7 @@ public void testImportEntries0() throws IOException, URISyntaxException { } @Test - public void testImportEntries1() throws IOException { + void testImportEntries1() throws IOException { String medlineString = "%O Artn\\\\s testO\n%A testA,\n%E testE0, testE1"; List bibEntries = importer.importDatabase(new BufferedReader(new StringReader(medlineString))).getDatabase() .getEntries(); @@ -134,7 +134,7 @@ public void testImportEntries1() throws IOException { } @Test - public void testImportEntriesBookExample() throws IOException, URISyntaxException { + void testImportEntriesBookExample() throws IOException, URISyntaxException { Path file = Path.of(EndnoteImporterTest.class.getResource("Endnote.book.example.enw").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteXmlImporterFilesTest.java b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteXmlImporterFilesTest.java index ec3e816ae031..c30858864767 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteXmlImporterFilesTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteXmlImporterFilesTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class EndnoteXmlImporterFilesTest { +class EndnoteXmlImporterFilesTest { private static final String FILE_ENDING = ".xml"; private ImportFormatPreferences importFormatPreferences; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/ImporterTestEngine.java b/src/test/java/org/jabref/logic/importer/fileformat/ImporterTestEngine.java index 9d24b9c96d78..5dbb1a134722 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/ImporterTestEngine.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/ImporterTestEngine.java @@ -17,9 +17,9 @@ import org.jabref.logic.importer.ParserResult; import org.jabref.model.entry.BibEntry; -import org.junit.jupiter.api.Assertions; - import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ImporterTestEngine { @@ -40,11 +40,11 @@ public static Collection getTestFiles(Predicate fileNamePredicat } public static void testIsRecognizedFormat(Importer importer, String fileName) throws IOException { - Assertions.assertTrue(importer.isRecognizedFormat(getPath(fileName))); + assertTrue(importer.isRecognizedFormat(getPath(fileName))); } public static void testIsNotRecognizedFormat(Importer importer, String fileName) throws IOException { - Assertions.assertFalse(importer.isRecognizedFormat(getPath(fileName))); + assertFalse(importer.isRecognizedFormat(getPath(fileName))); } public static void testImportEntries(Importer importer, String fileName, String fileType) throws IOException, ImportException { diff --git a/src/test/java/org/jabref/logic/importer/fileformat/InspecImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/InspecImporterTest.java index 60de76aff260..9dfad36be5ca 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/InspecImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/InspecImporterTest.java @@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class InspecImporterTest { +class InspecImporterTest { private static final String FILE_ENDING = ".txt"; private InspecImporter importer; @@ -40,24 +40,24 @@ private static Stream nonInspecfileNames() throws IOException { } @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { this.importer = new InspecImporter(); } @ParameterizedTest @MethodSource("fileNames") - public void testIsRecognizedFormatAccept(String fileName) throws IOException { + void testIsRecognizedFormatAccept(String fileName) throws IOException { ImporterTestEngine.testIsRecognizedFormat(importer, fileName); } @ParameterizedTest @MethodSource("nonInspecfileNames") - public void testIsRecognizedFormatReject(String fileName) throws IOException { + void testIsRecognizedFormatReject(String fileName) throws IOException { ImporterTestEngine.testIsNotRecognizedFormat(importer, fileName); } @Test - public void testCompleteBibtexEntryOnJournalPaperImport() throws IOException, URISyntaxException { + void testCompleteBibtexEntryOnJournalPaperImport() throws IOException, URISyntaxException { BibEntry expectedEntry = new BibEntry(StandardEntryType.Article); expectedEntry.setField(StandardField.TITLE, "The SIS project : software reuse with a natural language approach"); expectedEntry.setField(StandardField.AUTHOR, "Prechelt, Lutz"); @@ -73,7 +73,7 @@ public void testCompleteBibtexEntryOnJournalPaperImport() throws IOException, UR } @Test - public void importConferencePaperGivesInproceedings() throws IOException { + void importConferencePaperGivesInproceedings() throws IOException { String testInput = "Record.*INSPEC.*\n" + "\n" + "RT ~ Conference-Paper\n" + @@ -88,7 +88,7 @@ public void importConferencePaperGivesInproceedings() throws IOException { } @Test - public void importMiscGivesMisc() throws IOException { + void importMiscGivesMisc() throws IOException { String testInput = "Record.*INSPEC.*\n" + "\n" + "AU ~ Prechelt, Lutz \n" + @@ -105,22 +105,22 @@ public void importMiscGivesMisc() throws IOException { } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("INSPEC", importer.getName()); } @Test - public void testGetCLIId() { + void testGetCLIId() { assertEquals("inspec", importer.getId()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.TXT, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("INSPEC format importer.", importer.getDescription()); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/IsiImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/IsiImporterTest.java index 1739ac4ee281..7be8133922f9 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/IsiImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/IsiImporterTest.java @@ -23,7 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class IsiImporterTest { +class IsiImporterTest { private static final String FILE_ENDING = ".isi"; private final IsiImporter importer = new IsiImporter(); @@ -41,45 +41,45 @@ private static Stream invalidFileNames() throws IOException { } @Test - public void testParseMonthException() { + void testParseMonthException() { IsiImporter.parseMonth("20l06 06-07"); } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("ISI", importer.getName()); } @Test - public void testGetCLIId() { + void testGetCLIId() { assertEquals("isi", importer.getId()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.ISI, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Importer for the ISI Web of Science, INSPEC and Medline format.", importer.getDescription()); } @ParameterizedTest @MethodSource("fileNames") - public void testIsRecognizedFormatAccepted(String fileName) throws IOException { + void testIsRecognizedFormatAccepted(String fileName) throws IOException { ImporterTestEngine.testIsRecognizedFormat(importer, fileName); } @ParameterizedTest @MethodSource("invalidFileNames") - public void testIsRecognizedFormatRejected(String fileName) throws IOException { + void testIsRecognizedFormatRejected(String fileName) throws IOException { ImporterTestEngine.testIsNotRecognizedFormat(importer, fileName); } @Test - public void testProcessSubSup() { + void testProcessSubSup() { HashMap subs = new HashMap<>(); subs.put(StandardField.TITLE, "/sub 3/"); @@ -124,7 +124,7 @@ public void testProcessSubSup() { } @Test - public void testImportEntries1() throws IOException, URISyntaxException { + void testImportEntries1() throws IOException, URISyntaxException { Path file = Path.of(IsiImporterTest.class.getResource("IsiImporterTest1.isi").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = entries.get(0); @@ -145,7 +145,7 @@ public void testImportEntries1() throws IOException, URISyntaxException { } @Test - public void testImportEntries2() throws IOException, URISyntaxException { + void testImportEntries2() throws IOException, URISyntaxException { Path file = Path.of(IsiImporterTest.class.getResource("IsiImporterTest2.isi").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = entries.get(0); @@ -162,7 +162,7 @@ public void testImportEntries2() throws IOException, URISyntaxException { } @Test - public void testImportEntriesINSPEC() throws IOException, URISyntaxException { + void testImportEntriesINSPEC() throws IOException, URISyntaxException { Path file = Path.of(IsiImporterTest.class.getResource("IsiImporterTestInspec.isi").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); @@ -199,7 +199,7 @@ public void testImportEntriesINSPEC() throws IOException, URISyntaxException { } @Test - public void testImportEntriesWOS() throws IOException, URISyntaxException { + void testImportEntriesWOS() throws IOException, URISyntaxException { Path file = Path.of(IsiImporterTest.class.getResource("IsiImporterTestWOS.isi").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); @@ -217,7 +217,7 @@ public void testImportEntriesWOS() throws IOException, URISyntaxException { } @Test - public void testIsiAuthorsConvert() { + void testIsiAuthorsConvert() { assertEquals( "James Brown and James Marc Brown and Brown, J. M. and Brown, J. and Brown, J. M. and Brown, J.", IsiImporter.isiAuthorsConvert( @@ -230,7 +230,7 @@ public void testIsiAuthorsConvert() { } @Test - public void testMonthConvert() { + void testMonthConvert() { assertEquals("#jun#", IsiImporter.parseMonth("06")); assertEquals("#jun#", IsiImporter.parseMonth("JUN")); assertEquals("#jun#", IsiImporter.parseMonth("jUn")); @@ -242,7 +242,7 @@ public void testMonthConvert() { } @Test - public void testIsiAuthorConvert() { + void testIsiAuthorConvert() { assertEquals("James Brown", IsiImporter.isiAuthorConvert("James Brown")); assertEquals("James Marc Brown", IsiImporter.isiAuthorConvert("James Marc Brown")); assertEquals("Brown, J. M.", IsiImporter.isiAuthorConvert("Brown, J.M.")); @@ -255,7 +255,7 @@ public void testIsiAuthorConvert() { } @Test - public void testImportIEEEExport() throws IOException, URISyntaxException { + void testImportIEEEExport() throws IOException, URISyntaxException { Path file = Path.of(IsiImporterTest.class.getResource("IEEEImport1.txt").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = entries.get(0); @@ -278,7 +278,7 @@ public void testImportIEEEExport() throws IOException, URISyntaxException { } @Test - public void testIEEEImport() throws IOException, URISyntaxException { + void testIEEEImport() throws IOException, URISyntaxException { Path file = Path.of(IsiImporterTest.class.getResource("IEEEImport1.txt").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); BibEntry entry = entries.get(0); @@ -302,7 +302,7 @@ public void testIEEEImport() throws IOException, URISyntaxException { } @Test - public void testImportEntriesMedline() throws IOException, URISyntaxException { + void testImportEntriesMedline() throws IOException, URISyntaxException { Path file = Path.of(IsiImporterTest.class.getResource("IsiImporterTestMedline.isi").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); @@ -338,7 +338,7 @@ public void testImportEntriesMedline() throws IOException, URISyntaxException { } @Test - public void testImportEntriesEmpty() throws IOException, URISyntaxException { + void testImportEntriesEmpty() throws IOException, URISyntaxException { Path file = Path.of(IsiImporterTest.class.getResource("IsiImporterTestEmpty.isi").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MarcXmlParserTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MarcXmlParserTest.java index 18425acde19d..b9917e20f1e3 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MarcXmlParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MarcXmlParserTest.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; -public class MarcXmlParserTest { +class MarcXmlParserTest { private static final String FILE_ENDING = ".xml"; @@ -35,7 +35,7 @@ private void doTest(String xmlName, String bibName) throws Exception { @ParameterizedTest @MethodSource("fileNames") - public void testImportEntries(String fileName) throws Exception { + void testImportEntries(String fileName) throws Exception { String bibName = FileUtil.getBaseName(fileName) + ".bib"; doTest(fileName, bibName); } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterFilesTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterFilesTest.java index 949f02a9ab92..9735c6c55e5c 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterFilesTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterFilesTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class MedlineImporterFilesTest { +class MedlineImporterFilesTest { private static final String FILE_ENDING = ".xml"; @@ -26,19 +26,19 @@ private static Stream invalidFileNames() throws IOException { @ParameterizedTest @MethodSource("fileNames") - public void testIsRecognizedFormat(String fileName) throws IOException { + void testIsRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsRecognizedFormat(new MedlineImporter(), fileName); } @ParameterizedTest @MethodSource("invalidFileNames") - public void testIsNotRecognizedFormat(String fileName) throws IOException { + void testIsNotRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsNotRecognizedFormat(new MedlineImporter(), fileName); } @ParameterizedTest @MethodSource("fileNames") - public void testImportEntries(String fileName) throws Exception { + void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(new MedlineImporter(), fileName, FILE_ENDING); } @@ -50,7 +50,7 @@ private static Stream malformedFileNames() throws IOException { @ParameterizedTest @MethodSource("malformedFileNames") - public void testImportMalfomedFiles(String fileName) throws IOException { + void testImportMalfomedFiles(String fileName) throws IOException { ImporterTestEngine.testImportMalformedFiles(new MedlineImporter(), fileName); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTest.java index 79044243f87b..823bee0aa590 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTest.java @@ -17,32 +17,32 @@ *
  • Press 'Create File' to download your search results in a medline xml file.
  • * */ -public class MedlineImporterTest { +class MedlineImporterTest { private MedlineImporter importer; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { this.importer = new MedlineImporter(); } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("Medline/PubMed", importer.getName()); } @Test - public void testGetCLIId() { + void testGetCLIId() { assertEquals("medline", importer.getId()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.MEDLINE, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Importer for the Medline format.", importer.getDescription()); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java index 4c6568d4fe06..984b77bebf8e 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MrDLibImporterTest.java @@ -16,35 +16,35 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertSame; -public class MrDLibImporterTest { +class MrDLibImporterTest { private MrDLibImporter importer; private BufferedReader input; @BeforeEach - public void setUp() { + void setUp() { importer = new MrDLibImporter(); String testInput = "{\"label\": {\"label-description\": \"The following articles are similar to the document have currently selected.\", \"label-language\": \"en\", \"label-text\": \"Related Articles\"}, \"recommendation_set_id\": \"1\", \"recommendations\": { \"74021358\": { \"abstract\": \"abstract\", \"authors\":\"Sajovic, Marija\", \"published_year\": \"2006\", \"item_id_original\": \"12088644\", \"keywords\": [ \"visoko\\u0161olski program Geodezija - smer Prostorska informatika\" ], \"language_provided\": \"sl\", \"recommendation_id\": \"1\", \"title\": \"The protection of rural lands with the spatial development strategy on the case of Hrastnik commune\", \"url\": \"http://drugg.fgg.uni-lj.si/701/1/GEV_0199_Sajovic.pdf\" }, \"82005804\": { \"abstract\": \"abstract\", \"year_published\": null, \"item_id_original\": \"30145702\", \"language_provided\": null, \"recommendation_id\": \"2\", \"title\": \"Engagement of the volunteers in the solution to the accidents in the South-Moravia region\" }, \"82149599\": { \"abstract\": \"abstract\", \"year_published\": null, \"item_id_original\": \"97690763\", \"language_provided\": null, \"recommendation_id\": \"3\", \"title\": \"\\\"The only Father's word\\\". The relationship of the Father and the Son in the documents of saint John of the Cross\", \"url\": \"http://www.nusl.cz/ntk/nusl-285711\" }, \"84863921\": { \"abstract\": \"abstract\", \"authors\":\"Kaffa, Elena\", \"year_published\": null, \"item_id_original\": \"19397104\", \"keywords\": [ \"BX\", \"D111\" ], \"language_provided\": \"en\", \"recommendation_id\": \"4\", \"title\": \"Greek Church of Cyprus, the Morea and Constantinople during the Frankish Era (1196-1303)\" }, \"88950992\": { \"abstract\": \"abstract\", \"authors\":\"Yasui, Kono\", \"year_published\": null, \"item_id_original\": \"38763657\", \"language_provided\": null, \"recommendation_id\": \"5\", \"title\": \"A Phylogenetic Consideration on the Vascular Plants, Cotyledonary Node Including Hypocotyl Being Taken as the Ancestral Form : A Preliminary Note\" } }}"; input = new BufferedReader(new StringReader(testInput)); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Takes valid JSON documents from the Mr. DLib API and parses them into a BibEntry", importer.getDescription()); } @Test - public void testGetName() { + void testGetName() { assertEquals("MrDLibImporter", importer.getName()); } @Test - public void testGetFileExtention() { + void testGetFileExtention() { assertEquals(StandardFileType.JSON, importer.getFileType()); } @Test - public void testImportDatabaseIsYearSetCorrectly() throws IOException { + void testImportDatabaseIsYearSetCorrectly() throws IOException { ParserResult parserResult = importer.importDatabase(input); List resultList = parserResult.getDatabase().getEntries(); @@ -54,7 +54,7 @@ public void testImportDatabaseIsYearSetCorrectly() throws IOException { } @Test - public void testImportDatabaseIsTitleSetCorrectly() throws IOException { + void testImportDatabaseIsTitleSetCorrectly() throws IOException { ParserResult parserResult = importer.importDatabase(input); List resultList = parserResult.getDatabase().getEntries(); @@ -64,7 +64,7 @@ public void testImportDatabaseIsTitleSetCorrectly() throws IOException { } @Test - public void testImportDatabaseMin() throws IOException { + void testImportDatabaseMin() throws IOException { ParserResult parserResult = importer.importDatabase(input); List resultList = parserResult.getDatabase().getEntries(); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterFilesTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterFilesTest.java index 2562c524858a..dcaf9d8aa5cf 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterFilesTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterFilesTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class MsBibImporterFilesTest { +class MsBibImporterFilesTest { private static final String FILE_ENDING = ".xml"; @@ -24,19 +24,19 @@ private static Stream invalidFileNames() throws IOException { @ParameterizedTest @MethodSource("fileNames") - public void testIsRecognizedFormat(String fileName) throws IOException { + void testIsRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsRecognizedFormat(new MsBibImporter(), fileName); } @ParameterizedTest @MethodSource("invalidFileNames") - public void testIsNotRecognizedFormat(String fileName) throws IOException { + void testIsNotRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsNotRecognizedFormat(new MsBibImporter(), fileName); } @ParameterizedTest @MethodSource("fileNames") - public void testImportEntries(String fileName) throws Exception { + void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(new MsBibImporter(), fileName, FILE_ENDING); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java index c87c3d77cc0d..81dfa5d98689 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java @@ -15,22 +15,22 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -public class MsBibImporterTest { +class MsBibImporterTest { @Test - public void testsGetExtensions() { + void testsGetExtensions() { MsBibImporter importer = new MsBibImporter(); assertEquals(StandardFileType.XML, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { MsBibImporter importer = new MsBibImporter(); assertEquals("Importer for the MS Office 2007 XML bibliography format.", importer.getDescription()); } @Test - public final void testIsNotRecognizedFormat() throws Exception { + final void testIsNotRecognizedFormat() throws Exception { MsBibImporter testImporter = new MsBibImporter(); List notAccepted = Arrays.asList("CopacImporterTest1.txt", "IsiImporterTest1.isi", "IsiImporterTestInspec.isi", "emptyFile.xml", "IsiImporterTestWOS.isi"); @@ -41,7 +41,7 @@ public final void testIsNotRecognizedFormat() throws Exception { } @Test - public final void testImportEntriesEmpty() throws IOException, URISyntaxException { + final void testImportEntriesEmpty() throws IOException, URISyntaxException { MsBibImporter testImporter = new MsBibImporter(); Path file = Path.of(MsBibImporter.class.getResource("EmptyMsBib_Test.xml").toURI()); List entries = testImporter.importDatabase(file).getDatabase().getEntries(); @@ -49,7 +49,7 @@ public final void testImportEntriesEmpty() throws IOException, URISyntaxExceptio } @Test - public final void testImportEntriesNotRecognizedFormat() throws IOException, URISyntaxException { + final void testImportEntriesNotRecognizedFormat() throws IOException, URISyntaxException { MsBibImporter testImporter = new MsBibImporter(); Path file = Path.of(MsBibImporter.class.getResource("CopacImporterTest1.txt").toURI()); List entries = testImporter.importDatabase(file).getDatabase().getEntries(); @@ -57,13 +57,13 @@ public final void testImportEntriesNotRecognizedFormat() throws IOException, URI } @Test - public final void testGetFormatName() { + final void testGetFormatName() { MsBibImporter testImporter = new MsBibImporter(); assertEquals("MSBib", testImporter.getName()); } @Test - public final void testGetCommandLineId() { + final void testGetCommandLineId() { MsBibImporter testImporter = new MsBibImporter(); assertEquals("msbib", testImporter.getId()); } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java index a948ecf75b07..cdb6beeb2d01 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java @@ -25,7 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -public class OvidImporterTest { +class OvidImporterTest { private static final String FILE_ENDING = ".txt"; private OvidImporter importer; @@ -43,51 +43,51 @@ private static Stream invalidFileNames() throws IOException { } @BeforeEach - public void setUp() { + void setUp() { importer = new OvidImporter(); } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("Ovid", importer.getName()); } @Test - public void testGetCLIId() { + void testGetCLIId() { assertEquals("ovid", importer.getId()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.TXT, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Imports an Ovid file.", importer.getDescription()); } @ParameterizedTest @MethodSource("fileNames") - public void testIsRecognizedFormatAccept(String fileName) throws IOException, URISyntaxException { + void testIsRecognizedFormatAccept(String fileName) throws IOException, URISyntaxException { ImporterTestEngine.testIsRecognizedFormat(importer, fileName); } @ParameterizedTest @MethodSource("invalidFileNames") - public void testIsRecognizedFormatRejected(String fileName) throws IOException, URISyntaxException { + void testIsRecognizedFormatRejected(String fileName) throws IOException, URISyntaxException { ImporterTestEngine.testIsNotRecognizedFormat(importer, fileName); } @Test - public void testImportEmpty() throws IOException, URISyntaxException { + void testImportEmpty() throws IOException, URISyntaxException { Path file = Path.of(OvidImporter.class.getResource("Empty.txt").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); assertEquals(Collections.emptyList(), entries); } @Test - public void testImportEntries1() throws IOException, URISyntaxException { + void testImportEntries1() throws IOException, URISyntaxException { Path file = Path.of(OvidImporter.class.getResource("OvidImporterTest1.txt").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); assertEquals(5, entries.size()); @@ -140,14 +140,14 @@ public void testImportEntries1() throws IOException, URISyntaxException { } @Test - public void testImportEntries2() throws IOException, URISyntaxException { + void testImportEntries2() throws IOException, URISyntaxException { Path file = Path.of(OvidImporter.class.getResource("OvidImporterTest2Invalid.txt").toURI()); List entries = importer.importDatabase(file).getDatabase().getEntries(); assertEquals(Collections.emptyList(), entries); } @Test - public void testImportSingleEntries() throws IOException, URISyntaxException { + void testImportSingleEntries() throws IOException, URISyntaxException { for (int n = 3; n <= 7; n++) { Path file = Path.of(OvidImporter.class.getResource("OvidImporterTest" + n + ".txt").toURI()); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java index 07975a31f878..1b2027b2b317 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfGrobidImporterTest.java @@ -24,12 +24,12 @@ import static org.mockito.Mockito.when; @FetcherTest -public class PdfGrobidImporterTest { +class PdfGrobidImporterTest { private PdfGrobidImporter importer; @BeforeEach - public void setUp() { + void setUp() { GrobidPreferences grobidPreferences = mock(GrobidPreferences.class, Answers.RETURNS_DEEP_STUBS); when(grobidPreferences.isGrobidEnabled()).thenReturn(true); when(grobidPreferences.getGrobidURL()).thenReturn("http://grobid.jabref.org:8070"); @@ -42,12 +42,12 @@ public void setUp() { } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.PDF, importer.getFileType()); } @Test - public void testImportEntries() throws URISyntaxException { + void testImportEntries() throws URISyntaxException { Path file = Path.of(PdfGrobidImporterTest.class.getResource("LNCS-minimal.pdf").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); @@ -59,19 +59,19 @@ public void testImportEntries() throws URISyntaxException { } @Test - public void testIsRecognizedFormat() throws IOException, URISyntaxException { + void testIsRecognizedFormat() throws IOException, URISyntaxException { Path file = Path.of(PdfGrobidImporterTest.class.getResource("annotated.pdf").toURI()); assertTrue(importer.isRecognizedFormat(file)); } @Test - public void testIsRecognizedFormatReject() throws IOException, URISyntaxException { + void testIsRecognizedFormatReject() throws IOException, URISyntaxException { Path file = Path.of(PdfGrobidImporterTest.class.getResource("BibtexImporter.examples.bib").toURI()); assertFalse(importer.isRecognizedFormat(file)); } @Test - public void testGetCommandLineId() { + void testGetCommandLineId() { assertEquals("grobidPdf", importer.getId()); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java index b6a530ff29f5..c38ea6c1cde1 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfXmpImporterTest.java @@ -24,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; -public class PdfXmpImporterTest { +class PdfXmpImporterTest { private PdfXmpImporter importer; @@ -34,35 +34,35 @@ private static Stream invalidFileNames() throws IOException { } @BeforeEach - public void setUp() { + void setUp() { importer = new PdfXmpImporter(mock(XmpPreferences.class)); } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("XMP-annotated PDF", importer.getName()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.PDF, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Wraps the XMPUtility function to be used as an Importer.", importer.getDescription()); } @Disabled("XMP reader prints warnings to the logger when parsing does not work") @Test - public void importEncryptedFileReturnsError() throws URISyntaxException { + void importEncryptedFileReturnsError() throws URISyntaxException { Path file = Path.of(PdfXmpImporterTest.class.getResource("/pdfs/encrypted.pdf").toURI()); ParserResult result = importer.importDatabase(file); assertTrue(result.hasWarnings()); } @Test - public void testImportEntries() throws URISyntaxException { + void testImportEntries() throws URISyntaxException { Path file = Path.of(PdfXmpImporterTest.class.getResource("annotated.pdf").toURI()); List bibEntries = importer.importDatabase(file).getDatabase().getEntries(); @@ -76,19 +76,19 @@ public void testImportEntries() throws URISyntaxException { } @Test - public void testIsRecognizedFormat() throws IOException, URISyntaxException { + void testIsRecognizedFormat() throws IOException, URISyntaxException { Path file = Path.of(PdfXmpImporterTest.class.getResource("annotated.pdf").toURI()); assertTrue(importer.isRecognizedFormat(file)); } @ParameterizedTest @MethodSource("invalidFileNames") - public void testIsRecognizedFormatReject(String fileName) throws IOException, URISyntaxException { + void testIsRecognizedFormatReject(String fileName) throws IOException, URISyntaxException { ImporterTestEngine.testIsNotRecognizedFormat(importer, fileName); } @Test - public void testGetCommandLineId() { + void testGetCommandLineId() { assertEquals("xmp", importer.getId()); } } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/RISImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/RISImporterTest.java index 11ad5bb9782d..47262e3fb313 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/RISImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/RISImporterTest.java @@ -12,37 +12,37 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -public class RISImporterTest { +class RISImporterTest { private RisImporter importer; @BeforeEach - public void setUp() { + void setUp() { importer = new RisImporter(); } @Test - public void testGetFormatName() { + void testGetFormatName() { assertEquals("RIS", importer.getName()); } @Test - public void testGetCLIId() { + void testGetCLIId() { assertEquals("ris", importer.getId()); } @Test - public void testsGetExtensions() { + void testsGetExtensions() { assertEquals(StandardFileType.RIS, importer.getFileType()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Imports a Biblioscape Tag File.", importer.getDescription()); } @Test - public void testIfNotRecognizedFormat() throws IOException, URISyntaxException { + void testIfNotRecognizedFormat() throws IOException, URISyntaxException { Path file = Path.of(RISImporterTest.class.getResource("RisImporterCorrupted.ris").toURI()); assertFalse(importer.isRecognizedFormat(file)); } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/RepecNepImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/RepecNepImporterTest.java index 5130e8913fa3..a98a8d392884 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/RepecNepImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/RepecNepImporterTest.java @@ -17,14 +17,14 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class RepecNepImporterTest { +class RepecNepImporterTest { private static final String FILE_ENDING = ".txt"; private RepecNepImporter testImporter; @BeforeEach - public void setUp() { + void setUp() { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); when(importFormatPreferences.bibEntryPreferences().getKeywordSeparator()).thenReturn(','); @@ -44,39 +44,39 @@ private static Stream invalidFileNames() throws IOException { @ParameterizedTest @MethodSource("fileNames") - public void testIsRecognizedFormat(String fileName) throws IOException { + void testIsRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsRecognizedFormat(testImporter, fileName); } @ParameterizedTest @MethodSource("invalidFileNames") - public void testIsNotRecognizedFormat(String fileName) throws IOException { + void testIsNotRecognizedFormat(String fileName) throws IOException { ImporterTestEngine.testIsNotRecognizedFormat(testImporter, fileName); } @ParameterizedTest @MethodSource("fileNames") - public void testImportEntries(String fileName) throws Exception { + void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(testImporter, fileName, FILE_ENDING); } @Test - public final void testGetFormatName() { + final void testGetFormatName() { assertEquals("REPEC New Economic Papers (NEP)", testImporter.getName()); } @Test - public final void testGetCliId() { + final void testGetCliId() { assertEquals("repecnep", testImporter.getId()); } @Test - public void testGetExtension() { + void testGetExtension() { assertEquals(StandardFileType.TXT, testImporter.getFileType()); } @Test - public final void testGetDescription() { + final void testGetDescription() { assertEquals("Imports a New Economics Papers-Message from the REPEC-NEP Service.", testImporter.getDescription()); } diff --git a/src/test/java/org/jabref/logic/importer/util/FileFieldParserTest.java b/src/test/java/org/jabref/logic/importer/util/FileFieldParserTest.java index 73a391fa3550..35aff911ab28 100644 --- a/src/test/java/org/jabref/logic/importer/util/FileFieldParserTest.java +++ b/src/test/java/org/jabref/logic/importer/util/FileFieldParserTest.java @@ -32,7 +32,7 @@ private static Stream testData() { @ParameterizedTest @MethodSource("testData") - public void check(LinkedFile expected, List input) { + void check(LinkedFile expected, List input) { // we need to convert the unmodifiable list to a modifiable because of the side effect of "convert" assertEquals(expected, FileFieldParser.convert(new ArrayList<>(input))); } @@ -189,7 +189,7 @@ private static Stream stringsToParseTest() throws Exception { @ParameterizedTest @MethodSource - public void stringsToParseTest(List expected, String input) { + void stringsToParseTest(List expected, String input) { assertEquals(expected, FileFieldParser.parse(input)); } } diff --git a/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java b/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java index 2fa969bd8b9c..ba14c9389ec4 100644 --- a/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java +++ b/src/test/java/org/jabref/logic/importer/util/GrobidServiceTest.java @@ -27,13 +27,13 @@ import static org.mockito.Mockito.when; @FetcherTest -public class GrobidServiceTest { +class GrobidServiceTest { private static GrobidService grobidService; private static ImportFormatPreferences importFormatPreferences; @BeforeAll - public static void setup() { + static void setup() { importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); when(importFormatPreferences.bibEntryPreferences().getKeywordSeparator()).thenReturn(','); @@ -45,7 +45,7 @@ public static void setup() { } @Test - public void processValidCitationTest() throws IOException, ParseException { + void processValidCitationTest() throws IOException, ParseException { BibEntry exampleBibEntry = new BibEntry(StandardEntryType.Article) .withCitationKey("-1") .withField(StandardField.AUTHOR, "Derwing, Tracey and Rossiter, Marian and Munro, Murray") @@ -67,14 +67,14 @@ public void processValidCitationTest() throws IOException, ParseException { } @Test - public void processEmptyStringTest() throws IOException, ParseException { + void processEmptyStringTest() throws IOException, ParseException { Optional response = grobidService.processCitation(" ", importFormatPreferences, GrobidService.ConsolidateCitations.WITH_METADATA); assertNotNull(response); assertEquals(Optional.empty(), response); } @Test - public void processInvalidCitationTest() { + void processInvalidCitationTest() { assertThrows(IOException.class, () -> grobidService.processCitation( "Iiiiiiiiiiiiiiiiiiiiiiii", importFormatPreferences, @@ -82,7 +82,7 @@ public void processInvalidCitationTest() { } @Test - public void failsWhenGrobidDisabled() { + void failsWhenGrobidDisabled() { GrobidPreferences importSettingsWithGrobidDisabled = new GrobidPreferences( false, false, @@ -91,7 +91,7 @@ public void failsWhenGrobidDisabled() { } @Test - public void processPdfTest() throws IOException, ParseException, URISyntaxException { + void processPdfTest() throws IOException, ParseException, URISyntaxException { Path file = Path.of(PdfGrobidImporterTest.class.getResource("LNCS-minimal.pdf").toURI()); List response = grobidService.processPDF(file, importFormatPreferences); assertEquals(1, response.size()); diff --git a/src/test/java/org/jabref/logic/importer/util/JsonReaderTest.java b/src/test/java/org/jabref/logic/importer/util/JsonReaderTest.java index 50030b02e919..3b59324bb050 100644 --- a/src/test/java/org/jabref/logic/importer/util/JsonReaderTest.java +++ b/src/test/java/org/jabref/logic/importer/util/JsonReaderTest.java @@ -5,23 +5,23 @@ import org.jabref.logic.importer.ParseException; import kong.unirest.json.JSONObject; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; class JsonReaderTest { @Test void nullStreamThrowsNullPointerException() { - Assertions.assertThrows(NullPointerException.class, () -> { + assertThrows(NullPointerException.class, () -> { JsonReader.toJsonObject(null); }); } @Test void invalidJsonThrowsParserException() { - Assertions.assertThrows(ParseException.class, () -> { + assertThrows(ParseException.class, () -> { JsonReader.toJsonObject(new ByteArrayInputStream("invalid JSON".getBytes())); }); } @@ -35,7 +35,7 @@ void emptyStringResultsInEmptyObject() throws Exception { @Test void arrayThrowsParserException() { // Reason: We expect a JSON object, not a JSON array - Assertions.assertThrows(ParseException.class, () -> { + assertThrows(ParseException.class, () -> { JsonReader.toJsonObject(new ByteArrayInputStream("[]".getBytes())); }); } diff --git a/src/test/java/org/jabref/logic/importer/util/MathMLParserTest.java b/src/test/java/org/jabref/logic/importer/util/MathMLParserTest.java index f8866cf9c05f..d7f8c661e0ee 100644 --- a/src/test/java/org/jabref/logic/importer/util/MathMLParserTest.java +++ b/src/test/java/org/jabref/logic/importer/util/MathMLParserTest.java @@ -18,7 +18,7 @@ class MathMLParserTest { private static XMLInputFactory xmlInputFactory; @BeforeAll - public static void setUp() { + static void setUp() { xmlInputFactory = XMLInputFactory.newInstance(); xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, true); } diff --git a/src/test/java/org/jabref/logic/importer/util/StaxParserTest.java b/src/test/java/org/jabref/logic/importer/util/StaxParserTest.java index 54c07d74e546..9c14e80a1565 100644 --- a/src/test/java/org/jabref/logic/importer/util/StaxParserTest.java +++ b/src/test/java/org/jabref/logic/importer/util/StaxParserTest.java @@ -18,7 +18,7 @@ class StaxParserTest { private static XMLInputFactory xmlInputFactory; @BeforeAll - public static void setUp() { + static void setUp() { xmlInputFactory = XMLInputFactory.newInstance(); xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, true); } diff --git a/src/test/java/org/jabref/logic/integrity/ASCIICharacterCheckerTest.java b/src/test/java/org/jabref/logic/integrity/ASCIICharacterCheckerTest.java index 09efadebe2d9..e9bd044bbd6a 100644 --- a/src/test/java/org/jabref/logic/integrity/ASCIICharacterCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/ASCIICharacterCheckerTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ASCIICharacterCheckerTest { +class ASCIICharacterCheckerTest { private final ASCIICharacterChecker checker = new ASCIICharacterChecker(); private final BibEntry entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/integrity/AmpersandCheckerTest.java b/src/test/java/org/jabref/logic/integrity/AmpersandCheckerTest.java index 1e568793f709..5f78fb3fc5b4 100644 --- a/src/test/java/org/jabref/logic/integrity/AmpersandCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/AmpersandCheckerTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AmpersandCheckerTest { +class AmpersandCheckerTest { private final AmpersandChecker checker = new AmpersandChecker(); private final BibEntry entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/integrity/BibStringCheckerTest.java b/src/test/java/org/jabref/logic/integrity/BibStringCheckerTest.java index 71c09f2e6a44..87ea138fa717 100644 --- a/src/test/java/org/jabref/logic/integrity/BibStringCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/BibStringCheckerTest.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class BibStringCheckerTest { +class BibStringCheckerTest { private final BibStringChecker checker = new BibStringChecker(); private final BibEntry entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/integrity/BooktitleCheckerTest.java b/src/test/java/org/jabref/logic/integrity/BooktitleCheckerTest.java index 7ce09e1bd3a5..129b424225a1 100644 --- a/src/test/java/org/jabref/logic/integrity/BooktitleCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/BooktitleCheckerTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class BooktitleCheckerTest { +class BooktitleCheckerTest { private final BooktitleChecker checker = new BooktitleChecker(); diff --git a/src/test/java/org/jabref/logic/integrity/BracesCorrectorTest.java b/src/test/java/org/jabref/logic/integrity/BracesCorrectorTest.java index 245829abea39..4d77ff3e5b30 100644 --- a/src/test/java/org/jabref/logic/integrity/BracesCorrectorTest.java +++ b/src/test/java/org/jabref/logic/integrity/BracesCorrectorTest.java @@ -5,45 +5,45 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -public class BracesCorrectorTest { +class BracesCorrectorTest { @Test - public void inputIsNull() { + void inputIsNull() { assertNull(BracesCorrector.apply(null)); } @Test - public void inputIsEmpty() { + void inputIsEmpty() { assertEquals("", BracesCorrector.apply("")); } @Test - public void inputWithoutBraces() { + void inputWithoutBraces() { assertEquals("banana", BracesCorrector.apply("banana")); } @Test - public void inputAlreadyCorrect() { + void inputAlreadyCorrect() { assertEquals("{banana}", BracesCorrector.apply("{banana}")); } @Test - public void inputMissingClosing() { + void inputMissingClosing() { assertEquals("{banana}", BracesCorrector.apply("{banana")); } @Test - public void inputMissingOpening() { + void inputMissingOpening() { assertEquals("{banana}", BracesCorrector.apply("banana}")); } @Test - public void inputWithMaskedBraces() { + void inputWithMaskedBraces() { assertEquals("\\\\\\{banana", BracesCorrector.apply("\\\\\\{banana")); } @Test - public void inputWithMixedBraces() { + void inputWithMixedBraces() { assertEquals("{b{anana\\\\\\}}}", BracesCorrector.apply("{b{anana\\\\\\}")); } } diff --git a/src/test/java/org/jabref/logic/integrity/BracketCheckerTest.java b/src/test/java/org/jabref/logic/integrity/BracketCheckerTest.java index d49a6ac69ac1..658eb5ff8a75 100644 --- a/src/test/java/org/jabref/logic/integrity/BracketCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/BracketCheckerTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class BracketCheckerTest { +class BracketCheckerTest { private final BracketChecker checker = new BracketChecker(); diff --git a/src/test/java/org/jabref/logic/integrity/CitationKeyCheckerTest.java b/src/test/java/org/jabref/logic/integrity/CitationKeyCheckerTest.java index 44d0ce9e9795..17d891623b6f 100644 --- a/src/test/java/org/jabref/logic/integrity/CitationKeyCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/CitationKeyCheckerTest.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class CitationKeyCheckerTest { +class CitationKeyCheckerTest { private final CitationKeyChecker checker = new CitationKeyChecker(); diff --git a/src/test/java/org/jabref/logic/integrity/CitationKeyDeviationCheckerTest.java b/src/test/java/org/jabref/logic/integrity/CitationKeyDeviationCheckerTest.java index 731dbfac2eee..af820574d87b 100644 --- a/src/test/java/org/jabref/logic/integrity/CitationKeyDeviationCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/CitationKeyDeviationCheckerTest.java @@ -21,7 +21,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class CitationKeyDeviationCheckerTest { +class CitationKeyDeviationCheckerTest { private final BibDatabaseContext bibDatabaseContext = mock(BibDatabaseContext.class); private final BibDatabase bibDatabase = mock(BibDatabase.class); diff --git a/src/test/java/org/jabref/logic/integrity/CitationKeyDuplicationCheckerTest.java b/src/test/java/org/jabref/logic/integrity/CitationKeyDuplicationCheckerTest.java index b506e87194b5..97eb6e70c450 100644 --- a/src/test/java/org/jabref/logic/integrity/CitationKeyDuplicationCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/CitationKeyDuplicationCheckerTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class CitationKeyDuplicationCheckerTest { +class CitationKeyDuplicationCheckerTest { @Test void emptyCitationKey() { diff --git a/src/test/java/org/jabref/logic/integrity/DoiDuplicationCheckerTest.java b/src/test/java/org/jabref/logic/integrity/DoiDuplicationCheckerTest.java index 5b877503674c..8e46d69b35b2 100644 --- a/src/test/java/org/jabref/logic/integrity/DoiDuplicationCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/DoiDuplicationCheckerTest.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class DoiDuplicationCheckerTest { +class DoiDuplicationCheckerTest { private final DoiDuplicationChecker checker = new DoiDuplicationChecker(); private String doiA = "10.1023/A:1022883727209"; @@ -25,7 +25,7 @@ public class DoiDuplicationCheckerTest { private BibEntry doiC_entry1 = new BibEntry().withField(StandardField.DOI, doiC); @Test - public void testOnePairDuplicateDOI() { + void testOnePairDuplicateDOI() { List entries = List.of(doiA_entry1, doiA_entry2, doiC_entry1); BibDatabase database = new BibDatabase(entries); List results = List.of(new IntegrityMessage(Localization.lang("Same DOI used in multiple entries"), doiA_entry1, StandardField.DOI), @@ -34,7 +34,7 @@ public void testOnePairDuplicateDOI() { } @Test - public void testMultiPairsDuplicateDOI() { + void testMultiPairsDuplicateDOI() { List entries = List.of(doiA_entry1, doiA_entry2, doiB_entry1, doiB_entry2, doiC_entry1); BibDatabase database = new BibDatabase(entries); List results = List.of(new IntegrityMessage(Localization.lang("Same DOI used in multiple entries"), doiA_entry1, StandardField.DOI), @@ -45,7 +45,7 @@ public void testMultiPairsDuplicateDOI() { } @Test - public void testNoDuplicateDOI() { + void testNoDuplicateDOI() { List entries = List.of(doiA_entry1, doiB_entry1, doiC_entry1); BibDatabase database = new BibDatabase(entries); assertEquals(Collections.emptyList(), checker.check(database)); diff --git a/src/test/java/org/jabref/logic/integrity/EditionCheckerTest.java b/src/test/java/org/jabref/logic/integrity/EditionCheckerTest.java index e66c53ccd11a..19744e61fce4 100644 --- a/src/test/java/org/jabref/logic/integrity/EditionCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/EditionCheckerTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class EditionCheckerTest { +class EditionCheckerTest { @Test void isFirstCharacterANumber() { assertTrue(createSimpleEditionChecker(new BibDatabaseContext(), false).isFirstCharDigit("0HelloWorld")); diff --git a/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java b/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java index f185132a29c5..1ad5d2df41a9 100644 --- a/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/HTMLCharacterCheckerTest.java @@ -16,7 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -public class HTMLCharacterCheckerTest { +class HTMLCharacterCheckerTest { private final HTMLCharacterChecker checker = new HTMLCharacterChecker(); private final BibEntry entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/integrity/HowPublishedCheckerTest.java b/src/test/java/org/jabref/logic/integrity/HowPublishedCheckerTest.java index cea5ae468a29..99ecdc51680f 100644 --- a/src/test/java/org/jabref/logic/integrity/HowPublishedCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/HowPublishedCheckerTest.java @@ -11,13 +11,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class HowPublishedCheckerTest { +class HowPublishedCheckerTest { private HowPublishedChecker checker; private HowPublishedChecker checkerBiblatex; @BeforeEach - public void setUp() { + void setUp() { BibDatabaseContext databaseContext = new BibDatabaseContext(); BibDatabaseContext databaseBiblatex = new BibDatabaseContext(); databaseContext.setMode(BibDatabaseMode.BIBTEX); diff --git a/src/test/java/org/jabref/logic/integrity/ISBNCheckerTest.java b/src/test/java/org/jabref/logic/integrity/ISBNCheckerTest.java index e4dca72548d4..d779c86a61bc 100644 --- a/src/test/java/org/jabref/logic/integrity/ISBNCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/ISBNCheckerTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class ISBNCheckerTest { +class ISBNCheckerTest { private final ISBNChecker checker = new ISBNChecker(); @@ -39,7 +39,7 @@ void isbnDoesNotAcceptInvalidInput() { @ParameterizedTest @MethodSource("provideBoundaryArgumentsForISBN13") - public void checkISBNValue(Optional optValue, String id) { + void checkISBNValue(Optional optValue, String id) { assertEquals(optValue, checker.checkValue(id)); } diff --git a/src/test/java/org/jabref/logic/integrity/ISSNCheckerTest.java b/src/test/java/org/jabref/logic/integrity/ISSNCheckerTest.java index f06dccfdfced..6d69f6269865 100644 --- a/src/test/java/org/jabref/logic/integrity/ISSNCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/ISSNCheckerTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class ISSNCheckerTest { +class ISSNCheckerTest { private final ISSNChecker checker = new ISSNChecker(); @@ -44,7 +44,7 @@ void emptyIssnValue() { @ParameterizedTest @MethodSource("provideIncorrectFormatArguments") - public void issnWithWrongFormat(String wrongISSN) { + void issnWithWrongFormat(String wrongISSN) { assertEquals(Optional.of(Localization.lang("incorrect format")), checker.checkValue(wrongISSN)); } diff --git a/src/test/java/org/jabref/logic/integrity/JournalInAbbreviationListCheckerTest.java b/src/test/java/org/jabref/logic/integrity/JournalInAbbreviationListCheckerTest.java index 775ca2dd7a99..85e25eb995c2 100644 --- a/src/test/java/org/jabref/logic/integrity/JournalInAbbreviationListCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/JournalInAbbreviationListCheckerTest.java @@ -14,7 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class JournalInAbbreviationListCheckerTest { +class JournalInAbbreviationListCheckerTest { private JournalInAbbreviationListChecker checker; private JournalInAbbreviationListChecker checkerb; diff --git a/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java b/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java index 36c6e5926517..e6c1dcfec615 100644 --- a/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/LatexIntegrityCheckerTest.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class LatexIntegrityCheckerTest { +class LatexIntegrityCheckerTest { private final LatexIntegrityChecker checker = new LatexIntegrityChecker(); private final BibEntry entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/integrity/MonthCheckerTest.java b/src/test/java/org/jabref/logic/integrity/MonthCheckerTest.java index 44c1603bb814..4bc8f4fdad0c 100644 --- a/src/test/java/org/jabref/logic/integrity/MonthCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/MonthCheckerTest.java @@ -11,13 +11,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class MonthCheckerTest { +class MonthCheckerTest { private MonthChecker checker; private MonthChecker checkerBiblatex; @BeforeEach - public void setUp() { + void setUp() { BibDatabaseContext databaseContext = new BibDatabaseContext(); BibDatabaseContext databaseBiblatex = new BibDatabaseContext(); databaseContext.setMode(BibDatabaseMode.BIBTEX); diff --git a/src/test/java/org/jabref/logic/integrity/NoteCheckerTest.java b/src/test/java/org/jabref/logic/integrity/NoteCheckerTest.java index ffd5781695bb..37fcb177d43d 100644 --- a/src/test/java/org/jabref/logic/integrity/NoteCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/NoteCheckerTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class NoteCheckerTest { +class NoteCheckerTest { private NoteChecker checker; private NoteChecker checkerBiblatex; diff --git a/src/test/java/org/jabref/logic/integrity/PersonNamesCheckerTest.java b/src/test/java/org/jabref/logic/integrity/PersonNamesCheckerTest.java index b64900e61222..bd357ed378d8 100644 --- a/src/test/java/org/jabref/logic/integrity/PersonNamesCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/PersonNamesCheckerTest.java @@ -14,13 +14,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class PersonNamesCheckerTest { +class PersonNamesCheckerTest { private PersonNamesChecker checker; private PersonNamesChecker checkerb; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { BibDatabaseContext databaseContext = new BibDatabaseContext(); databaseContext.setMode(BibDatabaseMode.BIBTEX); checker = new PersonNamesChecker(databaseContext); @@ -31,7 +31,7 @@ public void setUp() throws Exception { @ParameterizedTest @MethodSource("provideValidNames") - public void validNames(String name) { + void validNames(String name) { assertEquals(Optional.empty(), checker.checkValue(name)); } @@ -53,20 +53,20 @@ private static Stream provideValidNames() { } @Test - public void complainAboutPersonStringWithTwoManyCommas() { + void complainAboutPersonStringWithTwoManyCommas() { assertEquals(Optional.of("Names are not in the standard BibTeX format."), checker.checkValue("Test1, Test2, Test3, Test4, Test5, Test6")); } @ParameterizedTest @MethodSource("provideCorrectFormats") - public void authorNameInCorrectFormatsShouldNotComplain(String input) { + void authorNameInCorrectFormatsShouldNotComplain(String input) { assertEquals(Optional.empty(), checkerb.checkValue(input)); } @ParameterizedTest @MethodSource("provideIncorrectFormats") - public void authorNameInIncorrectFormatsShouldComplain(String input) { + void authorNameInIncorrectFormatsShouldComplain(String input) { assertNotEquals(Optional.empty(), checkerb.checkValue(input)); } diff --git a/src/test/java/org/jabref/logic/integrity/TitleCheckerTest.java b/src/test/java/org/jabref/logic/integrity/TitleCheckerTest.java index 9e44e9d4215b..231507a133c0 100644 --- a/src/test/java/org/jabref/logic/integrity/TitleCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/TitleCheckerTest.java @@ -21,7 +21,7 @@ class BibTexChecker { private TitleChecker checker; @BeforeEach - public void setUp() { + void setUp() { BibDatabaseContext databaseContext = new BibDatabaseContext(); databaseContext.setMode(BibDatabaseMode.BIBTEX); checker = new TitleChecker(databaseContext); @@ -76,7 +76,7 @@ class BibLaTexChecker { private TitleChecker checkerBiblatex; @BeforeEach - public void setUp() { + void setUp() { BibDatabaseContext databaseBiblatex = new BibDatabaseContext(); databaseBiblatex.setMode(BibDatabaseMode.BIBLATEX); checkerBiblatex = new TitleChecker(databaseBiblatex); diff --git a/src/test/java/org/jabref/logic/integrity/TypeCheckerTest.java b/src/test/java/org/jabref/logic/integrity/TypeCheckerTest.java index 38969eb0fcde..f4b6cfaccfb2 100644 --- a/src/test/java/org/jabref/logic/integrity/TypeCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/TypeCheckerTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class TypeCheckerTest { +class TypeCheckerTest { private final TypeChecker checker = new TypeChecker(); private BibEntry entry; diff --git a/src/test/java/org/jabref/logic/integrity/UTF8CheckerTest.java b/src/test/java/org/jabref/logic/integrity/UTF8CheckerTest.java index 87b0857b7aac..42378717004f 100644 --- a/src/test/java/org/jabref/logic/integrity/UTF8CheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/UTF8CheckerTest.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class UTF8CheckerTest { +class UTF8CheckerTest { private static final Charset GBK = Charset.forName("GBK"); private final BibEntry entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/integrity/UrlCheckerTest.java b/src/test/java/org/jabref/logic/integrity/UrlCheckerTest.java index 747e2babe41e..238d9e3bba4f 100644 --- a/src/test/java/org/jabref/logic/integrity/UrlCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/UrlCheckerTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class UrlCheckerTest { +class UrlCheckerTest { private final UrlChecker checker = new UrlChecker(); diff --git a/src/test/java/org/jabref/logic/integrity/ValidCitationKeyCheckerTest.java b/src/test/java/org/jabref/logic/integrity/ValidCitationKeyCheckerTest.java index 042672a44309..5543a092c40c 100644 --- a/src/test/java/org/jabref/logic/integrity/ValidCitationKeyCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/ValidCitationKeyCheckerTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ValidCitationKeyCheckerTest { +class ValidCitationKeyCheckerTest { private final ValidCitationKeyChecker checker = new ValidCitationKeyChecker(); diff --git a/src/test/java/org/jabref/logic/integrity/YearCheckerTest.java b/src/test/java/org/jabref/logic/integrity/YearCheckerTest.java index dcd68676def1..6e5b600b538e 100644 --- a/src/test/java/org/jabref/logic/integrity/YearCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/YearCheckerTest.java @@ -7,7 +7,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class YearCheckerTest { +class YearCheckerTest { private final YearChecker checker = new YearChecker(); diff --git a/src/test/java/org/jabref/logic/journals/AbbreviationParserTest.java b/src/test/java/org/jabref/logic/journals/AbbreviationParserTest.java index 3237b60588ad..a519630e8c9a 100644 --- a/src/test/java/org/jabref/logic/journals/AbbreviationParserTest.java +++ b/src/test/java/org/jabref/logic/journals/AbbreviationParserTest.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AbbreviationParserTest { +class AbbreviationParserTest { private Path csvFile; private final AbbreviationParser parser = new AbbreviationParser(); diff --git a/src/test/java/org/jabref/logic/journals/JournalInformationFetcherTest.java b/src/test/java/org/jabref/logic/journals/JournalInformationFetcherTest.java index 25a189b0b45d..b874538e186b 100644 --- a/src/test/java/org/jabref/logic/journals/JournalInformationFetcherTest.java +++ b/src/test/java/org/jabref/logic/journals/JournalInformationFetcherTest.java @@ -42,62 +42,62 @@ class JournalInformationFetcherTest { ); @Test - public void getsName() { + void getsName() { assertEquals("Journal Information", fetcher.getName()); } @Test - public void getsJournalInfoValidISSN() throws FetcherException { + void getsJournalInfoValidISSN() throws FetcherException { assertEquals(Optional.of(journalInformation), fetcher.getJournalInformation("1545-4509", "")); } @Test - public void getsJournalInfoUsingName() throws FetcherException { + void getsJournalInfoUsingName() throws FetcherException { assertEquals(Optional.of(journalInformation), fetcher.getJournalInformation("", "Annual Review of Biochemistry")); } @Test - public void sameEntryReturnedFromISSNOrName() throws FetcherException { + void sameEntryReturnedFromISSNOrName() throws FetcherException { assertEquals(fetcher.getJournalInformation("1545-4509", ""), fetcher.getJournalInformation("", "Annual Review of Biochemistry")); } @Test - public void getsJournalInfoValidISSNWithoutHyphen() throws FetcherException { + void getsJournalInfoValidISSNWithoutHyphen() throws FetcherException { assertEquals(Optional.of(journalInformation), fetcher.getJournalInformation("15454509", "")); } @Test - public void getsJournalInfoNonTrimmedISSN() throws FetcherException { + void getsJournalInfoNonTrimmedISSN() throws FetcherException { assertEquals(Optional.of(journalInformation), fetcher.getJournalInformation(" 1545-4509 ", "")); } @Test - public void getJournalInfoExtraSpaceISSN() { + void getJournalInfoExtraSpaceISSN() { assertThrows(FetcherException.class, () -> fetcher.getJournalInformation("1545 - 4509", "")); } @Test - public void getJournalInfoEmptyISSN() { + void getJournalInfoEmptyISSN() { assertThrows(FetcherException.class, () -> fetcher.getJournalInformation("", "")); } @Test - public void getJournalInfoInvalidISSN() { + void getJournalInfoInvalidISSN() { assertThrows(FetcherException.class, () -> fetcher.getJournalInformation("123-123", "")); } @Test - public void getJournalInfoInvalidISSNAndNoName() { + void getJournalInfoInvalidISSNAndNoName() { assertThrows(FetcherException.class, () -> fetcher.getJournalInformation("123-123", "")); } @Test - public void getJournalInfoNoISSNAndNoName() { + void getJournalInfoNoISSNAndNoName() { assertThrows(FetcherException.class, () -> fetcher.getJournalInformation("", "")); } @Test - public void getJournalInfoNoISSNAndInvalidName() { + void getJournalInfoNoISSNAndInvalidName() { assertThrows(FetcherException.class, () -> fetcher.getJournalInformation("", "zzz")); } } diff --git a/src/test/java/org/jabref/logic/l10n/EncodingsTest.java b/src/test/java/org/jabref/logic/l10n/EncodingsTest.java index ed737b77fde5..f377ec42ba4b 100644 --- a/src/test/java/org/jabref/logic/l10n/EncodingsTest.java +++ b/src/test/java/org/jabref/logic/l10n/EncodingsTest.java @@ -5,24 +5,24 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -public class EncodingsTest { +class EncodingsTest { @Test - public void charsetsShouldNotBeNull() { + void charsetsShouldNotBeNull() { assertNotNull(Encodings.ENCODINGS); } @Test - public void displayNamesShouldNotBeNull() { + void displayNamesShouldNotBeNull() { assertNotNull(Encodings.ENCODINGS_DISPLAYNAMES); } @Test - public void charsetsShouldNotBeEmpty() { + void charsetsShouldNotBeEmpty() { assertNotEquals(0, Encodings.ENCODINGS.length); } @Test - public void displayNamesShouldNotBeEmpty() { + void displayNamesShouldNotBeEmpty() { assertNotEquals(0, Encodings.ENCODINGS_DISPLAYNAMES.length); } } diff --git a/src/test/java/org/jabref/logic/l10n/JavaLocalizationEntryParserTest.java b/src/test/java/org/jabref/logic/l10n/JavaLocalizationEntryParserTest.java index 803dec5df841..4097b544c300 100644 --- a/src/test/java/org/jabref/logic/l10n/JavaLocalizationEntryParserTest.java +++ b/src/test/java/org/jabref/logic/l10n/JavaLocalizationEntryParserTest.java @@ -67,27 +67,27 @@ public static Stream causesRuntimeExceptions() { @ParameterizedTest @MethodSource("singleLineChecks") - public void testLocalizationKeyParsing(String code, String expectedLanguageKeys) { + void testLocalizationKeyParsing(String code, String expectedLanguageKeys) { testLocalizationKeyParsing(code, List.of(expectedLanguageKeys)); } @ParameterizedTest @MethodSource("multiLineChecks") - public void testLocalizationKeyParsing(String code, List expectedLanguageKeys) { + void testLocalizationKeyParsing(String code, List expectedLanguageKeys) { List languageKeysInString = JavaLocalizationEntryParser.getLanguageKeysInString(code, LocalizationBundleForTest.LANG); assertEquals(expectedLanguageKeys, languageKeysInString); } @ParameterizedTest @MethodSource("singleLineParameterChecks") - public void testLocalizationParameterParsing(String code, String expectedParameter) { + void testLocalizationParameterParsing(String code, String expectedParameter) { List languageKeysInString = JavaLocalizationEntryParser.getLocalizationParameter(code, LocalizationBundleForTest.LANG); assertEquals(List.of(expectedParameter), languageKeysInString); } @ParameterizedTest @MethodSource("causesRuntimeExceptions") - public void throwsRuntimeException(String code) { + void throwsRuntimeException(String code) { assertThrows(RuntimeException.class, () -> JavaLocalizationEntryParser.getLanguageKeysInString(code, LocalizationBundleForTest.LANG)); } } diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java index cd7fcd499644..0e80f26f545d 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java @@ -10,11 +10,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -public class LocalizationKeyParamsTest { +class LocalizationKeyParamsTest { @ParameterizedTest @MethodSource("provideTestData") - public void testReplacePlaceholders(String expected, LocalizationKeyParams input) { + void testReplacePlaceholders(String expected, LocalizationKeyParams input) { assertEquals(expected, input.replacePlaceholders()); } @@ -29,7 +29,7 @@ private static Stream provideTestData() { } @Test - public void testTooManyParams() { + void testTooManyParams() { assertThrows(IllegalStateException.class, () -> new LocalizationKeyParams("", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0")); } } diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationKeyTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationKeyTest.java index e0d0bca52cbf..85d1dd1a89a0 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationKeyTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationKeyTest.java @@ -33,7 +33,7 @@ private static Stream propertiesKeyTestCases() { @ParameterizedTest @MethodSource("propertiesKeyTestCases") - public void getPropertiesKeyReturnsCorrectValue(String expected, String input) { + void getPropertiesKeyReturnsCorrectValue(String expected, String input) { assertEquals(expected, LocalizationKey.fromEscapedJavaString(input).getEscapedPropertiesKey()); } } diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationParser.java b/src/test/java/org/jabref/logic/l10n/LocalizationParser.java index 0fee3a336133..70637f58d9d9 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationParser.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationParser.java @@ -24,7 +24,6 @@ import javafx.fxml.FXMLLoader; import com.airhacks.afterburner.views.ViewLoader; -import org.mockito.Answers; import org.mockito.MockedStatic; import org.mockito.Mockito; @@ -178,7 +177,7 @@ private static List getLanguageKeysInFxmlFile(Path path, Loca List result = new ArrayList<>(); // Afterburner ViewLoader forces a controller factory, but we do not need any controller - MockedStatic viewLoader = Mockito.mockStatic(ViewLoader.class, Answers.RETURNS_DEEP_STUBS); + MockedStatic viewLoader; // Record which keys are requested; we pretend that we have all keys ResourceBundle registerUsageResourceBundle = new ResourceBundle() { diff --git a/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java b/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java index 5b910a2f2e8d..594a2c1150b0 100644 --- a/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java +++ b/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java @@ -35,7 +35,7 @@ public class LayoutEntryTest { private BibEntry mBTE; @BeforeEach - public void setUp() { + void setUp() { mBTE = new BibEntry(); mBTE.setField(StandardField.ABSTRACT, "In this paper, we initiate a formal study of security on Android: Google's new open-source platform for mobile devices. Tags: Paper android google Open-Source Devices"); // Specifically, we present a core typed language to describe Android applications, and to reason about their data-flow security properties. Our operational semantics and type system provide some necessary foundations to help both users and developers of Android applications deal with their security concerns. @@ -69,7 +69,7 @@ public String layout(String layoutFile, BibEntry entry) throws IOException { } @Test - public void testParseMethodCalls() { + void testParseMethodCalls() { assertEquals(1, LayoutEntry.parseMethodsCalls("bla").size()); assertEquals("bla", (LayoutEntry.parseMethodsCalls("bla").get(0)).get(0)); diff --git a/src/test/java/org/jabref/logic/layout/LayoutHelperTest.java b/src/test/java/org/jabref/logic/layout/LayoutHelperTest.java index dec5ab5d7817..ec8d4667731c 100644 --- a/src/test/java/org/jabref/logic/layout/LayoutHelperTest.java +++ b/src/test/java/org/jabref/logic/layout/LayoutHelperTest.java @@ -17,14 +17,14 @@ class LayoutHelperTest { private final JournalAbbreviationRepository abbreviationRepository = mock(JournalAbbreviationRepository.class); @Test - public void backslashDoesNotTriggerException() { + void backslashDoesNotTriggerException() { StringReader stringReader = new StringReader("\\"); LayoutHelper layoutHelper = new LayoutHelper(stringReader, layoutFormatterPreferences, abbreviationRepository); assertThrows(IOException.class, layoutHelper::getLayoutFromText); } @Test - public void unbalancedBeginEndIsParsed() throws Exception { + void unbalancedBeginEndIsParsed() throws Exception { StringReader stringReader = new StringReader("\\begin{doi}, DOI: \\doi"); LayoutHelper layoutHelper = new LayoutHelper(stringReader, layoutFormatterPreferences, abbreviationRepository); Layout layout = layoutHelper.getLayoutFromText(); @@ -32,7 +32,7 @@ public void unbalancedBeginEndIsParsed() throws Exception { } @Test - public void minimalExampleWithDoiGetsParsed() throws Exception { + void minimalExampleWithDoiGetsParsed() throws Exception { StringReader stringReader = new StringReader("\\begin{doi}, DOI: \\doi\\end{doi}"); LayoutHelper layoutHelper = new LayoutHelper(stringReader, layoutFormatterPreferences, abbreviationRepository); Layout layout = layoutHelper.getLayoutFromText(); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorAbbreviatorTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorAbbreviatorTest.java index 10fd71c68c5d..482cf1de465c 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorAbbreviatorTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorAbbreviatorTest.java @@ -9,10 +9,10 @@ /** * Is the save as the AuthorLastFirstAbbreviator. */ -public class AuthorAbbreviatorTest { +class AuthorAbbreviatorTest { @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorLastFirstAbbreviator(); LayoutFormatter b = new AuthorAbbreviator(); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacerTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacerTest.java index 0bdb17409189..6b00235dd5d8 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacerTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacerTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorAndsCommaReplacerTest { +class AuthorAndsCommaReplacerTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorAndsCommaReplacer#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorAndsCommaReplacer(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorAndsReplacerTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorAndsReplacerTest.java index 9c2bcb40c2c8..3e3f4e6374db 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorAndsReplacerTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorAndsReplacerTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorAndsReplacerTest { +class AuthorAndsReplacerTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorAndsReplacer#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorAndsReplacer(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastCommasTest.java index b4f6f544589c..1cb36462729d 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastCommasTest.java @@ -6,10 +6,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorFirstAbbrLastCommasTest { +class AuthorFirstAbbrLastCommasTest { @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorFirstAbbrLastCommas(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastOxfordCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastOxfordCommasTest.java index f35de4b55ac4..104d9a54372d 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastOxfordCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastOxfordCommasTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorFirstAbbrLastOxfordCommasTest { +class AuthorFirstAbbrLastOxfordCommasTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorFirstAbbrLastOxfordCommas#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorFirstAbbrLastOxfordCommas(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstCommasTest.java index 1972b6b781e9..22a4c28ae4c6 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstCommasTest.java @@ -4,13 +4,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorFirstFirstCommasTest { +class AuthorFirstFirstCommasTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorFirstFirstCommas#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { assertEquals("John von Neumann, John Smith and Peter Black Brown, Jr", new AuthorFirstFirstCommas() .format("von Neumann,,John and John Smith and Black Brown, Jr, Peter")); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstTest.java index d71647dd45e2..456e4271fb21 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstTest.java @@ -4,13 +4,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorFirstFirstTest { +class AuthorFirstFirstTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorFirstFirst#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { assertEquals("John von Neumann and John Smith and Peter Black Brown, Jr", new AuthorFirstFirst() .format("von Neumann,,John and John Smith and Black Brown, Jr, Peter")); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastCommasTest.java index bdf0490a42fb..145f4f4be268 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastCommasTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorFirstLastCommasTest { +class AuthorFirstLastCommasTest { LayoutFormatter authorFLCFormatter = new AuthorFirstLastCommas(); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastOxfordCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastOxfordCommasTest.java index 14c315803396..2c4fc34374db 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastOxfordCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastOxfordCommasTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorFirstLastOxfordCommasTest { +class AuthorFirstLastOxfordCommasTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorFirstLastOxfordCommas#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorFirstLastOxfordCommas(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorLF_FFAbbrTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorLF_FFAbbrTest.java index 937f7e0a71a2..b1b4e0c952c8 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLF_FFAbbrTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLF_FFAbbrTest.java @@ -4,13 +4,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorLF_FFAbbrTest { +class AuthorLF_FFAbbrTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorLF_FFAbbr#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { assertEquals("von Neumann, J. and J. Smith and P. Black Brown, Jr", new AuthorLF_FFAbbr() .format("von Neumann,,John and John Smith and Black Brown, Jr, Peter")); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorLF_FFTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorLF_FFTest.java index c3bd13219bc9..fb57feb0d2ea 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLF_FFTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLF_FFTest.java @@ -4,13 +4,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorLF_FFTest { +class AuthorLF_FFTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorLF_FF#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { assertEquals("von Neumann, John and John Smith and Peter Black Brown, Jr", new AuthorLF_FF() .format("von Neumann,,John and John Smith and Black Brown, Jr, Peter")); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrCommasTest.java index e49653a18c20..4dbdf8c65913 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrCommasTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorLastFirstAbbrCommasTest { +class AuthorLastFirstAbbrCommasTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorLastFirstAbbrCommas#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorLastFirstAbbrCommas(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrOxfordCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrOxfordCommasTest.java index 21a8e6a195de..b895167924a6 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrOxfordCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrOxfordCommasTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorLastFirstAbbrOxfordCommasTest { +class AuthorLastFirstAbbrOxfordCommasTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorLastFirstAbbrOxfordCommas#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorLastFirstAbbrOxfordCommas(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstCommasTest.java index 35d262ccffd8..8e38bbf7004e 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstCommasTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorLastFirstCommasTest { +class AuthorLastFirstCommasTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorLastFirstCommas#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorLastFirstCommas(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommasTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommasTest.java index e3beacbd4b47..5ca2ce59e6ae 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommasTest.java @@ -6,13 +6,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorLastFirstOxfordCommasTest { +class AuthorLastFirstOxfordCommasTest { /** * Test method for {@link org.jabref.logic.layout.format.AuthorLastFirstOxfordCommas#format(java.lang.String)}. */ @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorLastFirstOxfordCommas(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstTest.java index 8d26609ee87e..3becbe0edfce 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstTest.java @@ -6,10 +6,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorLastFirstTest { +class AuthorLastFirstTest { @Test - public void testFormat() { + void testFormat() { LayoutFormatter a = new AuthorLastFirst(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorNatBibTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorNatBibTest.java index 164e4c667de5..4daacb2ea226 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorNatBibTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorNatBibTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorNatBibTest { +class AuthorNatBibTest { LayoutFormatter authorNatBibFormatter = new AuthorNatBib(); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorOrgSciTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorOrgSciTest.java index 22b5b82a5654..922032821ca8 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorOrgSciTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorOrgSciTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorOrgSciTest { +class AuthorOrgSciTest { LayoutFormatter authorOrgNatFormatter = new AuthorOrgSci(); LayoutFormatter authorOrgNatFormatterComposite = new CompositeFormat(new AuthorOrgSci(), new NoSpaceBetweenAbbreviations()); diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorsTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorsTest.java index 8a3e22410c3c..12ef3a34c4b6 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorsTest.java @@ -8,133 +8,133 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class AuthorsTest { +class AuthorsTest { private ParamLayoutFormatter authorsLayoutFormatter = new Authors(); @Test - public void testStandardUsage() { + void testStandardUsage() { assertEquals("B. C. Bruce, C. Manson and J. Jumper", authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper")); } @Test - public void testStandardUsageOne() { + void testStandardUsageOne() { authorsLayoutFormatter.setArgument("fullname, LastFirst, Comma, Comma"); assertEquals("Bruce, Bob Croydon, Jumper, Jolly", authorsLayoutFormatter.format("Bob Croydon Bruce and Jolly Jumper")); } @Test - public void testStandardUsageTwo() { + void testStandardUsageTwo() { authorsLayoutFormatter.setArgument("initials"); assertEquals("B. C. Bruce and J. Jumper", authorsLayoutFormatter.format("Bob Croydon Bruce and Jolly Jumper")); } @Test - public void testStandardUsageThree() { + void testStandardUsageThree() { authorsLayoutFormatter.setArgument("fullname, LastFirst, Comma"); assertEquals("Bruce, Bob Croydon, Manson, Charles and Jumper, Jolly", authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper")); } @Test - public void testStandardUsageFour() { + void testStandardUsageFour() { authorsLayoutFormatter.setArgument("fullname, LastFirst, Comma, 2"); assertEquals("Bruce, Bob Croydon et al.", authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper")); } @Test - public void testStandardUsageFive() { + void testStandardUsageFive() { authorsLayoutFormatter.setArgument("fullname, LastFirst, Comma, 3"); assertEquals("Bruce, Bob Croydon et al.", authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles")); } @Test - public void testStandardUsageSix() { + void testStandardUsageSix() { authorsLayoutFormatter.setArgument("fullname, LastFirst, Comma, 3, 2"); assertEquals("Bruce, Bob Croydon, Manson, Charles et al.", authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles")); } @Test - public void testSpecialEtAl() { + void testSpecialEtAl() { authorsLayoutFormatter.setArgument("fullname, LastFirst, Comma, 3, etal= and a few more"); assertEquals("Bruce, Bob Croydon and a few more", authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles")); } @Test - public void testStandardUsageNull() { + void testStandardUsageNull() { assertEquals("", authorsLayoutFormatter.format(null)); } @Test - public void testStandardOxford() { + void testStandardOxford() { authorsLayoutFormatter.setArgument("Oxford"); assertEquals("B. C. Bruce, C. Manson, and J. Jumper", authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper")); } @Test - public void testStandardOxfordFullName() { + void testStandardOxfordFullName() { authorsLayoutFormatter.setArgument("FullName,Oxford"); assertEquals("Bob Croydon Bruce, Charles Manson, and Jolly Jumper", authorsLayoutFormatter.format("Bruce, Bob Croydon and Charles Manson and Jolly Jumper")); } @Test - public void testStandardCommaFullName() { + void testStandardCommaFullName() { authorsLayoutFormatter.setArgument("FullName,Comma,Comma"); assertEquals("Bob Croydon Bruce, Charles Manson, Jolly Jumper", authorsLayoutFormatter.format("Bruce, Bob Croydon and Charles Manson and Jolly Jumper")); } @Test - public void testStandardAmpFullName() { + void testStandardAmpFullName() { authorsLayoutFormatter.setArgument("FullName,Amp"); assertEquals("Bob Croydon Bruce, Charles Manson & Jolly Jumper", authorsLayoutFormatter.format("Bruce, Bob Croydon and Charles Manson and Jolly Jumper")); } @Test - public void testLastName() { + void testLastName() { authorsLayoutFormatter.setArgument("LastName"); assertEquals("Bruce, von Manson and Jumper", authorsLayoutFormatter.format("Bruce, Bob Croydon and Charles von Manson and Jolly Jumper")); } @Test - public void testMiddleInitial() { + void testMiddleInitial() { authorsLayoutFormatter.setArgument("MiddleInitial"); assertEquals("Bob C. Bruce, Charles K. von Manson and Jolly Jumper", authorsLayoutFormatter.format("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly")); } @Test - public void testNoPeriod() { + void testNoPeriod() { authorsLayoutFormatter.setArgument("NoPeriod"); assertEquals("B C Bruce, C K von Manson and J Jumper", authorsLayoutFormatter.format("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly")); } @Test - public void testEtAl() { + void testEtAl() { authorsLayoutFormatter.setArgument("2,1"); assertEquals("B. C. Bruce et al.", authorsLayoutFormatter.format("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly")); } @Test - public void testEtAlNotEnoughAuthors() { + void testEtAlNotEnoughAuthors() { authorsLayoutFormatter.setArgument("2,1"); assertEquals("B. C. Bruce and C. K. von Manson", authorsLayoutFormatter.format("Bruce, Bob Croydon and Charles Kermit von Manson")); } @Test - public void testEmptyEtAl() { + void testEmptyEtAl() { authorsLayoutFormatter.setArgument("fullname, LastFirst, Comma, 3, etal="); assertEquals("Bruce, Bob Croydon", authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles")); @@ -146,7 +146,7 @@ public void testEmptyEtAl() { "LastFirst, 'Bruce, B. C., Manson, C., Jumper, J. and Chuckles, C.'", // LastFirst "LastFirstFirstFirst, 'Bruce, B. C., C. Manson, J. Jumper and C. Chuckles'" // LastFirstFirstFirst }) - public void testAuthorOrder(String arg, String expectedResult) { + void testAuthorOrder(String arg, String expectedResult) { authorsLayoutFormatter.setArgument(arg); String formattedStr = authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles"); assertEquals(expectedResult, formattedStr); @@ -161,7 +161,7 @@ public void testAuthorOrder(String arg, String expectedResult) { "LastName, 'Bruce, Manson, Jumper and Chuckles'", // LastName "InitialsNoSpace, 'B.C. Bruce, C. Manson, J. Jumper and C. Chuckles'" // InitialsNoSpace }) - public void testAuthorABRV(String arg, String expectedResult) { + void testAuthorABRV(String arg, String expectedResult) { authorsLayoutFormatter.setArgument(arg); String formattedStr = authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles"); assertEquals(expectedResult, formattedStr); @@ -174,7 +174,7 @@ public void testAuthorABRV(String arg, String expectedResult) { "NoComma, 'B. C. Bruce, C. Manson, J. Jumper and C. Chuckles'", // NoComma "NoPeriod, 'B C Bruce, C Manson, J Jumper and C Chuckles'" // NoPeriod }) - public void testAuthorPUNC(String arg, String expectedResult) { + void testAuthorPUNC(String arg, String expectedResult) { authorsLayoutFormatter.setArgument(arg); String formattedStr = authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles"); assertEquals(expectedResult, formattedStr); @@ -196,7 +196,7 @@ public void testAuthorPUNC(String arg, String expectedResult) { "'Comma, Colon', 'B. C. Bruce, C. Manson, J. Jumper: C. Chuckles'", // Comma Colon "'Comma, Semicolon', 'B. C. Bruce, C. Manson, J. Jumper; C. Chuckles'", // Comma Semicolon }) - public void testAuthorSEPARATORS(String arg, String expectedResult) { + void testAuthorSEPARATORS(String arg, String expectedResult) { authorsLayoutFormatter.setArgument(arg); String formattedStr = authorsLayoutFormatter.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles"); assertEquals(expectedResult, formattedStr); diff --git a/src/test/java/org/jabref/logic/layout/format/CompositeFormatTest.java b/src/test/java/org/jabref/logic/layout/format/CompositeFormatTest.java index 9b0c6d49a2ff..5e36d94b9e2c 100644 --- a/src/test/java/org/jabref/logic/layout/format/CompositeFormatTest.java +++ b/src/test/java/org/jabref/logic/layout/format/CompositeFormatTest.java @@ -6,16 +6,16 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class CompositeFormatTest { +class CompositeFormatTest { @Test - public void testEmptyComposite() { + void testEmptyComposite() { LayoutFormatter f = new CompositeFormat(); assertEquals("No Change", f.format("No Change")); } @Test - public void testArrayComposite() { + void testArrayComposite() { LayoutFormatter f = new CompositeFormat(new LayoutFormatter[]{fieldText -> fieldText + fieldText, fieldText -> "A" + fieldText, fieldText -> "B" + fieldText}); @@ -23,7 +23,7 @@ public void testArrayComposite() { } @Test - public void testDoubleComposite() { + void testDoubleComposite() { LayoutFormatter f = new CompositeFormat(new AuthorOrgSci(), new NoSpaceBetweenAbbreviations()); LayoutFormatter first = new AuthorOrgSci(); LayoutFormatter second = new NoSpaceBetweenAbbreviations(); diff --git a/src/test/java/org/jabref/logic/layout/format/DOICheckTest.java b/src/test/java/org/jabref/logic/layout/format/DOICheckTest.java index 2c7fb18598c3..b43696a0fb57 100644 --- a/src/test/java/org/jabref/logic/layout/format/DOICheckTest.java +++ b/src/test/java/org/jabref/logic/layout/format/DOICheckTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class DOICheckTest { +class DOICheckTest { private LayoutFormatter layoutFormatter = new DOICheck(); diff --git a/src/test/java/org/jabref/logic/layout/format/DOIStripTest.java b/src/test/java/org/jabref/logic/layout/format/DOIStripTest.java index b8576d4e7839..201188a59d1d 100644 --- a/src/test/java/org/jabref/logic/layout/format/DOIStripTest.java +++ b/src/test/java/org/jabref/logic/layout/format/DOIStripTest.java @@ -10,13 +10,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class DOIStripTest { +class DOIStripTest { LayoutFormatter layoutFormatter = new DOIStrip(); - @ParameterizedTest - @MethodSource("provideDOI") - public void testFormatDOIStrip(String formattedDOI, String originalDOI) { + @ParameterizedTest + @MethodSource("provideDOI") + void testFormatDOIStrip(String formattedDOI, String originalDOI) { assertEquals(formattedDOI, layoutFormatter.format(originalDOI)); } diff --git a/src/test/java/org/jabref/logic/layout/format/DateFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/DateFormatterTest.java index d5eda7aa69aa..aa7cc152c686 100644 --- a/src/test/java/org/jabref/logic/layout/format/DateFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/DateFormatterTest.java @@ -9,22 +9,22 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class DateFormatterTest { +class DateFormatterTest { private ParamLayoutFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new DateFormatter(); } @Test - public void testDefaultFormat() { + void testDefaultFormat() { assertEquals("2016-07-15", formatter.format("2016-07-15")); } @Test - public void testRequestedFormat() { + void testRequestedFormat() { formatter.setArgument("MM/yyyy"); assertEquals("07/2016", formatter.format("2016-07-15")); } @@ -37,7 +37,7 @@ public void testRequestedFormat() { "yyyy.MM.dd, 2016-07-15, 2016.07.15", // yyyy.MM.dd "yyyy/MM, 2016-07-15, 2016/07", // yyyy/MM }) - public void testOtherFormats(String formatArg, String input, String expectedResult) { + void testOtherFormats(String formatArg, String input, String expectedResult) { formatter.setArgument(formatArg); String formattedStr = formatter.format(input); assertEquals(expectedResult, formattedStr); diff --git a/src/test/java/org/jabref/logic/layout/format/DefaultTest.java b/src/test/java/org/jabref/logic/layout/format/DefaultTest.java index 4414990c4fc4..ddaea45c2fb3 100644 --- a/src/test/java/org/jabref/logic/layout/format/DefaultTest.java +++ b/src/test/java/org/jabref/logic/layout/format/DefaultTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class DefaultTest { +class DefaultTest { ParamLayoutFormatter paramLayoutFormatter = new Default(); diff --git a/src/test/java/org/jabref/logic/layout/format/EntryTypeFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/EntryTypeFormatterTest.java index 8fca35e0b3a8..6be8a452859a 100644 --- a/src/test/java/org/jabref/logic/layout/format/EntryTypeFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/EntryTypeFormatterTest.java @@ -8,7 +8,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class EntryTypeFormatterTest { +class EntryTypeFormatterTest { private EntryTypeFormatter formatter = new EntryTypeFormatter(); diff --git a/src/test/java/org/jabref/logic/layout/format/FileLinkTest.java b/src/test/java/org/jabref/logic/layout/format/FileLinkTest.java index c7cd3c463023..1b58d4a07c79 100644 --- a/src/test/java/org/jabref/logic/layout/format/FileLinkTest.java +++ b/src/test/java/org/jabref/logic/layout/format/FileLinkTest.java @@ -12,12 +12,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FileLinkTest { +class FileLinkTest { private ParamLayoutFormatter fileLinkLayoutFormatter; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { fileLinkLayoutFormatter = new FileLink(Collections.emptyList(), ""); } diff --git a/src/test/java/org/jabref/logic/layout/format/FirstPageTest.java b/src/test/java/org/jabref/logic/layout/format/FirstPageTest.java index efe7f6691513..9326bbd0f5bd 100644 --- a/src/test/java/org/jabref/logic/layout/format/FirstPageTest.java +++ b/src/test/java/org/jabref/logic/layout/format/FirstPageTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FirstPageTest { +class FirstPageTest { private LayoutFormatter firstPageLayoutFormatter = new FirstPage(); diff --git a/src/test/java/org/jabref/logic/layout/format/HTMLCharsTest.java b/src/test/java/org/jabref/logic/layout/format/HTMLCharsTest.java index fd4a9c54b774..5e50fbdf0fc3 100644 --- a/src/test/java/org/jabref/logic/layout/format/HTMLCharsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/HTMLCharsTest.java @@ -7,17 +7,17 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class HTMLCharsTest { +class HTMLCharsTest { private LayoutFormatter layout; @BeforeEach - public void setUp() { + void setUp() { layout = new HTMLChars(); } @Test - public void testBasicFormat() { + void testBasicFormat() { assertEquals("", layout.format("")); assertEquals("hallo", layout.format("hallo")); @@ -47,7 +47,7 @@ public void testBasicFormat() { } @Test - public void testLaTeXHighlighting() { + void testLaTeXHighlighting() { assertEquals("hallo", layout.format("\\emph{hallo}")); assertEquals("hallo", layout.format("{\\emph hallo}")); assertEquals("hallo", layout.format("{\\em hallo}")); @@ -69,7 +69,7 @@ public void testLaTeXHighlighting() { } @Test - public void testEquations() { + void testEquations() { assertEquals("$", layout.format("\\$")); assertEquals("σ", layout.format("$\\sigma$")); assertEquals("A 32 mA ΣΔ-modulator", @@ -77,31 +77,32 @@ public void testEquations() { } @Test - public void testNewLine() { + void testNewLine() { assertEquals("a
    b", layout.format("a\nb")); assertEquals("a

    b", layout.format("a\n\nb")); } + /* * Is missing a lot of test cases for the individual chars... */ @Test - public void testQuoteSingle() { + void testQuoteSingle() { assertEquals("'", layout.format("{\\textquotesingle}")); } @Test - public void unknownCommandIsKept() { + void unknownCommandIsKept() { assertEquals("aaaa", layout.format("\\aaaa")); } @Test - public void unknownCommandKeepsArgument() { + void unknownCommandKeepsArgument() { assertEquals("bbbb", layout.format("\\aaaa{bbbb}")); } @Test - public void unknownCommandWithEmptyArgumentIsKept() { + void unknownCommandWithEmptyArgumentIsKept() { assertEquals("aaaa", layout.format("\\aaaa{}")); } } diff --git a/src/test/java/org/jabref/logic/layout/format/HTMLParagraphsTest.java b/src/test/java/org/jabref/logic/layout/format/HTMLParagraphsTest.java index 26391ed935dc..ab4d4f0b6bba 100644 --- a/src/test/java/org/jabref/logic/layout/format/HTMLParagraphsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/HTMLParagraphsTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class HTMLParagraphsTest { +class HTMLParagraphsTest { LayoutFormatter htmlFormatter = new HTMLParagraphs(); diff --git a/src/test/java/org/jabref/logic/layout/format/IfPluralTest.java b/src/test/java/org/jabref/logic/layout/format/IfPluralTest.java index bb5dbbaceff7..69eb1f02333d 100644 --- a/src/test/java/org/jabref/logic/layout/format/IfPluralTest.java +++ b/src/test/java/org/jabref/logic/layout/format/IfPluralTest.java @@ -6,44 +6,44 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class IfPluralTest { +class IfPluralTest { @Test - public void testStandardUsageOneEditor() { + void testStandardUsageOneEditor() { ParamLayoutFormatter a = new IfPlural(); a.setArgument("Eds.,Ed."); assertEquals("Ed.", a.format("Bob Bruce")); } @Test - public void testStandardUsageTwoEditors() { + void testStandardUsageTwoEditors() { ParamLayoutFormatter a = new IfPlural(); a.setArgument("Eds.,Ed."); assertEquals("Eds.", a.format("Bob Bruce and Jolly Jumper")); } @Test - public void testFormatNull() { + void testFormatNull() { ParamLayoutFormatter a = new IfPlural(); a.setArgument("Eds.,Ed."); assertEquals("", a.format(null)); } @Test - public void testFormatEmpty() { + void testFormatEmpty() { ParamLayoutFormatter a = new IfPlural(); a.setArgument("Eds.,Ed."); assertEquals("", a.format("")); } @Test - public void testNoArgumentSet() { + void testNoArgumentSet() { ParamLayoutFormatter a = new IfPlural(); assertEquals("", a.format("Bob Bruce and Jolly Jumper")); } @Test - public void testNoProperArgument() { + void testNoProperArgument() { ParamLayoutFormatter a = new IfPlural(); a.setArgument("Eds."); assertEquals("", a.format("Bob Bruce and Jolly Jumper")); diff --git a/src/test/java/org/jabref/logic/layout/format/LastPageTest.java b/src/test/java/org/jabref/logic/layout/format/LastPageTest.java index c7cf743dc228..84b34eee8f98 100644 --- a/src/test/java/org/jabref/logic/layout/format/LastPageTest.java +++ b/src/test/java/org/jabref/logic/layout/format/LastPageTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class LastPageTest { +class LastPageTest { private LayoutFormatter lastPageLayoutFormatter = new LastPage(); diff --git a/src/test/java/org/jabref/logic/layout/format/NameFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/NameFormatterTest.java index 5a4b1b6581b1..db7e76fac917 100644 --- a/src/test/java/org/jabref/logic/layout/format/NameFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/NameFormatterTest.java @@ -4,10 +4,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class NameFormatterTest { +class NameFormatterTest { @Test - public void testFormatStringStringBibtexEntry() { + void testFormatStringStringBibtexEntry() { NameFormatter l = new NameFormatter(); assertEquals("Doe", l.format("Joe Doe", "1@*@{ll}")); @@ -30,7 +30,7 @@ public void testFormatStringStringBibtexEntry() { } @Test - public void testFormat() { + void testFormat() { NameFormatter a = new NameFormatter(); // Empty case diff --git a/src/test/java/org/jabref/logic/layout/format/NoSpaceBetweenAbbreviationsTest.java b/src/test/java/org/jabref/logic/layout/format/NoSpaceBetweenAbbreviationsTest.java index 7c75e579b86a..9e9c00463b7e 100644 --- a/src/test/java/org/jabref/logic/layout/format/NoSpaceBetweenAbbreviationsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/NoSpaceBetweenAbbreviationsTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class NoSpaceBetweenAbbreviationsTest { +class NoSpaceBetweenAbbreviationsTest { private LayoutFormatter nsbaLayoutFormatter = new NoSpaceBetweenAbbreviations(); diff --git a/src/test/java/org/jabref/logic/layout/format/OrdinalTest.java b/src/test/java/org/jabref/logic/layout/format/OrdinalTest.java index af73ab217be2..881d53077cb5 100644 --- a/src/test/java/org/jabref/logic/layout/format/OrdinalTest.java +++ b/src/test/java/org/jabref/logic/layout/format/OrdinalTest.java @@ -5,20 +5,20 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -public class OrdinalTest { +class OrdinalTest { @Test - public void testEmpty() { + void testEmpty() { assertEquals("", new Ordinal().format("")); } @Test - public void testNull() { + void testNull() { assertNull(new Ordinal().format(null)); } @Test - public void testSingleDigit() { + void testSingleDigit() { assertEquals("1st", new Ordinal().format("1")); assertEquals("2nd", new Ordinal().format("2")); assertEquals("3rd", new Ordinal().format("3")); @@ -26,28 +26,28 @@ public void testSingleDigit() { } @Test - public void testMultiDigits() { + void testMultiDigits() { assertEquals("11th", new Ordinal().format("11")); assertEquals("111th", new Ordinal().format("111")); assertEquals("21st", new Ordinal().format("21")); } @Test - public void testAlreadyOrdinals() { + void testAlreadyOrdinals() { assertEquals("1st", new Ordinal().format("1st")); assertEquals("111th", new Ordinal().format("111th")); assertEquals("22nd", new Ordinal().format("22nd")); } @Test - public void testFullSentence() { + void testFullSentence() { assertEquals("1st edn.", new Ordinal().format("1 edn.")); assertEquals("1st edition", new Ordinal().format("1st edition")); assertEquals("The 2nd conference on 3rd.14th", new Ordinal().format("The 2 conference on 3.14")); } @Test - public void testLetters() { + void testLetters() { assertEquals("abCD eFg", new Ordinal().format("abCD eFg")); } } diff --git a/src/test/java/org/jabref/logic/layout/format/RTFCharsTest.java b/src/test/java/org/jabref/logic/layout/format/RTFCharsTest.java index 3e65598c1171..000c034f742e 100644 --- a/src/test/java/org/jabref/logic/layout/format/RTFCharsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RTFCharsTest.java @@ -180,7 +180,7 @@ void testSpecialCharacters() { "ß, \\u223ss", // ss "¡, \\u161!" // ! }) - public void testMoreSpecialCharacters(String specialChar, String expectedResult) { + void testMoreSpecialCharacters(String specialChar, String expectedResult) { String formattedStr = formatter.format(specialChar); assertEquals(expectedResult, formattedStr); } diff --git a/src/test/java/org/jabref/logic/layout/format/RemoveBracketsAddCommaTest.java b/src/test/java/org/jabref/logic/layout/format/RemoveBracketsAddCommaTest.java index 666958bb44ac..f2dce2085ac8 100644 --- a/src/test/java/org/jabref/logic/layout/format/RemoveBracketsAddCommaTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RemoveBracketsAddCommaTest.java @@ -11,11 +11,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RemoveBracketsAddCommaTest { +class RemoveBracketsAddCommaTest { private LayoutFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveBracketsAddComma(); } diff --git a/src/test/java/org/jabref/logic/layout/format/RemoveBracketsTest.java b/src/test/java/org/jabref/logic/layout/format/RemoveBracketsTest.java index 000cc393d32b..589f45427f03 100644 --- a/src/test/java/org/jabref/logic/layout/format/RemoveBracketsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RemoveBracketsTest.java @@ -7,36 +7,36 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RemoveBracketsTest { +class RemoveBracketsTest { private LayoutFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveBrackets(); } @Test - public void bracePairCorrectlyRemoved() throws Exception { + void bracePairCorrectlyRemoved() throws Exception { assertEquals("some text", formatter.format("{some text}")); } @Test - public void singleOpeningBraceCorrectlyRemoved() throws Exception { + void singleOpeningBraceCorrectlyRemoved() throws Exception { assertEquals("some text", formatter.format("{some text")); } @Test - public void singleClosingBraceCorrectlyRemoved() throws Exception { + void singleClosingBraceCorrectlyRemoved() throws Exception { assertEquals("some text", formatter.format("some text}")); } @Test - public void bracePairWithEscapedBackslashCorrectlyRemoved() throws Exception { + void bracePairWithEscapedBackslashCorrectlyRemoved() throws Exception { assertEquals("\\some text\\", formatter.format("\\{some text\\}")); } @Test - public void withoutBracketsUnmodified() throws Exception { + void withoutBracketsUnmodified() throws Exception { assertEquals("some text", formatter.format("some text")); } } diff --git a/src/test/java/org/jabref/logic/layout/format/RemoveLatexCommandsFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/RemoveLatexCommandsFormatterTest.java index 9eab6df5985a..a3915f83d43d 100644 --- a/src/test/java/org/jabref/logic/layout/format/RemoveLatexCommandsFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RemoveLatexCommandsFormatterTest.java @@ -10,52 +10,52 @@ class RemoveLatexCommandsFormatterTest { private RemoveLatexCommandsFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveLatexCommandsFormatter(); } @Test - public void withoutLatexCommandsUnmodified() { + void withoutLatexCommandsUnmodified() { assertEquals("some text", formatter.format("some text")); } @Test - public void singleCommandWiped() { + void singleCommandWiped() { assertEquals("", formatter.format("\\sometext")); } @Test - public void singleSpaceAfterCommandRemoved() { + void singleSpaceAfterCommandRemoved() { assertEquals("text", formatter.format("\\some text")); } @Test - public void multipleSpacesAfterCommandRemoved() { + void multipleSpacesAfterCommandRemoved() { assertEquals("text", formatter.format("\\some text")); } @Test - public void escapedBackslashBecomesBackslash() { + void escapedBackslashBecomesBackslash() { assertEquals("\\", formatter.format("\\\\")); } @Test - public void escapedBackslashFollowedByTextBecomesBackslashFollowedByText() { + void escapedBackslashFollowedByTextBecomesBackslashFollowedByText() { assertEquals("\\some text", formatter.format("\\\\some text")); } @Test - public void escapedBackslashKept() { + void escapedBackslashKept() { assertEquals("\\some text\\", formatter.format("\\\\some text\\\\")); } @Test - public void escapedUnderscoreReplaces() { + void escapedUnderscoreReplaces() { assertEquals("some_text", formatter.format("some\\_text")); } @Test - public void exampleUrlCorrectlyCleaned() { + void exampleUrlCorrectlyCleaned() { assertEquals("http://pi.informatik.uni-siegen.de/stt/36_2/./03_Technische_Beitraege/ZEUS2016/beitrag_2.pdf", formatter.format("http://pi.informatik.uni-siegen.de/stt/36\\_2/./03\\_Technische\\_Beitraege/ZEUS2016/beitrag\\_2.pdf")); } } diff --git a/src/test/java/org/jabref/logic/layout/format/RemoveTildeTest.java b/src/test/java/org/jabref/logic/layout/format/RemoveTildeTest.java index 17635c2b7231..ae832ef7316c 100644 --- a/src/test/java/org/jabref/logic/layout/format/RemoveTildeTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RemoveTildeTest.java @@ -11,11 +11,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RemoveTildeTest { +class RemoveTildeTest { private LayoutFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new RemoveTilde(); } diff --git a/src/test/java/org/jabref/logic/layout/format/RemoveWhitespaceTest.java b/src/test/java/org/jabref/logic/layout/format/RemoveWhitespaceTest.java index 96e92bbac0b9..644689f8ccc3 100644 --- a/src/test/java/org/jabref/logic/layout/format/RemoveWhitespaceTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RemoveWhitespaceTest.java @@ -5,30 +5,30 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -public class RemoveWhitespaceTest { +class RemoveWhitespaceTest { @Test - public void testEmptyExpectEmpty() { + void testEmptyExpectEmpty() { assertEquals("", new RemoveWhitespace().format("")); } @Test - public void testNullExpectNull() { + void testNullExpectNull() { assertNull(new RemoveWhitespace().format(null)); } @Test - public void testNormal() { + void testNormal() { assertEquals("abcd EFG", new RemoveWhitespace().format("abcd EFG")); } @Test - public void testTab() { + void testTab() { assertEquals("abcd EFG", new RemoveWhitespace().format("abcd\t EFG")); } @Test - public void testNewLineCombo() { + void testNewLineCombo() { assertEquals("abcd EFG", new RemoveWhitespace().format("abcd\r E\nFG\r\n")); } } diff --git a/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java b/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java index 31bc81144f59..1465a3f323b1 100644 --- a/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java @@ -7,44 +7,44 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -public class ReplaceTest { +class ReplaceTest { @Test - public void testSimpleText() { + void testSimpleText() { ParamLayoutFormatter a = new Replace(); a.setArgument("Bob,Ben"); assertEquals("Ben Bruce", a.format("Bob Bruce")); } @Test - public void testSimpleTextNoHit() { + void testSimpleTextNoHit() { ParamLayoutFormatter a = new Replace(); a.setArgument("Bob,Ben"); assertEquals("Jolly Jumper", a.format("Jolly Jumper")); } @Test - public void testFormatNull() { + void testFormatNull() { ParamLayoutFormatter a = new Replace(); a.setArgument("Eds.,Ed."); assertNull(a.format(null)); } @Test - public void testFormatEmpty() { + void testFormatEmpty() { ParamLayoutFormatter a = new Replace(); a.setArgument("Eds.,Ed."); assertEquals("", a.format("")); } @Test - public void testNoArgumentSet() { + void testNoArgumentSet() { ParamLayoutFormatter a = new Replace(); assertEquals("Bob Bruce and Jolly Jumper", a.format("Bob Bruce and Jolly Jumper")); } @Test - public void testNoProperArgument() { + void testNoProperArgument() { ParamLayoutFormatter a = new Replace(); a.setArgument("Eds."); assertEquals("Bob Bruce and Jolly Jumper", a.format("Bob Bruce and Jolly Jumper")); diff --git a/src/test/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatterTest.java index 987fc22153c3..0aa745f3b7ab 100644 --- a/src/test/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ReplaceUnicodeLigaturesFormatterTest.java @@ -5,34 +5,34 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ReplaceUnicodeLigaturesFormatterTest { +class ReplaceUnicodeLigaturesFormatterTest { private ReplaceUnicodeLigaturesFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new ReplaceUnicodeLigaturesFormatter(); } @Test - public void testPlainFormat() { + void testPlainFormat() { assertEquals("lorem ipsum", formatter.format("lorem ipsum")); } @Test - public void testSingleLigatures() { + void testSingleLigatures() { assertEquals("AA", formatter.format("\uA732")); assertEquals("fi", formatter.format("fi")); assertEquals("et", formatter.format("\uD83D\uDE70")); } @Test - public void testLigatureSequence() { + void testLigatureSequence() { assertEquals("aefffflstue", formatter.format("æfffflstᵫ")); } @Test - public void testSampleInput() { + void testSampleInput() { assertEquals("AEneas", formatter.format("Æneas")); } } diff --git a/src/test/java/org/jabref/logic/layout/format/RisKeywordsTest.java b/src/test/java/org/jabref/logic/layout/format/RisKeywordsTest.java index 863683620fa1..89731d85cc70 100644 --- a/src/test/java/org/jabref/logic/layout/format/RisKeywordsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RisKeywordsTest.java @@ -6,30 +6,30 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RisKeywordsTest { +class RisKeywordsTest { @Test - public void testEmpty() { + void testEmpty() { assertEquals("", new RisKeywords().format("")); } @Test - public void testNull() { + void testNull() { assertEquals("", new RisKeywords().format(null)); } @Test - public void testSingleKeyword() { + void testSingleKeyword() { assertEquals("KW - abcd", new RisKeywords().format("abcd")); } @Test - public void testTwoKeywords() { + void testTwoKeywords() { assertEquals("KW - abcd" + OS.NEWLINE + "KW - efg", new RisKeywords().format("abcd, efg")); } @Test - public void testMultipleKeywords() { + void testMultipleKeywords() { assertEquals("KW - abcd" + OS.NEWLINE + "KW - efg" + OS.NEWLINE + "KW - hij" + OS.NEWLINE + "KW - klm", new RisKeywords().format("abcd, efg, hij, klm")); } diff --git a/src/test/java/org/jabref/logic/layout/format/RisMonthTest.java b/src/test/java/org/jabref/logic/layout/format/RisMonthTest.java index a323dcd1d2ee..776a84408cb8 100644 --- a/src/test/java/org/jabref/logic/layout/format/RisMonthTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RisMonthTest.java @@ -6,15 +6,15 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class RisMonthTest { +class RisMonthTest { @Test - public void testEmpty() { + void testEmpty() { assertEquals("", new RisMonth().format("")); } @Test - public void testNull() { + void testNull() { assertEquals("", new RisMonth().format(null)); } @@ -33,13 +33,13 @@ public void testNull() { "nov, 11", // nov "dec, 12", // dec }) - public void testValidMonth(String input, String expectedResult) { + void testValidMonth(String input, String expectedResult) { String formattedStr = new RisMonth().format(input); assertEquals(expectedResult, formattedStr); } @Test - public void testInvalidMonth() { + void testInvalidMonth() { assertEquals("abcd", new RisMonth().format("abcd")); } } diff --git a/src/test/java/org/jabref/logic/layout/format/ShortMonthFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/ShortMonthFormatterTest.java index 2b8ee803be56..6091f3ea481b 100644 --- a/src/test/java/org/jabref/logic/layout/format/ShortMonthFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ShortMonthFormatterTest.java @@ -12,23 +12,23 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ShortMonthFormatterTest { +class ShortMonthFormatterTest { private LayoutFormatter formatter; @BeforeEach - public void setUp() { + void setUp() { formatter = new ShortMonthFormatter(); } @Test - public void formatNullInput() { + void formatNullInput() { assertEquals("", formatter.format(null)); } @ParameterizedTest @MethodSource("provideArguments") - public void formatDifferentInputs(String formattedString, String originalString) { + void formatDifferentInputs(String formattedString, String originalString) { assertEquals(formattedString, formatter.format(originalString)); } diff --git a/src/test/java/org/jabref/logic/layout/format/ToLowerCaseTest.java b/src/test/java/org/jabref/logic/layout/format/ToLowerCaseTest.java index 1ab1455925c4..522154d62338 100644 --- a/src/test/java/org/jabref/logic/layout/format/ToLowerCaseTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ToLowerCaseTest.java @@ -10,16 +10,16 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -public class ToLowerCaseTest { +class ToLowerCaseTest { @Test - public void testNull() { + void testNull() { assertNull(new ToLowerCase().format(null)); } @ParameterizedTest @MethodSource("provideArguments") - public void toLowerCaseWithDifferentInputs(String expectedString, String originalString) { + void toLowerCaseWithDifferentInputs(String expectedString, String originalString) { assertEquals(expectedString, new ToLowerCase().format(originalString)); } diff --git a/src/test/java/org/jabref/logic/layout/format/ToUpperCaseTest.java b/src/test/java/org/jabref/logic/layout/format/ToUpperCaseTest.java index 4611ed276ed5..62235429eea1 100644 --- a/src/test/java/org/jabref/logic/layout/format/ToUpperCaseTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ToUpperCaseTest.java @@ -8,7 +8,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class ToUpperCaseTest { +class ToUpperCaseTest { ToUpperCase upperCase = new ToUpperCase(); diff --git a/src/test/java/org/jabref/logic/layout/format/WrapContentTest.java b/src/test/java/org/jabref/logic/layout/format/WrapContentTest.java index bb933c44b5c5..7146ff172d48 100644 --- a/src/test/java/org/jabref/logic/layout/format/WrapContentTest.java +++ b/src/test/java/org/jabref/logic/layout/format/WrapContentTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class WrapContentTest { +class WrapContentTest { private ParamLayoutFormatter wrapContentParamLayoutFormatter = new WrapContent(); diff --git a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java index 2ccef4f8722d..fab70b2f0cfd 100644 --- a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java +++ b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java @@ -7,45 +7,45 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -public class MsBibAuthorTest { +class MsBibAuthorTest { @Test - public void testGetFirstName() { + void testGetFirstName() { Author author = new Author("Gustav Peter Johann", null, null, "Bach", null); MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertEquals("Gustav", msBibAuthor.getFirstName()); } @Test - public void testGetMiddleName() { + void testGetMiddleName() { Author author = new Author("Gustav Peter Johann", null, null, "Bach", null); MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertEquals("Peter Johann", msBibAuthor.getMiddleName()); } @Test - public void testGetNoMiddleName() { + void testGetNoMiddleName() { Author author = new Author("Gustav", null, null, "Bach", null); MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertNull(msBibAuthor.getMiddleName()); } @Test - public void testGetNoFirstName() { + void testGetNoFirstName() { Author author = new Author(null, null, null, "Bach", null); MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertNull(msBibAuthor.getMiddleName()); } @Test - public void testGetLastName() { + void testGetLastName() { Author author = new Author("Gustav Peter Johann", null, null, "Bach", null); MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertEquals("Bach", msBibAuthor.getLastName()); } @Test - public void testGetVonAndLastName() { + void testGetVonAndLastName() { Author author = new Author("John", null, "von", "Neumann", null); MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertEquals("von Neumann", msBibAuthor.getLastName()); diff --git a/src/test/java/org/jabref/logic/msbib/MsBibMappingTest.java b/src/test/java/org/jabref/logic/msbib/MsBibMappingTest.java index c5884d8e43b8..15a29ccf70ec 100644 --- a/src/test/java/org/jabref/logic/msbib/MsBibMappingTest.java +++ b/src/test/java/org/jabref/logic/msbib/MsBibMappingTest.java @@ -4,27 +4,27 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class MsBibMappingTest { +class MsBibMappingTest { @Test - public void testGetLanguage() { + void testGetLanguage() { String lang = MSBibMapping.getLanguage(1609); assertEquals("basque", lang); } @Test - public void testGetLCID() { + void testGetLCID() { int lcid = MSBibMapping.getLCID("basque"); assertEquals(1609, lcid); } @Test - public void testGetInvalidLanguage() { + void testGetInvalidLanguage() { String lang = MSBibMapping.getLanguage(1234567); assertEquals("english", lang); } @Test - public void testInvalidLCID() { + void testInvalidLCID() { int lcid = MSBibMapping.getLCID("not a language"); assertEquals(1033, lcid); } diff --git a/src/test/java/org/jabref/logic/net/ProxyTest.java b/src/test/java/org/jabref/logic/net/ProxyTest.java index 20f904441cb1..dadf07c9795b 100644 --- a/src/test/java/org/jabref/logic/net/ProxyTest.java +++ b/src/test/java/org/jabref/logic/net/ProxyTest.java @@ -5,13 +5,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ProxyTest { - /** - * The test checks if ProxyPreference class is still able to store password and use it from memory, - * even though it's no longer stored in register. - */ - @Test - public void testProxyPreferencesStorePassword() { +class ProxyTest { + /** + * The test checks if ProxyPreference class is still able to store password and use it from memory, + * even though it's no longer stored in register. + */ + @Test + void testProxyPreferencesStorePassword() { // mock data boolean useProxy = true; String hostname = "testName"; diff --git a/src/test/java/org/jabref/logic/net/URLDownloadTest.java b/src/test/java/org/jabref/logic/net/URLDownloadTest.java index 858bf839d35d..cb711741f8d3 100644 --- a/src/test/java/org/jabref/logic/net/URLDownloadTest.java +++ b/src/test/java/org/jabref/logic/net/URLDownloadTest.java @@ -23,26 +23,26 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @FetcherTest -public class URLDownloadTest { +class URLDownloadTest { private static final Logger LOGGER = LoggerFactory.getLogger(URLDownloadTest.class); @Test - public void testStringDownloadWithSetEncoding() throws IOException { + void testStringDownloadWithSetEncoding() throws IOException { URLDownload dl = new URLDownload(new URL("http://www.google.com")); assertTrue(dl.asString().contains("Google"), "google.com should contain google"); } @Test - public void testStringDownload() throws IOException { + void testStringDownload() throws IOException { URLDownload dl = new URLDownload(new URL("http://www.google.com")); assertTrue(dl.asString(StandardCharsets.UTF_8).contains("Google"), "google.com should contain google"); } @Test - public void testFileDownload() throws IOException { + void testFileDownload() throws IOException { File destination = File.createTempFile("jabref-test", ".html"); try { URLDownload dl = new URLDownload(new URL("http://www.google.com")); @@ -57,14 +57,14 @@ public void testFileDownload() throws IOException { } @Test - public void testDetermineMimeType() throws IOException { + void testDetermineMimeType() throws IOException { URLDownload dl = new URLDownload(new URL("http://www.google.com")); assertTrue(dl.getMimeType().startsWith("text/html")); } @Test - public void downloadToTemporaryFilePathWithoutFileSavesAsTmpFile() throws IOException { + void downloadToTemporaryFilePathWithoutFileSavesAsTmpFile() throws IOException { URLDownload google = new URLDownload(new URL("http://www.google.com")); String path = google.toTemporaryFile().toString(); @@ -72,7 +72,7 @@ public void downloadToTemporaryFilePathWithoutFileSavesAsTmpFile() throws IOExce } @Test - public void downloadToTemporaryFileKeepsName() throws IOException { + void downloadToTemporaryFileKeepsName() throws IOException { URLDownload google = new URLDownload(new URL("https://github.com/JabRef/jabref/blob/main/LICENSE")); String path = google.toTemporaryFile().toString(); @@ -81,7 +81,7 @@ public void downloadToTemporaryFileKeepsName() throws IOException { @Test @DisabledOnCIServer("CI Server is apparently blocked") - public void downloadOfFTPSucceeds() throws IOException { + void downloadOfFTPSucceeds() throws IOException { URLDownload ftp = new URLDownload(new URL("ftp://ftp.informatik.uni-stuttgart.de/pub/library/ncstrl.ustuttgart_fi/INPROC-2016-15/INPROC-2016-15.pdf")); Path path = ftp.toTemporaryFile(); @@ -89,7 +89,7 @@ public void downloadOfFTPSucceeds() throws IOException { } @Test - public void downloadOfHttpSucceeds() throws IOException { + void downloadOfHttpSucceeds() throws IOException { URLDownload ftp = new URLDownload(new URL("http://www.jabref.org")); Path path = ftp.toTemporaryFile(); @@ -97,7 +97,7 @@ public void downloadOfHttpSucceeds() throws IOException { } @Test - public void downloadOfHttpsSucceeds() throws IOException { + void downloadOfHttpsSucceeds() throws IOException { URLDownload ftp = new URLDownload(new URL("https://www.jabref.org")); Path path = ftp.toTemporaryFile(); @@ -105,21 +105,21 @@ public void downloadOfHttpsSucceeds() throws IOException { } @Test - public void testCheckConnectionSuccess() throws MalformedURLException { + void testCheckConnectionSuccess() throws MalformedURLException { URLDownload google = new URLDownload(new URL("http://www.google.com")); assertTrue(google.canBeReached()); } @Test - public void testCheckConnectionFail() throws MalformedURLException { + void testCheckConnectionFail() throws MalformedURLException { URLDownload nonsense = new URLDownload(new URL("http://nonsenseadddress")); assertThrows(UnirestException.class, nonsense::canBeReached); } @Test - public void connectTimeoutIsNeverNull() throws MalformedURLException { + void connectTimeoutIsNeverNull() throws MalformedURLException { URLDownload urlDownload = new URLDownload(new URL("http://www.example.com")); assertNotNull(urlDownload.getConnectTimeout(), "there's a non-null default by the constructor"); @@ -128,7 +128,7 @@ public void connectTimeoutIsNeverNull() throws MalformedURLException { } @Test - public void test503ErrorThrowsNestedIOExceptionWithFetcherServerException() throws Exception { + void test503ErrorThrowsNestedIOExceptionWithFetcherServerException() throws Exception { URLDownload urlDownload = new URLDownload(new URL("http://httpstat.us/503")); Exception exception = assertThrows(IOException.class, urlDownload::asString); @@ -136,7 +136,7 @@ public void test503ErrorThrowsNestedIOExceptionWithFetcherServerException() thro } @Test - public void test429ErrorThrowsNestedIOExceptionWithFetcherServerException() throws Exception { + void test429ErrorThrowsNestedIOExceptionWithFetcherServerException() throws Exception { URLDownload urlDownload = new URLDownload(new URL("http://httpstat.us/429")); Exception exception = assertThrows(IOException.class, urlDownload::asString); diff --git a/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java b/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java index 0478089a8dcd..d9d0fc9b6aa1 100644 --- a/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java +++ b/src/test/java/org/jabref/logic/openoffice/style/OOPreFormatterTest.java @@ -4,10 +4,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class OOPreFormatterTest { +class OOPreFormatterTest { @Test - public void testPlainFormat() { + void testPlainFormat() { assertEquals("aaa", new OOPreFormatter().format("aaa")); assertEquals("$", new OOPreFormatter().format("\\$")); assertEquals("%", new OOPreFormatter().format("\\%")); @@ -15,14 +15,14 @@ public void testPlainFormat() { } @Test - public void testFormatAccents() { + void testFormatAccents() { assertEquals("ä", new OOPreFormatter().format("{\\\"{a}}")); assertEquals("Ä", new OOPreFormatter().format("{\\\"{A}}")); assertEquals("Ç", new OOPreFormatter().format("{\\c{C}}")); } @Test - public void testSpecialCommands() { + void testSpecialCommands() { assertEquals("å", new OOPreFormatter().format("{\\aa}")); assertEquals("bb", new OOPreFormatter().format("{\\bb}")); assertEquals("å a", new OOPreFormatter().format("\\aa a")); @@ -32,24 +32,24 @@ public void testSpecialCommands() { } @Test - public void testUnsupportedSpecialCommands() { + void testUnsupportedSpecialCommands() { assertEquals("ftmch", new OOPreFormatter().format("\\ftmch")); assertEquals("ftmch", new OOPreFormatter().format("{\\ftmch}")); assertEquals("ftmchaaa", new OOPreFormatter().format("{\\ftmch\\aaa}")); } @Test - public void testEquations() { + void testEquations() { assertEquals("Σ", new OOPreFormatter().format("$\\Sigma$")); } @Test - public void testFormatStripLatexCommands() { + void testFormatStripLatexCommands() { assertEquals("-", new OOPreFormatter().format("\\mbox{-}")); } @Test - public void testFormatting() { + void testFormatting() { assertEquals("kkk", new OOPreFormatter().format("\\textit{kkk}")); assertEquals("kkk", new OOPreFormatter().format("{\\it kkk}")); assertEquals("kkk", new OOPreFormatter().format("\\emph{kkk}")); diff --git a/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java b/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java index 38d8a3596153..8c2c7379d7c7 100644 --- a/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java +++ b/src/test/java/org/jabref/logic/openoffice/style/StyleLoaderTest.java @@ -23,7 +23,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class StyleLoaderTest { +class StyleLoaderTest { private static final int NUMBER_OF_INTERNAL_STYLES = 2; private StyleLoader loader; @@ -33,29 +33,29 @@ public class StyleLoaderTest { private JournalAbbreviationRepository abbreviationRepository; @BeforeEach - public void setUp() { + void setUp() { preferences = mock(OpenOfficePreferences.class, Answers.RETURNS_DEEP_STUBS); layoutPreferences = mock(LayoutFormatterPreferences.class, Answers.RETURNS_DEEP_STUBS); abbreviationRepository = mock(JournalAbbreviationRepository.class); } @Test - public void throwNPEWithNullPreferences() { + void throwNPEWithNullPreferences() { assertThrows(NullPointerException.class, () -> loader = new StyleLoader(null, layoutPreferences, abbreviationRepository)); } @Test - public void throwNPEWithNullLayoutPreferences() { + void throwNPEWithNullLayoutPreferences() { assertThrows(NullPointerException.class, () -> loader = new StyleLoader(mock(OpenOfficePreferences.class), null, abbreviationRepository)); } @Test - public void throwNPEWithNullAbbreviationRepository() { + void throwNPEWithNullAbbreviationRepository() { assertThrows(NullPointerException.class, () -> loader = new StyleLoader(mock(OpenOfficePreferences.class), layoutPreferences, null)); } @Test - public void testGetStylesWithEmptyExternal() { + void testGetStylesWithEmptyExternal() { preferences.setExternalStyles(Collections.emptyList()); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); @@ -63,7 +63,7 @@ public void testGetStylesWithEmptyExternal() { } @Test - public void testAddStyleLeadsToOneMoreStyle() throws URISyntaxException { + void testAddStyleLeadsToOneMoreStyle() throws URISyntaxException { preferences.setExternalStyles(Collections.emptyList()); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); @@ -74,7 +74,7 @@ public void testAddStyleLeadsToOneMoreStyle() throws URISyntaxException { } @Test - public void testAddInvalidStyleLeadsToNoMoreStyle() { + void testAddInvalidStyleLeadsToNoMoreStyle() { preferences.setExternalStyles(Collections.emptyList()); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); int beforeAdding = loader.getStyles().size(); @@ -83,7 +83,7 @@ public void testAddInvalidStyleLeadsToNoMoreStyle() { } @Test - public void testInitalizeWithOneExternalFile() throws URISyntaxException { + void testInitalizeWithOneExternalFile() throws URISyntaxException { String filename = Path.of(StyleLoader.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) .toFile().getPath(); when(preferences.getExternalStyles()).thenReturn(FXCollections.singletonObservableList(filename)); @@ -92,7 +92,7 @@ public void testInitalizeWithOneExternalFile() throws URISyntaxException { } @Test - public void testInitalizeWithIncorrectExternalFile() { + void testInitalizeWithIncorrectExternalFile() { preferences.setExternalStyles(Collections.singletonList("DefinitelyNotAValidFileNameOrWeAreExtremelyUnlucky")); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); @@ -100,7 +100,7 @@ public void testInitalizeWithIncorrectExternalFile() { } @Test - public void testInitalizeWithOneExternalFileRemoveStyle() throws URISyntaxException { + void testInitalizeWithOneExternalFileRemoveStyle() throws URISyntaxException { String filename = Path.of(StyleLoader.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) .toFile().getPath(); when(preferences.getExternalStyles()).thenReturn(FXCollections.singletonObservableList(filename)); @@ -121,7 +121,7 @@ public void testInitalizeWithOneExternalFileRemoveStyle() throws URISyntaxExcept } @Test - public void testInitalizeWithOneExternalFileRemoveStyleUpdatesPreferences() throws URISyntaxException { + void testInitalizeWithOneExternalFileRemoveStyleUpdatesPreferences() throws URISyntaxException { String filename = Path.of(StyleLoader.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) .toFile().getPath(); when(preferences.getExternalStyles()).thenReturn(FXCollections.singletonObservableList(filename)); @@ -142,7 +142,7 @@ public void testInitalizeWithOneExternalFileRemoveStyleUpdatesPreferences() thro } @Test - public void testAddSameStyleTwiceLeadsToOneMoreStyle() throws URISyntaxException { + void testAddSameStyleTwiceLeadsToOneMoreStyle() throws URISyntaxException { preferences.setExternalStyles(Collections.emptyList()); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); int beforeAdding = loader.getStyles().size(); @@ -154,13 +154,13 @@ public void testAddSameStyleTwiceLeadsToOneMoreStyle() throws URISyntaxException } @Test - public void testAddNullStyleThrowsNPE() { + void testAddNullStyleThrowsNPE() { loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); assertThrows(NullPointerException.class, () -> loader.addStyleIfValid(null)); } @Test - public void testGetDefaultUsedStyleWhenEmpty() { + void testGetDefaultUsedStyleWhenEmpty() { when(preferences.getCurrentStyle()).thenReturn(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH); preferences.clearCurrentStyle(); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); @@ -171,7 +171,7 @@ public void testGetDefaultUsedStyleWhenEmpty() { } @Test - public void testGetStoredUsedStyle() { + void testGetStoredUsedStyle() { when(preferences.getCurrentStyle()).thenReturn(StyleLoader.DEFAULT_NUMERICAL_STYLE_PATH); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); OOBibStyle style = loader.getUsedStyle(); @@ -181,7 +181,7 @@ public void testGetStoredUsedStyle() { } @Test - public void testGetDefaultUsedStyleWhenIncorrect() { + void testGetDefaultUsedStyleWhenIncorrect() { when(preferences.getCurrentStyle()).thenReturn("ljlkjlkjnljnvdlsjniuhwelfhuewfhlkuewhfuwhelu"); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); OOBibStyle style = loader.getUsedStyle(); @@ -190,7 +190,7 @@ public void testGetDefaultUsedStyleWhenIncorrect() { } @Test - public void testRemoveInternalStyleReturnsFalseAndDoNotRemove() { + void testRemoveInternalStyleReturnsFalseAndDoNotRemove() { preferences.setExternalStyles(Collections.emptyList()); loader = new StyleLoader(preferences, layoutPreferences, abbreviationRepository); diff --git a/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java b/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java index d48982b4f535..eaef05673e7b 100644 --- a/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java +++ b/src/test/java/org/jabref/logic/pdf/EntryAnnotationImporterTest.java @@ -19,19 +19,19 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class EntryAnnotationImporterTest { +class EntryAnnotationImporterTest { private final BibDatabaseContext databaseContext = mock(BibDatabaseContext.class); private BibEntry entry; @BeforeEach - public void setUp() { + void setUp() { entry = new BibEntry(); when(databaseContext.getFileDirectories(any())).thenReturn(Collections.singletonList(Path.of("src/test/resources/pdfs/"))); } @Test - public void readEntryExampleThesis() { + void readEntryExampleThesis() { // given entry.setField(StandardField.FILE, ":thesis-example.pdf:PDF"); EntryAnnotationImporter entryAnnotationImporter = new EntryAnnotationImporter(entry); diff --git a/src/test/java/org/jabref/logic/pdf/PdfAnnotationImporterTest.java b/src/test/java/org/jabref/logic/pdf/PdfAnnotationImporterTest.java index 7606bed8cafa..df4d76b41955 100644 --- a/src/test/java/org/jabref/logic/pdf/PdfAnnotationImporterTest.java +++ b/src/test/java/org/jabref/logic/pdf/PdfAnnotationImporterTest.java @@ -12,47 +12,47 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class PdfAnnotationImporterTest { +class PdfAnnotationImporterTest { private final AnnotationImporter importer = new PdfAnnotationImporter(); @Test - public void invalidPath() { + void invalidPath() { assertEquals(Collections.emptyList(), importer.importAnnotations(Path.of("/asdf/does/not/exist.pdf"))); } @Test - public void invalidDirectory() { + void invalidDirectory() { assertEquals(Collections.emptyList(), importer.importAnnotations(Path.of("src/test/resources/pdfs"))); } @Test - public void invalidDocumentType() { + void invalidDocumentType() { assertEquals(Collections.emptyList(), importer.importAnnotations(Path.of("src/test/resources/pdfs/write-protected.docx"))); } @Test - public void noAnnotationsWriteProtected() { + void noAnnotationsWriteProtected() { assertEquals(Collections.emptyList(), importer.importAnnotations(Path.of("src/test/resources/pdfs/write-protected.pdf"))); } @Test - public void noAnnotationsEncrypted() { + void noAnnotationsEncrypted() { assertEquals(Collections.emptyList(), importer.importAnnotations(Path.of("src/test/resources/pdfs/encrypted.pdf"))); } @Test - public void twoAnnotationsThesisExample() { + void twoAnnotationsThesisExample() { assertEquals(2, importer.importAnnotations(Path.of("src/test/resources/pdfs/thesis-example.pdf")).size()); } @Test - public void noAnnotationsMinimal() { + void noAnnotationsMinimal() { assertEquals(Collections.emptyList(), importer.importAnnotations(Path.of("src/test/resources/pdfs/minimal.pdf"))); } @Test - public void inlineNoteMinimal() { + void inlineNoteMinimal() { final FileAnnotation expected = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 12, 20, 25), 1, "inline note annotation", FileAnnotationType.FREETEXT, Optional.empty()); @@ -61,7 +61,7 @@ public void inlineNoteMinimal() { } @Test - public void popupNoteMinimal() { + void popupNoteMinimal() { final FileAnnotation expected = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 12, 20, 17, 24), 1, "A simple pop-up note", FileAnnotationType.TEXT, Optional.empty()); @@ -70,7 +70,7 @@ public void popupNoteMinimal() { } @Test - public void highlightMinimalFoxit() { + void highlightMinimalFoxit() { final FileAnnotation expectedLinkedAnnotation = new FileAnnotation("lynyus", LocalDateTime.of(2017, 5, 31, 15, 16, 1), 1, "this is a foxit highlight", FileAnnotationType.HIGHLIGHT, Optional.empty()); final FileAnnotation expected = new FileAnnotation("lynyus", LocalDateTime.of(2017, 5, 31, 15, 16, 1), 1, @@ -80,7 +80,7 @@ public void highlightMinimalFoxit() { } @Test - public void highlightNoNoteMinimal() { + void highlightNoNoteMinimal() { final FileAnnotation expectedLinkedAnnotation = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 12, 20, 28, 39), 1, "", FileAnnotationType.HIGHLIGHT, Optional.empty()); final FileAnnotation expected = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 12, 20, 28, 39), 1, @@ -91,7 +91,7 @@ public void highlightNoNoteMinimal() { } @Test - public void squigglyWithNoteMinimal() { + void squigglyWithNoteMinimal() { final FileAnnotation expectedLinkedAnnotation = new FileAnnotation("lynyus", LocalDateTime.of(2017, 6, 1, 2, 40, 25), 1, "Squiggly note", FileAnnotationType.SQUIGGLY, Optional.empty()); final FileAnnotation expected = new FileAnnotation("lynyus", LocalDateTime.of(2017, 6, 1, 2, 40, 25), 1, @@ -102,7 +102,7 @@ public void squigglyWithNoteMinimal() { } @Test - public void strikeoutWithNoteMinimal() { + void strikeoutWithNoteMinimal() { final FileAnnotation expectedLinkedAnnotation = new FileAnnotation("lynyus", LocalDateTime.of(2017, 6, 1, 13, 2, 3), 1, "striked out", FileAnnotationType.STRIKEOUT, Optional.empty()); final FileAnnotation expected = new FileAnnotation("lynyus", LocalDateTime.of(2017, 6, 1, 13, 2, 3), 1, @@ -113,7 +113,7 @@ public void strikeoutWithNoteMinimal() { } @Test - public void highlightWithNoteMinimal() { + void highlightWithNoteMinimal() { final FileAnnotation expectedLinkedAnnotation = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 12, 20, 32, 2), 1, "linked note to highlight", FileAnnotationType.HIGHLIGHT, Optional.empty()); final FileAnnotation expected = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 12, 20, 32, 2), 1, @@ -124,7 +124,7 @@ public void highlightWithNoteMinimal() { } @Test - public void underlineWithNoteMinimal() { + void underlineWithNoteMinimal() { final FileAnnotation expectedLinkedAnnotation = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 12, 20, 36, 9), 1, "underlined", FileAnnotationType.UNDERLINE, Optional.empty()); final FileAnnotation expected = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 12, 20, 36, 9), 1, @@ -135,7 +135,7 @@ public void underlineWithNoteMinimal() { } @Test - public void polygonNoNoteMinimal() { + void polygonNoNoteMinimal() { final FileAnnotation expected = new FileAnnotation("Linus Dietz", LocalDateTime.of(2017, 3, 16, 9, 21, 1), 1, "polygon annotation", FileAnnotationType.POLYGON, Optional.empty()); diff --git a/src/test/java/org/jabref/logic/pdf/search/indexing/DocumentReaderTest.java b/src/test/java/org/jabref/logic/pdf/search/indexing/DocumentReaderTest.java index 982504c9938b..d9e5a41f97b0 100644 --- a/src/test/java/org/jabref/logic/pdf/search/indexing/DocumentReaderTest.java +++ b/src/test/java/org/jabref/logic/pdf/search/indexing/DocumentReaderTest.java @@ -23,13 +23,13 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class DocumentReaderTest { +class DocumentReaderTest { private BibDatabaseContext databaseContext; private FilePreferences filePreferences; @BeforeEach - public void setup() { + void setup() { this.databaseContext = mock(BibDatabaseContext.class); when(databaseContext.getFileDirectories(Mockito.any())).thenReturn(Collections.singletonList(Path.of("src/test/resources/pdfs"))); this.filePreferences = mock(FilePreferences.class); @@ -39,7 +39,7 @@ public void setup() { } @Test - public void unknownFileTestShouldReturnEmptyList() { + void unknownFileTestShouldReturnEmptyList() { // given BibEntry entry = new BibEntry(); entry.setFiles(Collections.singletonList(new LinkedFile("Wrong path", "NOT_PRESENT.pdf", "Type"))); @@ -62,7 +62,7 @@ private static Stream getLinesToMerge() { @ParameterizedTest @MethodSource("getLinesToMerge") - public void mergeLinesTest(String expected, String linesToMerge) { + void mergeLinesTest(String expected, String linesToMerge) { String result = DocumentReader.mergeLines(linesToMerge); assertEquals(expected, result); } diff --git a/src/test/java/org/jabref/logic/pdf/search/indexing/PdfIndexerTest.java b/src/test/java/org/jabref/logic/pdf/search/indexing/PdfIndexerTest.java index 629bb2937781..a201e2ace2ae 100644 --- a/src/test/java/org/jabref/logic/pdf/search/indexing/PdfIndexerTest.java +++ b/src/test/java/org/jabref/logic/pdf/search/indexing/PdfIndexerTest.java @@ -25,14 +25,14 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class PdfIndexerTest { +class PdfIndexerTest { private PdfIndexer indexer; private BibDatabase database; private BibDatabaseContext context = mock(BibDatabaseContext.class); @BeforeEach - public void setUp(@TempDir Path indexDir) throws IOException { + void setUp(@TempDir Path indexDir) throws IOException { FilePreferences filePreferences = mock(FilePreferences.class); this.database = new BibDatabase(); @@ -46,7 +46,7 @@ public void setUp(@TempDir Path indexDir) throws IOException { } @Test - public void exampleThesisIndex() throws IOException { + void exampleThesisIndex() throws IOException { // given BibEntry entry = new BibEntry(StandardEntryType.PhdThesis); entry.setFiles(Collections.singletonList(new LinkedFile("Example Thesis", "thesis-example.pdf", StandardFileType.PDF.getName()))); @@ -63,7 +63,7 @@ public void exampleThesisIndex() throws IOException { } @Test - public void dontIndexNonPdf() throws IOException { + void dontIndexNonPdf() throws IOException { // given BibEntry entry = new BibEntry(StandardEntryType.PhdThesis); entry.setFiles(Collections.singletonList(new LinkedFile("Example Thesis", "thesis-example.pdf", StandardFileType.AUX.getName()))); @@ -80,7 +80,7 @@ public void dontIndexNonPdf() throws IOException { } @Test - public void dontIndexOnlineLinks() throws IOException { + void dontIndexOnlineLinks() throws IOException { // given BibEntry entry = new BibEntry(StandardEntryType.PhdThesis); entry.setFiles(Collections.singletonList(new LinkedFile("Example Thesis", "https://raw.githubusercontent.com/JabRef/jabref/main/src/test/resources/pdfs/thesis-example.pdf", StandardFileType.PDF.getName()))); @@ -97,7 +97,7 @@ public void dontIndexOnlineLinks() throws IOException { } @Test - public void exampleThesisIndexWithKey() throws IOException { + void exampleThesisIndexWithKey() throws IOException { // given BibEntry entry = new BibEntry(StandardEntryType.PhdThesis); entry.setCitationKey("Example2017"); @@ -115,7 +115,7 @@ public void exampleThesisIndexWithKey() throws IOException { } @Test - public void metaDataIndex() throws IOException { + void metaDataIndex() throws IOException { // given BibEntry entry = new BibEntry(StandardEntryType.Article); entry.setFiles(Collections.singletonList(new LinkedFile("Example Thesis", "metaData.pdf", StandardFileType.PDF.getName()))); @@ -133,7 +133,7 @@ public void metaDataIndex() throws IOException { } @Test - public void testFlushIndex() throws IOException { + void testFlushIndex() throws IOException { // given BibEntry entry = new BibEntry(StandardEntryType.PhdThesis); entry.setCitationKey("Example2017"); @@ -157,7 +157,7 @@ public void testFlushIndex() throws IOException { } @Test - public void exampleThesisIndexAppendMetaData() throws IOException { + void exampleThesisIndexAppendMetaData() throws IOException { // given BibEntry exampleThesis = new BibEntry(StandardEntryType.PhdThesis); exampleThesis.setCitationKey("ExampleThesis2017"); diff --git a/src/test/java/org/jabref/logic/pdf/search/retrieval/PdfSearcherTest.java b/src/test/java/org/jabref/logic/pdf/search/retrieval/PdfSearcherTest.java index e005c271ff12..309daad57084 100644 --- a/src/test/java/org/jabref/logic/pdf/search/retrieval/PdfSearcherTest.java +++ b/src/test/java/org/jabref/logic/pdf/search/retrieval/PdfSearcherTest.java @@ -25,12 +25,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class PdfSearcherTest { +class PdfSearcherTest { private PdfSearcher search; @BeforeEach - public void setUp(@TempDir Path indexDir) throws IOException { + void setUp(@TempDir Path indexDir) throws IOException { FilePreferences filePreferences = mock(FilePreferences.class); // given BibDatabase database = new BibDatabase(); @@ -61,48 +61,48 @@ public void setUp(@TempDir Path indexDir) throws IOException { } @Test - public void searchForTest() throws IOException, ParseException { + void searchForTest() throws IOException, ParseException { PdfSearchResults result = search.search("test", 10); assertEquals(8, result.numSearchResults()); } @Test - public void searchForUniversity() throws IOException, ParseException { + void searchForUniversity() throws IOException, ParseException { PdfSearchResults result = search.search("University", 10); assertEquals(1, result.numSearchResults()); } @Test - public void searchForStopWord() throws IOException, ParseException { + void searchForStopWord() throws IOException, ParseException { PdfSearchResults result = search.search("and", 10); assertEquals(0, result.numSearchResults()); } @Test - public void searchForSecond() throws IOException, ParseException { + void searchForSecond() throws IOException, ParseException { PdfSearchResults result = search.search("second", 10); assertEquals(4, result.numSearchResults()); } @Test - public void searchForAnnotation() throws IOException, ParseException { + void searchForAnnotation() throws IOException, ParseException { PdfSearchResults result = search.search("annotation", 10); assertEquals(2, result.numSearchResults()); } @Test - public void searchForEmptyString() throws IOException { + void searchForEmptyString() throws IOException { PdfSearchResults result = search.search("", 10); assertEquals(0, result.numSearchResults()); } @Test - public void searchWithNullString() throws IOException { + void searchWithNullString() throws IOException { assertThrows(NullPointerException.class, () -> search.search(null, 10)); } @Test - public void searchForZeroResults() throws IOException { + void searchForZeroResults() throws IOException { assertThrows(IllegalArgumentException.class, () -> search.search("test", 0)); } } diff --git a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java index 54109db5c862..d883dbebd8da 100644 --- a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java +++ b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java @@ -14,13 +14,13 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ProtectedTermsListTest { +class ProtectedTermsListTest { private ProtectedTermsList internalList; private ProtectedTermsList externalList; @BeforeEach - public void setUp(@TempDir Path temporaryFolder) throws IOException { + void setUp(@TempDir Path temporaryFolder) throws IOException { Path path = temporaryFolder.resolve("ThisIsARandomlyNamedFile"); Files.createFile(path); String tempFileName = path.toString(); @@ -30,70 +30,70 @@ public void setUp(@TempDir Path temporaryFolder) throws IOException { } @Test - public void testProtectedTermsListStringListOfStringStringBoolean() { + void testProtectedTermsListStringListOfStringStringBoolean() { assertTrue(internalList.isInternalList()); } @Test - public void testProtectedTermsListStringListOfStringString() { + void testProtectedTermsListStringListOfStringString() { assertFalse(externalList.isInternalList()); } @Test - public void testGetDescription() { + void testGetDescription() { assertEquals("Name", internalList.getDescription()); } @Test - public void testGetTermList() { + void testGetTermList() { assertEquals(Arrays.asList("AAA", "BBB"), internalList.getTermList()); } @Test - public void testGetLocation() { + void testGetLocation() { assertEquals("location", internalList.getLocation()); } @Test - public void testGetTermListing() { + void testGetTermListing() { assertEquals("AAA\nBBB", internalList.getTermListing()); } @Test - public void testCompareTo() { + void testCompareTo() { assertEquals(-2, internalList.compareTo(externalList)); } @Test - public void testSetEnabledIsEnabled() { + void testSetEnabledIsEnabled() { assertFalse(internalList.isEnabled()); internalList.setEnabled(true); assertTrue(internalList.isEnabled()); } @Test - public void testNotEnabledByDefault() { + void testNotEnabledByDefault() { assertFalse(internalList.isEnabled()); } @Test - public void testCanNotAddTermToInternalList() { + void testCanNotAddTermToInternalList() { assertFalse(internalList.addProtectedTerm("CCC")); } @Test - public void testTermNotAddedToInternalList() { + void testTermNotAddedToInternalList() { internalList.addProtectedTerm("CCC"); assertFalse(internalList.getTermList().contains("CCC")); } @Test - public void testCanAddTermToExternalList() { + void testCanAddTermToExternalList() { assertTrue(externalList.addProtectedTerm("CCC")); } @Test - public void testTermAddedToExternalList() { + void testTermAddedToExternalList() { externalList.addProtectedTerm("CCC"); assertTrue(externalList.getTermList().contains("CCC")); } diff --git a/src/test/java/org/jabref/logic/remote/RemotePreferencesTest.java b/src/test/java/org/jabref/logic/remote/RemotePreferencesTest.java index a1a5aab1a721..1e39d33865d3 100644 --- a/src/test/java/org/jabref/logic/remote/RemotePreferencesTest.java +++ b/src/test/java/org/jabref/logic/remote/RemotePreferencesTest.java @@ -7,44 +7,44 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class RemotePreferencesTest { +class RemotePreferencesTest { private RemotePreferences preferences; @BeforeEach - public void setUp() { + void setUp() { preferences = new RemotePreferences(1000, true); } @Test - public void testGetPort() { + void testGetPort() { assertEquals(1000, preferences.getPort()); } @Test - public void testSetPort() { + void testSetPort() { preferences.setPort(2000); assertEquals(2000, preferences.getPort()); } @Test - public void testUseRemoteServer() { + void testUseRemoteServer() { assertTrue(preferences.useRemoteServer()); } @Test - public void testSetUseRemoteServer() { + void testSetUseRemoteServer() { preferences.setUseRemoteServer(false); assertFalse(preferences.useRemoteServer()); } @Test - public void testIsDifferentPortTrue() { + void testIsDifferentPortTrue() { assertTrue(preferences.isDifferentPort(2000)); } @Test - public void testIsDifferentPortFalse() { + void testIsDifferentPortFalse() { assertFalse(preferences.isDifferentPort(1000)); } } diff --git a/src/test/java/org/jabref/logic/remote/RemoteUtilTest.java b/src/test/java/org/jabref/logic/remote/RemoteUtilTest.java index 963d2755e473..0a3b8c0b145b 100644 --- a/src/test/java/org/jabref/logic/remote/RemoteUtilTest.java +++ b/src/test/java/org/jabref/logic/remote/RemoteUtilTest.java @@ -5,27 +5,27 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class RemoteUtilTest { +class RemoteUtilTest { @Test - public void rejectPortNumberBelowZero() { + void rejectPortNumberBelowZero() { assertFalse(RemoteUtil.isUserPort(-55), "Port number must be non negative."); } @Test - public void rejectReservedSystemPorts() { + void rejectReservedSystemPorts() { assertFalse(RemoteUtil.isUserPort(0), "Port number must be outside reserved system range (0-1023)."); assertFalse(RemoteUtil.isUserPort(1023), "Port number must be outside reserved system range (0-1023)."); } @Test - public void rejectPortsAbove16Bits() { + void rejectPortsAbove16Bits() { // 2 ^ 16 - 1 => 65535 assertFalse(RemoteUtil.isUserPort(65536), "Port number should be below 65535."); } @Test - public void acceptPortsAboveSystemPorts() { + void acceptPortsAboveSystemPorts() { // ports 1024 -> 65535 assertTrue(RemoteUtil.isUserPort(1024), "Port number in between 1024 and 65535 should be valid."); assertTrue(RemoteUtil.isUserPort(65535), "Port number in between 1024 and 65535 should be valid."); diff --git a/src/test/java/org/jabref/logic/search/DatabaseSearcherTest.java b/src/test/java/org/jabref/logic/search/DatabaseSearcherTest.java index f276f9ddfafa..7810c9455ca2 100644 --- a/src/test/java/org/jabref/logic/search/DatabaseSearcherTest.java +++ b/src/test/java/org/jabref/logic/search/DatabaseSearcherTest.java @@ -22,31 +22,31 @@ public class DatabaseSearcherTest { private BibDatabase database; @BeforeEach - public void setUp() { + void setUp() { database = new BibDatabase(); } @Test - public void testNoMatchesFromEmptyDatabase() { + void testNoMatchesFromEmptyDatabase() { List matches = new DatabaseSearcher(new SearchQuery("whatever", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)), database).getMatches(); assertEquals(Collections.emptyList(), matches); } @Test - public void testNoMatchesFromEmptyDatabaseWithInvalidSearchExpression() { + void testNoMatchesFromEmptyDatabaseWithInvalidSearchExpression() { List matches = new DatabaseSearcher(INVALID_SEARCH_QUERY, database).getMatches(); assertEquals(Collections.emptyList(), matches); } @Test - public void testGetDatabaseFromMatchesDatabaseWithEmptyEntries() { + void testGetDatabaseFromMatchesDatabaseWithEmptyEntries() { database.insertEntry(new BibEntry()); List matches = new DatabaseSearcher(new SearchQuery("whatever", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)), database).getMatches(); assertEquals(Collections.emptyList(), matches); } @Test - public void testNoMatchesFromDatabaseWithArticleTypeEntry() { + void testNoMatchesFromDatabaseWithArticleTypeEntry() { BibEntry entry = new BibEntry(StandardEntryType.Article); entry.setField(StandardField.AUTHOR, "harrer"); database.insertEntry(entry); @@ -55,7 +55,7 @@ public void testNoMatchesFromDatabaseWithArticleTypeEntry() { } @Test - public void testCorrectMatchFromDatabaseWithArticleTypeEntry() { + void testCorrectMatchFromDatabaseWithArticleTypeEntry() { BibEntry entry = new BibEntry(StandardEntryType.Article); entry.setField(StandardField.AUTHOR, "harrer"); database.insertEntry(entry); @@ -64,7 +64,7 @@ public void testCorrectMatchFromDatabaseWithArticleTypeEntry() { } @Test - public void testNoMatchesFromEmptyDatabaseWithInvalidQuery() { + void testNoMatchesFromEmptyDatabaseWithInvalidQuery() { SearchQuery query = new SearchQuery("asdf[", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)); DatabaseSearcher databaseSearcher = new DatabaseSearcher(query, database); @@ -73,7 +73,7 @@ public void testNoMatchesFromEmptyDatabaseWithInvalidQuery() { } @Test - public void testCorrectMatchFromDatabaseWithIncollectionTypeEntry() { + void testCorrectMatchFromDatabaseWithIncollectionTypeEntry() { BibEntry entry = new BibEntry(StandardEntryType.InCollection); entry.setField(StandardField.AUTHOR, "tonho"); database.insertEntry(entry); @@ -85,7 +85,7 @@ public void testCorrectMatchFromDatabaseWithIncollectionTypeEntry() { } @Test - public void testNoMatchesFromDatabaseWithTwoEntries() { + void testNoMatchesFromDatabaseWithTwoEntries() { BibEntry entry = new BibEntry(); database.insertEntry(entry); @@ -100,7 +100,7 @@ public void testNoMatchesFromDatabaseWithTwoEntries() { } @Test - public void testNoMatchesFromDabaseWithIncollectionTypeEntry() { + void testNoMatchesFromDabaseWithIncollectionTypeEntry() { BibEntry entry = new BibEntry(StandardEntryType.InCollection); entry.setField(StandardField.AUTHOR, "tonho"); database.insertEntry(entry); @@ -112,7 +112,7 @@ public void testNoMatchesFromDabaseWithIncollectionTypeEntry() { } @Test - public void testNoMatchFromDatabaseWithEmptyEntry() { + void testNoMatchFromDatabaseWithEmptyEntry() { BibEntry entry = new BibEntry(); database.insertEntry(entry); diff --git a/src/test/java/org/jabref/logic/search/SearchQueryTest.java b/src/test/java/org/jabref/logic/search/SearchQueryTest.java index 4bf01fadb736..66e7dd3cc96b 100644 --- a/src/test/java/org/jabref/logic/search/SearchQueryTest.java +++ b/src/test/java/org/jabref/logic/search/SearchQueryTest.java @@ -16,30 +16,30 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SearchQueryTest { +class SearchQueryTest { @Test - public void testToString() { + void testToString() { assertEquals("\"asdf\" (case sensitive, regular expression)", new SearchQuery("asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).toString()); assertEquals("\"asdf\" (case insensitive, plain text)", new SearchQuery("asdf", EnumSet.noneOf(SearchFlags.class)).toString()); } @Test - public void testIsContainsBasedSearch() { + void testIsContainsBasedSearch() { assertTrue(new SearchQuery("asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE)).isContainsBasedSearch()); assertTrue(new SearchQuery("asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).isContainsBasedSearch()); assertFalse(new SearchQuery("author=asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE)).isContainsBasedSearch()); } @Test - public void testIsGrammarBasedSearch() { + void testIsGrammarBasedSearch() { assertFalse(new SearchQuery("asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE)).isGrammarBasedSearch()); assertFalse(new SearchQuery("asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).isGrammarBasedSearch()); assertTrue(new SearchQuery("author=asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE)).isGrammarBasedSearch()); } @Test - public void testGrammarSearch() { + void testGrammarSearch() { BibEntry entry = new BibEntry(); entry.addKeyword("one two", ','); SearchQuery searchQuery = new SearchQuery("keywords=\"one two\"", EnumSet.noneOf(SearchFlags.class)); @@ -47,7 +47,7 @@ public void testGrammarSearch() { } @Test - public void testGrammarSearchFullEntryLastCharMissing() { + void testGrammarSearchFullEntryLastCharMissing() { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "systematic revie"); SearchQuery searchQuery = new SearchQuery("title=\"systematic review\"", EnumSet.noneOf(SearchFlags.class)); @@ -55,7 +55,7 @@ public void testGrammarSearchFullEntryLastCharMissing() { } @Test - public void testGrammarSearchFullEntry() { + void testGrammarSearchFullEntry() { BibEntry entry = new BibEntry(); entry.setField(StandardField.TITLE, "systematic review"); SearchQuery searchQuery = new SearchQuery("title=\"systematic review\"", EnumSet.noneOf(SearchFlags.class)); @@ -63,7 +63,7 @@ public void testGrammarSearchFullEntry() { } @Test - public void testSearchingForOpenBraketInBooktitle() { + void testSearchingForOpenBraketInBooktitle() { BibEntry e = new BibEntry(StandardEntryType.InProceedings); e.setField(StandardField.BOOKTITLE, "Super Conference (SC)"); @@ -72,7 +72,7 @@ public void testSearchingForOpenBraketInBooktitle() { } @Test - public void testSearchMatchesSingleKeywordNotPart() { + void testSearchMatchesSingleKeywordNotPart() { BibEntry e = new BibEntry(StandardEntryType.InProceedings); e.setField(StandardField.KEYWORDS, "banana, pineapple, orange"); @@ -81,7 +81,7 @@ public void testSearchMatchesSingleKeywordNotPart() { } @Test - public void testSearchMatchesSingleKeyword() { + void testSearchMatchesSingleKeyword() { BibEntry e = new BibEntry(StandardEntryType.InProceedings); e.setField(StandardField.KEYWORDS, "banana, pineapple, orange"); @@ -90,7 +90,7 @@ public void testSearchMatchesSingleKeyword() { } @Test - public void testSearchAllFields() { + void testSearchAllFields() { BibEntry e = new BibEntry(StandardEntryType.InProceedings); e.setField(StandardField.TITLE, "Fruity features"); e.setField(StandardField.KEYWORDS, "banana, pineapple, orange"); @@ -100,7 +100,7 @@ public void testSearchAllFields() { } @Test - public void testSearchAllFieldsNotForSpecificField() { + void testSearchAllFieldsNotForSpecificField() { BibEntry e = new BibEntry(StandardEntryType.InProceedings); e.setField(StandardField.TITLE, "Fruity features"); e.setField(StandardField.KEYWORDS, "banana, pineapple, orange"); @@ -110,7 +110,7 @@ public void testSearchAllFieldsNotForSpecificField() { } @Test - public void testSearchAllFieldsAndSpecificField() { + void testSearchAllFieldsAndSpecificField() { BibEntry e = new BibEntry(StandardEntryType.InProceedings); e.setField(StandardField.TITLE, "Fruity features"); e.setField(StandardField.KEYWORDS, "banana, pineapple, orange"); @@ -120,7 +120,7 @@ public void testSearchAllFieldsAndSpecificField() { } @Test - public void testIsMatch() { + void testIsMatch() { BibEntry entry = new BibEntry(); entry.setType(StandardEntryType.Article); entry.setField(StandardField.AUTHOR, "asdf"); @@ -131,57 +131,57 @@ public void testIsMatch() { } @Test - public void testIsValidQueryNotAsRegEx() { + void testIsValidQueryNotAsRegEx() { assertTrue(new SearchQuery("asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE)).isValid()); } @Test - public void testIsValidQueryContainsBracketNotAsRegEx() { + void testIsValidQueryContainsBracketNotAsRegEx() { assertTrue(new SearchQuery("asdf[", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE)).isValid()); } @Test - public void testIsNotValidQueryContainsBracketNotAsRegEx() { + void testIsNotValidQueryContainsBracketNotAsRegEx() { assertTrue(new SearchQuery("asdf[", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).isValid()); } @Test - public void testIsValidQueryAsRegEx() { + void testIsValidQueryAsRegEx() { assertTrue(new SearchQuery("asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).isValid()); } @Test - public void testIsValidQueryWithNumbersAsRegEx() { + void testIsValidQueryWithNumbersAsRegEx() { assertTrue(new SearchQuery("123", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).isValid()); } @Test - public void testIsValidQueryContainsBracketAsRegEx() { + void testIsValidQueryContainsBracketAsRegEx() { assertTrue(new SearchQuery("asdf[", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).isValid()); } @Test - public void testIsValidQueryWithEqualSignAsRegEx() { + void testIsValidQueryWithEqualSignAsRegEx() { assertTrue(new SearchQuery("author=asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).isValid()); } @Test - public void testIsValidQueryWithNumbersAndEqualSignAsRegEx() { + void testIsValidQueryWithNumbersAndEqualSignAsRegEx() { assertTrue(new SearchQuery("author=123", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)).isValid()); } @Test - public void testIsValidQueryWithEqualSignNotAsRegEx() { + void testIsValidQueryWithEqualSignNotAsRegEx() { assertTrue(new SearchQuery("author=asdf", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE)).isValid()); } @Test - public void testIsValidQueryWithNumbersAndEqualSignNotAsRegEx() { + void testIsValidQueryWithNumbersAndEqualSignNotAsRegEx() { assertTrue(new SearchQuery("author=123", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE)).isValid()); } @Test - public void isMatchedForNormalAndFieldBasedSearchMixed() { + void isMatchedForNormalAndFieldBasedSearchMixed() { BibEntry entry = new BibEntry(); entry.setType(StandardEntryType.Article); entry.setField(StandardField.AUTHOR, "asdf"); @@ -191,7 +191,7 @@ public void isMatchedForNormalAndFieldBasedSearchMixed() { } @Test - public void testSimpleTerm() { + void testSimpleTerm() { String query = "progress"; SearchQuery result = new SearchQuery(query, EnumSet.noneOf(SearchFlags.class)); @@ -199,7 +199,7 @@ public void testSimpleTerm() { } @Test - public void testGetPattern() { + void testGetPattern() { String query = "progress"; SearchQuery result = new SearchQuery(query, EnumSet.noneOf(SearchFlags.class)); Pattern pattern = Pattern.compile("(\\Qprogress\\E)"); @@ -208,7 +208,7 @@ public void testGetPattern() { } @Test - public void testGetRegexpPattern() { + void testGetRegexpPattern() { String queryText = "[a-c]\\d* \\d*"; SearchQuery regexQuery = new SearchQuery(queryText, EnumSet.of(SearchRules.SearchFlags.REGULAR_EXPRESSION)); Pattern pattern = Pattern.compile("([a-c]\\d* \\d*)"); @@ -216,7 +216,7 @@ public void testGetRegexpPattern() { } @Test - public void testGetRegexpJavascriptPattern() { + void testGetRegexpJavascriptPattern() { String queryText = "[a-c]\\d* \\d*"; SearchQuery regexQuery = new SearchQuery(queryText, EnumSet.of(SearchRules.SearchFlags.REGULAR_EXPRESSION)); Pattern pattern = Pattern.compile("([a-c]\\d* \\d*)"); @@ -224,7 +224,7 @@ public void testGetRegexpJavascriptPattern() { } @Test - public void testEscapingInPattern() { + void testEscapingInPattern() { // first word contain all java special regex characters String queryText = "<([{\\\\^-=$!|]})?*+.> word1 word2."; SearchQuery textQueryWithSpecialChars = new SearchQuery(queryText, EnumSet.noneOf(SearchFlags.class)); @@ -233,7 +233,7 @@ public void testEscapingInPattern() { } @Test - public void testEscapingInJavascriptPattern() { + void testEscapingInJavascriptPattern() { // first word contain all javascript special regex characters that should be escaped individually in text based search String queryText = "([{\\\\^$|]})?*+./ word1 word2."; SearchQuery textQueryWithSpecialChars = new SearchQuery(queryText, EnumSet.noneOf(SearchFlags.class)); diff --git a/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java b/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java index 208efc653344..717403a9960b 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java @@ -10,11 +10,11 @@ import static org.junit.jupiter.api.Assertions.assertThrows; @DatabaseTest -public class DBMSConnectionTest { +class DBMSConnectionTest { @ParameterizedTest @EnumSource(DBMSType.class) - public void getConnectionFailsWhenconnectingToInvalidHost(DBMSType dbmsType) { + void getConnectionFailsWhenconnectingToInvalidHost(DBMSType dbmsType) { assertThrows(SQLException.class, () -> new DBMSConnection( new DBMSConnectionPropertiesBuilder() diff --git a/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java b/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java index e429134839ce..f1dfc76dd099 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java @@ -20,12 +20,12 @@ import org.jabref.testutils.category.DatabaseTest; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -41,7 +41,7 @@ class DBMSProcessorTest { private DBMSType dbmsType; @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { this.dbmsType = TestManager.getDBMSTypeTestParameter(); this.dbmsConnection = ConnectorTest.getTestDBMSConnection(dbmsType); this.dbmsProcessor = DBMSProcessor.getProcessorInstance(ConnectorTest.getTestDBMSConnection(dbmsType)); @@ -50,7 +50,7 @@ public void setup() throws Exception { } @AfterEach - public void closeDbmsConnection() throws SQLException { + void closeDbmsConnection() throws SQLException { this.dbmsConnection.getConnection().close(); } @@ -436,7 +436,7 @@ private ResultSet selectFrom(String table, DBMSConnection dbmsConnection, DBMSPr // Oracle does not support multiple tuple insertion in one INSERT INTO command. // Therefore this function was defined to improve the readability and to keep the code short. private void insertMetaData(String key, String value, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) { - Assertions.assertDoesNotThrow(() -> { + assertDoesNotThrow(() -> { dbmsConnection.getConnection().createStatement().executeUpdate("INSERT INTO " + escape_Table("METADATA", dbmsProcessor) + "(" + escape("KEY", dbmsProcessor) + ", " + escape("VALUE", dbmsProcessor) + ") VALUES(" + escapeValue(key) + ", " + escapeValue(value) + ")"); diff --git a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java index a36db3efd7ed..bd776db6399b 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java @@ -33,7 +33,7 @@ @DatabaseTest @Execution(ExecutionMode.SAME_THREAD) -public class DBMSSynchronizerTest { +class DBMSSynchronizerTest { private DBMSSynchronizer dbmsSynchronizer; private BibDatabase bibDatabase; @@ -51,7 +51,7 @@ private BibEntry createExampleBibEntry(int index) { } @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { this.dbmsType = TestManager.getDBMSTypeTestParameter(); this.dbmsConnection = ConnectorTest.getTestDBMSConnection(dbmsType); this.dbmsProcessor = DBMSProcessor.getProcessorInstance(this.dbmsConnection); @@ -68,12 +68,12 @@ public void setup() throws Exception { } @AfterEach - public void clear() { + void clear() { dbmsSynchronizer.closeSharedDatabase(); } @Test - public void testEntryAddedEventListener() throws Exception { + void testEntryAddedEventListener() throws Exception { BibEntry expectedEntry = createExampleBibEntry(1); BibEntry furtherEntry = createExampleBibEntry(1); @@ -87,7 +87,7 @@ public void testEntryAddedEventListener() throws Exception { } @Test - public void twoLocalFieldChangesAreSynchronizedCorrectly() throws Exception { + void twoLocalFieldChangesAreSynchronizedCorrectly() throws Exception { BibEntry expectedEntry = createExampleBibEntry(1); expectedEntry.registerListener(dbmsSynchronizer); @@ -100,7 +100,7 @@ public void twoLocalFieldChangesAreSynchronizedCorrectly() throws Exception { } @Test - public void oneLocalAndOneSharedFieldChangeIsSynchronizedCorrectly() throws Exception { + void oneLocalAndOneSharedFieldChangeIsSynchronizedCorrectly() throws Exception { BibEntry exampleBibEntry = createExampleBibEntry(1); exampleBibEntry.registerListener(dbmsSynchronizer); @@ -118,7 +118,7 @@ public void oneLocalAndOneSharedFieldChangeIsSynchronizedCorrectly() throws Exce } @Test - public void testEntriesRemovedEventListener() throws Exception { + void testEntriesRemovedEventListener() throws Exception { BibEntry bibEntry = createExampleBibEntry(1); bibDatabase.insertEntry(bibEntry); @@ -140,7 +140,7 @@ public void testEntriesRemovedEventListener() throws Exception { } @Test - public void testMetaDataChangedEventListener() throws Exception { + void testMetaDataChangedEventListener() throws Exception { MetaData testMetaData = new MetaData(); testMetaData.registerListener(dbmsSynchronizer); dbmsSynchronizer.setMetaData(testMetaData); @@ -154,7 +154,7 @@ public void testMetaDataChangedEventListener() throws Exception { } @Test - public void testInitializeDatabases() throws Exception { + void testInitializeDatabases() throws Exception { dbmsSynchronizer.initializeDatabases(); assertTrue(dbmsProcessor.checkBaseIntegrity()); dbmsSynchronizer.initializeDatabases(); @@ -162,7 +162,7 @@ public void testInitializeDatabases() throws Exception { } @Test - public void testSynchronizeLocalDatabaseWithEntryRemoval() throws Exception { + void testSynchronizeLocalDatabaseWithEntryRemoval() throws Exception { List expectedBibEntries = Arrays.asList(createExampleBibEntry(1), createExampleBibEntry(2)); dbmsProcessor.insertEntry(expectedBibEntries.get(0)); @@ -184,7 +184,7 @@ public void testSynchronizeLocalDatabaseWithEntryRemoval() throws Exception { } @Test - public void testSynchronizeLocalDatabaseWithEntryUpdate() throws Exception { + void testSynchronizeLocalDatabaseWithEntryUpdate() throws Exception { BibEntry bibEntry = createExampleBibEntry(1); bibDatabase.insertEntry(bibEntry); assertEquals(List.of(bibEntry), bibDatabase.getEntries()); @@ -203,7 +203,7 @@ public void testSynchronizeLocalDatabaseWithEntryUpdate() throws Exception { } @Test - public void updateEntryDoesNotModifyLocalDatabase() throws Exception { + void updateEntryDoesNotModifyLocalDatabase() throws Exception { BibEntry bibEntry = createExampleBibEntry(1); bibDatabase.insertEntry(bibEntry); assertEquals(List.of(bibEntry), bibDatabase.getEntries()); @@ -220,7 +220,7 @@ public void updateEntryDoesNotModifyLocalDatabase() throws Exception { } @Test - public void testApplyMetaData() throws Exception { + void testApplyMetaData() throws Exception { BibEntry bibEntry = createExampleBibEntry(1); bibDatabase.insertEntry(bibEntry); diff --git a/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java b/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java index 9b087519da1c..04abaf58939e 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java @@ -10,110 +10,110 @@ import static org.junit.jupiter.api.Assertions.assertFalse; @DatabaseTest -public class DBMSTypeTest { +class DBMSTypeTest { @Test - public void toStringCorrectForMysql() { + void toStringCorrectForMysql() { assertEquals("MySQL", DBMSType.MYSQL.toString()); } @Test - public void toStringCorrectForOracle() { + void toStringCorrectForOracle() { assertEquals("Oracle", DBMSType.ORACLE.toString()); } @Test - public void toStringCorrectForPostgres() { + void toStringCorrectForPostgres() { assertEquals("PostgreSQL", DBMSType.POSTGRESQL.toString()); } @Test - public void fromStringWorksForMySQL() { + void fromStringWorksForMySQL() { assertEquals(Optional.of(DBMSType.MYSQL), DBMSType.fromString("MySQL")); } @Test - public void fromStringWorksForPostgreSQL() { + void fromStringWorksForPostgreSQL() { assertEquals(Optional.of(DBMSType.POSTGRESQL), DBMSType.fromString("PostgreSQL")); } @Test - public void fromStringWorksForNullString() { + void fromStringWorksForNullString() { assertEquals(Optional.empty(), DBMSType.fromString(null)); } @Test - public void fromStringWorksForEmptyString() { + void fromStringWorksForEmptyString() { assertEquals(Optional.empty(), DBMSType.fromString("")); } @Test - public void fromStringWorksForUnkownString() { + void fromStringWorksForUnkownString() { assertEquals(Optional.empty(), DBMSType.fromString("unknown")); } @Test - public void driverClassForMysqlIsCorrect() { + void driverClassForMysqlIsCorrect() { assertEquals("org.mariadb.jdbc.Driver", DBMSType.MYSQL.getDriverClassPath()); } @Test - public void driverClassForOracleIsCorrect() { + void driverClassForOracleIsCorrect() { assertEquals("oracle.jdbc.driver.OracleDriver", DBMSType.ORACLE.getDriverClassPath()); } @Test - public void driverClassForPostgresIsCorrect() { + void driverClassForPostgresIsCorrect() { assertEquals("org.postgresql.Driver", DBMSType.POSTGRESQL.getDriverClassPath()); } @Test - public void fromStringForMysqlReturnsCorrectValue() { + void fromStringForMysqlReturnsCorrectValue() { assertEquals(DBMSType.MYSQL, DBMSType.fromString("MySQL").get()); } @Test - public void fromStringForOracleRturnsCorrectValue() { + void fromStringForOracleRturnsCorrectValue() { assertEquals(DBMSType.ORACLE, DBMSType.fromString("Oracle").get()); } @Test - public void fromStringForPostgresReturnsCorrectValue() { + void fromStringForPostgresReturnsCorrectValue() { assertEquals(DBMSType.POSTGRESQL, DBMSType.fromString("PostgreSQL").get()); } @Test - public void fromStringFromInvalidStringReturnsOptionalEmpty() { + void fromStringFromInvalidStringReturnsOptionalEmpty() { assertFalse(DBMSType.fromString("XXX").isPresent()); } @Test - public void getUrlForMysqlHasCorrectFormat() { + void getUrlForMysqlHasCorrectFormat() { assertEquals("jdbc:mariadb://localhost:3306/xe", DBMSType.MYSQL.getUrl("localhost", 3306, "xe")); } @Test - public void getUrlForOracleHasCorrectFormat() { + void getUrlForOracleHasCorrectFormat() { assertEquals("jdbc:oracle:thin:@localhost:1521/xe", DBMSType.ORACLE.getUrl("localhost", 1521, "xe")); } @Test - public void getUrlForPostgresHasCorrectFormat() { + void getUrlForPostgresHasCorrectFormat() { assertEquals("jdbc:postgresql://localhost:5432/xe", DBMSType.POSTGRESQL.getUrl("localhost", 5432, "xe")); } @Test - public void getDefaultPortForMysqlHasCorrectValue() { + void getDefaultPortForMysqlHasCorrectValue() { assertEquals(3306, DBMSType.MYSQL.getDefaultPort()); } @Test - public void getDefaultPortForOracleHasCorrectValue() { + void getDefaultPortForOracleHasCorrectValue() { assertEquals(1521, DBMSType.ORACLE.getDefaultPort()); } @Test - public void getDefaultPortForPostgresHasCorrectValue() { + void getDefaultPortForPostgresHasCorrectValue() { assertEquals(5432, DBMSType.POSTGRESQL.getDefaultPort()); } } diff --git a/src/test/java/org/jabref/logic/shared/SynchronizationSimulatorTest.java b/src/test/java/org/jabref/logic/shared/SynchronizationSimulatorTest.java index 77008bef8e2b..f9eb30ecee29 100644 --- a/src/test/java/org/jabref/logic/shared/SynchronizationSimulatorTest.java +++ b/src/test/java/org/jabref/logic/shared/SynchronizationSimulatorTest.java @@ -26,7 +26,7 @@ @DatabaseTest @Execution(ExecutionMode.SAME_THREAD) -public class SynchronizationSimulatorTest { +class SynchronizationSimulatorTest { private BibDatabaseContext clientContextA; private BibDatabaseContext clientContextB; @@ -43,7 +43,7 @@ private BibEntry getBibEntryExample(int index) { } @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { DBMSConnection dbmsConnection = ConnectorTest.getTestDBMSConnection(TestManager.getDBMSTypeTestParameter()); TestManager.clearTables(dbmsConnection); @@ -62,13 +62,13 @@ public void setup() throws Exception { } @AfterEach - public void clear() throws SQLException { + void clear() throws SQLException { clientContextA.getDBMSSynchronizer().closeSharedDatabase(); clientContextB.getDBMSSynchronizer().closeSharedDatabase(); } @Test - public void simulateEntryInsertionAndManualPull() throws Exception { + void simulateEntryInsertionAndManualPull() throws Exception { // client A inserts an entry clientContextA.getDatabase().insertEntry(getBibEntryExample(1)); // client A inserts another entry @@ -80,7 +80,7 @@ public void simulateEntryInsertionAndManualPull() throws Exception { } @Test - public void simulateEntryUpdateAndManualPull() throws Exception { + void simulateEntryUpdateAndManualPull() throws Exception { BibEntry bibEntry = getBibEntryExample(1); // client A inserts an entry clientContextA.getDatabase().insertEntry(bibEntry); @@ -95,7 +95,7 @@ public void simulateEntryUpdateAndManualPull() throws Exception { } @Test - public void simulateEntryDelitionAndManualPull() throws Exception { + void simulateEntryDelitionAndManualPull() throws Exception { BibEntry bibEntry = getBibEntryExample(1); // client A inserts an entry clientContextA.getDatabase().insertEntry(bibEntry); @@ -116,7 +116,7 @@ public void simulateEntryDelitionAndManualPull() throws Exception { } @Test - public void simulateUpdateOnNoLongerExistingEntry() throws Exception { + void simulateUpdateOnNoLongerExistingEntry() throws Exception { BibEntry bibEntryOfClientA = getBibEntryExample(1); // client A inserts an entry clientContextA.getDatabase().insertEntry(bibEntryOfClientA); @@ -142,7 +142,7 @@ public void simulateUpdateOnNoLongerExistingEntry() throws Exception { } @Test - public void simulateEntryChangeConflicts() { + void simulateEntryChangeConflicts() { BibEntry bibEntryOfClientA = getBibEntryExample(1); // client A inserts an entry clientContextA.getDatabase().insertEntry(bibEntryOfClientA); diff --git a/src/test/java/org/jabref/logic/texparser/DefaultTexParserTest.java b/src/test/java/org/jabref/logic/texparser/DefaultTexParserTest.java index ab41c9967e67..2b4fe0d3042d 100644 --- a/src/test/java/org/jabref/logic/texparser/DefaultTexParserTest.java +++ b/src/test/java/org/jabref/logic/texparser/DefaultTexParserTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class DefaultTexParserTest { +class DefaultTexParserTest { private final static String DARWIN = "Darwin1888"; private final static String EINSTEIN = "Einstein1920"; @@ -37,7 +37,7 @@ private void testNonMatchCite(String citeString) { } @Test - public void testCiteCommands() { + void testCiteCommands() { testMatchCite(UNRESOLVED, "\\cite[pre][post]{UnresolvedKey}"); testMatchCite(UNRESOLVED, "\\cite*{UnresolvedKey}"); testMatchCite(UNRESOLVED, "\\parencite[post]{UnresolvedKey}"); @@ -55,7 +55,7 @@ public void testCiteCommands() { } @Test - public void testTwoCitationsSameLine() { + void testTwoCitationsSameLine() { String citeString = "\\citep{Einstein1920c} and \\citep{Einstein1920a}"; LatexParserResult latexParserResult = new DefaultLatexParser().parse(citeString); @@ -68,7 +68,7 @@ public void testTwoCitationsSameLine() { } @Test - public void testFileEncodingUtf8() throws URISyntaxException { + void testFileEncodingUtf8() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("utf-8.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -81,7 +81,7 @@ public void testFileEncodingUtf8() throws URISyntaxException { } @Test - public void testFileEncodingIso88591() throws URISyntaxException { + void testFileEncodingIso88591() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("iso-8859-1.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -96,7 +96,7 @@ public void testFileEncodingIso88591() throws URISyntaxException { } @Test - public void testFileEncodingIso885915() throws URISyntaxException { + void testFileEncodingIso885915() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("iso-8859-15.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -111,7 +111,7 @@ public void testFileEncodingIso885915() throws URISyntaxException { } @Test - public void testFileEncodingForThreeFiles() throws URISyntaxException { + void testFileEncodingForThreeFiles() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("utf-8.tex").toURI()); Path texFile2 = Path.of(DefaultTexParserTest.class.getResource("iso-8859-1.tex").toURI()); Path texFile3 = Path.of(DefaultTexParserTest.class.getResource("iso-8859-15.tex").toURI()); @@ -132,7 +132,7 @@ public void testFileEncodingForThreeFiles() throws URISyntaxException { } @Test - public void testSingleFile() throws URISyntaxException { + void testSingleFile() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("paper.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -149,7 +149,7 @@ public void testSingleFile() throws URISyntaxException { } @Test - public void testTwoFiles() throws URISyntaxException { + void testTwoFiles() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("paper.tex").toURI()); Path texFile2 = Path.of(DefaultTexParserTest.class.getResource("paper2.tex").toURI()); @@ -171,7 +171,7 @@ public void testTwoFiles() throws URISyntaxException { } @Test - public void testDuplicateFiles() throws URISyntaxException { + void testDuplicateFiles() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("paper.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(Arrays.asList(texFile, texFile)); @@ -188,7 +188,7 @@ public void testDuplicateFiles() throws URISyntaxException { } @Test - public void testUnknownKey() throws URISyntaxException { + void testUnknownKey() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("unknown_key.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -204,7 +204,7 @@ public void testUnknownKey() throws URISyntaxException { } @Test - public void testFileNotFound() { + void testFileNotFound() { Path texFile = Path.of("file_not_found.tex"); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -216,7 +216,7 @@ public void testFileNotFound() { } @Test - public void testNestedFiles() throws URISyntaxException { + void testNestedFiles() throws URISyntaxException { Path texFile = Path.of(DefaultTexParserTest.class.getResource("nested.tex").toURI()); Path texFile2 = Path.of(DefaultTexParserTest.class.getResource("nested2.tex").toURI()); Path texFile3 = Path.of(DefaultTexParserTest.class.getResource("paper.tex").toURI()); diff --git a/src/test/java/org/jabref/logic/texparser/LatexParserTest.java b/src/test/java/org/jabref/logic/texparser/LatexParserTest.java index b4e6edb131f4..15643a06e385 100644 --- a/src/test/java/org/jabref/logic/texparser/LatexParserTest.java +++ b/src/test/java/org/jabref/logic/texparser/LatexParserTest.java @@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class LatexParserTest { +class LatexParserTest { private final static String DARWIN = "Darwin1888"; private final static String EINSTEIN = "Einstein1920"; private final static String NEWTON = "Newton1999"; @@ -89,7 +89,7 @@ void setUp() { } @Test - public void testSameFileDifferentDatabases() throws URISyntaxException { + void testSameFileDifferentDatabases() throws URISyntaxException { Path texFile = Path.of(LatexParserTest.class.getResource("paper.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -117,7 +117,7 @@ public void testSameFileDifferentDatabases() throws URISyntaxException { } @Test - public void testTwoFilesDifferentDatabases() throws URISyntaxException { + void testTwoFilesDifferentDatabases() throws URISyntaxException { Path texFile = Path.of(LatexParserTest.class.getResource("paper.tex").toURI()); Path texFile2 = Path.of(LatexParserTest.class.getResource("paper2.tex").toURI()); diff --git a/src/test/java/org/jabref/logic/texparser/TexBibEntriesResolverTest.java b/src/test/java/org/jabref/logic/texparser/TexBibEntriesResolverTest.java index e7c5a943f04b..fab16c17245f 100644 --- a/src/test/java/org/jabref/logic/texparser/TexBibEntriesResolverTest.java +++ b/src/test/java/org/jabref/logic/texparser/TexBibEntriesResolverTest.java @@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; -public class TexBibEntriesResolverTest { +class TexBibEntriesResolverTest { private final static String DARWIN = "Darwin1888"; private final static String EINSTEIN = "Einstein1920"; private final static String NEWTON = "Newton1999"; @@ -98,7 +98,7 @@ void setUp() { } @Test - public void testSingleFile() throws URISyntaxException { + void testSingleFile() throws URISyntaxException { Path texFile = Path.of(TexBibEntriesResolverTest.class.getResource("paper.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -109,7 +109,7 @@ public void testSingleFile() throws URISyntaxException { } @Test - public void testTwoFiles() throws URISyntaxException { + void testTwoFiles() throws URISyntaxException { Path texFile = Path.of(TexBibEntriesResolverTest.class.getResource("paper.tex").toURI()); Path texFile2 = Path.of(TexBibEntriesResolverTest.class.getResource("paper2.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(Arrays.asList(texFile, texFile2)); @@ -121,7 +121,7 @@ public void testTwoFiles() throws URISyntaxException { } @Test - public void testDuplicateFiles() throws URISyntaxException { + void testDuplicateFiles() throws URISyntaxException { Path texFile = Path.of(TexBibEntriesResolverTest.class.getResource("paper.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -132,7 +132,7 @@ public void testDuplicateFiles() throws URISyntaxException { } @Test - public void testUnknownKey() throws URISyntaxException { + void testUnknownKey() throws URISyntaxException { Path texFile = Path.of(TexBibEntriesResolverTest.class.getResource("unknown_key.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -143,7 +143,7 @@ public void testUnknownKey() throws URISyntaxException { } @Test - public void testNestedFiles() throws URISyntaxException { + void testNestedFiles() throws URISyntaxException { Path texFile = Path.of(TexBibEntriesResolverTest.class.getResource("nested.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); @@ -154,7 +154,7 @@ public void testNestedFiles() throws URISyntaxException { } @Test - public void testCrossRef() throws URISyntaxException { + void testCrossRef() throws URISyntaxException { Path texFile = Path.of(TexBibEntriesResolverTest.class.getResource("crossref.tex").toURI()); LatexParserResult parserResult = new DefaultLatexParser().parse(texFile); diff --git a/src/test/java/org/jabref/logic/util/BuildInfoTest.java b/src/test/java/org/jabref/logic/util/BuildInfoTest.java index ed057a093443..899fa523aff9 100644 --- a/src/test/java/org/jabref/logic/util/BuildInfoTest.java +++ b/src/test/java/org/jabref/logic/util/BuildInfoTest.java @@ -5,22 +5,22 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -public class BuildInfoTest { +class BuildInfoTest { @Test - public void testDefaults() { + void testDefaults() { BuildInfo buildInfo = new BuildInfo("asdf"); assertEquals("UNKNOWN", buildInfo.version.getFullVersion()); } @Test - public void testFileImport() { + void testFileImport() { BuildInfo buildInfo = new BuildInfo("/org/jabref/util/build.properties"); assertEquals("42", buildInfo.version.getFullVersion()); } @Test - public void azureInstrumentationKeyIsNotEmpty() { + void azureInstrumentationKeyIsNotEmpty() { BuildInfo buildInfo = new BuildInfo(); assertNotNull(buildInfo.azureInstrumentationKey); } diff --git a/src/test/java/org/jabref/logic/util/DevelopmentStageTest.java b/src/test/java/org/jabref/logic/util/DevelopmentStageTest.java index b2d33d2eed7d..192423b126f9 100644 --- a/src/test/java/org/jabref/logic/util/DevelopmentStageTest.java +++ b/src/test/java/org/jabref/logic/util/DevelopmentStageTest.java @@ -5,10 +5,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DevelopmentStageTest { +class DevelopmentStageTest { @Test - public void checkStabilityOrder() { + void checkStabilityOrder() { assertTrue(Version.DevelopmentStage.ALPHA.isMoreStableThan(Version.DevelopmentStage.UNKNOWN)); assertTrue(Version.DevelopmentStage.BETA.isMoreStableThan(Version.DevelopmentStage.ALPHA)); assertTrue(Version.DevelopmentStage.STABLE.isMoreStableThan(Version.DevelopmentStage.BETA)); @@ -17,19 +17,19 @@ public void checkStabilityOrder() { } @Test - public void parseStages() { + void parseStages() { assertEquals(Version.DevelopmentStage.ALPHA, Version.DevelopmentStage.parse("-alpha")); assertEquals(Version.DevelopmentStage.BETA, Version.DevelopmentStage.parse("-beta")); assertEquals(Version.DevelopmentStage.STABLE, Version.DevelopmentStage.parse("")); } @Test - public void parseNull() { + void parseNull() { assertEquals(Version.DevelopmentStage.UNKNOWN, Version.DevelopmentStage.parse(null)); } @Test - public void parseUnknownString() { + void parseUnknownString() { assertEquals(Version.DevelopmentStage.UNKNOWN, Version.DevelopmentStage.parse("asdf")); } } diff --git a/src/test/java/org/jabref/logic/util/FileNameCleanerTest.java b/src/test/java/org/jabref/logic/util/FileNameCleanerTest.java index 14911166b4c8..dd0c6e7b08ce 100644 --- a/src/test/java/org/jabref/logic/util/FileNameCleanerTest.java +++ b/src/test/java/org/jabref/logic/util/FileNameCleanerTest.java @@ -6,31 +6,31 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class FileNameCleanerTest { +class FileNameCleanerTest { @Test - public void testCleanFileName() { + void testCleanFileName() { assertEquals("legalFilename.txt", FileNameCleaner.cleanFileName("legalFilename.txt")); assertEquals("illegalFilename______.txt", FileNameCleaner.cleanFileName("illegalFilename/?*<>|.txt")); assertEquals("illegalFileName_.txt", FileNameCleaner.cleanFileName("illegalFileName{.txt")); } @Test - public void testCleanDirectoryName() { + void testCleanDirectoryName() { assertEquals("legalFilename.txt", FileNameCleaner.cleanDirectoryName("legalFilename.txt")); assertEquals("subdir/legalFilename.txt", FileNameCleaner.cleanDirectoryName("subdir/legalFilename.txt")); assertEquals("illegalFilename/_____.txt", FileNameCleaner.cleanDirectoryName("illegalFilename/?*<>|.txt")); } @Test - public void testCleanDirectoryNameForWindows() { + void testCleanDirectoryNameForWindows() { assertEquals("legalFilename.txt", FileNameCleaner.cleanDirectoryName("legalFilename.txt")); assertEquals("subdir\\legalFilename.txt", FileNameCleaner.cleanDirectoryName("subdir\\legalFilename.txt")); assertEquals("illegalFilename\\_____.txt", FileNameCleaner.cleanDirectoryName("illegalFilename\\?*<>|.txt")); } @Test - public void testCleanCurlyBracesAsWell() { + void testCleanCurlyBracesAsWell() { assertEquals("The Evolution of Sentiment_ Analysis_A Review of Research Topics, Venues, and Top Cited Papers.PDF", FileNameCleaner.cleanFileName("The Evolution of Sentiment} Analysis}A Review of Research Topics, Venues, and Top Cited Papers.PDF")); } } diff --git a/src/test/java/org/jabref/logic/util/UpdateFieldTest.java b/src/test/java/org/jabref/logic/util/UpdateFieldTest.java index 5012e054f75c..fd1d89a47527 100644 --- a/src/test/java/org/jabref/logic/util/UpdateFieldTest.java +++ b/src/test/java/org/jabref/logic/util/UpdateFieldTest.java @@ -20,45 +20,45 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class UpdateFieldTest { +class UpdateFieldTest { private BibEntry entry; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { entry = new BibEntry(); entry.setChanged(false); } @Test - public void testUpdateFieldWorksEmptyField() { + void testUpdateFieldWorksEmptyField() { assertFalse(entry.hasField(StandardField.YEAR)); UpdateField.updateField(entry, StandardField.YEAR, "2016"); assertEquals(Optional.of("2016"), entry.getField(StandardField.YEAR)); } @Test - public void testUpdateFieldWorksNonEmptyField() { + void testUpdateFieldWorksNonEmptyField() { entry.setField(StandardField.YEAR, "2015"); UpdateField.updateField(entry, StandardField.YEAR, "2016"); assertEquals(Optional.of("2016"), entry.getField(StandardField.YEAR)); } @Test - public void testUpdateFieldHasChanged() { + void testUpdateFieldHasChanged() { assertFalse(entry.hasChanged()); UpdateField.updateField(entry, StandardField.YEAR, "2016"); assertTrue(entry.hasChanged()); } @Test - public void testUpdateFieldValidFieldChange() { + void testUpdateFieldValidFieldChange() { Optional change = UpdateField.updateField(entry, StandardField.YEAR, "2016"); assertTrue(change.isPresent()); } @Test - public void testUpdateFieldCorrectFieldChangeContentsEmptyField() { + void testUpdateFieldCorrectFieldChangeContentsEmptyField() { Optional change = UpdateField.updateField(entry, StandardField.YEAR, "2016"); assertNull(change.get().getOldValue()); assertEquals(StandardField.YEAR, change.get().getField()); @@ -67,7 +67,7 @@ public void testUpdateFieldCorrectFieldChangeContentsEmptyField() { } @Test - public void testUpdateFieldCorrectFieldChangeContentsNonEmptyField() { + void testUpdateFieldCorrectFieldChangeContentsNonEmptyField() { entry.setField(StandardField.YEAR, "2015"); Optional change = UpdateField.updateField(entry, StandardField.YEAR, "2016"); assertEquals("2015", change.get().getOldValue()); @@ -77,14 +77,14 @@ public void testUpdateFieldCorrectFieldChangeContentsNonEmptyField() { } @Test - public void testUpdateFieldSameValueNoChange() { + void testUpdateFieldSameValueNoChange() { entry.setField(StandardField.YEAR, "2016"); Optional change = UpdateField.updateField(entry, StandardField.YEAR, "2016"); assertFalse(change.isPresent()); } @Test - public void testUpdateFieldSameValueNotChange() { + void testUpdateFieldSameValueNotChange() { entry.setField(StandardField.YEAR, "2016"); entry.setChanged(false); UpdateField.updateField(entry, StandardField.YEAR, "2016"); @@ -92,33 +92,33 @@ public void testUpdateFieldSameValueNotChange() { } @Test - public void testUpdateFieldSetToNullClears() { + void testUpdateFieldSetToNullClears() { entry.setField(StandardField.YEAR, "2016"); UpdateField.updateField(entry, StandardField.YEAR, null); assertFalse(entry.hasField(StandardField.YEAR)); } @Test - public void testUpdateFieldSetEmptyToNullClears() { + void testUpdateFieldSetEmptyToNullClears() { UpdateField.updateField(entry, StandardField.YEAR, null); assertFalse(entry.hasField(StandardField.YEAR)); } @Test - public void testUpdateFieldSetToNullHasFieldChangeContents() { + void testUpdateFieldSetToNullHasFieldChangeContents() { entry.setField(StandardField.YEAR, "2016"); Optional change = UpdateField.updateField(entry, StandardField.YEAR, null); assertTrue(change.isPresent()); } @Test - public void testUpdateFieldSetRmptyToNullHasNoFieldChangeContents() { + void testUpdateFieldSetRmptyToNullHasNoFieldChangeContents() { Optional change = UpdateField.updateField(entry, StandardField.YEAR, null); assertFalse(change.isPresent()); } @Test - public void testUpdateFieldSetToNullCorrectFieldChangeContents() { + void testUpdateFieldSetToNullCorrectFieldChangeContents() { entry.setField(StandardField.YEAR, "2016"); Optional change = UpdateField.updateField(entry, StandardField.YEAR, null); assertNull(change.get().getNewValue()); @@ -128,14 +128,14 @@ public void testUpdateFieldSetToNullCorrectFieldChangeContents() { } @Test - public void testUpdateFieldSameContentClears() { + void testUpdateFieldSameContentClears() { entry.setField(StandardField.YEAR, "2016"); UpdateField.updateField(entry, StandardField.YEAR, "2016", true); assertFalse(entry.hasField(StandardField.YEAR)); } @Test - public void testUpdateFieldSameContentHasChanged() { + void testUpdateFieldSameContentHasChanged() { entry.setField(StandardField.YEAR, "2016"); entry.setChanged(false); UpdateField.updateField(entry, StandardField.YEAR, "2016", true); @@ -143,14 +143,14 @@ public void testUpdateFieldSameContentHasChanged() { } @Test - public void testUpdateFieldSameContentHasFieldChange() { + void testUpdateFieldSameContentHasFieldChange() { entry.setField(StandardField.YEAR, "2016"); Optional change = UpdateField.updateField(entry, StandardField.YEAR, "2016", true); assertTrue(change.isPresent()); } @Test - public void testUpdateFieldSameContentHasCorrectFieldChange() { + void testUpdateFieldSameContentHasCorrectFieldChange() { entry.setField(StandardField.YEAR, "2016"); Optional change = UpdateField.updateField(entry, StandardField.YEAR, "2016", true); assertNull(change.get().getNewValue()); @@ -160,7 +160,7 @@ public void testUpdateFieldSameContentHasCorrectFieldChange() { } @Test - public void testUpdateNonDisplayableFieldUpdates() { + void testUpdateNonDisplayableFieldUpdates() { assertFalse(entry.hasField(StandardField.YEAR)); UpdateField.updateNonDisplayableField(entry, StandardField.YEAR, "2016"); assertTrue(entry.hasField(StandardField.YEAR)); @@ -168,14 +168,14 @@ public void testUpdateNonDisplayableFieldUpdates() { } @Test - public void testUpdateNonDisplayableFieldHasNotChanged() { + void testUpdateNonDisplayableFieldHasNotChanged() { assertFalse(entry.hasChanged()); UpdateField.updateNonDisplayableField(entry, StandardField.YEAR, "2016"); assertFalse(entry.hasChanged()); } @Test - public void emptyOwnerFieldNowPresentAfterAutomaticSet() { + void emptyOwnerFieldNowPresentAfterAutomaticSet() { assertEquals(Optional.empty(), entry.getField(StandardField.OWNER), "Owner is present"); OwnerPreferences ownerPreferences = createOwnerPreference(true, true); @@ -186,7 +186,7 @@ public void emptyOwnerFieldNowPresentAfterAutomaticSet() { } @Test - public void ownerAssignedCorrectlyAfterAutomaticSet() { + void ownerAssignedCorrectlyAfterAutomaticSet() { OwnerPreferences ownerPreferences = createOwnerPreference(true, true); TimestampPreferences timestampPreferences = createTimestampPreference(); UpdateField.setAutomaticFields(List.of(entry), ownerPreferences, timestampPreferences); @@ -195,7 +195,7 @@ public void ownerAssignedCorrectlyAfterAutomaticSet() { } @Test - public void ownerIsNotResetAfterAutomaticSetIfOverwriteOwnerFalse() { + void ownerIsNotResetAfterAutomaticSetIfOverwriteOwnerFalse() { String alreadySetOwner = "alreadySetOwner"; entry.setField(StandardField.OWNER, alreadySetOwner); @@ -210,7 +210,7 @@ public void ownerIsNotResetAfterAutomaticSetIfOverwriteOwnerFalse() { } @Test - public void emptyCreationDateFieldNowPresentAfterAutomaticSet() { + void emptyCreationDateFieldNowPresentAfterAutomaticSet() { assertEquals(Optional.empty(), entry.getField(StandardField.CREATIONDATE), "CreationDate is present"); OwnerPreferences ownerPreferences = createOwnerPreference(true, true); @@ -223,7 +223,7 @@ public void emptyCreationDateFieldNowPresentAfterAutomaticSet() { } @Test - public void creationDateAssignedCorrectlyAfterAutomaticSet() { + void creationDateAssignedCorrectlyAfterAutomaticSet() { OwnerPreferences ownerPreferences = createOwnerPreference(true, true); TimestampPreferences timestampPreferences = createTimestampPreference(); UpdateField.setAutomaticFields(List.of(entry), ownerPreferences, timestampPreferences); @@ -234,7 +234,7 @@ public void creationDateAssignedCorrectlyAfterAutomaticSet() { } @Test - public void ownerSetToDefaultValueForCollectionOfBibEntries() { + void ownerSetToDefaultValueForCollectionOfBibEntries() { BibEntry entry2 = new BibEntry(); BibEntry entry3 = new BibEntry(); @@ -256,7 +256,7 @@ public void ownerSetToDefaultValueForCollectionOfBibEntries() { } @Test - public void ownerNotChangedForCollectionOfBibEntriesIfOptionsDisabled() { + void ownerNotChangedForCollectionOfBibEntriesIfOptionsDisabled() { String initialOwner = "initialOwner"; entry.setField(StandardField.OWNER, initialOwner); diff --git a/src/test/java/org/jabref/logic/util/VersionTest.java b/src/test/java/org/jabref/logic/util/VersionTest.java index 5e04e7d234a3..2193784b7c67 100644 --- a/src/test/java/org/jabref/logic/util/VersionTest.java +++ b/src/test/java/org/jabref/logic/util/VersionTest.java @@ -15,34 +15,34 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class VersionTest { +class VersionTest { @Test - public void unknownVersionAsString() { + void unknownVersionAsString() { Version version = Version.parse(BuildInfo.UNKNOWN_VERSION); assertEquals(BuildInfo.UNKNOWN_VERSION, version.getFullVersion()); } @Test - public void unknownVersionAsNull() { + void unknownVersionAsNull() { Version version = Version.parse(null); assertEquals(BuildInfo.UNKNOWN_VERSION, version.getFullVersion()); } @Test - public void unknownVersionAsEmptyString() { + void unknownVersionAsEmptyString() { Version version = Version.parse(""); assertEquals(BuildInfo.UNKNOWN_VERSION, version.getFullVersion()); } @Test - public void initVersionFromWrongStringResultsInUnknownVersion() { + void initVersionFromWrongStringResultsInUnknownVersion() { Version version = Version.parse("${version}"); assertEquals(BuildInfo.UNKNOWN_VERSION, version.getFullVersion()); } @Test - public void versionOneDigit() { + void versionOneDigit() { String versionText = "1"; Version version = Version.parse(versionText); assertEquals(versionText, version.getFullVersion()); @@ -53,7 +53,7 @@ public void versionOneDigit() { } @Test - public void versionTwoDigits() { + void versionTwoDigits() { String versionText = "1.2"; Version version = Version.parse(versionText); assertEquals(versionText, version.getFullVersion()); @@ -64,7 +64,7 @@ public void versionTwoDigits() { } @Test - public void versionThreeDigits() { + void versionThreeDigits() { String versionText = "1.2.3"; Version version = Version.parse(versionText); assertEquals(versionText, version.getFullVersion()); @@ -75,7 +75,7 @@ public void versionThreeDigits() { } @Test - public void versionOneDigitDevVersion() { + void versionOneDigitDevVersion() { String versionText = "1dev"; Version version = Version.parse(versionText); assertEquals(versionText, version.getFullVersion()); @@ -86,7 +86,7 @@ public void versionOneDigitDevVersion() { } @Test - public void versionTwoDigitDevVersion() { + void versionTwoDigitDevVersion() { String versionText = "1.2dev"; Version version = Version.parse(versionText); assertEquals(versionText, version.getFullVersion()); @@ -97,7 +97,7 @@ public void versionTwoDigitDevVersion() { } @Test - public void versionThreeDigitDevVersion() { + void versionThreeDigitDevVersion() { String versionText = "1.2.3dev"; Version version = Version.parse(versionText); assertEquals(versionText, version.getFullVersion()); @@ -108,7 +108,7 @@ public void versionThreeDigitDevVersion() { } @Test - public void validVersionIsNotNewerThanUnknownVersion() { + void validVersionIsNotNewerThanUnknownVersion() { // Reason: unknown version should only happen for developer builds where we don't want an update notification Version unknownVersion = Version.parse(BuildInfo.UNKNOWN_VERSION); Version validVersion = Version.parse("4.2"); @@ -116,42 +116,42 @@ public void validVersionIsNotNewerThanUnknownVersion() { } @Test - public void unknownVersionIsNotNewerThanValidVersion() { + void unknownVersionIsNotNewerThanValidVersion() { Version unknownVersion = Version.parse(BuildInfo.UNKNOWN_VERSION); Version validVersion = Version.parse("4.2"); assertFalse(unknownVersion.isNewerThan(validVersion)); } @Test - public void versionNewerThan() { + void versionNewerThan() { Version olderVersion = Version.parse("2.4"); Version newerVersion = Version.parse("4.2"); assertTrue(newerVersion.isNewerThan(olderVersion)); } @Test - public void versionNotNewerThan() { + void versionNotNewerThan() { Version olderVersion = Version.parse("2.4"); Version newerVersion = Version.parse("4.2"); assertFalse(olderVersion.isNewerThan(newerVersion)); } @Test - public void versionNotNewerThanSameVersion() { + void versionNotNewerThanSameVersion() { Version version1 = Version.parse("4.2"); Version version2 = Version.parse("4.2"); assertFalse(version1.isNewerThan(version2)); } @Test - public void versionNewerThanDevTwoDigits() { + void versionNewerThanDevTwoDigits() { Version older = Version.parse("4.2"); Version newer = Version.parse("4.3dev"); assertTrue(newer.isNewerThan(older)); } @Test - public void versionNewerThanDevVersion() { + void versionNewerThanDevVersion() { Version older = Version.parse("1.2dev"); Version newer = Version.parse("1.2"); assertTrue(newer.isNewerThan(older)); @@ -159,75 +159,75 @@ public void versionNewerThanDevVersion() { } @Test - public void versionNewerThanDevThreeDigits() { + void versionNewerThanDevThreeDigits() { Version older = Version.parse("4.2.1"); Version newer = Version.parse("4.3dev"); assertTrue(newer.isNewerThan(older)); } @Test - public void versionNewerMinor() { + void versionNewerMinor() { Version older = Version.parse("4.1"); Version newer = Version.parse("4.2.1"); assertTrue(newer.isNewerThan(older)); } @Test - public void versionNotNewerMinor() { + void versionNotNewerMinor() { Version older = Version.parse("4.1"); Version newer = Version.parse("4.2.1"); assertFalse(older.isNewerThan(newer)); } @Test - public void versionNewerPatch() { + void versionNewerPatch() { Version older = Version.parse("4.2.1"); Version newer = Version.parse("4.2.2"); assertTrue(newer.isNewerThan(older)); } @Test - public void versionNotNewerPatch() { + void versionNotNewerPatch() { Version older = Version.parse("4.2.1"); Version newer = Version.parse("4.2.2"); assertFalse(older.isNewerThan(newer)); } @Test - public void versionNewerDevelopmentNumber() { + void versionNewerDevelopmentNumber() { Version older = Version.parse("4.2-beta1"); Version newer = Version.parse("4.2-beta2"); assertFalse(older.isNewerThan(newer)); } @Test - public void versionNotNewerThanSameVersionWithBeta() { + void versionNotNewerThanSameVersionWithBeta() { Version version1 = Version.parse("4.2-beta2"); Version version2 = Version.parse("4.2-beta2"); assertFalse(version2.isNewerThan(version1)); } @Test - public void equalVersionsNotNewer() { + void equalVersionsNotNewer() { Version version1 = Version.parse("4.2.2"); Version version2 = Version.parse("4.2.2"); assertFalse(version1.isNewerThan(version2)); } @Test - public void changelogOfDevelopmentVersionWithDash() { + void changelogOfDevelopmentVersionWithDash() { Version version = Version.parse("4.0-dev"); assertEquals("https://github.com/JabRef/jabref/blob/main/CHANGELOG.md#unreleased", version.getChangelogUrl()); } @Test - public void changelogOfDevelopmentVersionWithoutDash() { + void changelogOfDevelopmentVersionWithoutDash() { Version version = Version.parse("3.7dev"); assertEquals("https://github.com/JabRef/jabref/blob/main/CHANGELOG.md#unreleased", version.getChangelogUrl()); } @Test - public void changelogOfDevelopmentStageSubNumber() { + void changelogOfDevelopmentStageSubNumber() { Version version1 = Version.parse("4.0"); Version version2 = Version.parse("4.0-beta"); Version version3 = Version.parse("4.0-beta2"); @@ -239,75 +239,75 @@ public void changelogOfDevelopmentStageSubNumber() { } @Test - public void changelogWithTwoDigits() { + void changelogWithTwoDigits() { Version version = Version.parse("3.4"); assertEquals("https://github.com/JabRef/jabref/blob/v3.4/CHANGELOG.md", version.getChangelogUrl()); } @Test - public void changelogWithThreeDigits() { + void changelogWithThreeDigits() { Version version = Version.parse("3.4.1"); assertEquals("https://github.com/JabRef/jabref/blob/v3.4.1/CHANGELOG.md", version.getChangelogUrl()); } @Test - public void versionNull() { + void versionNull() { String versionText = null; Version version = Version.parse(versionText); assertEquals(BuildInfo.UNKNOWN_VERSION, version.getFullVersion()); } @Test - public void versionEmpty() { + void versionEmpty() { String versionText = ""; Version version = Version.parse(versionText); assertEquals(BuildInfo.UNKNOWN_VERSION, version.getFullVersion()); } @Test - public void betaNewerThanAlpha() { + void betaNewerThanAlpha() { Version older = Version.parse("2.7-alpha"); Version newer = Version.parse("2.7-beta"); assertTrue(newer.isNewerThan(older)); } @Test - public void stableNewerThanBeta() { + void stableNewerThanBeta() { Version older = Version.parse("2.8-alpha"); Version newer = Version.parse("2.8"); assertTrue(newer.isNewerThan(older)); } @Test - public void alphaShouldBeUpdatedToBeta() { + void alphaShouldBeUpdatedToBeta() { Version alpha = Version.parse("2.8-alpha"); Version beta = Version.parse("2.8-beta"); assertTrue(alpha.shouldBeUpdatedTo(beta)); } @Test - public void betaShouldBeUpdatedToStable() { + void betaShouldBeUpdatedToStable() { Version beta = Version.parse("2.8-beta"); Version stable = Version.parse("2.8"); assertTrue(beta.shouldBeUpdatedTo(stable)); } @Test - public void stableShouldNotBeUpdatedToAlpha() { + void stableShouldNotBeUpdatedToAlpha() { Version stable = Version.parse("2.8"); Version alpha = Version.parse("2.9-alpha"); assertFalse(stable.shouldBeUpdatedTo(alpha)); } @Test - public void stableShouldNotBeUpdatedToBeta() { + void stableShouldNotBeUpdatedToBeta() { Version stable = Version.parse("3.8.2"); Version beta = Version.parse("4.0-beta"); assertFalse(stable.shouldBeUpdatedTo(beta)); } @Test - public void alphaShouldBeUpdatedToStables() { + void alphaShouldBeUpdatedToStables() { Version alpha = Version.parse("2.8-alpha"); Version stable = Version.parse("2.8"); List availableVersions = Arrays.asList(Version.parse("2.8-beta"), stable); @@ -315,13 +315,13 @@ public void alphaShouldBeUpdatedToStables() { } @Test - public void ciSuffixShouldBeRemoved() { + void ciSuffixShouldBeRemoved() { Version v50ci = Version.parse("5.0-ci.1"); assertEquals("5.0", v50ci.getFullVersion()); } @Test - public void ciSuffixShouldBeRemovedIfDateIsPresent() { + void ciSuffixShouldBeRemovedIfDateIsPresent() { Version v50ci = Version.parse("5.0-ci.1--2020-03-06--289142f"); assertEquals("5.0--2020-03-06--289142f", v50ci.getFullVersion()); } @@ -329,7 +329,7 @@ public void ciSuffixShouldBeRemovedIfDateIsPresent() { @Test @FetcherTest @DisabledOnCIServer("GitHub puts a low rate limit on unauthenticated calls") - public void getAllAvailableVersionsReturnsSomething() throws Exception { + void getAllAvailableVersionsReturnsSomething() throws Exception { assertNotEquals(Collections.emptyList(), Version.getAllAvailableVersions()); } } diff --git a/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java b/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java index a5ad81b76d97..b4ed896bb37a 100644 --- a/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java +++ b/src/test/java/org/jabref/logic/util/io/BackupFileUtilTest.java @@ -10,14 +10,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.mockito.Answers; import org.mockito.MockedStatic; -import org.mockito.Mockito; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -public class BackupFileUtilTest { +class BackupFileUtilTest { Path backupDir; @@ -44,7 +42,7 @@ void getPathOfBackupFileAndCreateDirectoryReturnsAppDirectoryInCaseOfNoError() { @Test void getPathOfBackupFileAndCreateDirectoryReturnsSameDirectoryInCaseOfException() { backupDir = OS.getNativeDesktop().getBackupDirectory(); - try (MockedStatic files = Mockito.mockStatic(Files.class, Answers.RETURNS_DEEP_STUBS)) { + try (MockedStatic files) { files.when(() -> Files.createDirectories(OS.getNativeDesktop().getBackupDirectory())) .thenThrow(new IOException()); Path testPath = Path.of("tmp", "test.bib"); diff --git a/src/test/java/org/jabref/logic/util/io/FileNameUniquenessTest.java b/src/test/java/org/jabref/logic/util/io/FileNameUniquenessTest.java index a54aadf58b41..87a4f709f36d 100644 --- a/src/test/java/org/jabref/logic/util/io/FileNameUniquenessTest.java +++ b/src/test/java/org/jabref/logic/util/io/FileNameUniquenessTest.java @@ -14,13 +14,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; -public class FileNameUniquenessTest { +class FileNameUniquenessTest { @TempDir protected Path tempDir; @Test - public void testGetNonOverWritingFileNameReturnsSameName() throws IOException { + void testGetNonOverWritingFileNameReturnsSameName() throws IOException { assertFalse(Files.exists(tempDir.resolve("sameFile.txt"))); String outputFileName = FileNameUniqueness.getNonOverWritingFileName(tempDir, "sameFile.txt"); @@ -28,7 +28,7 @@ public void testGetNonOverWritingFileNameReturnsSameName() throws IOException { } @Test - public void testGetNonOverWritingFileNameReturnsUniqueNameOver1Conflict() throws IOException { + void testGetNonOverWritingFileNameReturnsUniqueNameOver1Conflict() throws IOException { Path dummyFilePath1 = tempDir.resolve("differentFile.txt"); Files.createFile(dummyFilePath1); @@ -38,7 +38,7 @@ public void testGetNonOverWritingFileNameReturnsUniqueNameOver1Conflict() throws } @Test - public void testGetNonOverWritingFileNameReturnsUniqueNameOverNConflicts() throws IOException { + void testGetNonOverWritingFileNameReturnsUniqueNameOverNConflicts() throws IOException { Path dummyFilePath1 = tempDir.resolve("manyfiles.txt"); Path dummyFilePath2 = tempDir.resolve("manyfiles (1).txt"); @@ -50,7 +50,7 @@ public void testGetNonOverWritingFileNameReturnsUniqueNameOverNConflicts() throw } @Test - public void testIsDuplicatedFileWithNoSimilarNames() throws IOException { + void testIsDuplicatedFileWithNoSimilarNames() throws IOException { DialogService dialogService = mock(DialogService.class); String filename1 = "file1.txt"; Path filePath1 = tempDir.resolve(filename1); @@ -61,7 +61,7 @@ public void testIsDuplicatedFileWithNoSimilarNames() throws IOException { } @Test - public void testIsDuplicatedFileWithOneSimilarNames() throws IOException { + void testIsDuplicatedFileWithOneSimilarNames() throws IOException { DialogService dialogService = mock(DialogService.class); String filename1 = "file.txt"; String filename2 = "file (1).txt"; @@ -75,28 +75,28 @@ public void testIsDuplicatedFileWithOneSimilarNames() throws IOException { } @Test - public void testTaseDuplicateMarksReturnsOrignalFileName1() throws IOException { + void testTaseDuplicateMarksReturnsOrignalFileName1() throws IOException { String fileName1 = "abc def (1)"; String fileName2 = FileNameUniqueness.eraseDuplicateMarks(fileName1); assertEquals("abc def", fileName2); } @Test - public void testTaseDuplicateMarksReturnsOrignalFileName2() throws IOException { + void testTaseDuplicateMarksReturnsOrignalFileName2() throws IOException { String fileName1 = "abc (def) gh (1)"; String fileName2 = FileNameUniqueness.eraseDuplicateMarks(fileName1); assertEquals("abc (def) gh", fileName2); } @Test - public void testTaseDuplicateMarksReturnsSameName1() throws IOException { + void testTaseDuplicateMarksReturnsSameName1() throws IOException { String fileName1 = "abc def (g)"; String fileName2 = FileNameUniqueness.eraseDuplicateMarks(fileName1); assertEquals("abc def (g)", fileName2); } @Test - public void testTaseDuplicateMarksReturnsSameName2() throws IOException { + void testTaseDuplicateMarksReturnsSameName2() throws IOException { String fileName1 = "abc def"; String fileName2 = FileNameUniqueness.eraseDuplicateMarks(fileName1); assertEquals("abc def", fileName2); diff --git a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java index b5bf3b8d5b40..f6ee49780db3 100644 --- a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java +++ b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java @@ -360,32 +360,32 @@ void testFindInListOfPath() { } @Test - public void extractFileExtension() { + void extractFileExtension() { final String filePath = FileUtilTest.class.getResource("pdffile.pdf").getPath(); assertEquals(Optional.of("pdf"), FileUtil.getFileExtension(filePath)); } @Test - public void fileExtensionFromUrl() { + void fileExtensionFromUrl() { final String filePath = "https://link.springer.com/content/pdf/10.1007%2Fs40955-018-0121-9.pdf"; assertEquals(Optional.of("pdf"), FileUtil.getFileExtension(filePath)); } @Test - public void testFileNameEmpty() { + void testFileNameEmpty() { Path path = Path.of("/"); assertEquals(Optional.of(path), FileUtil.find("", path)); } @ParameterizedTest @ValueSource(strings = {"*", "?", ">", "\""}) - public void testFileNameIllegal(String fileName) { + void testFileNameIllegal(String fileName) { Path path = Path.of("/"); assertEquals(Optional.empty(), FileUtil.find(fileName, path)); } @Test - public void testFindsFileInDirectory(@TempDir Path temp) throws Exception { + void testFindsFileInDirectory(@TempDir Path temp) throws Exception { Path firstFilePath = temp.resolve("files"); Files.createDirectories(firstFilePath); Path firstFile = Files.createFile(firstFilePath.resolve("test.pdf")); @@ -394,7 +394,7 @@ public void testFindsFileInDirectory(@TempDir Path temp) throws Exception { } @Test - public void testFindsFileStartingWithTheSameDirectory(@TempDir Path temp) throws Exception { + void testFindsFileStartingWithTheSameDirectory(@TempDir Path temp) throws Exception { Path firstFilePath = temp.resolve("files"); Files.createDirectories(firstFilePath); Path firstFile = Files.createFile(firstFilePath.resolve("test.pdf")); @@ -403,7 +403,7 @@ public void testFindsFileStartingWithTheSameDirectory(@TempDir Path temp) throws } @Test - public void testDoesNotFindsFileStartingWithTheSameDirectoryHasASubdirectory(@TempDir Path temp) throws Exception { + void testDoesNotFindsFileStartingWithTheSameDirectoryHasASubdirectory(@TempDir Path temp) throws Exception { Path firstFilesPath = temp.resolve("files"); Path secondFilesPath = firstFilesPath.resolve("files"); Files.createDirectories(secondFilesPath); @@ -423,13 +423,13 @@ public void testCTemp() { @ParameterizedTest @ValueSource(strings = {"/mnt/tmp/test.pdf"}) - public void legalPaths(String fileName) { + void legalPaths(String fileName) { assertFalse(FileUtil.detectBadFileName(fileName)); } @ParameterizedTest @ValueSource(strings = {"te{}mp.pdf"}) - public void illegalPaths(String fileName) { + void illegalPaths(String fileName) { assertTrue(FileUtil.detectBadFileName(fileName)); } } diff --git a/src/test/java/org/jabref/logic/util/strings/StringLengthComparatorTest.java b/src/test/java/org/jabref/logic/util/strings/StringLengthComparatorTest.java index 174b2de82383..0530c2179472 100644 --- a/src/test/java/org/jabref/logic/util/strings/StringLengthComparatorTest.java +++ b/src/test/java/org/jabref/logic/util/strings/StringLengthComparatorTest.java @@ -9,12 +9,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class StringLengthComparatorTest { +class StringLengthComparatorTest { private StringLengthComparator slc; @BeforeEach - public void setUp() { + void setUp() { slc = new StringLengthComparator(); } diff --git a/src/test/java/org/jabref/logic/util/strings/StringManipulatorTest.java b/src/test/java/org/jabref/logic/util/strings/StringManipulatorTest.java index fce0126c0b70..c9d2ee2eb7e3 100644 --- a/src/test/java/org/jabref/logic/util/strings/StringManipulatorTest.java +++ b/src/test/java/org/jabref/logic/util/strings/StringManipulatorTest.java @@ -11,10 +11,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class StringManipulatorTest { +class StringManipulatorTest { @Test - public void testCapitalizePreservesNewlines() { + void testCapitalizePreservesNewlines() { int caretPosition = 5; // Position of the caret, between the two ll in the first hellO" String input = "hello\n\nhELLO"; String expectedResult = "hello\n\nHello"; @@ -23,7 +23,7 @@ public void testCapitalizePreservesNewlines() { } @Test - public void testUppercasePreservesSpace() { + void testUppercasePreservesSpace() { int caretPosition = 3; // Position of the caret, between the two ll in the first hello String input = "hello hello"; String expectedResult = "helLO hello"; @@ -32,7 +32,7 @@ public void testUppercasePreservesSpace() { } @Test - public void testUppercasePreservesNewlines() { + void testUppercasePreservesNewlines() { int caretPosition = 3; // Position of the caret, between the two ll in the first hello String input = "hello\nhello"; String expectedResult = "helLO\nhello"; @@ -41,7 +41,7 @@ public void testUppercasePreservesNewlines() { } @Test - public void testUppercasePreservesTab() { + void testUppercasePreservesTab() { int caretPosition = 3; // Position of the caret, between the two ll in the first hello String input = "hello\thello"; String expectedResult = "helLO\thello"; @@ -50,7 +50,7 @@ public void testUppercasePreservesTab() { } @Test - public void testUppercasePreservesDoubleSpace() { + void testUppercasePreservesDoubleSpace() { int caretPosition = 5; // Position of the caret, at the first space String input = "hello hello"; String expectedResult = "hello HELLO"; @@ -59,7 +59,7 @@ public void testUppercasePreservesDoubleSpace() { } @Test - public void testUppercaseIgnoresTrailingWhitespace() { + void testUppercaseIgnoresTrailingWhitespace() { int caretPosition = 5; // First space String input = "hello "; String expectedResult = "hello "; @@ -70,7 +70,7 @@ public void testUppercaseIgnoresTrailingWhitespace() { } @Test - public void testKillWordTrimsTrailingWhitespace() { + void testKillWordTrimsTrailingWhitespace() { int caretPosition = 5; // First space String input = "hello "; String expectedResult = "hello"; @@ -80,7 +80,7 @@ public void testKillWordTrimsTrailingWhitespace() { } @Test - public void testBackwardsKillWordTrimsPreceedingWhitespace() { + void testBackwardsKillWordTrimsPreceedingWhitespace() { int caretPosition = 1; // Second space String input = " hello"; // One space should be preserved since we are deleting everything preceding the second space. @@ -92,7 +92,7 @@ public void testBackwardsKillWordTrimsPreceedingWhitespace() { } @Test - public void testUppercasePreservesMixedSpaceNewLineTab() { + void testUppercasePreservesMixedSpaceNewLineTab() { int caretPosition = 5; // Position of the caret, after first hello String input = "hello \n\thello"; String expectedResult = "hello \n\tHELLO"; @@ -101,7 +101,7 @@ public void testUppercasePreservesMixedSpaceNewLineTab() { } @Test - public void testLowercaseEditsTheNextWord() { + void testLowercaseEditsTheNextWord() { int caretPosition = 5; // Position of the caret, right at the space String input = "hello HELLO"; String expectedResult = "hello hello"; @@ -110,7 +110,7 @@ public void testLowercaseEditsTheNextWord() { } @Test - public void testKillWordRemovesFromPositionUpToNextWord() { + void testKillWordRemovesFromPositionUpToNextWord() { int caretPosition = 3; // Position of the caret, between the two "ll in the first hello" String input = "hello hello"; String expectedResult = "hel hello"; @@ -119,7 +119,7 @@ public void testKillWordRemovesFromPositionUpToNextWord() { } @Test - public void testKillWordRemovesNextWordIfPositionIsInSpace() { + void testKillWordRemovesNextWordIfPositionIsInSpace() { int caretPosition = 5; // Position of the caret, after the first hello" String input = "hello person"; String expectedResult = "hello"; @@ -128,7 +128,7 @@ public void testKillWordRemovesNextWordIfPositionIsInSpace() { } @Test - public void testKillPreviousWord() { + void testKillPreviousWord() { int caretPosition = 8; int expectedPosition = 6; String input = "hello person"; diff --git a/src/test/java/org/jabref/logic/util/strings/StringSimilarityTest.java b/src/test/java/org/jabref/logic/util/strings/StringSimilarityTest.java index 908727784a5b..21daed8f9f8d 100644 --- a/src/test/java/org/jabref/logic/util/strings/StringSimilarityTest.java +++ b/src/test/java/org/jabref/logic/util/strings/StringSimilarityTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class StringSimilarityTest { +class StringSimilarityTest { private StringSimilarity similarityChecker = new StringSimilarity(); @@ -24,7 +24,7 @@ public class StringSimilarityTest { "abcdef, ab, true", // no empty strings and similarity == threshold (4) "abcdef, a, false" // no empty string sand similarity > threshold (4) }) - public void testStringSimilarity(String a, String b, String expectedResult) { + void testStringSimilarity(String a, String b, String expectedResult) { assertEquals(Boolean.valueOf(expectedResult), similarityChecker.isSimilar(a, b)); } } diff --git a/src/test/java/org/jabref/migrations/MergeReviewIntoCommentActionMigrationTest.java b/src/test/java/org/jabref/migrations/MergeReviewIntoCommentActionMigrationTest.java index 39d94ef7d52d..46c3b61a0ed9 100644 --- a/src/test/java/org/jabref/migrations/MergeReviewIntoCommentActionMigrationTest.java +++ b/src/test/java/org/jabref/migrations/MergeReviewIntoCommentActionMigrationTest.java @@ -20,14 +20,14 @@ class MergeReviewIntoCommentActionMigrationTest { private BibEntry expectedEntry; @BeforeEach - public void setUp() { + void setUp() { action = new MergeReviewIntoCommentMigration(); entry = createMinimalBibEntry(); expectedEntry = createMinimalBibEntry(); } @Test - public void noFields() { + void noFields() { ParserResult actualParserResult = new ParserResult(Collections.singletonList(entry)); action.performMigration(actualParserResult); @@ -36,7 +36,7 @@ public void noFields() { } @Test - public void reviewField() { + void reviewField() { entry.setField(StandardField.REVIEW, "My Review"); ParserResult actualParserResult = new ParserResult(Collections.singletonList(entry)); @@ -48,7 +48,7 @@ public void reviewField() { } @Test - public void commentField() { + void commentField() { entry.setField(StandardField.COMMENT, "My Comment"); ParserResult actualParserResult = new ParserResult(Collections.singletonList(entry)); @@ -58,7 +58,7 @@ public void commentField() { } @Test - public void multiLineReviewField() { + void multiLineReviewField() { String commentString = "My Review\n\nSecond Paragraph\n\nThird Paragraph"; entry.setField(StandardField.REVIEW, commentString); @@ -73,7 +73,7 @@ public void multiLineReviewField() { @Test @Disabled("Re-enable if the MergeReviewIntoCommentMigration.mergeCommentFieldIfPresent() does not block and wait for user input.") - public void reviewAndCommentField() { + void reviewAndCommentField() { entry.setField(StandardField.REVIEW, "My Review"); entry.setField(StandardField.COMMENT, "My Comment"); diff --git a/src/test/java/org/jabref/migrations/PreferencesMigrationsTest.java b/src/test/java/org/jabref/migrations/PreferencesMigrationsTest.java index 7146764d8c17..3a4838b7288a 100644 --- a/src/test/java/org/jabref/migrations/PreferencesMigrationsTest.java +++ b/src/test/java/org/jabref/migrations/PreferencesMigrationsTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.mockito.Answers; import org.mockito.MockedStatic; -import org.mockito.Mockito; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -205,7 +204,7 @@ void testMoveApiKeysToKeyRing() throws Exception { when(prefs.getStringList(V5_9_FETCHER_CUSTOM_KEYS)).thenReturn(List.of("KeyA", "KeyB", "KeyC")); when(prefs.getInternalPreferences().getUserAndHost()).thenReturn("user-host"); - try (MockedStatic keyringFactory = Mockito.mockStatic(Keyring.class, Answers.RETURNS_DEEP_STUBS)) { + try (MockedStatic keyringFactory) { keyringFactory.when(Keyring::create).thenReturn(keyring); PreferencesMigrations.moveApiKeysToKeyring(prefs); diff --git a/src/test/java/org/jabref/migrations/SpecialFieldsToSeparateFieldsTest.java b/src/test/java/org/jabref/migrations/SpecialFieldsToSeparateFieldsTest.java index 3b62d531fe7b..11dbc262077d 100644 --- a/src/test/java/org/jabref/migrations/SpecialFieldsToSeparateFieldsTest.java +++ b/src/test/java/org/jabref/migrations/SpecialFieldsToSeparateFieldsTest.java @@ -19,7 +19,7 @@ class SpecialFieldsToSeparateFieldsTest { @ParameterizedTest @MethodSource("provideKeywordFieldPairs") - public void migrateToCorrectField(SpecialField field, String fieldInKeyword, BibEntry expected) { + void migrateToCorrectField(SpecialField field, String fieldInKeyword, BibEntry expected) { BibEntry entry = new BibEntry().withField(StandardField.KEYWORDS, fieldInKeyword); new SpecialFieldsToSeparateFields(',').performMigration(new ParserResult(List.of(entry))); @@ -28,7 +28,7 @@ public void migrateToCorrectField(SpecialField field, String fieldInKeyword, Bib } @Test - public void noKewordToMigrate() { + void noKewordToMigrate() { BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "JabRef") .withField(StandardField.KEYWORDS, "tdd"); BibEntry expected = new BibEntry().withField(StandardField.AUTHOR, "JabRef") @@ -40,7 +40,7 @@ public void noKewordToMigrate() { } @Test - public void noKeywordToMigrateButDuplicateKeywords() { + void noKeywordToMigrateButDuplicateKeywords() { BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "JabRef") .withField(StandardField.KEYWORDS, "asdf, asdf, asdf"); BibEntry expected = new BibEntry().withField(StandardField.AUTHOR, "JabRef") @@ -52,7 +52,7 @@ public void noKeywordToMigrateButDuplicateKeywords() { } @Test - public void migrateMultipleSpecialFields() { + void migrateMultipleSpecialFields() { BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "JabRef") .withField(StandardField.KEYWORDS, "printed, prio1"); BibEntry expected = new BibEntry().withField(StandardField.AUTHOR, "JabRef") @@ -65,7 +65,7 @@ public void migrateMultipleSpecialFields() { } @Test - public void migrateSpecialFieldsMixedWithKeyword() { + void migrateSpecialFieldsMixedWithKeyword() { BibEntry entry = new BibEntry().withField(StandardField.AUTHOR, "JabRef") .withField(StandardField.KEYWORDS, "tdd, prio1, SE"); diff --git a/src/test/java/org/jabref/model/TreeNodeTest.java b/src/test/java/org/jabref/model/TreeNodeTest.java index da2a00f89fc9..92effe4e3196 100644 --- a/src/test/java/org/jabref/model/TreeNodeTest.java +++ b/src/test/java/org/jabref/model/TreeNodeTest.java @@ -17,28 +17,28 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -public class TreeNodeTest { +class TreeNodeTest { Consumer subscriber; @BeforeEach - public void setUp() { + void setUp() { subscriber = mock(Consumer.class); } @Test - public void constructorChecksThatClassImplementsCorrectInterface() { + void constructorChecksThatClassImplementsCorrectInterface() { assertThrows(UnsupportedOperationException.class, WrongTreeNodeImplementation::new); } @Test - public void constructorExceptsCorrectImplementation() { + void constructorExceptsCorrectImplementation() { TreeNodeTestData.TreeNodeMock treeNode = new TreeNodeTestData.TreeNodeMock(); assertNotNull(treeNode); } @Test - public void newTreeNodeHasNoParentOrChildren() { + void newTreeNodeHasNoParentOrChildren() { TreeNodeTestData.TreeNodeMock treeNode = new TreeNodeTestData.TreeNodeMock(); assertEquals(Optional.empty(), treeNode.getParent()); assertEquals(Collections.emptyList(), treeNode.getChildren()); @@ -46,100 +46,100 @@ public void newTreeNodeHasNoParentOrChildren() { } @Test - public void getIndexedPathFromRootReturnsEmptyListForRoot() { + void getIndexedPathFromRootReturnsEmptyListForRoot() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertEquals(Collections.emptyList(), root.getIndexedPathFromRoot()); } @Test - public void getIndexedPathFromRootSimplePath() { + void getIndexedPathFromRootSimplePath() { assertEquals(Arrays.asList(1, 0), TreeNodeTestData.getNodeInSimpleTree().getIndexedPathFromRoot()); } @Test - public void getIndexedPathFromRootComplexPath() { + void getIndexedPathFromRootComplexPath() { assertEquals(Arrays.asList(2, 1, 0), TreeNodeTestData.getNodeInComplexTree().getIndexedPathFromRoot()); } @Test - public void getDescendantSimplePath() { + void getDescendantSimplePath() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInSimpleTree(root); assertEquals(node, root.getDescendant(Arrays.asList(1, 0)).get()); } @Test - public void getDescendantComplexPath() { + void getDescendantComplexPath() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); assertEquals(node, root.getDescendant(Arrays.asList(2, 1, 0)).get()); } @Test - public void getDescendantNonExistentReturnsEmpty() { + void getDescendantNonExistentReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.getNodeInComplexTree(root); assertEquals(Optional.empty(), root.getDescendant(Arrays.asList(1, 100, 0))); } @Test - public void getPositionInParentForRootThrowsException() { + void getPositionInParentForRootThrowsException() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertThrows(UnsupportedOperationException.class, root::getPositionInParent); } @Test - public void getPositionInParentSimpleTree() { + void getPositionInParentSimpleTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); assertEquals(2, node.getPositionInParent()); } @Test - public void getIndexOfNonExistentChildReturnsEmpty() { + void getIndexOfNonExistentChildReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertEquals(Optional.empty(), root.getIndexOfChild(new TreeNodeTestData.TreeNodeMock())); } @Test - public void getIndexOfChild() { + void getIndexOfChild() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); assertEquals((Integer) 2, root.getIndexOfChild(node).get()); } @Test - public void getLevelOfRoot() { + void getLevelOfRoot() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertEquals(0, root.getLevel()); } @Test - public void getLevelInSimpleTree() { + void getLevelInSimpleTree() { assertEquals(2, TreeNodeTestData.getNodeInSimpleTree().getLevel()); } @Test - public void getLevelInComplexTree() { + void getLevelInComplexTree() { assertEquals(3, TreeNodeTestData.getNodeInComplexTree().getLevel()); } @Test - public void getChildCountInSimpleTree() { + void getChildCountInSimpleTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.getNodeInSimpleTree(root); assertEquals(2, root.getNumberOfChildren()); } @Test - public void getChildCountInComplexTree() { + void getChildCountInComplexTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.getNodeInComplexTree(root); assertEquals(4, root.getNumberOfChildren()); } @Test - public void moveToAddsAsLastChildInSimpleTree() { + void moveToAddsAsLastChildInSimpleTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInSimpleTree(root); node.moveTo(root); @@ -147,7 +147,7 @@ public void moveToAddsAsLastChildInSimpleTree() { } @Test - public void moveToAddsAsLastChildInComplexTree() { + void moveToAddsAsLastChildInComplexTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); node.moveTo(root); @@ -155,7 +155,7 @@ public void moveToAddsAsLastChildInComplexTree() { } @Test - public void moveToChangesParent() { + void moveToChangesParent() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInSimpleTree(root); node.moveTo(root); @@ -163,7 +163,7 @@ public void moveToChangesParent() { } @Test - public void moveToInSameLevelAddsAtEnd() { + void moveToInSameLevelAddsAtEnd() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child1 = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child2 = new TreeNodeTestData.TreeNodeMock(); @@ -176,7 +176,7 @@ public void moveToInSameLevelAddsAtEnd() { } @Test - public void moveToInSameLevelWhenNodeWasBeforeTargetIndex() { + void moveToInSameLevelWhenNodeWasBeforeTargetIndex() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child1 = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child2 = new TreeNodeTestData.TreeNodeMock(); @@ -191,7 +191,7 @@ public void moveToInSameLevelWhenNodeWasBeforeTargetIndex() { } @Test - public void moveToInSameLevelWhenNodeWasAfterTargetIndex() { + void moveToInSameLevelWhenNodeWasAfterTargetIndex() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child1 = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child2 = new TreeNodeTestData.TreeNodeMock(); @@ -206,7 +206,7 @@ public void moveToInSameLevelWhenNodeWasAfterTargetIndex() { } @Test - public void getPathFromRootInSimpleTree() { + void getPathFromRootInSimpleTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInSimpleTree(root); @@ -217,7 +217,7 @@ public void getPathFromRootInSimpleTree() { } @Test - public void getPathFromRootInComplexTree() { + void getPathFromRootInComplexTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); @@ -228,7 +228,7 @@ public void getPathFromRootInComplexTree() { } @Test - public void getPreviousSiblingReturnsCorrect() { + void getPreviousSiblingReturnsCorrect() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); root.addChild(new TreeNodeTestData.TreeNodeMock()); TreeNodeTestData.TreeNodeMock previous = new TreeNodeTestData.TreeNodeMock(); @@ -241,13 +241,13 @@ public void getPreviousSiblingReturnsCorrect() { } @Test - public void getPreviousSiblingForRootReturnsEmpty() { + void getPreviousSiblingForRootReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertEquals(Optional.empty(), root.getPreviousSibling()); } @Test - public void getPreviousSiblingForNonexistentReturnsEmpty() { + void getPreviousSiblingForNonexistentReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = new TreeNodeTestData.TreeNodeMock(); root.addChild(node); @@ -255,7 +255,7 @@ public void getPreviousSiblingForNonexistentReturnsEmpty() { } @Test - public void getNextSiblingReturnsCorrect() { + void getNextSiblingReturnsCorrect() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); root.addChild(new TreeNodeTestData.TreeNodeMock()); TreeNodeTestData.TreeNodeMock node = new TreeNodeTestData.TreeNodeMock(); @@ -268,13 +268,13 @@ public void getNextSiblingReturnsCorrect() { } @Test - public void getNextSiblingForRootReturnsEmpty() { + void getNextSiblingForRootReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertEquals(Optional.empty(), root.getNextSibling()); } @Test - public void getNextSiblingForNonexistentReturnsEmpty() { + void getNextSiblingForNonexistentReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = new TreeNodeTestData.TreeNodeMock(); root.addChild(node); @@ -282,7 +282,7 @@ public void getNextSiblingForNonexistentReturnsEmpty() { } @Test - public void getParentReturnsCorrect() { + void getParentReturnsCorrect() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -290,13 +290,13 @@ public void getParentReturnsCorrect() { } @Test - public void getParentForRootReturnsEmpty() { + void getParentForRootReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertEquals(Optional.empty(), root.getParent()); } @Test - public void getChildAtReturnsCorrect() { + void getChildAtReturnsCorrect() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -304,7 +304,7 @@ public void getChildAtReturnsCorrect() { } @Test - public void getChildAtInvalidIndexReturnsEmpty() { + void getChildAtInvalidIndexReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); root.addChild(new TreeNodeTestData.TreeNodeMock()); root.addChild(new TreeNodeTestData.TreeNodeMock()); @@ -312,64 +312,64 @@ public void getChildAtInvalidIndexReturnsEmpty() { } @Test - public void getRootReturnsTrueForRoot() { + void getRootReturnsTrueForRoot() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertTrue(root.isRoot()); } @Test - public void getRootReturnsFalseForChild() { + void getRootReturnsFalseForChild() { assertFalse(TreeNodeTestData.getNodeInSimpleTree().isRoot()); } @Test - public void nodeIsAncestorOfItself() { + void nodeIsAncestorOfItself() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertTrue(root.isAncestorOf(root)); } @Test - public void isAncestorOfInSimpleTree() { + void isAncestorOfInSimpleTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInSimpleTree(root); assertTrue(root.isAncestorOf(node)); } @Test - public void isAncestorOfInComplexTree() { + void isAncestorOfInComplexTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); assertTrue(root.isAncestorOf(node)); } @Test - public void getRootOfSingleNode() { + void getRootOfSingleNode() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertEquals(root, root.getRoot()); } @Test - public void getRootInSimpleTree() { + void getRootInSimpleTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInSimpleTree(root); assertEquals(root, node.getRoot()); } @Test - public void getRootInComplexTree() { + void getRootInComplexTree() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); assertEquals(root, node.getRoot()); } @Test - public void isLeafIsCorrectForRootWithoutChildren() { + void isLeafIsCorrectForRootWithoutChildren() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); assertTrue(root.isLeaf()); } @Test - public void removeFromParentSetsParentToEmpty() { + void removeFromParentSetsParentToEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -378,7 +378,7 @@ public void removeFromParentSetsParentToEmpty() { } @Test - public void removeFromParentRemovesNodeFromChildrenCollection() { + void removeFromParentRemovesNodeFromChildrenCollection() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -387,7 +387,7 @@ public void removeFromParentRemovesNodeFromChildrenCollection() { } @Test - public void removeAllChildrenSetsParentOfChildToEmpty() { + void removeAllChildrenSetsParentOfChildToEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -396,7 +396,7 @@ public void removeAllChildrenSetsParentOfChildToEmpty() { } @Test - public void removeAllChildrenRemovesAllNodesFromChildrenCollection() { + void removeAllChildrenRemovesAllNodesFromChildrenCollection() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.getNodeAsChild(root); @@ -405,7 +405,7 @@ public void removeAllChildrenRemovesAllNodesFromChildrenCollection() { } @Test - public void getFirstChildAtReturnsCorrect() { + void getFirstChildAtReturnsCorrect() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = new TreeNodeTestData.TreeNodeMock(); root.addChild(node); @@ -414,28 +414,28 @@ public void getFirstChildAtReturnsCorrect() { } @Test - public void getFirstChildAtLeafReturnsEmpty() { + void getFirstChildAtLeafReturnsEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock leaf = TreeNodeTestData.getNodeAsChild(root); assertEquals(Optional.empty(), leaf.getFirstChild()); } @Test - public void isNodeDescendantInFirstLevel() { + void isNodeDescendantInFirstLevel() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child = TreeNodeTestData.getNodeAsChild(root); assertTrue(root.isNodeDescendant(child)); } @Test - public void isNodeDescendantInComplex() { + void isNodeDescendantInComplex() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock descendant = TreeNodeTestData.getNodeInComplexTree(root); assertTrue(root.isNodeDescendant(descendant)); } @Test - public void getChildrenReturnsAllChildren() { + void getChildrenReturnsAllChildren() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child1 = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child2 = new TreeNodeTestData.TreeNodeMock(); @@ -446,7 +446,7 @@ public void getChildrenReturnsAllChildren() { } @Test - public void removeChildSetsParentToEmpty() { + void removeChildSetsParentToEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -455,7 +455,7 @@ public void removeChildSetsParentToEmpty() { } @Test - public void removeChildRemovesNodeFromChildrenCollection() { + void removeChildRemovesNodeFromChildrenCollection() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -464,7 +464,7 @@ public void removeChildRemovesNodeFromChildrenCollection() { } @Test - public void removeChildIndexSetsParentToEmpty() { + void removeChildIndexSetsParentToEmpty() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -473,7 +473,7 @@ public void removeChildIndexSetsParentToEmpty() { } @Test - public void removeChildIndexRemovesNodeFromChildrenCollection() { + void removeChildIndexRemovesNodeFromChildrenCollection() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -482,14 +482,14 @@ public void removeChildIndexRemovesNodeFromChildrenCollection() { } @Test - public void addThrowsExceptionIfNodeHasParent() { + void addThrowsExceptionIfNodeHasParent() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); assertThrows(UnsupportedOperationException.class, () -> root.addChild(node)); } @Test - public void moveAllChildrenToAddsAtSpecifiedPosition() { + void moveAllChildrenToAddsAtSpecifiedPosition() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = new TreeNodeTestData.TreeNodeMock(); root.addChild(node); @@ -503,7 +503,7 @@ public void moveAllChildrenToAddsAtSpecifiedPosition() { } @Test - public void moveAllChildrenToChangesParent() { + void moveAllChildrenToChangesParent() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = new TreeNodeTestData.TreeNodeMock(); root.addChild(node); @@ -518,7 +518,7 @@ public void moveAllChildrenToChangesParent() { } @Test - public void moveAllChildrenToDescendantThrowsException() { + void moveAllChildrenToDescendantThrowsException() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -526,7 +526,7 @@ public void moveAllChildrenToDescendantThrowsException() { } @Test - public void sortChildrenSortsInFirstLevel() { + void sortChildrenSortsInFirstLevel() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock child1 = new TreeNodeTestData.TreeNodeMock("a"); TreeNodeTestData.TreeNodeMock child2 = new TreeNodeTestData.TreeNodeMock("b"); @@ -540,7 +540,7 @@ public void sortChildrenSortsInFirstLevel() { } @Test - public void sortChildrenRecursiveSortsInDeeperLevel() { + void sortChildrenRecursiveSortsInDeeperLevel() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInSimpleTree(root); TreeNodeTestData.TreeNodeMock child1 = new TreeNodeTestData.TreeNodeMock("a"); @@ -555,7 +555,7 @@ public void sortChildrenRecursiveSortsInDeeperLevel() { } @Test - public void copySubtreeCopiesChildren() { + void copySubtreeCopiesChildren() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeAsChild(root); @@ -566,7 +566,7 @@ public void copySubtreeCopiesChildren() { } @Test - public void addChildSomewhereInTreeInvokesChangeEvent() { + void addChildSomewhereInTreeInvokesChangeEvent() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); @@ -577,7 +577,7 @@ public void addChildSomewhereInTreeInvokesChangeEvent() { } @Test - public void moveNodeSomewhereInTreeInvokesChangeEvent() { + void moveNodeSomewhereInTreeInvokesChangeEvent() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); TreeNodeTestData.TreeNodeMock oldParent = node.getParent().get(); @@ -590,7 +590,7 @@ public void moveNodeSomewhereInTreeInvokesChangeEvent() { } @Test - public void removeChildSomewhereInTreeInvokesChangeEvent() { + void removeChildSomewhereInTreeInvokesChangeEvent() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); TreeNodeTestData.TreeNodeMock child = node.addChild(new TreeNodeTestData.TreeNodeMock()); @@ -602,7 +602,7 @@ public void removeChildSomewhereInTreeInvokesChangeEvent() { } @Test - public void removeChildIndexSomewhereInTreeInvokesChangeEvent() { + void removeChildIndexSomewhereInTreeInvokesChangeEvent() { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock(); TreeNodeTestData.TreeNodeMock node = TreeNodeTestData.getNodeInComplexTree(root); node.addChild(new TreeNodeTestData.TreeNodeMock()); @@ -614,7 +614,7 @@ public void removeChildIndexSomewhereInTreeInvokesChangeEvent() { } @Test - public void findChildrenWithSameName() throws Exception { + void findChildrenWithSameName() throws Exception { TreeNodeTestData.TreeNodeMock root = new TreeNodeTestData.TreeNodeMock("A"); TreeNodeTestData.TreeNodeMock childB = root.addChild(new TreeNodeTestData.TreeNodeMock("B")); TreeNodeTestData.TreeNodeMock node = childB.addChild(new TreeNodeTestData.TreeNodeMock("A")); diff --git a/src/test/java/org/jabref/model/database/BibDatabaseModeDetectionTest.java b/src/test/java/org/jabref/model/database/BibDatabaseModeDetectionTest.java index 30937e8235ea..6c204cdf5245 100644 --- a/src/test/java/org/jabref/model/database/BibDatabaseModeDetectionTest.java +++ b/src/test/java/org/jabref/model/database/BibDatabaseModeDetectionTest.java @@ -13,19 +13,19 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class BibDatabaseModeDetectionTest { +class BibDatabaseModeDetectionTest { private static final EntryType UNKNOWN_TYPE = new UnknownEntryType("unknowntype"); @Test - public void detectBiblatex() { + void detectBiblatex() { List entries = Arrays.asList(new BibEntry(StandardEntryType.MvBook)); assertEquals(BibDatabaseMode.BIBLATEX, BibDatabaseModeDetection.inferMode(new BibDatabase(entries))); } @Test - public void detectUndistinguishableAsBibtex() { + void detectUndistinguishableAsBibtex() { BibEntry entry = new BibEntry(StandardEntryType.Article); entry.setField(StandardField.TITLE, "My cool paper"); List entries = Arrays.asList(entry); @@ -34,7 +34,7 @@ public void detectUndistinguishableAsBibtex() { } @Test - public void detectMixedModeAsBiblatex() { + void detectMixedModeAsBiblatex() { BibEntry bibtex = new BibEntry(StandardEntryType.Article); bibtex.setField(StandardField.JOURNAL, "IEEE Trans. Services Computing"); BibEntry biblatex = new BibEntry(StandardEntryType.Article); @@ -45,7 +45,7 @@ public void detectMixedModeAsBiblatex() { } @Test - public void detectUnknownTypeAsBibtex() { + void detectUnknownTypeAsBibtex() { BibEntry entry = new BibEntry(UNKNOWN_TYPE); List entries = Arrays.asList(entry); @@ -53,7 +53,7 @@ public void detectUnknownTypeAsBibtex() { } @Test - public void ignoreUnknownTypesForBibtexDecision() { + void ignoreUnknownTypesForBibtexDecision() { BibEntry custom = new BibEntry(UNKNOWN_TYPE); BibEntry bibtex = new BibEntry(StandardEntryType.Article); BibEntry biblatex = new BibEntry(StandardEntryType.Article); @@ -63,7 +63,7 @@ public void ignoreUnknownTypesForBibtexDecision() { } @Test - public void ignoreUnknownTypesForBiblatexDecision() { + void ignoreUnknownTypesForBiblatexDecision() { BibEntry custom = new BibEntry(UNKNOWN_TYPE); BibEntry bibtex = new BibEntry(StandardEntryType.Article); BibEntry biblatex = new BibEntry(StandardEntryType.MvBook); diff --git a/src/test/java/org/jabref/model/database/KeyChangeListenerTest.java b/src/test/java/org/jabref/model/database/KeyChangeListenerTest.java index a0cdc5b65e70..ab853bca7b9a 100644 --- a/src/test/java/org/jabref/model/database/KeyChangeListenerTest.java +++ b/src/test/java/org/jabref/model/database/KeyChangeListenerTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class KeyChangeListenerTest { +class KeyChangeListenerTest { private BibDatabase db; private BibEntry entry1; @@ -22,7 +22,7 @@ public class KeyChangeListenerTest { private BibEntry entry4; @BeforeEach - public void setUp() { + void setUp() { db = new BibDatabase(); entry1 = new BibEntry(); @@ -46,46 +46,46 @@ public void setUp() { } @Test - public void testCrossrefChanged() { + void testCrossrefChanged() { assertEquals(Optional.of("Entry4"), entry1.getField(StandardField.CROSSREF)); entry4.setCitationKey("Banana"); assertEquals(Optional.of("Banana"), entry1.getField(StandardField.CROSSREF)); } @Test - public void testRelatedChanged() { + void testRelatedChanged() { assertEquals(Optional.of("Entry1,Entry3"), entry2.getField(StandardField.RELATED)); entry1.setCitationKey("Banana"); assertEquals(Optional.of("Banana,Entry3"), entry2.getField(StandardField.RELATED)); } @Test - public void testRelatedChangedInSameEntry() { + void testRelatedChangedInSameEntry() { assertEquals(Optional.of("Entry1,Entry2,Entry3"), entry3.getField(StandardField.RELATED)); entry3.setCitationKey("Banana"); assertEquals(Optional.of("Entry1,Entry2,Banana"), entry3.getField(StandardField.RELATED)); } @Test - public void testCrossrefRemoved() { + void testCrossrefRemoved() { entry4.clearField(InternalField.KEY_FIELD); assertEquals(Optional.empty(), entry1.getField(StandardField.CROSSREF)); } @Test - public void testCrossrefEntryRemoved() { + void testCrossrefEntryRemoved() { db.removeEntry(entry4); assertEquals(Optional.empty(), entry1.getField(StandardField.CROSSREF)); } @Test - public void testRelatedEntryRemoved() { + void testRelatedEntryRemoved() { db.removeEntry(entry1); assertEquals(Optional.of("Entry3"), entry2.getField(StandardField.RELATED)); } @Test - public void testRelatedAllEntriesRemoved() { + void testRelatedAllEntriesRemoved() { List entries = Arrays.asList(entry1, entry3); db.removeEntries(entries); assertEquals(Optional.empty(), entry2.getField(StandardField.RELATED)); diff --git a/src/test/java/org/jabref/model/entry/AuthorListTest.java b/src/test/java/org/jabref/model/entry/AuthorListTest.java index 152bd3d80a8d..9afa8562cd8f 100644 --- a/src/test/java/org/jabref/model/entry/AuthorListTest.java +++ b/src/test/java/org/jabref/model/entry/AuthorListTest.java @@ -43,7 +43,7 @@ public static int size(String bibtex) { } @Test - public void testFixAuthorNatbib() { + void testFixAuthorNatbib() { assertEquals("", AuthorList.fixAuthorNatbib("")); assertEquals("Smith", AuthorList.fixAuthorNatbib("John Smith")); assertEquals("Smith and Black Brown", AuthorList @@ -53,54 +53,54 @@ public void testFixAuthorNatbib() { } @Test - public void getAsNatbibLatexFreeEmptyAuthorStringForEmptyInput() { + void getAsNatbibLatexFreeEmptyAuthorStringForEmptyInput() { assertEquals("", EMPTY_AUTHOR.latexFree().getAsNatbib()); } @Test - public void getAsNatbibLatexFreeUnicodeOneAuthorNameFromLatex() { + void getAsNatbibLatexFreeUnicodeOneAuthorNameFromLatex() { assertEquals("al-Khwārizmī", ONE_AUTHOR_WITH_LATEX.latexFree().getAsNatbib()); } @Test - public void getAsNatbibLatexFreeUnicodeTwoAuthorNamesFromLatex() { + void getAsNatbibLatexFreeUnicodeTwoAuthorNamesFromLatex() { assertEquals("al-Khwārizmī and Böhm", TWO_AUTHORS_WITH_LATEX.latexFree().getAsNatbib()); } @Test - public void getAsNatbibLatexFreeUnicodeAuthorEtAlFromLatex() { + void getAsNatbibLatexFreeUnicodeAuthorEtAlFromLatex() { assertEquals("al-Khwārizmī et al.", THREE_AUTHORS_WITH_LATEX.latexFree().getAsNatbib()); } @Test - public void getAsNatbibLatexFreeUnicodeOneInsitutionNameFromLatex() { + void getAsNatbibLatexFreeUnicodeOneInsitutionNameFromLatex() { assertEquals("The Banū Mūsā brothers", ONE_INSTITUTION_WITH_LATEX.latexFree().getAsNatbib()); } @Test - public void getAsNatbibLatexFreeUnicodeTwoInsitutionNameFromLatex() { + void getAsNatbibLatexFreeUnicodeTwoInsitutionNameFromLatex() { assertEquals("The Banū Mūsā brothers and The Banū Mūsā brothers", TWO_INSTITUTIONS_WITH_LATEX.latexFree().getAsNatbib()); } @Test - public void getAsNatbibLatexFreeUnicodeMixedAuthorsFromLatex() { + void getAsNatbibLatexFreeUnicodeMixedAuthorsFromLatex() { assertEquals("The Banū Mūsā brothers and Böhm", MIXED_AUTHOR_AND_INSTITUTION_WITH_LATEX.latexFree().getAsNatbib()); } @Test - public void getAsNatbibLatexFreeOneInstitutionWithParanthesisAtStart() { + void getAsNatbibLatexFreeOneInstitutionWithParanthesisAtStart() { assertEquals("Łukasz Michał", ONE_INSTITUTION_WITH_STARTING_PARANTHESIS.latexFree().getAsNatbib()); } @Test - public void parseCachesOneAuthor() { + void parseCachesOneAuthor() { // Test caching in authorCache. AuthorList authorList = AuthorList.parse("John Smith"); assertSame(authorList, AuthorList.parse("John Smith")); @@ -108,7 +108,7 @@ public void parseCachesOneAuthor() { } @Test - public void parseCachesOneLatexFreeAuthor() { + void parseCachesOneLatexFreeAuthor() { // Test caching in authorCache. AuthorList authorList = AuthorList.parse("John Smith").latexFree(); assertSame(authorList, AuthorList.parse("John Smith").latexFree()); @@ -116,7 +116,7 @@ public void parseCachesOneLatexFreeAuthor() { } @Test - public void testFixAuthorFirstNameFirstCommas() { + void testFixAuthorFirstNameFirstCommas() { // No Commas assertEquals("", AuthorList.fixAuthorFirstNameFirstCommas("", true, false)); assertEquals("", AuthorList.fixAuthorFirstNameFirstCommas("", false, false)); @@ -180,112 +180,112 @@ public void testFixAuthorFirstNameFirstCommas() { } @Test - public void getAsFirstLastNamesLatexFreeEmptyAuthorStringForEmptyInputAbbreviate() { + void getAsFirstLastNamesLatexFreeEmptyAuthorStringForEmptyInputAbbreviate() { assertEquals("", EMPTY_AUTHOR.latexFree().getAsFirstLastNames(true, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeOneAuthorNameFromLatexAbbreviate() { + void getAsFirstLastNamesLatexFreeUnicodeOneAuthorNameFromLatexAbbreviate() { assertEquals("M. al-Khwārizmī", ONE_AUTHOR_WITH_LATEX.latexFree().getAsFirstLastNames(true, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatexAbbreviate() { + void getAsFirstLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatexAbbreviate() { assertEquals("M. al-Khwārizmī and C. Böhm", TWO_AUTHORS_WITH_LATEX.latexFree().getAsFirstLastNames(true, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatexAbbreviateAndOxfordComma() { + void getAsFirstLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatexAbbreviateAndOxfordComma() { assertEquals("M. al-Khwārizmī and C. Böhm", TWO_AUTHORS_WITH_LATEX.latexFree().getAsFirstLastNames(true, true)); } @Test - public void getAsFirstLastNamesLatexFreeThreeUnicodeAuthorsFromLatexAbbreviate() { + void getAsFirstLastNamesLatexFreeThreeUnicodeAuthorsFromLatexAbbreviate() { assertEquals("M. al-Khwārizmī, C. Böhm and K. Gödel", THREE_AUTHORS_WITH_LATEX.latexFree().getAsFirstLastNames(true, false)); } @Test - public void getAsFirstLastNamesLatexFreeThreeUnicodeAuthorsFromLatexAbbreviateAndOxfordComma() { + void getAsFirstLastNamesLatexFreeThreeUnicodeAuthorsFromLatexAbbreviateAndOxfordComma() { assertEquals("M. al-Khwārizmī, C. Böhm, and K. Gödel", THREE_AUTHORS_WITH_LATEX.latexFree().getAsFirstLastNames(true, true)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeOneInsitutionNameFromLatexAbbreviate() { + void getAsFirstLastNamesLatexFreeUnicodeOneInsitutionNameFromLatexAbbreviate() { assertEquals("The Banū Mūsā brothers", ONE_INSTITUTION_WITH_LATEX.latexFree().getAsFirstLastNames(true, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeTwoInsitutionNameFromLatexAbbreviate() { + void getAsFirstLastNamesLatexFreeUnicodeTwoInsitutionNameFromLatexAbbreviate() { assertEquals("The Banū Mūsā brothers and The Banū Mūsā brothers", TWO_INSTITUTIONS_WITH_LATEX.latexFree().getAsFirstLastNames(true, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeMixedAuthorsFromLatexAbbreviate() { + void getAsFirstLastNamesLatexFreeUnicodeMixedAuthorsFromLatexAbbreviate() { assertEquals("The Banū Mūsā brothers and C. Böhm", MIXED_AUTHOR_AND_INSTITUTION_WITH_LATEX.latexFree().getAsFirstLastNames(true, false)); } @Test - public void getAsFirstLastNamesLatexFreeOneInstitutionWithParanthesisAtStartAbbreviate() { + void getAsFirstLastNamesLatexFreeOneInstitutionWithParanthesisAtStartAbbreviate() { assertEquals("Łukasz Michał", ONE_INSTITUTION_WITH_STARTING_PARANTHESIS.latexFree().getAsFirstLastNames(true, false)); } @Test - public void getAsFirstLastNamesLatexFreeEmptyAuthorStringForEmptyInput() { + void getAsFirstLastNamesLatexFreeEmptyAuthorStringForEmptyInput() { assertEquals("", EMPTY_AUTHOR.latexFree().getAsFirstLastNames(false, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeOneAuthorNameFromLatex() { + void getAsFirstLastNamesLatexFreeUnicodeOneAuthorNameFromLatex() { assertEquals("Muḥammad al-Khwārizmī", ONE_AUTHOR_WITH_LATEX.latexFree().getAsFirstLastNames(false, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatex() { + void getAsFirstLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatex() { assertEquals("Muḥammad al-Khwārizmī and Corrado Böhm", TWO_AUTHORS_WITH_LATEX.latexFree().getAsFirstLastNames(false, false)); } @Test - public void getAsFirstLastNamesLatexFreeThreeUnicodeAuthorsFromLatex() { + void getAsFirstLastNamesLatexFreeThreeUnicodeAuthorsFromLatex() { assertEquals("Muḥammad al-Khwārizmī, Corrado Böhm and Kurt Gödel", THREE_AUTHORS_WITH_LATEX.latexFree().getAsFirstLastNames(false, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeOneInsitutionNameFromLatex() { + void getAsFirstLastNamesLatexFreeUnicodeOneInsitutionNameFromLatex() { assertEquals("The Banū Mūsā brothers", ONE_INSTITUTION_WITH_LATEX.latexFree().getAsFirstLastNames(false, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeTwoInsitutionNameFromLatex() { + void getAsFirstLastNamesLatexFreeUnicodeTwoInsitutionNameFromLatex() { assertEquals("The Banū Mūsā brothers and The Banū Mūsā brothers", TWO_INSTITUTIONS_WITH_LATEX.latexFree().getAsFirstLastNames(false, false)); } @Test - public void getAsFirstLastNamesLatexFreeUnicodeMixedAuthorsFromLatex() { + void getAsFirstLastNamesLatexFreeUnicodeMixedAuthorsFromLatex() { assertEquals("The Banū Mūsā brothers and Corrado Böhm", MIXED_AUTHOR_AND_INSTITUTION_WITH_LATEX.latexFree().getAsFirstLastNames(false, false)); } @Test - public void getAsFirstLastNamesLatexFreeOneInstitutionWithParanthesisAtStart() { + void getAsFirstLastNamesLatexFreeOneInstitutionWithParanthesisAtStart() { assertEquals("Łukasz Michał", ONE_INSTITUTION_WITH_STARTING_PARANTHESIS.latexFree().getAsFirstLastNames(false, false)); } @Test - public void testFixAuthorFirstNameFirst() { + void testFixAuthorFirstNameFirst() { assertEquals("John Smith", AuthorList.fixAuthorFirstNameFirst("John Smith")); assertEquals("John Smith and Peter Black Brown", AuthorList @@ -304,7 +304,7 @@ public void testFixAuthorFirstNameFirst() { } @Test - public void testFixAuthorLastNameFirstCommasNoComma() { + void testFixAuthorLastNameFirstCommasNoComma() { // No commas before and assertEquals("", AuthorList.fixAuthorLastNameFirstCommas("", true, false)); assertEquals("", AuthorList.fixAuthorLastNameFirstCommas("", false, false)); @@ -335,7 +335,7 @@ public void testFixAuthorLastNameFirstCommasNoComma() { } @Test - public void testFixAuthorLastNameFirstCommasOxfordComma() { + void testFixAuthorLastNameFirstCommasOxfordComma() { // Oxford Commas assertEquals("", AuthorList.fixAuthorLastNameFirstCommas("", true, true)); assertEquals("", AuthorList.fixAuthorLastNameFirstCommas("", false, true)); @@ -370,195 +370,195 @@ public void testFixAuthorLastNameFirstCommasOxfordComma() { } @Test - public void getAsLastFirstNamesLatexFreeEmptyAuthorStringForEmptyInputAbbr() { + void getAsLastFirstNamesLatexFreeEmptyAuthorStringForEmptyInputAbbr() { assertEquals("", EMPTY_AUTHOR.latexFree().getAsLastFirstNames(true, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeOneAuthorNameFromLatexAbbr() { + void getAsLastFirstNamesLatexFreeUnicodeOneAuthorNameFromLatexAbbr() { assertEquals("al-Khwārizmī, M.", ONE_AUTHOR_WITH_LATEX.latexFree().getAsLastFirstNames(true, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeTwoAuthorNamesFromLatexAbbr() { + void getAsLastFirstNamesLatexFreeUnicodeTwoAuthorNamesFromLatexAbbr() { assertEquals("al-Khwārizmī, M. and Böhm, C.", TWO_AUTHORS_WITH_LATEX.latexFree().getAsLastFirstNames(true, false)); } @Test - public void getAsLastFirstNamesLatexFreeThreeUnicodeAuthorsFromLatexAbbr() { + void getAsLastFirstNamesLatexFreeThreeUnicodeAuthorsFromLatexAbbr() { assertEquals("al-Khwārizmī, M., Böhm, C. and Gödel, K.", THREE_AUTHORS_WITH_LATEX.latexFree().getAsLastFirstNames(true, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeOneInsitutionNameFromLatexAbbr() { + void getAsLastFirstNamesLatexFreeUnicodeOneInsitutionNameFromLatexAbbr() { assertEquals("The Banū Mūsā brothers", ONE_INSTITUTION_WITH_LATEX.latexFree().getAsLastFirstNames(true, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeTwoInsitutionNameFromLatexAbbr() { + void getAsLastFirstNamesLatexFreeUnicodeTwoInsitutionNameFromLatexAbbr() { assertEquals("The Banū Mūsā brothers and The Banū Mūsā brothers", TWO_INSTITUTIONS_WITH_LATEX.latexFree().getAsLastFirstNames(true, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeMixedAuthorsFromLatexAbbr() { + void getAsLastFirstNamesLatexFreeUnicodeMixedAuthorsFromLatexAbbr() { assertEquals("The Banū Mūsā brothers and Böhm, C.", MIXED_AUTHOR_AND_INSTITUTION_WITH_LATEX.latexFree().getAsLastFirstNames(true, false)); } @Test - public void getAsLastFirstNamesLatexFreeOneInstitutionWithParanthesisAtStartAbbr() { + void getAsLastFirstNamesLatexFreeOneInstitutionWithParanthesisAtStartAbbr() { assertEquals("Łukasz Michał", ONE_INSTITUTION_WITH_STARTING_PARANTHESIS.latexFree().getAsLastFirstNames(true, false)); } @Test - public void getAsLastFirstNamesLatexFreeEmptyAuthorStringForEmptyInput() { + void getAsLastFirstNamesLatexFreeEmptyAuthorStringForEmptyInput() { assertEquals("", EMPTY_AUTHOR.latexFree().getAsLastFirstNames(false, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeOneAuthorNameFromLatex() { + void getAsLastFirstNamesLatexFreeUnicodeOneAuthorNameFromLatex() { assertEquals("al-Khwārizmī, Muḥammad", ONE_AUTHOR_WITH_LATEX.latexFree().getAsLastFirstNames(false, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeTwoAuthorNamesFromLatex() { + void getAsLastFirstNamesLatexFreeUnicodeTwoAuthorNamesFromLatex() { assertEquals("al-Khwārizmī, Muḥammad and Böhm, Corrado", TWO_AUTHORS_WITH_LATEX.latexFree().getAsLastFirstNames(false, false)); } @Test - public void getAsLastFirstNamesLatexFreeThreeUnicodeAuthorsFromLatex() { + void getAsLastFirstNamesLatexFreeThreeUnicodeAuthorsFromLatex() { assertEquals("al-Khwārizmī, Muḥammad, Böhm, Corrado and Gödel, Kurt", THREE_AUTHORS_WITH_LATEX.latexFree().getAsLastFirstNames(false, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeOneInsitutionNameFromLatex() { + void getAsLastFirstNamesLatexFreeUnicodeOneInsitutionNameFromLatex() { assertEquals("The Banū Mūsā brothers", ONE_INSTITUTION_WITH_LATEX.latexFree().getAsLastFirstNames(false, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeTwoInsitutionNameFromLatex() { + void getAsLastFirstNamesLatexFreeUnicodeTwoInsitutionNameFromLatex() { assertEquals("The Banū Mūsā brothers and The Banū Mūsā brothers", TWO_INSTITUTIONS_WITH_LATEX.latexFree().getAsLastFirstNames(false, false)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeMixedAuthorsFromLatex() { + void getAsLastFirstNamesLatexFreeUnicodeMixedAuthorsFromLatex() { assertEquals("The Banū Mūsā brothers and Böhm, Corrado", MIXED_AUTHOR_AND_INSTITUTION_WITH_LATEX.latexFree().getAsLastFirstNames(false, false)); } @Test - public void getAsLastFirstNamesLatexFreeOneInstitutionWithParanthesisAtStart() { + void getAsLastFirstNamesLatexFreeOneInstitutionWithParanthesisAtStart() { assertEquals("Łukasz Michał", ONE_INSTITUTION_WITH_STARTING_PARANTHESIS.latexFree().getAsLastFirstNames(false, false)); } @Test - public void getAsLastFirstNamesLatexFreeEmptyAuthorStringForEmptyInputAbbrOxfordComma() { + void getAsLastFirstNamesLatexFreeEmptyAuthorStringForEmptyInputAbbrOxfordComma() { assertEquals("", EMPTY_AUTHOR.latexFree().getAsLastFirstNames(true, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeOneAuthorNameFromLatexAbbrOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeOneAuthorNameFromLatexAbbrOxfordComma() { assertEquals("al-Khwārizmī, M.", ONE_AUTHOR_WITH_LATEX.latexFree().getAsLastFirstNames(true, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeTwoAuthorNamesFromLatexAbbrOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeTwoAuthorNamesFromLatexAbbrOxfordComma() { assertEquals("al-Khwārizmī, M. and Böhm, C.", TWO_AUTHORS_WITH_LATEX.latexFree().getAsLastFirstNames(true, true)); } @Test - public void getAsLastFirstNamesLatexFreeThreeUnicodeAuthorsFromLatexAbbrOxfordComma() { + void getAsLastFirstNamesLatexFreeThreeUnicodeAuthorsFromLatexAbbrOxfordComma() { assertEquals("al-Khwārizmī, M., Böhm, C., and Gödel, K.", THREE_AUTHORS_WITH_LATEX.latexFree().getAsLastFirstNames(true, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeOneInsitutionNameFromLatexAbbrOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeOneInsitutionNameFromLatexAbbrOxfordComma() { assertEquals("The Banū Mūsā brothers", ONE_INSTITUTION_WITH_LATEX.latexFree().getAsLastFirstNames(true, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeTwoInsitutionNameFromLatexAbbrOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeTwoInsitutionNameFromLatexAbbrOxfordComma() { assertEquals("The Banū Mūsā brothers and The Banū Mūsā brothers", TWO_INSTITUTIONS_WITH_LATEX.latexFree().getAsLastFirstNames(true, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeMixedAuthorsFromLatexAbbrOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeMixedAuthorsFromLatexAbbrOxfordComma() { assertEquals("The Banū Mūsā brothers and Böhm, C.", MIXED_AUTHOR_AND_INSTITUTION_WITH_LATEX.latexFree().getAsLastFirstNames(true, true)); } @Test - public void getAsLastFirstNamesLatexFreeOneInstitutionWithParanthesisAtStartAbbrOxfordComma() { + void getAsLastFirstNamesLatexFreeOneInstitutionWithParanthesisAtStartAbbrOxfordComma() { assertEquals("Łukasz Michał", ONE_INSTITUTION_WITH_STARTING_PARANTHESIS.latexFree().getAsLastFirstNames(true, true)); } @Test - public void getAsLastFirstNamesLatexFreeEmptyAuthorStringForEmptyInputOxfordComma() { + void getAsLastFirstNamesLatexFreeEmptyAuthorStringForEmptyInputOxfordComma() { assertEquals("", EMPTY_AUTHOR.latexFree().getAsLastFirstNames(false, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeOneAuthorNameFromLatexOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeOneAuthorNameFromLatexOxfordComma() { assertEquals("al-Khwārizmī, Muḥammad", ONE_AUTHOR_WITH_LATEX.latexFree().getAsLastFirstNames(false, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeTwoAuthorNamesFromLatexOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeTwoAuthorNamesFromLatexOxfordComma() { assertEquals("al-Khwārizmī, Muḥammad and Böhm, Corrado", TWO_AUTHORS_WITH_LATEX.latexFree().getAsLastFirstNames(false, true)); } @Test - public void getAsLastFirstNamesLatexFreeThreeUnicodeAuthorsFromLatexOxfordComma() { + void getAsLastFirstNamesLatexFreeThreeUnicodeAuthorsFromLatexOxfordComma() { assertEquals("al-Khwārizmī, Muḥammad, Böhm, Corrado, and Gödel, Kurt", THREE_AUTHORS_WITH_LATEX.latexFree().getAsLastFirstNames(false, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeOneInsitutionNameFromLatexOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeOneInsitutionNameFromLatexOxfordComma() { assertEquals("The Banū Mūsā brothers", ONE_INSTITUTION_WITH_LATEX.latexFree().getAsLastFirstNames(false, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeTwoInsitutionNameFromLatexOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeTwoInsitutionNameFromLatexOxfordComma() { assertEquals("The Banū Mūsā brothers and The Banū Mūsā brothers", TWO_INSTITUTIONS_WITH_LATEX.latexFree().getAsLastFirstNames(false, true)); } @Test - public void getAsLastFirstNamesLatexFreeUnicodeMixedAuthorsFromLatexOxfordComma() { + void getAsLastFirstNamesLatexFreeUnicodeMixedAuthorsFromLatexOxfordComma() { assertEquals("The Banū Mūsā brothers and Böhm, Corrado", MIXED_AUTHOR_AND_INSTITUTION_WITH_LATEX.latexFree().getAsLastFirstNames(false, true)); } @Test - public void getAsLastFirstNamesLatexFreeOneInstitutionWithParanthesisAtStartOxfordComma() { + void getAsLastFirstNamesLatexFreeOneInstitutionWithParanthesisAtStartOxfordComma() { assertEquals("Łukasz Michał", ONE_INSTITUTION_WITH_STARTING_PARANTHESIS.latexFree().getAsLastFirstNames(false, true)); } @Test - public void testFixAuthorLastNameFirst() { + void testFixAuthorLastNameFirst() { // Test helper method assertEquals("Smith, John", AuthorList.fixAuthorLastNameFirst("John Smith")); @@ -612,7 +612,7 @@ public void testFixAuthorLastNameFirst() { } @Test - public void testFixAuthorLastNameOnlyCommas() { + void testFixAuthorLastNameOnlyCommas() { // No comma before and assertEquals("", AuthorList.fixAuthorLastNameOnlyCommas("", false)); assertEquals("Smith", AuthorList.fixAuthorLastNameOnlyCommas("John Smith", false)); @@ -640,55 +640,55 @@ public void testFixAuthorLastNameOnlyCommas() { } @Test - public void getAsLastNamesLatexFreeUnicodeOneAuthorNameFromLatex() { + void getAsLastNamesLatexFreeUnicodeOneAuthorNameFromLatex() { assertEquals("al-Khwārizmī", ONE_AUTHOR_WITH_LATEX.latexFree().getAsLastNames(false)); } @Test - public void getAsLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatex() { + void getAsLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatex() { assertEquals("al-Khwārizmī and Böhm", TWO_AUTHORS_WITH_LATEX.latexFree().getAsLastNames(false)); } @Test - public void getAsLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatexUsingOxfordComma() { + void getAsLastNamesLatexFreeUnicodeTwoAuthorNamesFromLatexUsingOxfordComma() { assertEquals("al-Khwārizmī and Böhm", TWO_AUTHORS_WITH_LATEX.latexFree().getAsLastNames(true)); } @Test - public void getAsLastNamesLatexFreeUnicodeThreeAuthorsFromLatex() { + void getAsLastNamesLatexFreeUnicodeThreeAuthorsFromLatex() { assertEquals("al-Khwārizmī, Böhm and Gödel", THREE_AUTHORS_WITH_LATEX.latexFree().getAsLastNames(false)); } @Test - public void getAsLastNamesLatexFreeUnicodeThreeAuthorsFromLatexUsingOxfordComma() { + void getAsLastNamesLatexFreeUnicodeThreeAuthorsFromLatexUsingOxfordComma() { assertEquals("al-Khwārizmī, Böhm, and Gödel", THREE_AUTHORS_WITH_LATEX.latexFree().getAsLastNames(true)); } @Test - public void getAsLastNamesLatexFreeUnicodeOneInsitutionNameFromLatex() { + void getAsLastNamesLatexFreeUnicodeOneInsitutionNameFromLatex() { assertEquals("The Banū Mūsā brothers", ONE_INSTITUTION_WITH_LATEX.latexFree().getAsLastNames(false)); } @Test - public void getAsLastNamesLatexFreeUnicodeTwoInsitutionNameFromLatex() { + void getAsLastNamesLatexFreeUnicodeTwoInsitutionNameFromLatex() { assertEquals("The Banū Mūsā brothers and The Banū Mūsā brothers", TWO_INSTITUTIONS_WITH_LATEX.latexFree().getAsLastNames(false)); } @Test - public void getAsLastNamesLatexFreeUnicodeMixedAuthorsFromLatex() { + void getAsLastNamesLatexFreeUnicodeMixedAuthorsFromLatex() { assertEquals("The Banū Mūsā brothers and Böhm", MIXED_AUTHOR_AND_INSTITUTION_WITH_LATEX.latexFree().getAsLastNames(false)); } @Test - public void getAsLastNamesLatexFreeOneInstitutionWithParanthesisAtStart() { + void getAsLastNamesLatexFreeOneInstitutionWithParanthesisAtStart() { assertEquals("Łukasz Michał", ONE_INSTITUTION_WITH_STARTING_PARANTHESIS.latexFree().getAsLastNames(false)); } @Test - public void testFixAuthorForAlphabetization() { + void testFixAuthorForAlphabetization() { assertEquals("Smith, J.", AuthorList.fixAuthorForAlphabetization("John Smith")); assertEquals("Neumann, J.", AuthorList.fixAuthorForAlphabetization("John von Neumann")); assertEquals("Neumann, J.", AuthorList.fixAuthorForAlphabetization("J. von Neumann")); @@ -699,7 +699,7 @@ public void testFixAuthorForAlphabetization() { } @Test - public void testSize() { + void testSize() { assertEquals(0, AuthorListTest.size("")); assertEquals(1, AuthorListTest.size("Bar")); assertEquals(1, AuthorListTest.size("Foo Bar")); @@ -721,18 +721,18 @@ public void testSize() { } @Test - public void testIsEmpty() { + void testIsEmpty() { assertTrue(AuthorList.parse("").isEmpty()); assertFalse(AuthorList.parse("Bar").isEmpty()); } @Test - public void testGetEmptyAuthor() { + void testGetEmptyAuthor() { assertThrows(Exception.class, () -> AuthorList.parse("").getAuthor(0)); } @Test - public void testGetAuthor() { + void testGetAuthor() { Author author = AuthorList.parse("John Smith and von Neumann, Jr, John").getAuthor(0); assertEquals(Optional.of("John"), author.getFirst()); assertEquals(Optional.of("J."), author.getFirstAbbr()); @@ -769,35 +769,35 @@ public void testGetAuthor() { } @Test - public void testCompanyAuthor() { + void testCompanyAuthor() { Author author = AuthorList.parse("{JabRef Developers}").getAuthor(0); Author expected = new Author(null, null, null, "JabRef Developers", null); assertEquals(expected, author); } @Test - public void testCompanyAuthorAndPerson() { + void testCompanyAuthorAndPerson() { Author company = new Author(null, null, null, "JabRef Developers", null); Author person = new Author("Stefan", "S.", null, "Kolb", null); assertEquals(Arrays.asList(company, person), AuthorList.parse("{JabRef Developers} and Stefan Kolb").getAuthors()); } @Test - public void testCompanyAuthorWithLowerCaseWord() { + void testCompanyAuthorWithLowerCaseWord() { Author author = AuthorList.parse("{JabRef Developers on Fire}").getAuthor(0); Author expected = new Author(null, null, null, "JabRef Developers on Fire", null); assertEquals(expected, author); } @Test - public void testAbbreviationWithRelax() { + void testAbbreviationWithRelax() { Author author = AuthorList.parse("{\\relax Ch}ristoph Cholera").getAuthor(0); Author expected = new Author("{\\relax Ch}ristoph", "{\\relax Ch}.", null, "Cholera", null); assertEquals(expected, author); } @Test - public void testGetAuthorsNatbib() { + void testGetAuthorsNatbib() { assertEquals("", AuthorList.parse("").getAsNatbib()); assertEquals("Smith", AuthorList.parse("John Smith").getAsNatbib()); assertEquals("Smith and Black Brown", AuthorList.parse( @@ -818,7 +818,7 @@ public void testGetAuthorsNatbib() { } @Test - public void testGetAuthorsLastOnly() { + void testGetAuthorsLastOnly() { // No comma before and assertEquals("", AuthorList.parse("").getAsLastNames(false)); assertEquals("Smith", AuthorList.parse("John Smith").getAsLastNames(false)); @@ -841,7 +841,7 @@ public void testGetAuthorsLastOnly() { } @Test - public void testGetAuthorsLastFirstNoComma() { + void testGetAuthorsLastFirstNoComma() { // No commas before and AuthorList al; @@ -869,7 +869,7 @@ public void testGetAuthorsLastFirstNoComma() { } @Test - public void testGetAuthorsLastFirstOxfordComma() { + void testGetAuthorsLastFirstOxfordComma() { // Oxford comma AuthorList al; @@ -896,7 +896,7 @@ public void testGetAuthorsLastFirstOxfordComma() { } @Test - public void testGetAuthorsLastFirstAnds() { + void testGetAuthorsLastFirstAnds() { assertEquals("Smith, John", AuthorList.parse("John Smith").getAsLastFirstNamesWithAnd( false)); assertEquals("Smith, John and Black Brown, Peter", AuthorList.parse( @@ -918,7 +918,7 @@ public void testGetAuthorsLastFirstAnds() { } @Test - public void testGetAuthorsFirstFirst() { + void testGetAuthorsFirstFirst() { AuthorList al; al = AuthorList.parse(""); @@ -957,7 +957,7 @@ public void testGetAuthorsFirstFirst() { } @Test - public void testGetAuthorsFirstFirstAnds() { + void testGetAuthorsFirstFirstAnds() { assertEquals("John Smith", AuthorList.parse("John Smith") .getAsFirstLastNamesWithAnd()); assertEquals("John Smith and Peter Black Brown", AuthorList.parse( @@ -970,7 +970,7 @@ public void testGetAuthorsFirstFirstAnds() { } @Test - public void testGetAuthorsForAlphabetization() { + void testGetAuthorsForAlphabetization() { assertEquals("Smith, J.", AuthorList.parse("John Smith") .getForAlphabetization()); assertEquals("Neumann, J.", AuthorList.parse("John von Neumann") @@ -983,7 +983,7 @@ public void testGetAuthorsForAlphabetization() { } @Test - public void testRemoveStartAndEndBraces() { + void testRemoveStartAndEndBraces() { assertEquals("{A}bbb{c}", AuthorList.parse("{A}bbb{c}").getAsLastNames(false)); assertEquals("Vall{\\'e}e Poussin", AuthorList.parse("{Vall{\\'e}e Poussin}").getAsLastNames(false)); assertEquals("Poussin", AuthorList.parse("{Vall{\\'e}e} {Poussin}").getAsLastNames(false)); @@ -993,97 +993,97 @@ public void testRemoveStartAndEndBraces() { } @Test - public void createCorrectInitials() { + void createCorrectInitials() { assertEquals(Optional.of("J. G."), AuthorList.parse("Hornberg, Johann Gottfried").getAuthor(0).getFirstAbbr()); } @Test - public void parseNameWithBracesAroundFirstName() throws Exception { + void parseNameWithBracesAroundFirstName() throws Exception { // TODO: Be more intelligent and abbreviate the first name correctly Author expected = new Author("Tse-tung", "{Tse-tung}.", null, "Mao", null); assertEquals(AuthorList.of(expected), AuthorList.parse("{Tse-tung} Mao")); } @Test - public void parseNameWithBracesAroundLastName() throws Exception { + void parseNameWithBracesAroundLastName() throws Exception { Author expected = new Author("Hans", "H.", null, "van den Bergen", null); assertEquals(AuthorList.of(expected), AuthorList.parse("{van den Bergen}, Hans")); } @Test - public void parseNameWithHyphenInFirstName() throws Exception { + void parseNameWithHyphenInFirstName() throws Exception { Author expected = new Author("Tse-tung", "T.-t.", null, "Mao", null); assertEquals(AuthorList.of(expected), AuthorList.parse("Tse-tung Mao")); } @Test - public void parseNameWithHyphenInLastName() throws Exception { + void parseNameWithHyphenInLastName() throws Exception { Author expected = new Author("Firstname", "F.", null, "Bailey-Jones", null); assertEquals(AuthorList.of(expected), AuthorList.parse("Firstname Bailey-Jones")); } @Test - public void parseNameWithHyphenInLastNameWithInitials() throws Exception { + void parseNameWithHyphenInLastNameWithInitials() throws Exception { Author expected = new Author("E. S.", "E. S.", null, "El-{M}allah", null); assertEquals(AuthorList.of(expected), AuthorList.parse("E. S. El-{M}allah")); } @Test - public void parseNameWithHyphenInLastNameWithEscaped() throws Exception { + void parseNameWithHyphenInLastNameWithEscaped() throws Exception { Author expected = new Author("E. S.", "E. S.", null, "{K}ent-{B}oswell", null); assertEquals(AuthorList.of(expected), AuthorList.parse("E. S. {K}ent-{B}oswell")); } @Test - public void parseNameWithHyphenInLastNameWhenLastNameGivenFirst() throws Exception { + void parseNameWithHyphenInLastNameWhenLastNameGivenFirst() throws Exception { // TODO: Fix abbreviation to be "A." Author expected = new Author("ʿAbdallāh", "ʿ.", null, "al-Ṣāliḥ", null); assertEquals(AuthorList.of(expected), AuthorList.parse("al-Ṣāliḥ, ʿAbdallāh")); } @Test - public void parseNameWithBraces() throws Exception { + void parseNameWithBraces() throws Exception { Author expected = new Author("H{e}lene", "H.", null, "Fiaux", null); assertEquals(AuthorList.of(expected), AuthorList.parse("H{e}lene Fiaux")); } @Test - public void parseFirstNameFromFirstAuthorMultipleAuthorsWithLatexNames() throws Exception { + void parseFirstNameFromFirstAuthorMultipleAuthorsWithLatexNames() throws Exception { assertEquals("Mu{\\d{h}}ammad", AuthorList.parse("Mu{\\d{h}}ammad al-Khw{\\={a}}rizm{\\={i}} and Corrado B{\\\"o}hm") .getAuthor(0).getFirst().orElse(null)); } @Test - public void parseFirstNameFromSecondAuthorMultipleAuthorsWithLatexNames() throws Exception { + void parseFirstNameFromSecondAuthorMultipleAuthorsWithLatexNames() throws Exception { assertEquals("Corrado", AuthorList.parse("Mu{\\d{h}}ammad al-Khw{\\={a}}rizm{\\={i}} and Corrado B{\\\"o}hm") .getAuthor(1).getFirst().orElse(null)); } @Test - public void parseLastNameFromFirstAuthorMultipleAuthorsWithLatexNames() throws Exception { + void parseLastNameFromFirstAuthorMultipleAuthorsWithLatexNames() throws Exception { assertEquals("al-Khw{\\={a}}rizm{\\={i}}", AuthorList.parse("Mu{\\d{h}}ammad al-Khw{\\={a}}rizm{\\={i}} and Corrado B{\\\"o}hm") .getAuthor(0).getLast().orElse(null)); } @Test - public void parseLastNameFromSecondAuthorMultipleAuthorsWithLatexNames() throws Exception { + void parseLastNameFromSecondAuthorMultipleAuthorsWithLatexNames() throws Exception { assertEquals("B{\\\"o}hm", AuthorList.parse("Mu{\\d{h}}ammad al-Khw{\\={a}}rizm{\\={i}} and Corrado B{\\\"o}hm") .getAuthor(1).getLast().orElse(null)); } @Test - public void parseInstitutionAuthorWithLatexNames() throws Exception { + void parseInstitutionAuthorWithLatexNames() throws Exception { assertEquals("The Ban\\={u} M\\={u}s\\={a} brothers", AuthorList.parse("{The Ban\\={u} M\\={u}s\\={a} brothers}").getAuthor(0).getLast().orElse(null)); } @Test - public void parseRetrieveCachedAuthorListAfterGarbageCollection() throws Exception { + void parseRetrieveCachedAuthorListAfterGarbageCollection() throws Exception { final String uniqueAuthorName = "Osvaldo Iongi"; AuthorList author = AuthorList.parse(uniqueAuthorName); System.gc(); @@ -1091,7 +1091,7 @@ public void parseRetrieveCachedAuthorListAfterGarbageCollection() throws Excepti } @Test - public void parseGarbageCollectAuthorListForUnreachableKey() throws Exception { + void parseGarbageCollectAuthorListForUnreachableKey() throws Exception { final String uniqueAuthorName = "Fleur Hornbach"; // Note that "new String()" is needed, uniqueAuthorName is a reference to a String literal AuthorList uniqueAuthor = AuthorList.parse(new String(uniqueAuthorName)); @@ -1100,7 +1100,7 @@ public void parseGarbageCollectAuthorListForUnreachableKey() throws Exception { } @Test - public void parseGarbageCollectUnreachableInstitution() throws Exception { + void parseGarbageCollectUnreachableInstitution() throws Exception { final String uniqueInstitutionName = "{Unique LLC}"; // Note that "new String()" is needed, uniqueAuthorName is a reference to a String literal AuthorList uniqueInstitution = AuthorList.parse(new String(uniqueInstitutionName)); @@ -1112,7 +1112,7 @@ public void parseGarbageCollectUnreachableInstitution() throws Exception { * This tests an unreachable key issue addressed in [#6552](https://github.com/JabRef/jabref/pull/6552). The test is incorrect BibTeX but is handled by the parser and common in practice. */ @Test - public void parseCacheAuthorsWithTwoOrMoreCommasAndWithSpaceInAllParts() throws Exception { + void parseCacheAuthorsWithTwoOrMoreCommasAndWithSpaceInAllParts() throws Exception { final String uniqueAuthorsNames = "Basil Dankworth, Gianna Birdwhistle, Cosmo Berrycloth"; AuthorList uniqueAuthors = AuthorList.parse(uniqueAuthorsNames); System.gc(); @@ -1123,7 +1123,7 @@ public void parseCacheAuthorsWithTwoOrMoreCommasAndWithSpaceInAllParts() throws * This tests an unreachable key issue addressed in [#6552](https://github.com/JabRef/jabref/pull/6552). */ @Test - public void parseCacheAuthorsWithTwoOrMoreCommasAndWithoutSpaceInAllParts() throws Exception { + void parseCacheAuthorsWithTwoOrMoreCommasAndWithoutSpaceInAllParts() throws Exception { final String uniqueAuthorsNames = "Dankworth, Jr., Braelynn"; AuthorList uniqueAuthors = AuthorList.parse(uniqueAuthorsNames); System.gc(); @@ -1134,7 +1134,7 @@ public void parseCacheAuthorsWithTwoOrMoreCommasAndWithoutSpaceInAllParts() thro * This tests the issue described at https://github.com/JabRef/jabref/pull/2669#issuecomment-288519458 */ @Test - public void correctNamesWithOneComma() throws Exception { + void correctNamesWithOneComma() throws Exception { Author expected = new Author("Alexander der Große", "A. d. G.", null, "Canon der Barbar", null); assertEquals(AuthorList.of(expected), AuthorList.parse("Canon der Barbar, Alexander der Große")); @@ -1149,7 +1149,7 @@ public void correctNamesWithOneComma() throws Exception { } @Test - public void equalsFalseDifferentOrder() { + void equalsFalseDifferentOrder() { Author firstAuthor = new Author("A", null, null, null, null); Author secondAuthor = new Author("B", null, null, null, null); AuthorList firstAuthorList = AuthorList.of(firstAuthor, secondAuthor); @@ -1158,19 +1158,19 @@ public void equalsFalseDifferentOrder() { } @Test - public void equalsFalseWhenNotAuthorList() { + void equalsFalseWhenNotAuthorList() { assertNotEquals(AuthorList.of(new Author(null, null, null, null, null)), new Author(null, null, null, null, null)); } @Test - public void equalsTrueReflexive() { + void equalsTrueReflexive() { AuthorList authorList = AuthorList.of(new Author(null, null, null, null, null)); assertEquals(authorList, authorList); } @Test - public void equalsTrueSymmetric() { + void equalsTrueSymmetric() { AuthorList firstAuthorList = AuthorList.of(new Author("A", null, null, null, null)); AuthorList secondAuthorList = AuthorList.of(new Author("A", null, null, null, null)); assertEquals(firstAuthorList, secondAuthorList); @@ -1178,7 +1178,7 @@ public void equalsTrueSymmetric() { } @Test - public void equalsTrueTransitive() { + void equalsTrueTransitive() { AuthorList firstAuthorList = AuthorList.of(new Author("A", null, null, null, null)); AuthorList secondAuthorList = AuthorList.of(new Author("A", null, null, null, null)); AuthorList thirdAuthorList = AuthorList.of(new Author("A", null, null, null, null)); @@ -1188,7 +1188,7 @@ public void equalsTrueTransitive() { } @Test - public void equalsTrueConsistent() { + void equalsTrueConsistent() { AuthorList firstAuthorList = AuthorList.of(new Author("A", null, null, null, null)); AuthorList secondAuthorList = AuthorList.of(new Author("A", null, null, null, null)); assertEquals(firstAuthorList, secondAuthorList); @@ -1197,31 +1197,31 @@ public void equalsTrueConsistent() { } @Test - public void equalsFalseForNull() { + void equalsFalseForNull() { assertNotEquals(null, AuthorList.of(new Author(null, null, null, null, null))); } @Test - public void hashCodeConsistent() { + void hashCodeConsistent() { AuthorList authorList = AuthorList.of(new Author(null, null, null, null, null)); assertEquals(authorList.hashCode(), authorList.hashCode()); } @Test - public void hashCodeNotConstant() { + void hashCodeNotConstant() { AuthorList firstAuthorList = AuthorList.of(new Author("A", null, null, null, null)); AuthorList secondAuthorList = AuthorList.of(new Author("B", null, null, null, null)); assertNotEquals(firstAuthorList.hashCode(), secondAuthorList.hashCode()); } @Test - public void getAsLastFirstFirstLastNamesWithAndEmptyAuthor() { + void getAsLastFirstFirstLastNamesWithAndEmptyAuthor() { assertEquals("", EMPTY_AUTHOR.getAsLastFirstFirstLastNamesWithAnd(true)); } @Test - public void getAsLastFirstFirstLastNamesWithAndMultipleAuthors() { + void getAsLastFirstFirstLastNamesWithAndMultipleAuthors() { assertEquals("al-Khw{\\={a}}rizm{\\={i}}, M. and C. B{\\\"o}hm and K. G{\\\"{o}}del", THREE_AUTHORS_WITH_LATEX.getAsLastFirstFirstLastNamesWithAnd(true)); } diff --git a/src/test/java/org/jabref/model/entry/BibtexStringTest.java b/src/test/java/org/jabref/model/entry/BibtexStringTest.java index 1d418a13f7b1..e16104bd9918 100644 --- a/src/test/java/org/jabref/model/entry/BibtexStringTest.java +++ b/src/test/java/org/jabref/model/entry/BibtexStringTest.java @@ -6,10 +6,10 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -public class BibtexStringTest { +class BibtexStringTest { @Test - public void initalizationWorksCorrectly() { + void initalizationWorksCorrectly() { // Instantiate BibtexString bs = new BibtexString("AAA", "An alternative action"); assertEquals("AAA", bs.getName()); @@ -18,7 +18,7 @@ public void initalizationWorksCorrectly() { } @Test - public void idIsUpdatedAtSetId() { + void idIsUpdatedAtSetId() { // Instantiate BibtexString bs = new BibtexString("AAA", "An alternative action"); bs.setId("ID"); @@ -26,7 +26,7 @@ public void idIsUpdatedAtSetId() { } @Test - public void cloningDoesNotChangeContents() { + void cloningDoesNotChangeContents() { BibtexString bs = new BibtexString("AAA", "An alternative action"); bs.setId("ID"); @@ -39,7 +39,7 @@ public void cloningDoesNotChangeContents() { } @Test - public void clonedBibtexStringEqualsOriginalString() { + void clonedBibtexStringEqualsOriginalString() { BibtexString bibtexString = new BibtexString("AAA", "An alternative action"); bibtexString.setId("ID"); @@ -49,7 +49,7 @@ public void clonedBibtexStringEqualsOriginalString() { } @Test - public void usingTheIdGeneratorDoesNotHitTheOriginalId() { + void usingTheIdGeneratorDoesNotHitTheOriginalId() { // Instantiate BibtexString bs = new BibtexString("AAA", "An alternative action"); bs.setId("ID"); @@ -59,7 +59,7 @@ public void usingTheIdGeneratorDoesNotHitTheOriginalId() { } @Test - public void settingFieldsInACloneWorks() { + void settingFieldsInACloneWorks() { // Instantiate BibtexString bs = new BibtexString("AAA", "An alternative action"); bs.setId("ID"); @@ -75,7 +75,7 @@ public void settingFieldsInACloneWorks() { } @Test - public void modifyingACloneDoesNotModifyTheOriginalEntry() { + void modifyingACloneDoesNotModifyTheOriginalEntry() { // Instantiate BibtexString original = new BibtexString("AAA", "An alternative action"); original.setId("ID"); @@ -90,34 +90,34 @@ public void modifyingACloneDoesNotModifyTheOriginalEntry() { } @Test - public void getContentNeverReturnsNull() { + void getContentNeverReturnsNull() { BibtexString bs = new BibtexString("SomeName", null); assertNotNull(bs.getContent()); } @Test - public void authorTypeCorrectlyDetermined() { + void authorTypeCorrectlyDetermined() { // Source of the example: https://docs.jabref.org/fields/strings BibtexString bibtexString = new BibtexString("aKopp", "KoppOliver"); assertEquals(BibtexString.Type.AUTHOR, bibtexString.getType()); } @Test - public void institutionTypeCorrectlyDetermined() { + void institutionTypeCorrectlyDetermined() { // Source of the example: https://docs.jabref.org/fields/strings BibtexString bibtexString = new BibtexString("iMIT", "{Massachusetts Institute of Technology ({MIT})}"); assertEquals(BibtexString.Type.INSTITUTION, bibtexString.getType()); } @Test - public void otherTypeCorrectlyDeterminedForLowerCase() { + void otherTypeCorrectlyDeterminedForLowerCase() { // Source of the example: https://docs.jabref.org/fields/strings BibtexString bibtexString = new BibtexString("anct", "Anecdote"); assertEquals(BibtexString.Type.OTHER, bibtexString.getType()); } @Test - public void otherTypeCorrectlyDeterminedForUpperCase() { + void otherTypeCorrectlyDeterminedForUpperCase() { // Source of the example: https://docs.jabref.org/fields/strings BibtexString bibtexString = new BibtexString("lTOSCA", "Topology and Orchestration Specification for Cloud Applications"); assertEquals(BibtexString.Type.OTHER, bibtexString.getType()); diff --git a/src/test/java/org/jabref/model/entry/CanonicalBibEntryTest.java b/src/test/java/org/jabref/model/entry/CanonicalBibEntryTest.java index 7861f47fbdc0..a05c1980b835 100644 --- a/src/test/java/org/jabref/model/entry/CanonicalBibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/CanonicalBibEntryTest.java @@ -20,7 +20,7 @@ void canonicalRepresentationIsCorrectForStringMonth() { } @Test - public void simpleCanonicalRepresentation() { + void simpleCanonicalRepresentation() { BibEntry e = new BibEntry(StandardEntryType.Article); e.setCitationKey("key"); e.setField(StandardField.AUTHOR, "abc"); @@ -32,7 +32,7 @@ public void simpleCanonicalRepresentation() { } @Test - public void canonicalRepresentationWithNewlines() { + void canonicalRepresentationWithNewlines() { BibEntry e = new BibEntry(StandardEntryType.Article); e.setCitationKey("key"); e.setField(StandardField.ABSTRACT, "line 1\nline 2"); diff --git a/src/test/java/org/jabref/model/entry/EntryLinkListTest.java b/src/test/java/org/jabref/model/entry/EntryLinkListTest.java index 46f34989c7f6..1b10e3503d94 100644 --- a/src/test/java/org/jabref/model/entry/EntryLinkListTest.java +++ b/src/test/java/org/jabref/model/entry/EntryLinkListTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class EntryLinkListTest { +class EntryLinkListTest { private static final String KEY = "test"; @@ -24,7 +24,7 @@ public class EntryLinkListTest { private BibEntry target; @BeforeEach - public void before() { + void before() { database = new BibDatabase(); links = EntryLinkList.parse(KEY, database); link = links.get(0); @@ -40,40 +40,40 @@ private BibEntry create(String citeKey) { } @Test - public void givenFieldValueAndDatabaseWhenParsingThenExpectKey() { + void givenFieldValueAndDatabaseWhenParsingThenExpectKey() { assertEquals(KEY, link.getKey()); } @Test - public void givenFieldValueAndDatabaseWhenParsingThenExpectDataBase() { + void givenFieldValueAndDatabaseWhenParsingThenExpectDataBase() { assertEquals(database, link.getDatabase()); } @Test - public void givenFieldValueAndDatabaseWhenParsingThenExpectEmptyLinkedEntry() { + void givenFieldValueAndDatabaseWhenParsingThenExpectEmptyLinkedEntry() { assertEquals(Optional.empty(), link.getLinkedEntry()); } @Test - public void givenFieldValueAndDatabaseWhenParsingThenExpectLink() { + void givenFieldValueAndDatabaseWhenParsingThenExpectLink() { ParsedEntryLink expected = new ParsedEntryLink(KEY, database); assertEquals(expected, link); } @Test - public void givenBibEntryWhenParsingThenExpectLink() { + void givenBibEntryWhenParsingThenExpectLink() { ParsedEntryLink expected = new ParsedEntryLink(new BibEntry().withCitationKey("key")); assertFalse(expected.getLinkedEntry().isEmpty()); } @Test - public void givenNullFieldValueAndDatabaseWhenParsingThenExpectLinksIsEmpty() { + void givenNullFieldValueAndDatabaseWhenParsingThenExpectLinksIsEmpty() { links = EntryLinkList.parse(null, database); assertTrue(links.isEmpty()); } @Test - public void givenTargetAndSourceWhenSourceCrossrefTargetThenSourceCrossrefsTarget() { + void givenTargetAndSourceWhenSourceCrossrefTargetThenSourceCrossrefsTarget() { source.setField(StandardField.CROSSREF, "target"); assertSourceCrossrefsTarget(target, source); } diff --git a/src/test/java/org/jabref/model/entry/EntryTypeFactoryTest.java b/src/test/java/org/jabref/model/entry/EntryTypeFactoryTest.java index 9cfef3dbff6d..9cfd4a99e640 100644 --- a/src/test/java/org/jabref/model/entry/EntryTypeFactoryTest.java +++ b/src/test/java/org/jabref/model/entry/EntryTypeFactoryTest.java @@ -8,10 +8,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class EntryTypeFactoryTest { +class EntryTypeFactoryTest { @Test - public void testParseEntryTypePatent() { + void testParseEntryTypePatent() { EntryType patent = IEEETranEntryType.Patent; assertEquals(patent, EntryTypeFactory.parse("patent")); } diff --git a/src/test/java/org/jabref/model/entry/IdGeneratorTest.java b/src/test/java/org/jabref/model/entry/IdGeneratorTest.java index 83ef54af5eb2..73b9fc8a5c6e 100644 --- a/src/test/java/org/jabref/model/entry/IdGeneratorTest.java +++ b/src/test/java/org/jabref/model/entry/IdGeneratorTest.java @@ -6,10 +6,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse; -public class IdGeneratorTest { +class IdGeneratorTest { @Test - public void testCreateNeutralId() { + void testCreateNeutralId() { HashSet set = new HashSet<>(); for (int i = 0; i < 10000; i++) { String string = IdGenerator.next(); diff --git a/src/test/java/org/jabref/model/entry/KeywordListTest.java b/src/test/java/org/jabref/model/entry/KeywordListTest.java index 4fc3ce2a6d00..b4c3edf57bcd 100644 --- a/src/test/java/org/jabref/model/entry/KeywordListTest.java +++ b/src/test/java/org/jabref/model/entry/KeywordListTest.java @@ -5,89 +5,89 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class KeywordListTest { +class KeywordListTest { private KeywordList keywords; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { keywords = new KeywordList(); keywords.add("keywordOne"); keywords.add("keywordTwo"); } @Test - public void parseEmptyStringReturnsEmptyList() throws Exception { + void parseEmptyStringReturnsEmptyList() throws Exception { assertEquals(new KeywordList(), KeywordList.parse("", ',')); } @Test - public void parseOneWordReturnsOneKeyword() throws Exception { + void parseOneWordReturnsOneKeyword() throws Exception { assertEquals(new KeywordList("keywordOne"), KeywordList.parse("keywordOne", ',')); } @Test - public void parseTwoWordReturnsTwoKeywords() throws Exception { + void parseTwoWordReturnsTwoKeywords() throws Exception { assertEquals(new KeywordList("keywordOne", "keywordTwo"), KeywordList.parse("keywordOne, keywordTwo", ',')); } @Test - public void parseTwoWordReturnsTwoKeywordsWithoutSpace() throws Exception { + void parseTwoWordReturnsTwoKeywordsWithoutSpace() throws Exception { assertEquals(new KeywordList("keywordOne", "keywordTwo"), KeywordList.parse("keywordOne,keywordTwo", ',')); } @Test - public void parseTwoWordReturnsTwoKeywordsWithDifferentDelimiter() throws Exception { + void parseTwoWordReturnsTwoKeywordsWithDifferentDelimiter() throws Exception { assertEquals(new KeywordList("keywordOne", "keywordTwo"), KeywordList.parse("keywordOne| keywordTwo", '|')); } @Test - public void parseWordsWithWhitespaceReturnsOneKeyword() throws Exception { + void parseWordsWithWhitespaceReturnsOneKeyword() throws Exception { assertEquals(new KeywordList("keyword and one"), KeywordList.parse("keyword and one", ',')); } @Test - public void parseWordsWithWhitespaceAndCommaReturnsTwoKeyword() throws Exception { + void parseWordsWithWhitespaceAndCommaReturnsTwoKeyword() throws Exception { assertEquals(new KeywordList("keyword and one", "and two"), KeywordList.parse("keyword and one, and two", ',')); } @Test - public void parseIgnoresDuplicates() throws Exception { + void parseIgnoresDuplicates() throws Exception { assertEquals(new KeywordList("keywordOne", "keywordTwo"), KeywordList.parse("keywordOne, keywordTwo, keywordOne", ',')); } @Test - public void parseTakeDelimiterNotRegexWhite() throws Exception { + void parseTakeDelimiterNotRegexWhite() throws Exception { assertEquals(new KeywordList("keywordOne keywordTwo", "keywordThree"), KeywordList.parse("keywordOne keywordTwoskeywordThree", 's')); } @Test - public void parseWordsWithBracketsReturnsOneKeyword() throws Exception { + void parseWordsWithBracketsReturnsOneKeyword() throws Exception { assertEquals(new KeywordList("[a] keyword"), KeywordList.parse("[a] keyword", ',')); } @Test - public void asStringAddsSpaceAfterDelimiter() throws Exception { + void asStringAddsSpaceAfterDelimiter() throws Exception { assertEquals("keywordOne, keywordTwo", keywords.getAsString(',')); } @Test - public void parseHierarchicalChain() throws Exception { + void parseHierarchicalChain() throws Exception { Keyword expected = Keyword.of("Parent", "Node", "Child"); assertEquals(new KeywordList(expected), KeywordList.parse("Parent > Node > Child", ',', '>')); } @Test - public void parseTwoHierarchicalChains() throws Exception { + void parseTwoHierarchicalChains() throws Exception { Keyword expectedOne = Keyword.of("Parent1", "Node1", "Child1"); Keyword expectedTwo = Keyword.of("Parent2", "Node2", "Child2"); @@ -96,23 +96,23 @@ public void parseTwoHierarchicalChains() throws Exception { } @Test - public void mergeTwoIdenticalKeywordsShouldReturnOnKeyword() { + void mergeTwoIdenticalKeywordsShouldReturnOnKeyword() { assertEquals(new KeywordList("JabRef"), KeywordList.merge("JabRef", "JabRef", ',')); } @Test - public void mergeOneEmptyKeywordAnAnotherNonEmptyShouldReturnTheNonEmptyKeyword() { + void mergeOneEmptyKeywordAnAnotherNonEmptyShouldReturnTheNonEmptyKeyword() { assertEquals(new KeywordList("JabRef"), KeywordList.merge("", "JabRef", ',')); } @Test - public void mergeTwoDistinctKeywordsShouldReturnTheTwoKeywordsMerged() { + void mergeTwoDistinctKeywordsShouldReturnTheTwoKeywordsMerged() { assertEquals(new KeywordList("Figma", "JabRef"), KeywordList.merge("Figma", "JabRef", ',')); assertEquals(new KeywordList("JabRef", "Figma"), KeywordList.merge("Figma", "JabRef", ',')); } @Test - public void mergeTwoListsOfKeywordsShouldReturnTheKeywordsMerged() { + void mergeTwoListsOfKeywordsShouldReturnTheKeywordsMerged() { assertEquals(new KeywordList("Figma", "Adobe", "JabRef", "Eclipse", "JetBrains"), KeywordList.merge("Figma, Adobe, JetBrains, Eclipse", "Adobe, JabRef", ',')); } } diff --git a/src/test/java/org/jabref/model/entry/KeywordTest.java b/src/test/java/org/jabref/model/entry/KeywordTest.java index 7496ed237710..3557012ea4f9 100644 --- a/src/test/java/org/jabref/model/entry/KeywordTest.java +++ b/src/test/java/org/jabref/model/entry/KeywordTest.java @@ -7,16 +7,16 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class KeywordTest { +class KeywordTest { @Test - public void getPathFromRootAsStringForSimpleChain() throws Exception { + void getPathFromRootAsStringForSimpleChain() throws Exception { Keyword keywordChain = Keyword.of("A", "B", "C"); assertEquals("A > B", keywordChain.getChild().get().getPathFromRootAsString('>')); } @Test - public void getAllSubchainsAsStringForSimpleChain() throws Exception { + void getAllSubchainsAsStringForSimpleChain() throws Exception { Keyword keywordChain = Keyword.of("A", "B", "C"); Set expected = new HashSet<>(); expected.add("A"); diff --git a/src/test/java/org/jabref/model/entry/MonthTest.java b/src/test/java/org/jabref/model/entry/MonthTest.java index 17c988979071..4b5c975261c3 100644 --- a/src/test/java/org/jabref/model/entry/MonthTest.java +++ b/src/test/java/org/jabref/model/entry/MonthTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.params.provider.Arguments.arguments; -public class MonthTest { +class MonthTest { @ParameterizedTest @MethodSource({"parseShortName", "parseBibtexName", "parseFullName", "parseTwoDigitNumber", "parseNumber", "parseShortNameGerman", "parseFullNameGerman", "parseShortNameGermanLowercase", "parseSpecialCases"}) @@ -169,7 +169,7 @@ private static Stream parseSpecialCases() { @ParameterizedTest @MethodSource("parseGermanShortMonthTest") - public void parseGermanShortMonthTest(Optional expected, String input) { + void parseGermanShortMonthTest(Optional expected, String input) { assertEquals(expected, Month.parseGermanShortMonth(input)); } @@ -205,7 +205,7 @@ private static Stream parseGermanShortMonthTest() { @ParameterizedTest @MethodSource("getMonthByNumberTest") - public void getMonthByNumberTest(Optional expected, int input) { + void getMonthByNumberTest(Optional expected, int input) { assertEquals(expected, Month.getMonthByNumber(input)); } @@ -232,7 +232,7 @@ private static Stream getMonthByNumberTest() { @ParameterizedTest @MethodSource({"parseShortName", "getMonthByShortNameSpecialCases"}) - public void getMonthByShortNameLowercaseTest(Optional expected, String input) { + void getMonthByShortNameLowercaseTest(Optional expected, String input) { assertEquals(expected, Month.getMonthByShortName(input)); } @@ -249,7 +249,7 @@ private static Stream getMonthByShortNameSpecialCases() { @ParameterizedTest @MethodSource("getShortNameTest") - public void getShortNameTest(String expected, Month month) { + void getShortNameTest(String expected, Month month) { assertEquals(expected, month.getShortName()); } @@ -272,7 +272,7 @@ private static Stream getShortNameTest() { @ParameterizedTest @MethodSource("getJabRefFormatTest") - public void getJabRefFormatTest(String expected, Month month) { + void getJabRefFormatTest(String expected, Month month) { assertEquals(expected, month.getJabRefFormat()); } @@ -295,7 +295,7 @@ private static Stream getJabRefFormatTest() { @ParameterizedTest @MethodSource("getNumberTest") - public void getNumberTest(int expected, Month month) { + void getNumberTest(int expected, Month month) { assertEquals(expected, month.getNumber()); } @@ -318,7 +318,7 @@ private static Stream getNumberTest() { @ParameterizedTest @MethodSource("getFullNameTest") - public void getFullNameTest(String expected, Month month) { + void getFullNameTest(String expected, Month month) { assertEquals(expected, month.getFullName()); } @@ -341,7 +341,7 @@ private static Stream getFullNameTest() { @ParameterizedTest @MethodSource("getTwoDigitNumberTest") - public void getTwoDigitNumberTest(String expected, Month month) { + void getTwoDigitNumberTest(String expected, Month month) { assertEquals(expected, month.getTwoDigitNumber()); } diff --git a/src/test/java/org/jabref/model/entry/field/SpecialFieldTest.java b/src/test/java/org/jabref/model/entry/field/SpecialFieldTest.java index eacd5ef3e271..6d5f50f863a5 100644 --- a/src/test/java/org/jabref/model/entry/field/SpecialFieldTest.java +++ b/src/test/java/org/jabref/model/entry/field/SpecialFieldTest.java @@ -6,16 +6,16 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class SpecialFieldTest { +class SpecialFieldTest { @Test - public void getSpecialFieldInstanceFromFieldNameValid() { + void getSpecialFieldInstanceFromFieldNameValid() { assertEquals(Optional.of(SpecialField.RANKING), SpecialField.fromName("ranking")); } @Test - public void getSpecialFieldInstanceFromFieldNameEmptyForInvalidField() { + void getSpecialFieldInstanceFromFieldNameEmptyForInvalidField() { assertEquals(Optional.empty(), SpecialField.fromName("title")); } } diff --git a/src/test/java/org/jabref/model/entry/identifier/ArXivIdentifierTest.java b/src/test/java/org/jabref/model/entry/identifier/ArXivIdentifierTest.java index d6892808fef3..fd395d54ee7a 100644 --- a/src/test/java/org/jabref/model/entry/identifier/ArXivIdentifierTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/ArXivIdentifierTest.java @@ -52,13 +52,13 @@ void parseOldIdentifier() throws Exception { } @Test - public void acceptLegacyEprint() { + void acceptLegacyEprint() { Optional parsed = ArXivIdentifier.parse("astro-ph.GT/1234567"); assertEquals(Optional.of(new ArXivIdentifier("astro-ph.GT/1234567", "astro-ph.GT")), parsed); } @Test - public void acceptLegacyMathEprint() { + void acceptLegacyMathEprint() { Optional parsed = ArXivIdentifier.parse("math/1234567"); assertEquals(Optional.of(new ArXivIdentifier("math/1234567", "math")), parsed); } @@ -112,61 +112,61 @@ void fourDigitDateIsInvalidInLegacyFormat() throws Exception { } @Test - public void acceptPlainEprint() { + void acceptPlainEprint() { Optional parsed = ArXivIdentifier.parse("0706.0001"); assertEquals(Optional.of(new ArXivIdentifier("0706.0001")), parsed); } @Test - public void acceptPlainEprintWithVersion() { + void acceptPlainEprintWithVersion() { Optional parsed = ArXivIdentifier.parse("0706.0001v1"); assertEquals(Optional.of(new ArXivIdentifier("0706.0001", "v1", "")), parsed); } @Test - public void acceptArxivPrefix() { + void acceptArxivPrefix() { Optional parsed = ArXivIdentifier.parse("arXiv:0706.0001v1"); assertEquals(Optional.of(new ArXivIdentifier("0706.0001", "v1", "")), parsed); } @Test - public void ignoreLeadingAndTrailingWhitespaces() { + void ignoreLeadingAndTrailingWhitespaces() { Optional parsed = ArXivIdentifier.parse(" 0706.0001v1 "); assertEquals(Optional.of(new ArXivIdentifier("0706.0001", "v1", "")), parsed); } @Test - public void rejectEmbeddedEprint() { + void rejectEmbeddedEprint() { Optional parsed = ArXivIdentifier.parse("other stuff 0706.0001v1 end"); assertEquals(Optional.empty(), parsed); } @Test - public void rejectInvalidEprint() { + void rejectInvalidEprint() { Optional parsed = ArXivIdentifier.parse("https://thisisnouri"); assertEquals(Optional.empty(), parsed); } @Test - public void acceptUrlHttpEprint() { + void acceptUrlHttpEprint() { Optional parsed = ArXivIdentifier.parse("http://arxiv.org/abs/0706.0001v1"); assertEquals(Optional.of(new ArXivIdentifier("0706.0001", "v1", "")), parsed); } @Test - public void acceptUrlHttpsEprint() { + void acceptUrlHttpsEprint() { Optional parsed = ArXivIdentifier.parse("https://arxiv.org/abs/0706.0001v1"); assertEquals(Optional.of(new ArXivIdentifier("0706.0001", "v1", "")), parsed); } @Test - public void rejectUrlOtherDomainEprint() { + void rejectUrlOtherDomainEprint() { Optional parsed = ArXivIdentifier.parse("https://asdf.org/abs/0706.0001v1"); assertEquals(Optional.empty(), parsed); } @Test - public void constructCorrectURLForEprint() throws Exception { + void constructCorrectURLForEprint() throws Exception { Optional parsed = ArXivIdentifier.parse("0706.0001v1"); assertEquals(Optional.of(new URI("https://arxiv.org/abs/0706.0001v1")), parsed.get().getExternalURI()); } diff --git a/src/test/java/org/jabref/model/entry/identifier/DOITest.java b/src/test/java/org/jabref/model/entry/identifier/DOITest.java index 544844845de1..02f5a26de4b0 100644 --- a/src/test/java/org/jabref/model/entry/identifier/DOITest.java +++ b/src/test/java/org/jabref/model/entry/identifier/DOITest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -public class DOITest { +class DOITest { private static Stream testData() { return Stream.of( @@ -208,22 +208,22 @@ private static Stream testData() { @ParameterizedTest @MethodSource("testData") - public void testEquals(String expected, String input) { + void testEquals(String expected, String input) { assertEquals(expected, input); } @Test - public void equalsWorksFor2017Doi() { + void equalsWorksFor2017Doi() { assertEquals(new DOI("10.1109/cloud.2017.89"), new DOI("10.1109/CLOUD.2017.89")); } @Test - public void isShortDoiShouldReturnTrueWhenItIsShortDoi() { + void isShortDoiShouldReturnTrueWhenItIsShortDoi() { assertTrue(new DOI("10/abcde").isShortDoi()); } @Test - public void noDOIFoundInsideArbitraryText() { + void noDOIFoundInsideArbitraryText() { assertEquals(Optional.empty(), DOI.findInText("text without 28282 a doi")); assertEquals(Optional.empty(), DOI.findInText("It's 10:30 o'clock")); assertEquals(Optional.empty(), DOI.findInText("...archive number 10/XYZ/123...")); @@ -231,24 +231,24 @@ public void noDOIFoundInsideArbitraryText() { } @Test - public void rejectURLShortDoi() { + void rejectURLShortDoi() { assertThrows(IllegalArgumentException.class, () -> new DOI("http://www.cs.utexas.edu/users/kaufmann/itp-trusted-extensions-aug-2010/summary/summary.pdf")); assertThrows(IllegalArgumentException.class, () -> new DOI("http://www.cs.utexas.edu/users/kaufmann/itp-trusted-extensions-aug-20/10/summary/summary.pdf")); assertThrows(IllegalArgumentException.class, () -> new DOI("http://www.boi.org/10/2010bingbong")); } @Test - public void isShortDoiShouldReturnFalseWhenItIsDoi() { + void isShortDoiShouldReturnFalseWhenItIsDoi() { assertFalse(new DOI("10.1006/jmbi.1998.2354").isShortDoi()); } @Test - public void rejectEmbeddedDoi() { + void rejectEmbeddedDoi() { assertThrows(IllegalArgumentException.class, () -> new DOI("other stuff 10.1006/jmbi.1998.2354 end")); } @Test - public void rejectEmbeddedShortDoi() { + void rejectEmbeddedShortDoi() { assertThrows(IllegalArgumentException.class, () -> new DOI("other stuff 10/gf4gqc end")); assertThrows(IllegalArgumentException.class, () -> new DOI("10/2021/01")); assertThrows(IllegalArgumentException.class, () -> new DOI("01/10/2021")); @@ -256,36 +256,36 @@ public void rejectEmbeddedShortDoi() { } @Test - public void rejectInvalidDirectoryIndicator() { + void rejectInvalidDirectoryIndicator() { // wrong directory indicator assertThrows(IllegalArgumentException.class, () -> new DOI("12.1006/jmbi.1998.2354 end")); } @Test - public void rejectInvalidDirectoryIndicatorInShortDoi() { + void rejectInvalidDirectoryIndicatorInShortDoi() { assertThrows(IllegalArgumentException.class, () -> new DOI("20/abcd")); } @Test - public void emptyOrUndescoreOnlyReturnsEmpty() { + void emptyOrUndescoreOnlyReturnsEmpty() { assertEquals(Optional.empty(), DOI.parse("_")); assertEquals(Optional.empty(), DOI.parse("\t_")); assertEquals(Optional.empty(), DOI.parse("___")); } @Test - public void rejectInvalidDoiUri() { + void rejectInvalidDoiUri() { assertThrows(IllegalArgumentException.class, () -> new DOI("https://thisisnouri")); } @Test - public void rejectMissingDivider() { + void rejectMissingDivider() { // missing divider assertThrows(IllegalArgumentException.class, () -> new DOI("10.1006jmbi.1998.2354 end")); } @Test - public void rejectMissingDividerInShortDoi() { + void rejectMissingDividerInShortDoi() { assertThrows(IllegalArgumentException.class, () -> new DOI("10gf4gqc end")); } } diff --git a/src/test/java/org/jabref/model/entry/identifier/ISBNTest.java b/src/test/java/org/jabref/model/entry/identifier/ISBNTest.java index 55dcfe847ca1..79d7139cade0 100644 --- a/src/test/java/org/jabref/model/entry/identifier/ISBNTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/ISBNTest.java @@ -5,69 +5,69 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ISBNTest { +class ISBNTest { @Test - public void testIsValidFormat10Correct() { + void testIsValidFormat10Correct() { assertTrue(new ISBN("0-123456-47-9").isValidFormat()); assertTrue(new ISBN("0-9752298-0-X").isValidFormat()); } @Test - public void testIsValidFormat10Incorrect() { + void testIsValidFormat10Incorrect() { assertFalse(new ISBN("0-12B456-47-9").isValidFormat()); } @Test - public void testIsValidChecksum10Correct() { + void testIsValidChecksum10Correct() { assertTrue(new ISBN("0-123456-47-9").isValidChecksum()); assertTrue(new ISBN("0-9752298-0-X").isValidChecksum()); assertTrue(new ISBN("0-9752298-0-x").isValidChecksum()); } @Test - public void testIsValidChecksum10Incorrect() { + void testIsValidChecksum10Incorrect() { assertFalse(new ISBN("0-123456-47-8").isValidChecksum()); } @Test - public void testIsValidFormat13Correct() { + void testIsValidFormat13Correct() { assertTrue(new ISBN("978-1-56619-909-4").isValidFormat()); } @Test - public void testIsValidFormat13Incorrect() { + void testIsValidFormat13Incorrect() { assertFalse(new ISBN("978-1-56619-9O9-4 ").isValidFormat()); } @Test - public void testIsValidChecksum13Correct() { + void testIsValidChecksum13Correct() { assertTrue(new ISBN("978-1-56619-909-4 ").isValidChecksum()); } @Test - public void testIsValidChecksum13Incorrect() { + void testIsValidChecksum13Incorrect() { assertFalse(new ISBN("978-1-56619-909-5").isValidChecksum()); } @Test - public void testIsIsbn10Correct() { + void testIsIsbn10Correct() { assertTrue(new ISBN("0-123456-47-9").isIsbn10()); assertTrue(new ISBN("0-9752298-0-X").isIsbn10()); } @Test - public void testIsIsbn10Incorrect() { + void testIsIsbn10Incorrect() { assertFalse(new ISBN("978-1-56619-909-4").isIsbn10()); } @Test - public void testIsIsbn13Correct() { + void testIsIsbn13Correct() { assertTrue(new ISBN("978-1-56619-909-4").isIsbn13()); } @Test - public void testIsIsbn13Incorrect() { + void testIsIsbn13Incorrect() { assertFalse(new ISBN("0-123456-47-9").isIsbn13()); } } diff --git a/src/test/java/org/jabref/model/entry/identifier/ISSNTest.java b/src/test/java/org/jabref/model/entry/identifier/ISSNTest.java index d585552e5fe1..2f266c7b9188 100644 --- a/src/test/java/org/jabref/model/entry/identifier/ISSNTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/ISSNTest.java @@ -6,57 +6,57 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class ISSNTest { +class ISSNTest { @Test - public void testIsCanBeCleaned() { + void testIsCanBeCleaned() { assertTrue(new ISSN("00279633").isCanBeCleaned()); } @Test - public void testIsCanBeCleanedIncorrectRubbish() { + void testIsCanBeCleanedIncorrectRubbish() { assertFalse(new ISSN("A brown fox").isCanBeCleaned()); } @Test - public void testIsCanBeCleanedDashAlreadyThere() { + void testIsCanBeCleanedDashAlreadyThere() { assertFalse(new ISSN("0027-9633").isCanBeCleaned()); } @Test - public void testGetCleanedISSN() { + void testGetCleanedISSN() { assertEquals("0027-9633", new ISSN("00279633").getCleanedISSN()); } @Test - public void testGetCleanedISSNDashAlreadyThere() { + void testGetCleanedISSNDashAlreadyThere() { assertEquals("0027-9633", new ISSN("0027-9633").getCleanedISSN()); } @Test - public void testGetCleanedISSNDashRubbish() { + void testGetCleanedISSNDashRubbish() { assertEquals("A brown fox", new ISSN("A brown fox").getCleanedISSN()); } @Test - public void testIsValidChecksumCorrect() { + void testIsValidChecksumCorrect() { assertTrue(new ISSN("0027-9633").isValidChecksum()); assertTrue(new ISSN("2434-561X").isValidChecksum()); assertTrue(new ISSN("2434-561x").isValidChecksum()); } @Test - public void testIsValidChecksumIncorrect() { + void testIsValidChecksumIncorrect() { assertFalse(new ISSN("0027-9634").isValidChecksum()); } @Test - public void testIsValidFormatCorrect() { + void testIsValidFormatCorrect() { assertTrue(new ISSN("0027-963X").isValidFormat()); } @Test - public void testIsValidFormatIncorrect() { + void testIsValidFormatIncorrect() { assertFalse(new ISSN("00279634").isValidFormat()); } } diff --git a/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java b/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java index cd8c8731c947..e82cc952520f 100644 --- a/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java @@ -10,7 +10,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -public class IacrEprintTest { +class IacrEprintTest { private static Stream provideTestData() { return Stream.of( @@ -42,18 +42,18 @@ private static Stream provideTestData() { } @Test - public void rejectInvalidIacrEprint() { + void rejectInvalidIacrEprint() { assertThrows(IllegalArgumentException.class, () -> new IacrEprint("2021/12")); } @ParameterizedTest(name = "{index} {0}") @MethodSource("provideTestData") - public void acceptCorrectIacrEprintIdentifier(String name, String identifier) { + void acceptCorrectIacrEprintIdentifier(String name, String identifier) { assertEquals("2019/001", new IacrEprint(identifier).getNormalized()); } @Test - public void constructValidIacrEprintUrl() { + void constructValidIacrEprintUrl() { assertEquals("https://ia.cr/2019/001", new IacrEprint("2019/001").getAsciiUrl()); } } diff --git a/src/test/java/org/jabref/model/entry/identifier/MathSciNetIdTest.java b/src/test/java/org/jabref/model/entry/identifier/MathSciNetIdTest.java index 5ec576414159..f4d742454340 100644 --- a/src/test/java/org/jabref/model/entry/identifier/MathSciNetIdTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/MathSciNetIdTest.java @@ -6,10 +6,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class MathSciNetIdTest { +class MathSciNetIdTest { @Test - public void parseRemovesNewLineCharacterAtEnd() throws Exception { + void parseRemovesNewLineCharacterAtEnd() throws Exception { Optional id = MathSciNetId.parse("3014184\n"); assertEquals(Optional.of(new MathSciNetId("3014184")), id); } diff --git a/src/test/java/org/jabref/model/groups/SearchGroupTest.java b/src/test/java/org/jabref/model/groups/SearchGroupTest.java index 5bdec41d87e9..a4eacfb288bd 100644 --- a/src/test/java/org/jabref/model/groups/SearchGroupTest.java +++ b/src/test/java/org/jabref/model/groups/SearchGroupTest.java @@ -11,10 +11,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class SearchGroupTest { +class SearchGroupTest { @Test - public void containsFindsWordWithRegularExpression() { + void containsFindsWordWithRegularExpression() { SearchGroup group = new SearchGroup("myExplicitGroup", GroupHierarchyType.INDEPENDENT, "anyfield=rev*", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)); BibEntry entry = new BibEntry(); entry.addKeyword("review", ','); @@ -23,7 +23,7 @@ public void containsFindsWordWithRegularExpression() { } @Test - public void containsDoesNotFindsWordWithInvalidRegularExpression() { + void containsDoesNotFindsWordWithInvalidRegularExpression() { SearchGroup group = new SearchGroup("myExplicitGroup", GroupHierarchyType.INDEPENDENT, "anyfield=*rev*", EnumSet.of(SearchRules.SearchFlags.CASE_SENSITIVE, SearchRules.SearchFlags.REGULAR_EXPRESSION)); BibEntry entry = new BibEntry(); entry.addKeyword("review", ','); @@ -32,7 +32,7 @@ public void containsDoesNotFindsWordWithInvalidRegularExpression() { } @Test - public void notQueryWorksWithLeftPartOfQuery() { + void notQueryWorksWithLeftPartOfQuery() { SearchGroup groupToBeClassified = new SearchGroup("to-be-classified", GroupHierarchyType.INDEPENDENT, "NOT(groups=alpha) AND NOT(groups=beta)", EnumSet.noneOf(SearchRules.SearchFlags.class)); BibEntry alphaEntry = new BibEntry() @@ -42,7 +42,7 @@ public void notQueryWorksWithLeftPartOfQuery() { } @Test - public void notQueryWorksWithLRightPartOfQuery() { + void notQueryWorksWithLRightPartOfQuery() { SearchGroup groupToBeClassified = new SearchGroup("to-be-classified", GroupHierarchyType.INDEPENDENT, "NOT(groups=alpha) AND NOT(groups=beta)", EnumSet.noneOf(SearchRules.SearchFlags.class)); BibEntry betaEntry = new BibEntry() diff --git a/src/test/java/org/jabref/model/groups/TexGroupTest.java b/src/test/java/org/jabref/model/groups/TexGroupTest.java index a140ccba4cd8..c4ce616f6d34 100644 --- a/src/test/java/org/jabref/model/groups/TexGroupTest.java +++ b/src/test/java/org/jabref/model/groups/TexGroupTest.java @@ -17,17 +17,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @AllowedToUseLogic("because class under test relies on logic classes") -public class TexGroupTest { +class TexGroupTest { private MetaData metaData; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { metaData = new MetaData(); } @Test - public void containsReturnsTrueForEntryInAux() throws Exception { + void containsReturnsTrueForEntryInAux() throws Exception { Path auxFile = Path.of(TexGroupTest.class.getResource("paper.aux").toURI()); TexGroup group = new TexGroup("paper", GroupHierarchyType.INDEPENDENT, auxFile, new DefaultAuxParser(new BibDatabase()), new DummyFileUpdateMonitor(), metaData); BibEntry inAux = new BibEntry(); @@ -37,7 +37,7 @@ public void containsReturnsTrueForEntryInAux() throws Exception { } @Test - public void containsReturnsTrueForEntryNotInAux() throws Exception { + void containsReturnsTrueForEntryNotInAux() throws Exception { Path auxFile = Path.of(TexGroupTest.class.getResource("paper.aux").toURI()); TexGroup group = new TexGroup("paper", GroupHierarchyType.INDEPENDENT, auxFile, new DefaultAuxParser(new BibDatabase()), new DummyFileUpdateMonitor(), metaData); BibEntry notInAux = new BibEntry(); @@ -47,7 +47,7 @@ public void containsReturnsTrueForEntryNotInAux() throws Exception { } @Test - public void getFilePathReturnsRelativePath() throws Exception { + void getFilePathReturnsRelativePath() throws Exception { Path auxFile = Path.of(TexGroupTest.class.getResource("paper.aux").toURI()); String user = "Darwin"; metaData.setLatexFileDirectory(user, auxFile.getParent()); diff --git a/src/test/java/org/jabref/model/groups/WordKeywordGroupTest.java b/src/test/java/org/jabref/model/groups/WordKeywordGroupTest.java index 915390ed533b..a9b453a99c56 100644 --- a/src/test/java/org/jabref/model/groups/WordKeywordGroupTest.java +++ b/src/test/java/org/jabref/model/groups/WordKeywordGroupTest.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class WordKeywordGroupTest { +class WordKeywordGroupTest { private WordKeywordGroup testGroup; private WordKeywordGroup testCaseSensitiveGroup; @@ -20,7 +20,7 @@ public class WordKeywordGroupTest { private BibEntry entry; @BeforeEach - public void setUp() { + void setUp() { testGroup = new WordKeywordGroup("name", GroupHierarchyType.INDEPENDENT, StandardField.KEYWORDS, "test", false, ',', false); testCaseSensitiveGroup = new WordKeywordGroup("name", GroupHierarchyType.INDEPENDENT, StandardField.KEYWORDS, "test", true, ',', false); waterGroup = new WordKeywordGroup("name", GroupHierarchyType.INDEPENDENT, StandardField.KEYWORDS, "\\H2O", false, ',', false); @@ -28,70 +28,70 @@ public void setUp() { } @Test - public void containsFindsSameWord() { + void containsFindsSameWord() { entry.setField(StandardField.KEYWORDS, "test"); assertTrue(testGroup.contains(entry)); } @Test - public void containsFindsWordInSentence() throws Exception { + void containsFindsWordInSentence() throws Exception { entry.setField(StandardField.KEYWORDS, "Some sentence containing test word"); assertTrue(testGroup.contains(entry)); } @Test - public void containsFindsWordInCommaSeparatedList() throws Exception { + void containsFindsWordInCommaSeparatedList() throws Exception { entry.setField(StandardField.KEYWORDS, "Some,list,containing,test,word"); assertTrue(testGroup.contains(entry)); } @Test - public void containsFindsWordInSemicolonSeparatedList() throws Exception { + void containsFindsWordInSemicolonSeparatedList() throws Exception { entry.setField(StandardField.KEYWORDS, "Some;list;containing;test;word"); assertTrue(testGroup.contains(entry)); } @Test - public void containsFindsSameComplexWord() throws Exception { + void containsFindsSameComplexWord() throws Exception { entry.setField(StandardField.KEYWORDS, "\\H2O"); assertTrue(waterGroup.contains(entry)); } @Test - public void containsFindsComplexWordInSentence() throws Exception { + void containsFindsComplexWordInSentence() throws Exception { entry.setField(StandardField.KEYWORDS, "Some sentence containing \\H2O word"); assertTrue(waterGroup.contains(entry)); } @Test - public void containsDoesNotFindWordIfCaseDiffers() throws Exception { + void containsDoesNotFindWordIfCaseDiffers() throws Exception { entry.setField(StandardField.KEYWORDS, "Test"); assertFalse(testCaseSensitiveGroup.contains(entry)); } @Test - public void containsDoesNotFindsWordInSentenceIfCaseDiffers() throws Exception { + void containsDoesNotFindsWordInSentenceIfCaseDiffers() throws Exception { entry.setField(StandardField.KEYWORDS, "Some sentence containing Test word"); assertFalse(testCaseSensitiveGroup.contains(entry)); } @Test - public void addChangesFieldIfEmptyBefore() throws Exception { + void addChangesFieldIfEmptyBefore() throws Exception { testGroup.add(entry); assertEquals(Optional.of("test"), entry.getField(StandardField.KEYWORDS)); } @Test - public void addChangesFieldIfNotEmptyBefore() throws Exception { + void addChangesFieldIfNotEmptyBefore() throws Exception { entry.setField(StandardField.KEYWORDS, "bla, blubb"); testGroup.add(entry); @@ -99,7 +99,7 @@ public void addChangesFieldIfNotEmptyBefore() throws Exception { } @Test - public void addDoesNotAddDuplicate() throws Exception { + void addDoesNotAddDuplicate() throws Exception { entry.setField(StandardField.KEYWORDS, "test, blubb"); testGroup.add(entry); @@ -107,7 +107,7 @@ public void addDoesNotAddDuplicate() throws Exception { } @Test - public void removeDoesNothingIfEntryNotMatched() throws Exception { + void removeDoesNothingIfEntryNotMatched() throws Exception { entry.setField(StandardField.KEYWORDS, "something"); testGroup.remove(entry); @@ -115,7 +115,7 @@ public void removeDoesNothingIfEntryNotMatched() throws Exception { } @Test - public void removeRemovesNameFromField() throws Exception { + void removeRemovesNameFromField() throws Exception { entry.setField(StandardField.KEYWORDS, "test, blubb"); testGroup.remove(entry); diff --git a/src/test/java/org/jabref/model/metadata/MetaDataTest.java b/src/test/java/org/jabref/model/metadata/MetaDataTest.java index 017881ba922d..e67d8b0ba154 100644 --- a/src/test/java/org/jabref/model/metadata/MetaDataTest.java +++ b/src/test/java/org/jabref/model/metadata/MetaDataTest.java @@ -7,17 +7,17 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class MetaDataTest { +class MetaDataTest { private MetaData metaData; @BeforeEach - public void setUp() { + void setUp() { metaData = new MetaData(); } @Test - public void emptyGroupsIfNotSet() { + void emptyGroupsIfNotSet() { assertEquals(Optional.empty(), metaData.getGroups()); } } diff --git a/src/test/java/org/jabref/model/paging/PageTest.java b/src/test/java/org/jabref/model/paging/PageTest.java index e08e0d436193..fa8e50fdfbab 100644 --- a/src/test/java/org/jabref/model/paging/PageTest.java +++ b/src/test/java/org/jabref/model/paging/PageTest.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PageTest { +class PageTest { private Page page1; private Page page2; private final int testPageNumber = 3; @@ -21,7 +21,7 @@ public class PageTest { private final String[] testStrings = {"str1", "str2", "str3"}; @BeforeEach - public void setup() { + void setup() { testContent.addAll(Arrays.asList(testStrings)); testContent = Collections.unmodifiableCollection(testContent); page1 = new Page(testQuery, testPageNumber, testContent); @@ -29,7 +29,7 @@ public void setup() { } @Test - public void getContentTest() { + void getContentTest() { // make sure the collections have the same elements List differences = new ArrayList<>(testContent); differences.removeAll(page1.getContent()); @@ -43,17 +43,17 @@ public void getContentTest() { } @Test - public void getPageNumberTest() { + void getPageNumberTest() { assertEquals(testPageNumber, page1.getPageNumber()); } @Test - public void getQueryTest() { + void getQueryTest() { assertEquals(testQuery, page1.getQuery()); } @Test - public void getSizeTest() { + void getSizeTest() { assertEquals(testContent.size(), page1.getSize()); } } diff --git a/src/test/java/org/jabref/model/pdf/FileAnnotationTest.java b/src/test/java/org/jabref/model/pdf/FileAnnotationTest.java index 74b54990ef64..ecb90e76baa6 100644 --- a/src/test/java/org/jabref/model/pdf/FileAnnotationTest.java +++ b/src/test/java/org/jabref/model/pdf/FileAnnotationTest.java @@ -9,38 +9,38 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -public class FileAnnotationTest { +class FileAnnotationTest { @Test - public void testParseDateMinusBeforeTimezone() { + void testParseDateMinusBeforeTimezone() { String dateString = "D:20170512224019-03'00'"; LocalDateTime date = FileAnnotation.extractModifiedTime(dateString); assertEquals(LocalDateTime.of(2017, 05, 12, 22, 40, 19), date); } @Test - public void testParseDatePlusBeforeTimezone() { + void testParseDatePlusBeforeTimezone() { String dateString = "D:20170512224019+03'00'"; LocalDateTime date = FileAnnotation.extractModifiedTime(dateString); assertEquals(LocalDateTime.of(2017, 05, 12, 22, 40, 19), date); } @Test - public void testParseDateNoTimezone() { + void testParseDateNoTimezone() { String dateString = "D:20170512224019"; LocalDateTime date = FileAnnotation.extractModifiedTime(dateString); assertEquals(LocalDateTime.of(2017, 05, 12, 22, 40, 19), date); } @Test - public void testParseNotADate() { + void testParseNotADate() { String dateString = "gsdfgwergsdf"; LocalDateTime date = FileAnnotation.extractModifiedTime(dateString); assertTrue(ChronoUnit.SECONDS.between(LocalDateTime.now(), date) <= 1); } @Test - public void testAbbreviateAnnotationName() { + void testAbbreviateAnnotationName() { final FileAnnotation fileAnnotation = new FileAnnotation("John Robertson", LocalDateTime.of(2020, 4, 18, 17, 10), 1, "this is an annotation that is very long and goes over the character limit of 45", diff --git a/src/test/java/org/jabref/model/search/matchers/MatcherSetsTest.java b/src/test/java/org/jabref/model/search/matchers/MatcherSetsTest.java index be77c6773e3b..9f3c604326ae 100644 --- a/src/test/java/org/jabref/model/search/matchers/MatcherSetsTest.java +++ b/src/test/java/org/jabref/model/search/matchers/MatcherSetsTest.java @@ -8,10 +8,10 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -public class MatcherSetsTest { +class MatcherSetsTest { @Test - public void testBuildAnd() { + void testBuildAnd() { MatcherSet matcherSet = MatcherSets.build(MatcherSets.MatcherType.AND); assertTrue(matcherSet.isMatch(new BibEntry())); @@ -23,7 +23,7 @@ public void testBuildAnd() { } @Test - public void testBuildOr() { + void testBuildOr() { MatcherSet matcherSet = MatcherSets.build(MatcherSets.MatcherType.OR); assertFalse(matcherSet.isMatch(new BibEntry())); @@ -35,13 +35,13 @@ public void testBuildOr() { } @Test - public void testBuildNotWithTrue() { + void testBuildNotWithTrue() { NotMatcher matcher = new NotMatcher(new MockSearchMatcher(true)); assertFalse(matcher.isMatch(new BibEntry())); } @Test - public void testBuildNotWithFalse() { + void testBuildNotWithFalse() { NotMatcher matcher = new NotMatcher(new MockSearchMatcher(false)); assertTrue(matcher.isMatch(new BibEntry())); } diff --git a/src/test/java/org/jabref/model/search/rules/ContainsBasedSearchRuleTest.java b/src/test/java/org/jabref/model/search/rules/ContainsBasedSearchRuleTest.java index ed77afd40beb..ffd8cfe72c66 100644 --- a/src/test/java/org/jabref/model/search/rules/ContainsBasedSearchRuleTest.java +++ b/src/test/java/org/jabref/model/search/rules/ContainsBasedSearchRuleTest.java @@ -14,7 +14,7 @@ /** * Test case for ContainBasedSearchRule. */ -public class ContainsBasedSearchRuleTest { +class ContainsBasedSearchRuleTest { private final BibEntry be = new BibEntry(StandardEntryType.InCollection) .withCitationKey("shields01") @@ -27,7 +27,7 @@ public class ContainsBasedSearchRuleTest { private final RegexBasedSearchRule bsCaseInsensitiveRegexp = new RegexBasedSearchRule(EnumSet.of(SearchRules.SearchFlags.REGULAR_EXPRESSION)); @Test - public void testContentOfSingleField() { + void testContentOfSingleField() { String query = "\"marine larviculture\""; assertFalse(bsCaseSensitive.applyRule(query, be)); @@ -37,7 +37,7 @@ public void testContentOfSingleField() { } @Test - public void testContentDistributedOnMultipleFields() { + void testContentDistributedOnMultipleFields() { String query = "marine 2001 shields"; assertFalse(bsCaseSensitive.applyRule(query, be)); @@ -47,7 +47,7 @@ public void testContentDistributedOnMultipleFields() { } @Test - public void testRegularExpressionMatch() { + void testRegularExpressionMatch() { String query = "marine [A-Za-z]* larviculture"; assertFalse(bsCaseSensitive.applyRule(query, be)); diff --git a/src/test/java/org/jabref/model/search/rules/SentenceAnalyzerTest.java b/src/test/java/org/jabref/model/search/rules/SentenceAnalyzerTest.java index 61e05e3def40..e53ddf4c075d 100644 --- a/src/test/java/org/jabref/model/search/rules/SentenceAnalyzerTest.java +++ b/src/test/java/org/jabref/model/search/rules/SentenceAnalyzerTest.java @@ -9,7 +9,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class SentenceAnalyzerTest { +class SentenceAnalyzerTest { static Stream getParameters() { return Stream.of( @@ -28,7 +28,7 @@ static Stream getParameters() { @ParameterizedTest @MethodSource("getParameters") - public void testGetWords(List expected, String input) { + void testGetWords(List expected, String input) { assertEquals(expected, new SentenceAnalyzer(input).getWords()); } } diff --git a/src/test/java/org/jabref/model/texparser/CitationTest.java b/src/test/java/org/jabref/model/texparser/CitationTest.java index 36b7df4f2c05..b212078d0db5 100644 --- a/src/test/java/org/jabref/model/texparser/CitationTest.java +++ b/src/test/java/org/jabref/model/texparser/CitationTest.java @@ -15,13 +15,13 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.params.provider.Arguments.arguments; -public class CitationTest { +class CitationTest { Path path; Citation citation; @BeforeEach - public void init() { + void init() { path = Path.of("test"); citation = new Citation(path, 10, 1, 4, "lineText"); } @@ -42,62 +42,62 @@ private static Stream colStartColEndInBounds() { @ParameterizedTest @ValueSource(ints = {-1, 0}) - public void constructorLineSmallerEqualZeroTest(int line) { + void constructorLineSmallerEqualZeroTest(int line) { Exception e = assertThrows(IllegalArgumentException.class, () -> new Citation(path, line, 1, 5, "lineText")); assertEquals("Line has to be greater than 0.", e.getMessage()); } @ParameterizedTest @ValueSource(ints = {1, 2}) - public void constructorLineLargerZeroTest(int line) { + void constructorLineLargerZeroTest(int line) { Citation citation = new Citation(path, line, 1, 5, "lineText"); } @ParameterizedTest @MethodSource("colStartColEndNotInBounds") - public void constructorColStartColEndNotInBoundsTest(int colStart, int colEnd) { + void constructorColStartColEndNotInBoundsTest(int colStart, int colEnd) { Exception e = assertThrows(IllegalArgumentException.class, () -> new Citation(path, 10, colStart, colEnd, "lineText")); assertEquals("Citation has to be between 0 and line length.", e.getMessage()); } @ParameterizedTest @MethodSource("colStartColEndInBounds") - public void constructorColStartColEndInBoundsTest(int colStart, int colEnd) { + void constructorColStartColEndInBoundsTest(int colStart, int colEnd) { Citation citation = new Citation(path, 10, colStart, colEnd, "lineText"); } @Test - public void getPathTest() { + void getPathTest() { assertEquals(path, citation.getPath()); } @Test - public void getLineTest() { + void getLineTest() { assertEquals(10, citation.getLine()); } @Test - public void getColStartTest() { + void getColStartTest() { assertEquals(1, citation.getColStart()); } @Test - public void getColEndTest() { + void getColEndTest() { assertEquals(4, citation.getColEnd()); } @Test - public void getLineTextTest() { + void getLineTextTest() { assertEquals("lineText", citation.getLineText()); } @Test - public void getContextTest() { + void getContextTest() { assertEquals("lineText", citation.getContext()); } @Test - public void equalsTest() { + void equalsTest() { Citation citation1 = new Citation(path, 10, 1, 4, "lineText"); Citation citation2 = null; assertEquals(citation, citation1);