From e7780ed8038fd2a9193573eca03750777f9f7bec Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 17 Oct 2018 11:05:51 +0200 Subject: [PATCH] Enable checkstyle for tests and fix style issues (#4378) * Enable checkstyle for tests * Correct imports * Reformat code * Reformat code --- build.gradle | 8 +- config/checkstyle/suppressions.xml | 1 - .../org/jabref/CatchExceptionsFromThread.java | 4 +- .../org/jabref/JabRefPreferencesTest.java | 1 - .../architecture/MainArchitectureTests.java | 4 +- .../MainArchitectureTestsWithArchUnit.java | 14 +- .../architecture/TestArchitectureTests.java | 39 ++-- .../cleanup/CleanupActionsListModelTest.java | 3 - .../org/jabref/cli/AuxCommandLineTest.java | 1 - .../java/org/jabref/cli/JabRefCLITest.java | 6 +- .../org/jabref/gui/AWTExceptionHandler.java | 1 - .../java/org/jabref/gui/AbstractUITest.java | 7 +- src/test/java/org/jabref/gui/DialogTest.java | 2 +- .../java/org/jabref/gui/EntryTableTest.java | 16 +- .../org/jabref/gui/IdFetcherDialogTest.java | 2 - .../gui/ParameterizedDialogNewEntryTest.java | 1 - .../jabref/gui/ParameterizedDialogTest.java | 13 +- .../gui/ParameterizedMenuNewEntryTest.java | 1 - .../PersonNameSuggestionProviderTest.java | 2 +- .../FileAnnotationViewModelTest.java | 10 +- .../AutoSetFileLinksUtilTest.java | 1 - .../gui/groups/GroupNodeViewModelTest.java | 2 +- .../gui/groups/GroupTreeViewModelTest.java | 2 +- .../EntryFromFileCreatorManagerTest.java | 3 +- .../gui/importer/EntryFromPDFCreatorTest.java | 1 - ...nageJournalAbbreviationsViewModelTest.java | 8 +- .../KeyBindingsDialogViewModelTest.java | 1 - .../jabref/gui/search/SearchResultsTest.java | 2 - .../gui/util/FileDialogConfigurationTest.java | 3 - .../gui/util/RecursiveTreeItemTest.java | 1 - .../autosaveandbackup/BackupManagerTest.java | 1 - .../jabref/logic/bibtex/BibEntryAssert.java | 38 ++-- .../logic/bibtex/BibEntryWriterTest.java | 1 - .../logic/bibtex/FieldContentParserTest.java | 1 - .../bibtex/LatexFieldFormatterTests.java | 5 +- .../comparator/BibDatabaseDiffTest.java | 1 - .../BibtexStringComparatorTest.java | 3 - .../bibtex/comparator/MetaDataDiffTest.java | 1 - .../BibtexKeyGeneratorTest.java | 8 +- .../MakeLabelWithDatabaseTest.java | 1 - .../MakeLabelWithoutDatabaseTest.java | 2 - .../logic/bst/BibtexCaseChangersTest.java | 2 - .../logic/bst/BibtexNameFormatterTest.java | 2 - .../org/jabref/logic/bst/BibtexWidthTest.java | 2 - .../java/org/jabref/logic/bst/TestVM.java | 5 +- .../logic/bst/TextPrefixFunctionTest.java | 1 - .../CitationStyleGeneratorTest.java | 2 - .../citationstyle/CitationStyleTest.java | 1 - .../logic/cleanup/CleanupWorkerTest.java | 1 - .../cleanup/FieldFormatterCleanupTest.java | 4 +- .../jabref/logic/cleanup/ISSNCleanupTest.java | 1 - .../exporter/BibTeXMLExporterTestFiles.java | 10 +- .../exporter/BibtexDatabaseWriterTest.java | 37 ++-- .../logic/exporter/CsvExportFormatTest.java | 21 +-- .../jabref/logic/exporter/ExporterTest.java | 4 +- .../exporter/FieldFormatterCleanupsTest.java | 1 - .../logic/exporter/GroupSerializerTest.java | 1 - .../logic/exporter/HtmlExportFormatTest.java | 4 +- .../exporter/MSBibExportFormatTestFiles.java | 3 +- .../exporter/ModsExportFormatTestFiles.java | 20 +- .../logic/exporter/XmpExporterTest.java | 176 +++++++++--------- .../jabref/logic/formatter/FormatterTest.java | 19 +- .../bibtexfields/AddBracesFormatterTest.java | 3 +- .../bibtexfields/CleanupUrlFormatterTest.java | 4 +- .../bibtexfields/ClearFormatterTest.java | 1 - .../HtmlToUnicodeFormatterTest.java | 1 - .../LatexCleanupFormatterTest.java | 1 - .../NormalizeMonthFormatterTest.java | 1 - .../NormalizePagesFormatterTest.java | 1 - .../RemoveBracesFormatterTest.java | 1 - .../TrimWhitespaceFormatterTest.java | 2 - .../bibtexfields/UnicodeConverterTest.java | 3 +- .../UnitsToLatexFormatterTest.java | 1 - .../casechanger/CapitalizeFormatterTest.java | 1 - .../casechanger/LowerCaseFormatterTest.java | 1 - .../ProtectTermsFormatterTest.java | 4 +- .../SentenceCaseFormatterTest.java | 1 - .../casechanger/TitleCaseFormatterTest.java | 1 - .../casechanger/UpperCaseFormatterTest.java | 1 - .../minifier/MinifyNameListFormatterTest.java | 1 - .../importer/BibDatabaseTestsWithFiles.java | 3 +- .../importer/DatabaseFileLookupTest.java | 4 +- .../jabref/logic/importer/ImportDataTest.java | 2 - .../ImportFormatReaderIntegrationTest.java | 17 +- .../ImportFormatReaderTestParameterless.java | 3 - .../jabref/logic/importer/ImporterTest.java | 24 ++- .../logic/importer/OpenDatabaseTest.java | 2 +- .../logic/importer/fetcher/ACSTest.java | 2 +- .../fetcher/AbstractIsbnFetcherTest.java | 1 - .../logic/importer/fetcher/ArXivTest.java | 7 +- .../importer/fetcher/DBLPFetcherTest.java | 8 +- .../logic/importer/fetcher/DiVATest.java | 2 +- .../importer/fetcher/DoiFetcherTest.java | 2 - .../fetcher/IacrEprintFetcherTest.java | 2 +- .../importer/fetcher/IsbnFetcherTest.java | 7 +- .../fetcher/IsbnViaChimboriFetcherTest.java | 5 +- .../fetcher/IsbnViaEbookDeFetcherTest.java | 5 +- .../importer/fetcher/MathSciNetTest.java | 2 +- .../importer/fetcher/MrDLibFetcherTest.java | 1 - .../importer/fetcher/TitleFetcherTest.java | 1 - .../fileformat/BibTeXMLImporterTest.java | 1 - .../fileformat/BibTeXMLImporterTestFiles.java | 1 - .../fileformat/BibTeXMLImporterTestTypes.java | 3 +- .../fileformat/BiblioscapeImporterTest.java | 1 - .../BiblioscapeImporterTestTypes.java | 4 +- .../fileformat/BibtexImporterTest.java | 24 +-- .../importer/fileformat/BibtexParserTest.java | 6 +- .../fileformat/CopacImporterTest.java | 2 - .../fileformat/CopacImporterTestFiles.java | 1 - .../fileformat/EndnoteImporterTest.java | 2 +- .../fileformat/ImporterTestEngine.java | 2 +- .../fileformat/InspecImporterTest.java | 14 +- .../importer/fileformat/IsiImporterTest.java | 6 +- .../fileformat/MedlineImporterTest.java | 12 +- .../fileformat/MedlineImporterTestFiles.java | 2 - .../fileformat/MedlinePlainImporterTest.java | 10 +- .../fileformat/MsBibImporterTest.java | 1 - .../fileformat/MsBibImporterTestFiles.java | 1 - .../importer/fileformat/OvidImporterTest.java | 5 +- .../fileformat/PdfContentImporterTest.java | 1 - .../PdfContentImporterTestFiles.java | 1 - .../importer/fileformat/RISImporterTest.java | 1 - .../fileformat/SilverPlatterImporterTest.java | 2 - .../logic/importer/util/GroupsParserTest.java | 1 - .../logic/integrity/BracesCorrectorTest.java | 1 - .../logic/integrity/IntegrityCheckTest.java | 9 +- .../integrity/NoBibTexFieldCheckerTest.java | 2 - .../journals/AbbreviationParserTest.java | 2 +- .../logic/journals/AbbreviationTest.java | 1 - .../logic/journals/AbbreviationsTest.java | 10 +- .../JournalAbbreviationRepositoryTest.java | 3 - ...ippedJournalAbbreviationDuplicateTest.java | 1 - .../l10n/LocalizationConsistencyTest.java | 34 ++-- .../jabref/logic/l10n/LocalizationEntry.java | 3 +- .../logic/l10n/LocalizationKeyParamsTest.java | 1 - .../logic/l10n/LocalizationKeyTest.java | 1 - .../jabref/logic/l10n/LocalizationParser.java | 22 +-- .../logic/l10n/LocalizationParserTest.java | 1 - .../jabref/logic/l10n/LocalizationTest.java | 1 - .../jabref/logic/layout/LayoutEntryTest.java | 24 +-- .../org/jabref/logic/layout/LayoutTest.java | 2 +- .../layout/format/AuthorAbbreviatorTest.java | 5 +- .../AuthorAndToSemicolonReplacerTest.java | 4 +- .../format/AuthorAndsCommaReplacerTest.java | 6 +- .../layout/format/AuthorAndsReplacerTest.java | 7 +- .../format/AuthorFirstAbbrLastCommasTest.java | 4 +- .../AuthorFirstAbbrLastOxfordCommasTest.java | 4 +- .../format/AuthorFirstFirstCommasTest.java | 7 +- .../layout/format/AuthorFirstFirstTest.java | 7 +- .../format/AuthorFirstLastCommasTest.java | 4 +- .../AuthorFirstLastOxfordCommasTest.java | 4 +- .../layout/format/AuthorLF_FFAbbrTest.java | 7 +- .../logic/layout/format/AuthorLF_FFTest.java | 7 +- .../format/AuthorLastFirstAbbrCommasTest.java | 5 +- .../AuthorLastFirstAbbrOxfordCommasTest.java | 4 +- .../AuthorLastFirstAbbreviatorTester.java | 4 +- .../format/AuthorLastFirstCommasTest.java | 7 +- .../AuthorLastFirstOxfordCommasTest.java | 4 +- .../layout/format/AuthorLastFirstTest.java | 4 +- .../logic/layout/format/AuthorNatBibTest.java | 10 +- .../logic/layout/format/AuthorOrgSciTest.java | 4 +- .../logic/layout/format/AuthorsTest.java | 4 +- .../layout/format/CompositeFormatTest.java | 6 +- .../logic/layout/format/DOICheckTest.java | 4 +- .../logic/layout/format/DOIStripTest.java | 5 +- .../layout/format/DateFormatterTest.java | 4 +- .../logic/layout/format/DefaultTest.java | 4 +- .../layout/format/EntryTypeFormatterTest.java | 2 - .../logic/layout/format/FileLinkTest.java | 3 +- .../logic/layout/format/FirstPageTest.java | 3 +- .../logic/layout/format/HTMLCharsTest.java | 1 - .../layout/format/HTMLParagraphsTest.java | 5 +- .../logic/layout/format/IfPluralTest.java | 3 +- .../logic/layout/format/LastPageTest.java | 3 +- .../format/LatexToUnicodeFormatterTest.java | 4 - .../layout/format/NameFormatterTest.java | 5 +- .../NoSpaceBetweenAbbreviationsTest.java | 4 +- .../logic/layout/format/RTFCharsTest.java | 105 ++++++----- .../logic/layout/format/RemoveTildeTest.java | 3 +- .../logic/layout/format/ReplaceTest.java | 3 +- .../logic/layout/format/RisKeywordsTest.java | 1 - .../logic/layout/format/RisMonthTest.java | 1 - .../logic/layout/format/ToLowerCaseTest.java | 1 - .../logic/layout/format/ToUpperCaseTest.java | 1 - .../logic/layout/format/WrapContentTest.java | 3 +- .../layout/format/WrapFileLinksTest.java | 3 - .../jabref/logic/msbib/MsBibAuthorTest.java | 1 - .../org/jabref/logic/net/URLDownloadTest.java | 1 - .../logic/openoffice/OOBibStyleTest.java | 16 +- .../logic/openoffice/OOPreFormatterTest.java | 2 - .../logic/openoffice/StyleLoaderTest.java | 15 +- .../logic/pdf/PdfAnnotationImporterTest.java | 1 - .../ProtectedTermsListTest.java | 3 +- .../ProtectedTermsLoaderTest.java | 19 +- .../logic/remote/RemoteCommunicationTest.java | 4 +- .../logic/remote/RemotePreferencesTest.java | 2 - .../logic/search/DatabaseSearcherTest.java | 1 - .../SearchQueryHighlightObservableTest.java | 4 +- .../jabref/logic/search/SearchQueryTest.java | 3 - .../logic/shared/DBMSConnectionTest.java | 2 +- .../logic/shared/DBMSProcessorTest.java | 8 +- .../logic/shared/DBMSSynchronizerTest.java | 17 +- .../org/jabref/logic/shared/DBMSTypeTest.java | 1 - .../SynchronizationTestEventListener.java | 1 - .../shared/SynchronizationTestSimulator.java | 15 +- .../org/jabref/logic/shared/TestManager.java | 14 +- .../logic/util/DevelopmentStageTest.java | 3 - .../jabref/logic/util/JavaVersionTest.java | 16 +- .../jabref/logic/util/UpdateFieldTest.java | 3 - .../org/jabref/logic/util/VersionTest.java | 2 - .../util/io/CiteKeyBasedFileFinderTest.java | 5 +- .../jabref/logic/util/io/FileUtilTest.java | 47 +++-- .../util/io/RegExpBasedFileFinderTests.java | 13 +- .../strings/StringLengthComparatorTest.java | 2 - .../jabref/logic/xmp/XmpUtilReaderTest.java | 8 +- .../jabref/logic/xmp/XmpUtilWriterTest.java | 7 +- .../migrations/PreferencesMigrationsTest.java | 85 ++++----- .../java/org/jabref/model/EntryTypesTest.java | 5 +- .../java/org/jabref/model/TreeNodeTest.java | 1 - .../org/jabref/model/TreeNodeTestData.java | 30 +-- .../BibDatabaseModeDetectionTest.java | 1 - .../model/database/BibDatabaseTest.java | 4 - .../database/DuplicationCheckerTest.java | 9 +- .../model/database/KeyChangeListenerTest.java | 3 - .../model/entry/AuthorListParameterTest.java | 1 - .../jabref/model/entry/AuthorListTest.java | 43 ++--- .../org/jabref/model/entry/AuthorTest.java | 1 - .../org/jabref/model/entry/BibEntryTest.java | 2 - .../org/jabref/model/entry/BibEntryTests.java | 4 - .../jabref/model/entry/BibtexStringTest.java | 1 - .../model/entry/CanonicalBibEntryTest.java | 1 - .../jabref/model/entry/EntryLinkListTest.java | 8 +- .../org/jabref/model/entry/FieldNameTest.java | 1 - .../model/entry/FileFieldWriterTest.java | 10 +- .../model/entry/IEEETranEntryTypesTest.java | 1 - .../jabref/model/entry/IdGeneratorTest.java | 2 - .../jabref/model/entry/KeywordListTest.java | 1 - .../org/jabref/model/entry/MonthTest.java | 2 +- .../model/entry/identifier/DOITest.java | 2 - .../model/entry/identifier/ISBNTest.java | 1 - .../entry/specialfields/SpecialFieldTest.java | 1 - .../jabref/model/event/TestEventListener.java | 2 - .../jabref/model/groups/SearchGroupTest.java | 1 - .../jabref/model/pdf/FileAnnotationTest.java | 1 - .../search/matchers/MatcherSetsTest.java | 2 - .../rules/ContainBasedSearchRuleTest.java | 1 - .../search/rules/SentenceAnalyzerTest.java | 5 +- .../jabref/model/strings/StringUtilTest.java | 4 +- .../performance/BibtexEntryGenerator.java | 1 - .../org/jabref/support/CIServerCondition.java | 4 +- .../java/org/jabref/testutils/TestUtils.java | 4 +- 251 files changed, 675 insertions(+), 985 deletions(-) diff --git a/build.gradle b/build.gradle index 5f06b384566..8796658b173 100644 --- a/build.gradle +++ b/build.gradle @@ -177,7 +177,8 @@ dependencies { testCompile 'org.reflections:reflections:0.9.11' testCompile 'org.xmlunit:xmlunit-core:2.6.2' testCompile 'org.xmlunit:xmlunit-matchers:2.6.2' - testCompile 'com.tngtech.archunit:archunit-junit:0.8.3' + testCompile 'com.tngtech.archunit:archunit-junit5-api:0.9.1' + testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.9.1' testCompile "org.testfx:testfx-core:4.0.+" testCompile "org.testfx:testfx-junit5:4.0.+" @@ -402,12 +403,7 @@ jacocoTestReport { // Code quality tasks checkstyle { - // do not use other packages for checkstyle, excluding gen(erated) sources - checkstyleMain.source = "src/main/java" - toolVersion = '8.5' - // do not perform checkstyle checks by default - sourceSets = [] } modernizer { diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml index 7e853704d9d..71943814250 100644 --- a/config/checkstyle/suppressions.xml +++ b/config/checkstyle/suppressions.xml @@ -6,5 +6,4 @@ - diff --git a/src/test/java/org/jabref/CatchExceptionsFromThread.java b/src/test/java/org/jabref/CatchExceptionsFromThread.java index 16cb2c6845c..dc3b523e280 100644 --- a/src/test/java/org/jabref/CatchExceptionsFromThread.java +++ b/src/test/java/org/jabref/CatchExceptionsFromThread.java @@ -3,8 +3,8 @@ import org.junit.rules.ExternalResource; /** - * JUnit by default ignores exceptions, which are reported via {@link Thread.UncaughtExceptionHandler}. - * With this rule also these kind of exceptions result in a failure of the test. + * JUnit by default ignores exceptions, which are reported via {@link Thread.UncaughtExceptionHandler}. With this rule + * also these kind of exceptions result in a failure of the test. */ public class CatchExceptionsFromThread extends ExternalResource { @Override diff --git a/src/test/java/org/jabref/JabRefPreferencesTest.java b/src/test/java/org/jabref/JabRefPreferencesTest.java index 91f441936bf..187bab026a6 100644 --- a/src/test/java/org/jabref/JabRefPreferencesTest.java +++ b/src/test/java/org/jabref/JabRefPreferencesTest.java @@ -26,5 +26,4 @@ void getDefaultEncodingReturnsPreviouslyStoredEncoding() { prefs.setDefaultEncoding(StandardCharsets.UTF_8); assertEquals(StandardCharsets.UTF_8, prefs.getDefaultEncoding()); } - } diff --git a/src/test/java/org/jabref/architecture/MainArchitectureTests.java b/src/test/java/org/jabref/architecture/MainArchitectureTests.java index 85983851bb3..042b72a6610 100644 --- a/src/test/java/org/jabref/architecture/MainArchitectureTests.java +++ b/src/test/java/org/jabref/architecture/MainArchitectureTests.java @@ -84,8 +84,8 @@ void firstPackageIsIndependentOfSecondPackage(String firstPackage, String second Predicate isExceptionPackage = (s) -> (s.startsWith("import " + secondPackage) || s.startsWith("import static " + secondPackage)) && exceptions.getOrDefault(firstPackage, Collections.emptyList()) - .stream() - .noneMatch(exception -> s.startsWith("import " + exception)); + .stream() + .noneMatch(exception -> s.startsWith("import " + exception)); Predicate isPackage = (s) -> s.startsWith("package " + firstPackage); diff --git a/src/test/java/org/jabref/architecture/MainArchitectureTestsWithArchUnit.java b/src/test/java/org/jabref/architecture/MainArchitectureTestsWithArchUnit.java index 6120da6b808..ab22b7dd5aa 100644 --- a/src/test/java/org/jabref/architecture/MainArchitectureTestsWithArchUnit.java +++ b/src/test/java/org/jabref/architecture/MainArchitectureTestsWithArchUnit.java @@ -1,20 +1,18 @@ package org.jabref.architecture; +import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; -import com.tngtech.archunit.junit.ArchUnitRunner; -import com.tngtech.archunit.lang.ArchRule; -import org.junit.runner.RunWith; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; -@RunWith(ArchUnitRunner.class) @AnalyzeClasses(packages = "org.jabref") public class MainArchitectureTestsWithArchUnit { @ArchTest - public static final ArchRule doNotUseApacheCommonsLang3 = - noClasses().that().areNotAnnotatedWith(ApacheCommonsLang3Allowed.class) - .should().accessClassesThat().resideInAPackage("org.apache.commons.lang3"); - + public static void doNotUseApacheCommonsLang3(JavaClasses classes) { + noClasses().that().areNotAnnotatedWith(ApacheCommonsLang3Allowed.class) + .should().accessClassesThat().resideInAPackage("org.apache.commons.lang3") + .check(classes); + } } diff --git a/src/test/java/org/jabref/architecture/TestArchitectureTests.java b/src/test/java/org/jabref/architecture/TestArchitectureTests.java index 1e98148ca4c..c37c450d8a0 100644 --- a/src/test/java/org/jabref/architecture/TestArchitectureTests.java +++ b/src/test/java/org/jabref/architecture/TestArchitectureTests.java @@ -39,15 +39,14 @@ public TestArchitectureTests() { exceptions.add(CLASS_ORG_JABREF_UPDATE_TIMESTAMP_LISTENER_TEST); exceptions.add(CLASS_ORG_JABREF_ENTRY_EDITOR_TEST); exceptions.add(CLASS_ORG_JABREF_LINKED_FILE_VIEW_MODEL_TEST); - } public static Stream data() { return Stream.of( - new String[][] { - {CLASS_ORG_JABREF_PREFERENCES}, - {CLASS_ORG_JABREF_GLOBALS} - }); + new String[][]{ + {CLASS_ORG_JABREF_PREFERENCES}, + {CLASS_ORG_JABREF_GLOBALS} + }); } @ParameterizedTest @@ -58,21 +57,21 @@ public void testsAreIndependent(String forbiddenPackage) throws IOException { try (Stream pathStream = Files.walk(Paths.get("src/test/"))) { List files = pathStream - .filter(p -> p.toString().endsWith(".java")) - .filter(p -> { - try { - return Files.readAllLines(p, StandardCharsets.UTF_8).stream().noneMatch(isExceptionClass); - } catch (IOException e) { - return false; - } - }) - .filter(p -> { - try { - return Files.readAllLines(p, StandardCharsets.UTF_8).stream().anyMatch(isForbiddenPackage); - } catch (IOException e) { - return false; - } - }).collect(Collectors.toList()); + .filter(p -> p.toString().endsWith(".java")) + .filter(p -> { + try { + return Files.readAllLines(p, StandardCharsets.UTF_8).stream().noneMatch(isExceptionClass); + } catch (IOException e) { + return false; + } + }) + .filter(p -> { + try { + return Files.readAllLines(p, StandardCharsets.UTF_8).stream().anyMatch(isForbiddenPackage); + } catch (IOException e) { + return false; + } + }).collect(Collectors.toList()); assertEquals(Collections.emptyList(), files, "The following classes are not allowed to depend on " + forbiddenPackage); } diff --git a/src/test/java/org/jabref/cleanup/CleanupActionsListModelTest.java b/src/test/java/org/jabref/cleanup/CleanupActionsListModelTest.java index 885a6d1e109..b44b0c572aa 100644 --- a/src/test/java/org/jabref/cleanup/CleanupActionsListModelTest.java +++ b/src/test/java/org/jabref/cleanup/CleanupActionsListModelTest.java @@ -68,7 +68,6 @@ public void removedAtIndexOkay() { ArgumentCaptor argument = ArgumentCaptor.forClass(ListDataEvent.class); verify(listener).intervalRemoved(argument.capture()); assertEquals(ListDataEvent.INTERVAL_REMOVED, argument.getValue().getType()); - } @Test @@ -91,7 +90,5 @@ public void removedAtIndexgreaterListSizeDoesNothing() { model.removeAtIndex((getDefaultFieldFormatterCleanups().size() + 1)); verifyZeroInteractions(listener); - } - } diff --git a/src/test/java/org/jabref/cli/AuxCommandLineTest.java b/src/test/java/org/jabref/cli/AuxCommandLineTest.java index 81e81952062..c366e54ffba 100644 --- a/src/test/java/org/jabref/cli/AuxCommandLineTest.java +++ b/src/test/java/org/jabref/cli/AuxCommandLineTest.java @@ -45,5 +45,4 @@ public void test() throws URISyntaxException, IOException { assertEquals(2, newDB.getEntries().size()); } } - } diff --git a/src/test/java/org/jabref/cli/JabRefCLITest.java b/src/test/java/org/jabref/cli/JabRefCLITest.java index f3c43c05fed..cd79ca7cecf 100644 --- a/src/test/java/org/jabref/cli/JabRefCLITest.java +++ b/src/test/java/org/jabref/cli/JabRefCLITest.java @@ -11,7 +11,7 @@ class JabRefCLITest { @Test void parsingLongOptions() { - JabRefCLI cli = new JabRefCLI(new String[] {"--nogui", "--import=some/file", "--output=some/export/file"}); + JabRefCLI cli = new JabRefCLI(new String[]{"--nogui", "--import=some/file", "--output=some/export/file"}); assertEquals(Collections.emptyList(), cli.getLeftOver()); assertEquals("some/file", cli.getFileImport()); @@ -21,7 +21,7 @@ void parsingLongOptions() { @Test void parsingShortOptions() { - JabRefCLI cli = new JabRefCLI(new String[] {"-n", "-i=some/file", "-o=some/export/file"}); + JabRefCLI cli = new JabRefCLI(new String[]{"-n", "-i=some/file", "-o=some/export/file"}); assertEquals(Collections.emptyList(), cli.getLeftOver()); assertEquals("some/file", cli.getFileImport()); @@ -31,7 +31,7 @@ void parsingShortOptions() { @Test void preferencesExport() { - JabRefCLI cli = new JabRefCLI(new String[] {"-n", "-x=some/file"}); + JabRefCLI cli = new JabRefCLI(new String[]{"-n", "-x=some/file"}); assertEquals(Collections.emptyList(), cli.getLeftOver()); assertEquals("some/file", cli.getPreferencesExport()); diff --git a/src/test/java/org/jabref/gui/AWTExceptionHandler.java b/src/test/java/org/jabref/gui/AWTExceptionHandler.java index a6e25848e4b..74586f4d709 100644 --- a/src/test/java/org/jabref/gui/AWTExceptionHandler.java +++ b/src/test/java/org/jabref/gui/AWTExceptionHandler.java @@ -21,5 +21,4 @@ public void assertNoExceptions() { throw new AssertionError("Uncaught exception in EDT", list.get(0)); } } - } diff --git a/src/test/java/org/jabref/gui/AbstractUITest.java b/src/test/java/org/jabref/gui/AbstractUITest.java index 579729783d2..dfc33236d98 100644 --- a/src/test/java/org/jabref/gui/AbstractUITest.java +++ b/src/test/java/org/jabref/gui/AbstractUITest.java @@ -45,8 +45,9 @@ protected void onSetUp() { } /** - * Returns the absolute Path of the given relative Path - * The backlashes are replaced with forwardslashes b/c assertJ can't type the former one on windows + * Returns the absolute Path of the given relative Path The backlashes are replaced with forwardslashes b/c assertJ + * can't type the former one on windows + * * @param relativePath the relative path to the resource database */ protected String getAbsolutePath(String relativePath) throws URISyntaxException { @@ -94,7 +95,7 @@ protected void takeScreenshot(AbstractWindowFixture dialog, String file screenshotTaker.saveComponentAsPng(dialog.target(), file.toString()); } - protected void assertColumnValue(JTableFixture table, int rowIndex, int columnIndex, String selectionValue){ + protected void assertColumnValue(JTableFixture table, int rowIndex, int columnIndex, String selectionValue) { String[][] tableContent; tableContent = table.contents(); diff --git a/src/test/java/org/jabref/gui/DialogTest.java b/src/test/java/org/jabref/gui/DialogTest.java index fb038b8588b..e97eb1a56dc 100644 --- a/src/test/java/org/jabref/gui/DialogTest.java +++ b/src/test/java/org/jabref/gui/DialogTest.java @@ -3,13 +3,13 @@ import javax.swing.JButton; import javax.swing.JDialog; - import org.assertj.swing.core.GenericTypeMatcher; import org.assertj.swing.dependency.jsr305.Nonnull; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static org.assertj.swing.finder.WindowFinder.findDialog; + /** * This test has been split to work, the other part can be found at DialogTest2 */ diff --git a/src/test/java/org/jabref/gui/EntryTableTest.java b/src/test/java/org/jabref/gui/EntryTableTest.java index 42dd811c1b3..d5f4fbfa861 100644 --- a/src/test/java/org/jabref/gui/EntryTableTest.java +++ b/src/test/java/org/jabref/gui/EntryTableTest.java @@ -11,13 +11,12 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; /** - * Specific Use-Case: - * I import a database. Then I doubleclick on the first entry in the table to open the entry editor. - * Then I click on the first entry again, and scroll through all of the lists entries, without having to click - * on the table again. + * Specific Use-Case: I import a database. Then I doubleclick on the first entry in the table to open the entry editor. + * Then I click on the first entry again, and scroll through all of the lists entries, without having to click on the + * table again. */ @Tag("GUITest") -public class EntryTableTest extends AbstractUITest{ +public class EntryTableTest extends AbstractUITest { private final static int SCROLL_ACTION_EXECUTION = 5; private final static String TEST_FILE_NAME = "testbib/testjabref.bib"; @@ -48,20 +47,19 @@ public void scrollThroughEntryList() throws Exception { assertColumnValue(entryTable, 0, TITLE_COLUMN_INDEX, entryTable.selectionValue()); //go throught the table and check if the entry with the correct index is selected - for (int i=0; i < SCROLL_ACTION_EXECUTION; i++) { + for (int i = 0; i < SCROLL_ACTION_EXECUTION; i++) { robot().pressAndReleaseKey(DOWN); assertNotNull(entryTable.selectionValue()); - assertColumnValue(entryTable, i+1, TITLE_COLUMN_INDEX, entryTable.selectionValue()); + assertColumnValue(entryTable, i + 1, TITLE_COLUMN_INDEX, entryTable.selectionValue()); } //do the same going up again for (int i = SCROLL_ACTION_EXECUTION; i > 0; i--) { robot().pressAndReleaseKey(UP); assertNotNull(entryTable.selectionValue()); - assertColumnValue(entryTable, i-1, TITLE_COLUMN_INDEX, entryTable.selectionValue()); + assertColumnValue(entryTable, i - 1, TITLE_COLUMN_INDEX, entryTable.selectionValue()); } closeDatabase(); exitJabRef(); } - } diff --git a/src/test/java/org/jabref/gui/IdFetcherDialogTest.java b/src/test/java/org/jabref/gui/IdFetcherDialogTest.java index 023d2c5f0fa..65a1330b25a 100644 --- a/src/test/java/org/jabref/gui/IdFetcherDialogTest.java +++ b/src/test/java/org/jabref/gui/IdFetcherDialogTest.java @@ -110,7 +110,6 @@ public boolean test() { entryTable.requireRowCount(1); } - public static Stream instancesToTest() { return Stream.of( new Object[]{"BibTeX", "DOI", "10.1002/9781118257517"}, @@ -119,5 +118,4 @@ public static Stream instancesToTest() { new Object[]{"biblatex", "ISBN", "9780321356680"} ); } - } diff --git a/src/test/java/org/jabref/gui/ParameterizedDialogNewEntryTest.java b/src/test/java/org/jabref/gui/ParameterizedDialogNewEntryTest.java index 6ce2bb71083..2cfd70baa8a 100644 --- a/src/test/java/org/jabref/gui/ParameterizedDialogNewEntryTest.java +++ b/src/test/java/org/jabref/gui/ParameterizedDialogNewEntryTest.java @@ -188,5 +188,4 @@ public static Stream instancesToTest() { ); // @formatter:on } - } diff --git a/src/test/java/org/jabref/gui/ParameterizedDialogTest.java b/src/test/java/org/jabref/gui/ParameterizedDialogTest.java index 07d1f0a63e8..de3d6dcfc43 100644 --- a/src/test/java/org/jabref/gui/ParameterizedDialogTest.java +++ b/src/test/java/org/jabref/gui/ParameterizedDialogTest.java @@ -36,13 +36,13 @@ protected boolean isMatching(JDialog dialog) { findDialog(matcher).withTimeout(10_000).using(robot()).close(); } else { findDialog(matcher).withTimeout(10_000).using(robot()) - .button(new GenericTypeMatcher(JButton.class) { + .button(new GenericTypeMatcher(JButton.class) { - @Override - protected boolean isMatching(@Nonnull JButton jButton) { - return buttonName.equals(jButton.getText()); - } - }).click(); + @Override + protected boolean isMatching(@Nonnull JButton jButton) { + return buttonName.equals(jButton.getText()); + } + }).click(); } if (createDatabase) { closeDatabase(); @@ -130,5 +130,4 @@ public static Stream instancesToTest() { ); // @formatter:on } - } diff --git a/src/test/java/org/jabref/gui/ParameterizedMenuNewEntryTest.java b/src/test/java/org/jabref/gui/ParameterizedMenuNewEntryTest.java index 31a66bb3b6c..67efff9e04b 100644 --- a/src/test/java/org/jabref/gui/ParameterizedMenuNewEntryTest.java +++ b/src/test/java/org/jabref/gui/ParameterizedMenuNewEntryTest.java @@ -61,5 +61,4 @@ public static Stream instancesToTest() { ); // @formatter:on } - } diff --git a/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java b/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java index dcb9d07e32c..2ae76c383b6 100644 --- a/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java +++ b/src/test/java/org/jabref/gui/autocompleter/PersonNameSuggestionProviderTest.java @@ -16,7 +16,7 @@ public class PersonNameSuggestionProviderTest { - private static final Author vassilisKostakos = new Author("Vassilis", "V.", "", "Kostakos", ""); + private final Author vassilisKostakos = new Author("Vassilis", "V.", "", "Kostakos", ""); private PersonNameSuggestionProvider autoCompleter; private BibEntry entry; 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 57279df9b55..32450d93cc4 100644 --- a/src/test/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModelTest.java +++ b/src/test/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationViewModelTest.java @@ -16,8 +16,8 @@ public class FileAnnotationViewModelTest { public void removeOnlyLineBreaksNotPrecededByPeriodOrColon() { String content = "This is content"; String marking = String.format("This is paragraph 1.%n" + - "This is paragr-%naph 2, and it crosses%nseveral lines,%nnow you can see next paragraph:%n" - + "This is paragraph%n3."); + "This is paragr-%naph 2, and it crosses%nseveral lines,%nnow you can see next paragraph:%n" + + "This is paragraph%n3."); FileAnnotation linkedFileAnnotation = new FileAnnotation("John", LocalDateTime.now(), 3, content, FileAnnotationType.FREETEXT, Optional.empty()); FileAnnotation annotation = new FileAnnotation("Jaroslav Kucha ˇr", LocalDateTime.parse("2017-07-20T10:11:30"), 1, marking, FileAnnotationType.HIGHLIGHT, Optional.of(linkedFileAnnotation)); @@ -30,8 +30,8 @@ public void removeOnlyLineBreaksNotPrecededByPeriodOrColon() { assertEquals("This is content", annotationViewModel.getContent()); assertEquals(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."), - annotationViewModel.getMarking()); + "This is paragraph 2, and it crosses several lines, now you can see next paragraph:%n" + + "This is paragraph 3."), + annotationViewModel.getMarking()); } } diff --git a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java index c2e2773a31f..e25495e99f2 100644 --- a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java @@ -51,5 +51,4 @@ public void test() throws Exception { List actual = util.findAssociatedNotLinkedFiles(entry); assertEquals(expected, actual); } - } diff --git a/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java b/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java index 05941f3a4ab..aa369649d73 100644 --- a/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java +++ b/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java @@ -154,7 +154,7 @@ public void draggedOnTopOfGroupAddsBeforeItWhenSourceGroupWasBefore() throws Exc @Test public void entriesAreAddedCorrectly() { String groupName = "group"; - ExplicitGroup group = new ExplicitGroup(groupName, GroupHierarchyType.INDEPENDENT,','); + ExplicitGroup group = new ExplicitGroup(groupName, GroupHierarchyType.INDEPENDENT, ','); BibEntry entry = new BibEntry(); databaseContext.getDatabase().insertEntry(entry); diff --git a/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java b/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java index afa4ad53eba..4b0c57c6448 100644 --- a/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java +++ b/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java @@ -44,7 +44,7 @@ public void rootGroupIsAllEntriesByDefault() throws Exception { @Test public void explicitGroupsAreRemovedFromEntriesOnDelete() { - ExplicitGroup group = new ExplicitGroup("group", GroupHierarchyType.INDEPENDENT,','); + ExplicitGroup group = new ExplicitGroup("group", GroupHierarchyType.INDEPENDENT, ','); BibEntry entry = new BibEntry(); databaseContext.getDatabase().insertEntry(entry); diff --git a/src/test/java/org/jabref/gui/importer/EntryFromFileCreatorManagerTest.java b/src/test/java/org/jabref/gui/importer/EntryFromFileCreatorManagerTest.java index 38301e769ef..ec04c0d99e7 100644 --- a/src/test/java/org/jabref/gui/importer/EntryFromFileCreatorManagerTest.java +++ b/src/test/java/org/jabref/gui/importer/EntryFromFileCreatorManagerTest.java @@ -41,7 +41,6 @@ public class EntryFromFileCreatorManagerTest { public void setUp() { externalFileTypes = mock(ExternalFileTypes.class, Answers.RETURNS_DEEP_STUBS); when(externalFileTypes.getExternalFileTypeByExt("pdf")).thenReturn(Optional.empty()); - } @Test @@ -58,7 +57,7 @@ public void testGetCreator() { @Test public void testAddEntrysFromFiles() throws IOException { try (FileInputStream stream = new FileInputStream(ImportDataTest.UNLINKED_FILES_TEST_BIB); - InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) { + InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) { ParserResult result = new BibtexParser(prefs, new DummyFileUpdateMonitor()).parse(reader); BibDatabase database = result.getDatabase(); diff --git a/src/test/java/org/jabref/gui/importer/EntryFromPDFCreatorTest.java b/src/test/java/org/jabref/gui/importer/EntryFromPDFCreatorTest.java index 17817eeb6b4..575d82852b0 100644 --- a/src/test/java/org/jabref/gui/importer/EntryFromPDFCreatorTest.java +++ b/src/test/java/org/jabref/gui/importer/EntryFromPDFCreatorTest.java @@ -55,6 +55,5 @@ public void testCreationOfEntryNotInDatabase() { assertTrue(entry.get().getField("file").get().endsWith(":PDF")); assertEquals(Optional.of(ImportDataTest.FILE_NOT_IN_DATABASE.getName()), entry.get().getField("title")); - } } diff --git a/src/test/java/org/jabref/gui/journals/ManageJournalAbbreviationsViewModelTest.java b/src/test/java/org/jabref/gui/journals/ManageJournalAbbreviationsViewModelTest.java index 5c47dec695e..77e7d20cc36 100644 --- a/src/test/java/org/jabref/gui/journals/ManageJournalAbbreviationsViewModelTest.java +++ b/src/test/java/org/jabref/gui/journals/ManageJournalAbbreviationsViewModelTest.java @@ -209,7 +209,7 @@ void testBuiltInListsIncludeAllBuiltInAbbreviations() { .observableArrayList(JournalAbbreviationLoader.getBuiltInAbbreviations()); ObservableList actualAbbreviations = FXCollections .observableArrayList(viewModel.abbreviationsProperty().stream() - .map(AbbreviationViewModel::getAbbreviationObject).collect(Collectors.toList())); + .map(AbbreviationViewModel::getAbbreviationObject).collect(Collectors.toList())); assertEquals(expected, actualAbbreviations); } @@ -224,7 +224,7 @@ void testBuiltInListsStandardIEEEIncludesAllBuiltIEEEAbbreviations() throws Exce .observableArrayList(JournalAbbreviationLoader.getOfficialIEEEAbbreviations()); ObservableList actualAbbreviations = FXCollections .observableArrayList(viewModel.abbreviationsProperty().stream() - .map(AbbreviationViewModel::getAbbreviationObject).collect(Collectors.toList())); + .map(AbbreviationViewModel::getAbbreviationObject).collect(Collectors.toList())); assertEquals(expected, actualAbbreviations); } @@ -443,7 +443,7 @@ void testSaveAbbreviationsToFilesCreatesNewFilesWithWrittenAbbreviations() throw void testSaveExternalFilesListToPreferences() throws Exception { addFourTestFileToViewModelAndPreferences(); List expected = Stream.of(testFile1Entries, testFile3Entries, testFile4Entries, testFile5EntriesWithDuplicate) - .map(Path::toString).collect(Collectors.toList()); + .map(Path::toString).collect(Collectors.toList()); verify(abbreviationPreferences).setExternalJournalLists(expected); } @@ -478,6 +478,6 @@ private void addFourTestFileToViewModelAndPreferences() throws Exception { */ private void selectLastAbbreviation() { viewModel.currentAbbreviationProperty() - .set(viewModel.abbreviationsProperty().get(viewModel.abbreviationsCountProperty().get() - 1)); + .set(viewModel.abbreviationsProperty().get(viewModel.abbreviationsCountProperty().get() - 1)); } } diff --git a/src/test/java/org/jabref/gui/keyboard/KeyBindingsDialogViewModelTest.java b/src/test/java/org/jabref/gui/keyboard/KeyBindingsDialogViewModelTest.java index 7878cb9c678..c9c34e25e0e 100644 --- a/src/test/java/org/jabref/gui/keyboard/KeyBindingsDialogViewModelTest.java +++ b/src/test/java/org/jabref/gui/keyboard/KeyBindingsDialogViewModelTest.java @@ -50,7 +50,6 @@ public void testInvalidKeyBindingIsNotSaved() { assertFalse(keyBindingRepository.checkKeyCombinationEquality(KeyBinding.COPY, shortcutKeyEvent)); } - @Test public void testSpecialKeysValidKeyBindingIsSaved() { setKeyBindingViewModel(KeyBinding.IMPORT_INTO_NEW_DATABASE); diff --git a/src/test/java/org/jabref/gui/search/SearchResultsTest.java b/src/test/java/org/jabref/gui/search/SearchResultsTest.java index 6daafde1f70..1e2badcc2ad 100644 --- a/src/test/java/org/jabref/gui/search/SearchResultsTest.java +++ b/src/test/java/org/jabref/gui/search/SearchResultsTest.java @@ -21,7 +21,6 @@ public class SearchResultsTest extends AssertJSwingJUnitTestCase { private FrameFixture frameFixture; - @BeforeAll public static void before() { FailOnThreadViolationRepaintManager.uninstall(); @@ -94,5 +93,4 @@ public void testSearchInvalidQuery() { Assert.assertTrue(entries.stream().noneMatch(entry -> entry.isSearchHit())); */ } - } diff --git a/src/test/java/org/jabref/gui/util/FileDialogConfigurationTest.java b/src/test/java/org/jabref/gui/util/FileDialogConfigurationTest.java index 74c90fd5f9b..2a19e5593a6 100644 --- a/src/test/java/org/jabref/gui/util/FileDialogConfigurationTest.java +++ b/src/test/java/org/jabref/gui/util/FileDialogConfigurationTest.java @@ -30,7 +30,6 @@ void testWithValidDirectoryString(@TempDirectory.TempDir Path folder) { assertEquals(Optional.of(Paths.get(tempFolder)), fileDialogConfiguration.getInitialDirectory()); } - @Test void testWithValidDirectoryPath(@TempDirectory.TempDir Path tempFolder) { FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() @@ -74,10 +73,8 @@ void testSingleExtension() { assertEquals(filter.getExtensions(), fileDialogConfiguration.getDefaultExtension().getExtensions()); } - private FileChooser.ExtensionFilter toFilter(String description, FileType extension) { return new FileChooser.ExtensionFilter(description, extension.getExtensions().stream().map(ending -> "*." + ending).collect(Collectors.toList())); } - } diff --git a/src/test/java/org/jabref/gui/util/RecursiveTreeItemTest.java b/src/test/java/org/jabref/gui/util/RecursiveTreeItemTest.java index 912ad78feb7..343ed8d63b1 100644 --- a/src/test/java/org/jabref/gui/util/RecursiveTreeItemTest.java +++ b/src/test/java/org/jabref/gui/util/RecursiveTreeItemTest.java @@ -16,7 +16,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - class RecursiveTreeItemTest { private RecursiveTreeItem rootTreeItem; diff --git a/src/test/java/org/jabref/logic/autosaveandbackup/BackupManagerTest.java b/src/test/java/org/jabref/logic/autosaveandbackup/BackupManagerTest.java index 744682b6f9c..fea23323f6c 100644 --- a/src/test/java/org/jabref/logic/autosaveandbackup/BackupManagerTest.java +++ b/src/test/java/org/jabref/logic/autosaveandbackup/BackupManagerTest.java @@ -15,5 +15,4 @@ public void backupFileNameIsCorrectlyGeneratedWithinTmpDirectory() { Path savPath = BackupManager.getBackupPath(bibPath); assertEquals(Paths.get("tmp", "test.bib.sav"), savPath); } - } diff --git a/src/test/java/org/jabref/logic/bibtex/BibEntryAssert.java b/src/test/java/org/jabref/logic/bibtex/BibEntryAssert.java index e5cd84faa34..c745a684457 100644 --- a/src/test/java/org/jabref/logic/bibtex/BibEntryAssert.java +++ b/src/test/java/org/jabref/logic/bibtex/BibEntryAssert.java @@ -19,11 +19,11 @@ import org.jabref.model.entry.BibEntry; import org.jabref.model.util.DummyFileUpdateMonitor; -import static org.junit.jupiter.api.Assertions.*; - import org.junit.jupiter.api.Assertions; import org.mockito.Answers; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.mockito.Mockito.mock; public class BibEntryAssert { @@ -32,9 +32,9 @@ public class BibEntryAssert { * Reads a single entry from the resource using `getResourceAsStream` from the given class. The resource has to * contain a single entry * - * @param clazz the class where to call `getResourceAsStream` + * @param clazz the class where to call `getResourceAsStream` * @param resourceName the resource to read - * @param entry the entry to compare with + * @param entry the entry to compare with */ public static void assertEquals(Class clazz, String resourceName, BibEntry entry) throws IOException { @@ -50,9 +50,9 @@ public static void assertEquals(Class clazz, String resourceName, BibEntry en * Reads a single entry from the resource using `getResourceAsStream` from the given class. The resource has to * contain a single entry * - * @param clazz the class where to call `getResourceAsStream` + * @param clazz the class where to call `getResourceAsStream` * @param resourceName the resource to read - * @param asIsEntries a list containing a single entry to compare with + * @param asIsEntries a list containing a single entry to compare with */ public static void assertEquals(Class clazz, String resourceName, List asIsEntries) throws IOException { @@ -79,7 +79,7 @@ private static List getListFromInputStream(InputStream is) throws IOEx * Reads a bibtex database from the given InputStream. The list is compared with the given list. * * @param expectedInputStream the inputStream reading the entry from - * @param actualEntries a list containing a single entry to compare with + * @param actualEntries a list containing a single entry to compare with */ public static void assertEquals(InputStream expectedInputStream, List actualEntries) throws IOException { @@ -102,7 +102,7 @@ public static void assertEquals(List expectedEntries, InputStream actu * compared to the given entry * * @param expected the inputStream reading the entry from - * @param actual the entry to compare with + * @param actual the entry to compare with */ public static void assertEquals(InputStream expected, BibEntry actual) throws IOException { @@ -110,11 +110,13 @@ public static void assertEquals(InputStream expected, BibEntry actual) } /** - * Compares two InputStreams. For each InputStream a list will be created. expectedIs is read directly, actualIs is filtered through importer to convert to a list of BibEntries. - * @param expectedIs A BibtexImporter InputStream. + * Compares two InputStreams. For each InputStream a list will be created. expectedIs is read directly, actualIs is + * filtered through importer to convert to a list of BibEntries. + * + * @param expectedIs A BibtexImporter InputStream. * @param fileToImport The path to the file to be imported. - * @param importer The fileformat you want to use to read the passed file to get the list of expected BibEntries - * @throws IOException + * @param importer The fileformat you want to use to read the passed file to get the list of expected + * BibEntries */ public static void assertEquals(InputStream expectedIs, Path fileToImport, Importer importer) throws IOException { @@ -127,16 +129,18 @@ public static void assertEquals(InputStream expectedIs, URL fileToImport, Import } /** - * Compares a list of BibEntries to an InputStream. actualIs is filtered through importerForActualIs to convert to a list of BibEntries. - * @param expected A BibtexImporter InputStream. + * Compares a list of BibEntries to an InputStream. actualIs is filtered through importerForActualIs to convert to a + * list of BibEntries. + * + * @param expected A BibtexImporter InputStream. * @param fileToImport The path to the file to be imported. - * @param importer The fileformat you want to use to read the passed file to get the list of expected BibEntries - * @throws IOException + * @param importer The fileformat you want to use to read the passed file to get the list of expected + * BibEntries */ public static void assertEquals(List expected, Path fileToImport, Importer importer) throws IOException { List actualEntries = importer.importDatabase(fileToImport, StandardCharsets.UTF_8) - .getDatabase().getEntries(); + .getDatabase().getEntries(); // explicit reference of Assertions is needed here to disambiguate from the methods defined by this class Assertions.assertEquals(expected, actualEntries); } diff --git a/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java b/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java index 68a31d6eb54..a340fdc7b59 100644 --- a/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java +++ b/src/test/java/org/jabref/logic/bibtex/BibEntryWriterTest.java @@ -509,5 +509,4 @@ public void roundTripWithPrecedingCommentAndModificationTest() throws IOExceptio assertEquals(expected, actual); } - } diff --git a/src/test/java/org/jabref/logic/bibtex/FieldContentParserTest.java b/src/test/java/org/jabref/logic/bibtex/FieldContentParserTest.java index b63242b6f30..a2d40588f96 100644 --- a/src/test/java/org/jabref/logic/bibtex/FieldContentParserTest.java +++ b/src/test/java/org/jabref/logic/bibtex/FieldContentParserTest.java @@ -13,7 +13,6 @@ public class FieldContentParserTest { private FieldContentParser parser; - @BeforeEach public void setUp() throws Exception { FieldContentParserPreferences prefs = new FieldContentParserPreferences(Collections.emptyList()); diff --git a/src/test/java/org/jabref/logic/bibtex/LatexFieldFormatterTests.java b/src/test/java/org/jabref/logic/bibtex/LatexFieldFormatterTests.java index 7b822bb1b98..aafd1e80c8e 100644 --- a/src/test/java/org/jabref/logic/bibtex/LatexFieldFormatterTests.java +++ b/src/test/java/org/jabref/logic/bibtex/LatexFieldFormatterTests.java @@ -28,7 +28,7 @@ public void normalizeNewlineInAbstractField() throws Exception { // The newlines are normalized according to the globally configured newline setting in the formatter String expected = "{" + "lorem" + OS.NEWLINE + " ipsum lorem ipsum" + OS.NEWLINE - + "lorem ipsum " + + "lorem ipsum " + OS.NEWLINE + "lorem ipsum" + OS.NEWLINE + "test" + "}"; @@ -69,7 +69,7 @@ public void preserveNewlineInReviewField() throws Exception { String text = "lorem ipsum lorem ipsum" + OS.NEWLINE + "lorem ipsum lorem ipsum" + OS.NEWLINE; String result = formatter.format(text, fieldName); - String expected = "{"+text+"}"; + String expected = "{" + text + "}"; assertEquals(expected, result); } @@ -126,5 +126,4 @@ public void hashEnclosedWordsGetRealStringsInMonthFieldBecauseMonthIsStandardFie String text = "#jan# - #feb#"; assertEquals("jan #{ - } # feb", formatter.format(text, "month")); } - } diff --git a/src/test/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiffTest.java b/src/test/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiffTest.java index cdf7115824c..3061f648959 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiffTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/BibDatabaseDiffTest.java @@ -19,5 +19,4 @@ public void compareOfEmptyDatabasesReportsNoDifferences() throws Exception { assertEquals(Collections.emptyList(), diff.getBibStringDifferences()); assertEquals(Collections.emptyList(), diff.getEntryDifferences()); } - } 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 9a6d3bbbb26..d256f4472b4 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/BibtexStringComparatorTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/BibtexStringComparatorTest.java @@ -12,7 +12,6 @@ public class BibtexStringComparatorTest { private final BibtexStringComparator bsc1 = new BibtexStringComparator(false); private final BibtexStringComparator bsc2 = new BibtexStringComparator(true); - @Test public void test() { BibtexString bs1 = new BibtexString("VLSI", "Very Large Scale Integration"); @@ -42,7 +41,5 @@ public void test() { // bs4 after bs1 if considering that bs4 contains bs1 assertTrue(bsc2.compare(bs1, bs4) < 0); assertTrue(bsc2.compare(bs4, bs1) > 0); - } - } 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 38c9b152f61..89c212c3839 100644 --- a/src/test/java/org/jabref/logic/bibtex/comparator/MetaDataDiffTest.java +++ b/src/test/java/org/jabref/logic/bibtex/comparator/MetaDataDiffTest.java @@ -19,5 +19,4 @@ public void compareWithSameContentSelectorsDoesNotReportAnyDiffs() throws Except assertEquals(Optional.empty(), MetaDataDiff.compare(one, two)); } - } diff --git a/src/test/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGeneratorTest.java b/src/test/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGeneratorTest.java index 17134b98dc8..4ed5b5bb728 100644 --- a/src/test/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGeneratorTest.java +++ b/src/test/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGeneratorTest.java @@ -227,8 +227,8 @@ public void testMakeLabelAndCheckLegalKeysAccentGrave() throws ParseException { } /** - * Tests if checkLegalKey replaces Non-ASCII chars. - * There are quite a few chars that should be replaced. Perhaps there is a better method than the current. + * Tests if checkLegalKey replaces Non-ASCII chars. There are quite a few chars that should be replaced. Perhaps + * there is a better method than the current. * * @see BibtexKeyGenerator#checkLegalKey(String) */ @@ -799,8 +799,8 @@ public void shortTitle() { } /** - * Tests [camel] - */ + * Tests [camel] + */ @Test public void camel() { // camel capitalises and concatenates all the words of the title diff --git a/src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithDatabaseTest.java b/src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithDatabaseTest.java index 20f7c634dcf..a28d412bc35 100644 --- a/src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithDatabaseTest.java +++ b/src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithDatabaseTest.java @@ -12,7 +12,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - class MakeLabelWithDatabaseTest { private BibDatabase database; diff --git a/src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithoutDatabaseTest.java b/src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithoutDatabaseTest.java index 3ca979b9be3..10c02b89016 100644 --- a/src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithoutDatabaseTest.java +++ b/src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithoutDatabaseTest.java @@ -7,7 +7,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - class MakeLabelWithoutDatabaseTest { private BibEntry entry; @@ -36,5 +35,4 @@ void makeEditorLabelForFileSearch() { String label = BibtexKeyGenerator.generateKey(localEntry, "auth"); assertEquals("Doe", label); } - } diff --git a/src/test/java/org/jabref/logic/bst/BibtexCaseChangersTest.java b/src/test/java/org/jabref/logic/bst/BibtexCaseChangersTest.java index a6214a7f0c8..bcdcac3b4ce 100644 --- a/src/test/java/org/jabref/logic/bst/BibtexCaseChangersTest.java +++ b/src/test/java/org/jabref/logic/bst/BibtexCaseChangersTest.java @@ -77,7 +77,6 @@ public void testChangeCase() { assertCaseChangerTitleLowers("On notions of information transfer in {VLSI} circuits", "On Notions of Information Transfer in {VLSI} Circuits"); - } @Test @@ -123,7 +122,6 @@ public void testTitleCase() { private void assertCaseChangerTitleLowers(final String string, final String string2) { assertEquals(string, BibtexCaseChanger.changeCase(string2, FORMAT_MODE.TITLE_LOWERS)); - } private void assertCaseChangerAllLowers(final String string, final String string2) { diff --git a/src/test/java/org/jabref/logic/bst/BibtexNameFormatterTest.java b/src/test/java/org/jabref/logic/bst/BibtexNameFormatterTest.java index 8fd58e42ff1..5a457bc0f7d 100644 --- a/src/test/java/org/jabref/logic/bst/BibtexNameFormatterTest.java +++ b/src/test/java/org/jabref/logic/bst/BibtexNameFormatterTest.java @@ -54,7 +54,6 @@ public void testFormatName() { assertNameFormatB("P.~{\\'E}. Victor", "Paul {\\'E}mile Victor and and de la Cierva y Codorn{\\’\\i}u, Juan"); assertNameFormatC("Paul~{\\'E}mile Victor", "Paul {\\'E}mile Victor and and de la Cierva y Codorn{\\’\\i}u, Juan"); - } private void assertNameFormat(String string, String string2, int which, String format) { @@ -114,5 +113,4 @@ public void testNumberOfChars() { assertEquals(8, BibtexNameFormatter.numberOfChars("Vall{e}e", -1)); assertEquals(6, BibtexNameFormatter.numberOfChars("Vall{\\'e this will be skipped}e", -1)); } - } diff --git a/src/test/java/org/jabref/logic/bst/BibtexWidthTest.java b/src/test/java/org/jabref/logic/bst/BibtexWidthTest.java index 924165bf5e0..015eb900300 100644 --- a/src/test/java/org/jabref/logic/bst/BibtexWidthTest.java +++ b/src/test/java/org/jabref/logic/bst/BibtexWidthTest.java @@ -1,7 +1,5 @@ package org.jabref.logic.bst; - - import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/src/test/java/org/jabref/logic/bst/TestVM.java b/src/test/java/org/jabref/logic/bst/TestVM.java index a1e853b8c83..54bf2f0b7c1 100644 --- a/src/test/java/org/jabref/logic/bst/TestVM.java +++ b/src/test/java/org/jabref/logic/bst/TestVM.java @@ -58,7 +58,6 @@ public void testVMSimple() throws RecognitionException, IOException { assertEquals(1, vm.getEntries().size()); assertEquals(5, vm.getEntries().get(0).getFields().size()); assertEquals(38, vm.getFunctions().size()); - } @Test @@ -76,7 +75,6 @@ public void testLabel() throws RecognitionException, IOException { assertEquals("Effective work practices for floss development: A model and propositions", vm .getStack() .pop()); - } @Test @@ -171,8 +169,8 @@ public void testVMArithmetic() throws RecognitionException { assertEquals(3, vm.getStack().pop()); assertEquals(2, vm.getStack().pop()); assertEquals(0, vm.getStack().size()); - } + @Test public void testVMArithmetic2() throws RecognitionException { VM vm = new VM("FUNCTION {test} { " + "#1 \"HELLO\" + #5 #2 - }" + "EXECUTE {test}"); @@ -666,5 +664,4 @@ public void testHypthenatedName() throws RecognitionException, IOException { private BibEntry t1BibtexEntry() throws IOException { return TestVM.bibtexString2BibtexEntry(t1BibtexString()); } - } diff --git a/src/test/java/org/jabref/logic/bst/TextPrefixFunctionTest.java b/src/test/java/org/jabref/logic/bst/TextPrefixFunctionTest.java index 353a7643314..d91eadd8920 100644 --- a/src/test/java/org/jabref/logic/bst/TextPrefixFunctionTest.java +++ b/src/test/java/org/jabref/logic/bst/TextPrefixFunctionTest.java @@ -23,5 +23,4 @@ public void testPrefix() { private static void assertPrefix(final String string, final String string2) { assertEquals(string, BibtexTextPrefix.textPrefix(5, string2, s -> fail("Should not Warn! text.prefix$ should be " + string + " for (5) " + string2))); } - } diff --git a/src/test/java/org/jabref/logic/citationstyle/CitationStyleGeneratorTest.java b/src/test/java/org/jabref/logic/citationstyle/CitationStyleGeneratorTest.java index 890eed33bea..3b9189afed5 100644 --- a/src/test/java/org/jabref/logic/citationstyle/CitationStyleGeneratorTest.java +++ b/src/test/java/org/jabref/logic/citationstyle/CitationStyleGeneratorTest.java @@ -9,7 +9,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - public class CitationStyleGeneratorTest { @Test @@ -116,5 +115,4 @@ public void testXslFoFormat() { String actualCitation = CitationStyleGenerator.generateCitation(entry, style, format); assertEquals(expectedCitation, actualCitation); } - } diff --git a/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java b/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java index b63d9d94f0e..040f7a7155d 100644 --- a/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java +++ b/src/test/java/org/jabref/logic/citationstyle/CitationStyleTest.java @@ -27,5 +27,4 @@ public void testDefaultCitation() { assertEquals(expected, citation); } - } diff --git a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java index 124e08b2304..567dffd1f6a 100644 --- a/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java +++ b/src/test/java/org/jabref/logic/cleanup/CleanupWorkerTest.java @@ -350,5 +350,4 @@ void cleanupWithDisabledFieldFormatterChangesNothing() { worker.cleanup(preset, entry); assertEquals(Optional.of("01"), entry.getField("month")); } - } diff --git a/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java index 57a87a1493d..196263f76ea 100644 --- a/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupTest.java @@ -3,8 +3,8 @@ import java.util.HashMap; import java.util.Map; -import org.jabref.logic.formatter.casechanger.UpperCaseFormatter; import org.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter; +import org.jabref.logic.formatter.casechanger.UpperCaseFormatter; import org.jabref.model.cleanup.FieldFormatterCleanup; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibtexEntryTypes; @@ -34,7 +34,6 @@ public void setUp() { fieldMap.put("doi", "jabrefdoi"); fieldMap.put("issn", "jabrefissn"); entry.setField(fieldMap); - } @Test @@ -91,5 +90,4 @@ public void testCleanupKeyFieldCleansUpKeyField() throws Exception { assertEquals("Fran{\\c{c}}ois-Marie Arouet", entry.getField(BibEntry.KEY_FIELD).get()); } - } diff --git a/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java index fbe92bc4a65..aa6dc774647 100644 --- a/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java @@ -52,5 +52,4 @@ public void cleanupISSNJunkStaysJunk() { worker.cleanup(preset, entry); assertEquals(Optional.of("Banana"), entry.getField("issn")); } - } diff --git a/src/test/java/org/jabref/logic/exporter/BibTeXMLExporterTestFiles.java b/src/test/java/org/jabref/logic/exporter/BibTeXMLExporterTestFiles.java index a683dd2bff5..85051a17351 100644 --- a/src/test/java/org/jabref/logic/exporter/BibTeXMLExporterTestFiles.java +++ b/src/test/java/org/jabref/logic/exporter/BibTeXMLExporterTestFiles.java @@ -35,21 +35,19 @@ @ExtendWith(TempDirectory.class) public class BibTeXMLExporterTestFiles { + private static Path resourceDir; public BibDatabaseContext databaseContext; public Charset charset; public Path tempFile; public BibTeXMLExporter bibtexmlExportFormat; public BibtexImporter testImporter; - private static Path resourceDir; - public static Stream fileNames() throws IOException, URISyntaxException { resourceDir = Paths.get(MSBibExportFormatTestFiles.class.getResource("BibTeXMLExporterTestArticle.bib").toURI()).getParent(); -// System.out.println(resourceDir); try (Stream stream = Files.list(resourceDir)) { return stream.map(n -> n.getFileName().toString()).filter(n -> n.endsWith(".bib")) - .filter(n -> n.startsWith("BibTeXML")).collect(Collectors.toList()).stream(); + .filter(n -> n.startsWith("BibTeXML")).collect(Collectors.toList()).stream(); } } @@ -71,7 +69,7 @@ public final void testPerformExport(String filename) throws IOException, SaveExc String tempFilePath = tempFile.toAbsolutePath().toString(); List entries = testImporter.importDatabase(importFile, StandardCharsets.UTF_8).getDatabase() - .getEntries(); + .getEntries(); bibtexmlExportFormat.export(databaseContext, tempFile, charset, entries); @@ -79,6 +77,6 @@ public final void testPerformExport(String filename) throws IOException, SaveExc Builder test = Input.from(Files.newInputStream(Paths.get(tempFilePath))); assertThat(test, CompareMatcher.isSimilarTo(control) - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure()); + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure()); } } diff --git a/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java b/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java index 1d988120573..e30ecf77ca8 100644 --- a/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java +++ b/src/test/java/org/jabref/logic/exporter/BibtexDatabaseWriterTest.java @@ -218,9 +218,9 @@ void writeGroupsAndEncoding() throws Exception { // @formatter:off assertEquals( "% Encoding: US-ASCII" + OS.NEWLINE + - OS.NEWLINE + OS.NEWLINE + "@Comment{jabref-meta: grouping:" + OS.NEWLINE - + "0 AllEntriesGroup:;" + OS.NEWLINE + + "0 AllEntriesGroup:;" + OS.NEWLINE + "1 StaticGroup:test\\;2\\;1\\;\\;\\;\\;;" + OS.NEWLINE + "}" + OS.NEWLINE, stringWriter.toString()); // @formatter:on @@ -297,7 +297,7 @@ void roundtripWithUserComment() throws Exception { new Defaults(BibDatabaseMode.BIBTEX)); databaseWriter.savePartOfDatabase(context, result.getDatabase().getEntries()); - try (Scanner scanner = new Scanner(testBibtexFile,encoding.name())) { + try (Scanner scanner = new Scanner(testBibtexFile, encoding.name())) { assertEquals(scanner.useDelimiter("\\A").next(), stringWriter.toString()); } } @@ -341,7 +341,7 @@ void roundtripWithUserCommentBeforeStringAndChange() throws Exception { databaseWriter.savePartOfDatabase(context, result.getDatabase().getEntries()); - try (Scanner scanner = new Scanner(testBibtexFile,encoding.name())) { + try (Scanner scanner = new Scanner(testBibtexFile, encoding.name())) { assertEquals(scanner.useDelimiter("\\A").next(), stringWriter.toString()); } } @@ -358,7 +358,7 @@ void roundtripWithUnknownMetaData() throws Exception { new Defaults(BibDatabaseMode.BIBTEX)); databaseWriter.savePartOfDatabase(context, result.getDatabase().getEntries()); - try (Scanner scanner = new Scanner(testBibtexFile,encoding.name())) { + try (Scanner scanner = new Scanner(testBibtexFile, encoding.name())) { assertEquals(scanner.useDelimiter("\\A").next(), stringWriter.toString()); } } @@ -419,7 +419,6 @@ void reformatStringIfAskedToDoSo() throws Exception { databaseWriter.savePartOfDatabase(bibtexContext, Collections.emptyList()); assertEquals(OS.NEWLINE + "@String{name = {content}}" + OS.NEWLINE, stringWriter.toString()); - } @Test @@ -525,21 +524,21 @@ void writeEntriesSorted() throws Exception { assertEquals( OS.NEWLINE + - "@Article{," + OS.NEWLINE + - " author = {A}," + OS.NEWLINE + + "@Article{," + OS.NEWLINE + + " author = {A}," + OS.NEWLINE + " year = {2010}," + OS.NEWLINE + - "}" + OS.NEWLINE + OS.NEWLINE + - "@Article{," + OS.NEWLINE + - " author = {A}," + OS.NEWLINE + + "}" + OS.NEWLINE + OS.NEWLINE + + "@Article{," + OS.NEWLINE + + " author = {A}," + OS.NEWLINE + + " year = {2000}," + OS.NEWLINE + + "}" + OS.NEWLINE + OS.NEWLINE + + "@Article{," + OS.NEWLINE + + " author = {B}," + OS.NEWLINE + " year = {2000}," + OS.NEWLINE + - "}" + OS.NEWLINE + OS.NEWLINE + - "@Article{," + OS.NEWLINE + - " author = {B}," + OS.NEWLINE + - " year = {2000}," + OS.NEWLINE + - "}" + OS.NEWLINE + OS.NEWLINE + - "@Comment{jabref-meta: databaseType:bibtex;}" - + OS.NEWLINE + OS.NEWLINE + - "@Comment{jabref-meta: saveOrderConfig:specified;author;false;year;true;abstract;false;}" + + "}" + OS.NEWLINE + OS.NEWLINE + + "@Comment{jabref-meta: databaseType:bibtex;}" + + OS.NEWLINE + OS.NEWLINE + + "@Comment{jabref-meta: saveOrderConfig:specified;author;false;year;true;abstract;false;}" + OS.NEWLINE, stringWriter.toString()); } diff --git a/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java index 776b1d84235..a2e7cd9ccfa 100644 --- a/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/CsvExportFormatTest.java @@ -15,9 +15,9 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junitpioneer.jupiter.TempDirectory; import org.mockito.Answers; @@ -28,9 +28,9 @@ @ExtendWith(TempDirectory.class) public class CsvExportFormatTest { - private Exporter exportFormat; public BibDatabaseContext databaseContext; public Charset charset; + private Exporter exportFormat; @BeforeEach public void setUp() { @@ -64,8 +64,8 @@ public void testPerformExportForSingleAuthor(@TempDirectory.TempDir Path testFol List lines = Files.readAllLines(path); assertEquals(2, lines.size()); assertEquals( - "10,\"\",\"\",\"Someone, Van Something\",\"\",\"\",,,\"\",\"\",,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"", - lines.get(1)); + "10,\"\",\"\",\"Someone, Van Something\",\"\",\"\",,,\"\",\"\",,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"", + lines.get(1)); } @Test @@ -81,8 +81,8 @@ public void testPerformExportForMultipleAuthors(@TempDirectory.TempDir Path test List lines = Files.readAllLines(path); assertEquals(2, lines.size()); assertEquals( - "10,\"\",\"\",\"von Neumann, John; Smith, John; Black Brown, Peter\",\"\",\"\",,,\"\",\"\",,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"", - lines.get(1)); + "10,\"\",\"\",\"von Neumann, John; Smith, John; Black Brown, Peter\",\"\",\"\",,,\"\",\"\",,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"", + lines.get(1)); } @Test @@ -98,8 +98,8 @@ public void testPerformExportForSingleEditor(@TempDirectory.TempDir Path testFol List lines = Files.readAllLines(tmpFile.toPath()); assertEquals(2, lines.size()); assertEquals( - "10,\"\",\"\",\"\",\"\",\"\",,,\"\",\"\",,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"Someone, Van Something\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"", - lines.get(1)); + "10,\"\",\"\",\"\",\"\",\"\",,,\"\",\"\",,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"Someone, Van Something\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"", + lines.get(1)); } @Test @@ -115,8 +115,7 @@ public void testPerformExportForMultipleEditors(@TempDirectory.TempDir Path test List lines = Files.readAllLines(tmpFile.toPath()); assertEquals(2, lines.size()); assertEquals( - "10,\"\",\"\",\"\",\"\",\"\",,,\"\",\"\",,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"von Neumann, John; Smith, John; Black Brown, Peter\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"", - lines.get(1)); + "10,\"\",\"\",\"\",\"\",\"\",,,\"\",\"\",,\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"von Neumann, John; Smith, John; Black Brown, Peter\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"", + lines.get(1)); } - } diff --git a/src/test/java/org/jabref/logic/exporter/ExporterTest.java b/src/test/java/org/jabref/logic/exporter/ExporterTest.java index e5978b76343..842319f2bb3 100644 --- a/src/test/java/org/jabref/logic/exporter/ExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/ExporterTest.java @@ -68,7 +68,7 @@ public void testExportingEmptyDatabaseYieldsEmptyFile(Exporter exportFormat, Str @ParameterizedTest @MethodSource("exportFormats") public void testExportingNullDatabaseThrowsNPE(Exporter exportFormat, String name, @TempDirectory.TempDir Path testFolder) { - assertThrows(NullPointerException.class, ()->{ + assertThrows(NullPointerException.class, () -> { Path tmpFile = testFolder.resolve("ARandomlyNamedFile"); Files.createFile(tmpFile); exportFormat.export(null, tmpFile, charset, entries); @@ -78,7 +78,7 @@ public void testExportingNullDatabaseThrowsNPE(Exporter exportFormat, String nam @ParameterizedTest @MethodSource("exportFormats") public void testExportingNullEntriesThrowsNPE(Exporter exportFormat, String name, @TempDirectory.TempDir Path testFolder) { - assertThrows(NullPointerException.class, ()->{ + assertThrows(NullPointerException.class, () -> { Path tmpFile = testFolder.resolve("ARandomlyNamedFile"); Files.createFile(tmpFile); exportFormat.export(databaseContext, tmpFile, charset, null); diff --git a/src/test/java/org/jabref/logic/exporter/FieldFormatterCleanupsTest.java b/src/test/java/org/jabref/logic/exporter/FieldFormatterCleanupsTest.java index ae6a864d198..9cea5c9c203 100644 --- a/src/test/java/org/jabref/logic/exporter/FieldFormatterCleanupsTest.java +++ b/src/test/java/org/jabref/logic/exporter/FieldFormatterCleanupsTest.java @@ -24,7 +24,6 @@ public class FieldFormatterCleanupsTest { private BibEntry entry; - @BeforeEach public void setUp() { entry = new BibEntry(); diff --git a/src/test/java/org/jabref/logic/exporter/GroupSerializerTest.java b/src/test/java/org/jabref/logic/exporter/GroupSerializerTest.java index 92549163859..b1560a3aa65 100644 --- a/src/test/java/org/jabref/logic/exporter/GroupSerializerTest.java +++ b/src/test/java/org/jabref/logic/exporter/GroupSerializerTest.java @@ -157,5 +157,4 @@ public void getTreeAsStringInComplexTree() throws Exception { ); assertEquals(expected, groupSerializer.serializeTree(root)); } - } diff --git a/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java b/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java index 87433f65fb6..7fe930f9fd5 100644 --- a/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java +++ b/src/test/java/org/jabref/logic/exporter/HtmlExportFormatTest.java @@ -14,9 +14,9 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junitpioneer.jupiter.TempDirectory; import org.mockito.Answers; @@ -26,10 +26,10 @@ @ExtendWith(TempDirectory.class) public class HtmlExportFormatTest { - private Exporter exportFormat; public BibDatabaseContext databaseContext; public Charset charset; public List entries; + private Exporter exportFormat; @BeforeEach public void setUp() { diff --git a/src/test/java/org/jabref/logic/exporter/MSBibExportFormatTestFiles.java b/src/test/java/org/jabref/logic/exporter/MSBibExportFormatTestFiles.java index ad8b02d9bd2..e1de292326a 100644 --- a/src/test/java/org/jabref/logic/exporter/MSBibExportFormatTestFiles.java +++ b/src/test/java/org/jabref/logic/exporter/MSBibExportFormatTestFiles.java @@ -35,14 +35,13 @@ @ExtendWith(TempDirectory.class) public class MSBibExportFormatTestFiles { + private static Path resourceDir; public BibDatabaseContext databaseContext; public Charset charset; public Path tempFile; public MSBibExporter msBibExportFormat; public BibtexImporter testImporter; - private static Path resourceDir; - static Stream fileNames() throws IOException, URISyntaxException { //we have to point it to one existing file, otherwise it will return the default class path resourceDir = Paths.get(MSBibExportFormatTestFiles.class.getResource("MsBibExportFormatTest1.bib").toURI()).getParent(); diff --git a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTestFiles.java b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTestFiles.java index 1c0bbbca22f..7a0d8ac6b6f 100644 --- a/src/test/java/org/jabref/logic/exporter/ModsExportFormatTestFiles.java +++ b/src/test/java/org/jabref/logic/exporter/ModsExportFormatTestFiles.java @@ -1,8 +1,5 @@ package org.jabref.logic.exporter; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Mockito.mock; - import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -19,6 +16,7 @@ import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.util.DummyFileUpdateMonitor; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.extension.ExtendWith; @@ -33,9 +31,13 @@ import org.xmlunit.diff.ElementSelectors; import org.xmlunit.matchers.CompareMatcher; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.mock; + @ExtendWith(TempDirectory.class) public class ModsExportFormatTestFiles { + private static Path resourceDir; public Charset charset; private BibDatabaseContext databaseContext; private Path tempFile; @@ -44,8 +46,6 @@ public class ModsExportFormatTestFiles { private ModsImporter modsImporter; private Path importFile; - private static Path resourceDir; - public static Stream fileNames() throws Exception { resourceDir = Paths.get(MSBibExportFormatTestFiles.class.getResource("ModsExportFormatTestAllFields.bib").toURI()).getParent(); System.out.println(resourceDir); @@ -53,7 +53,7 @@ public static Stream fileNames() throws Exception { try (Stream stream = Files.list(resourceDir)) { // stream.forEach(n -> System.out.println(n)); return stream.map(n -> n.getFileName().toString()).filter(n -> n.endsWith(".bib")) - .filter(n -> n.startsWith("Mods")).collect(Collectors.toList()).stream(); + .filter(n -> n.startsWith("Mods")).collect(Collectors.toList()).stream(); } } @@ -80,16 +80,15 @@ public final void testPerformExport(String filename) throws Exception { Path tempFilename = tempFile.toAbsolutePath(); List entries = bibtexImporter.importDatabase(importFile, charset).getDatabase().getEntries(); Path xmlFile = Paths.get(ModsExportFormatTestFiles.class.getResource(xmlFileName).toURI()); - + modsExportFormat.export(databaseContext, tempFile, charset, entries); Builder control = Input.from(Files.newInputStream(xmlFile)); Builder test = Input.from(Files.newInputStream(tempFilename)); assertThat(test, CompareMatcher.isSimilarTo(control) - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure()); + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure()); } - @ParameterizedTest @MethodSource("fileNames") public final void testExportAsModsAndThenImportAsMods(String filename) throws Exception { @@ -117,7 +116,6 @@ public final void testImportAsModsAndExportAsMods(String filename) throws Except Builder test = Input.from(Files.newInputStream(tempFilename)); assertThat(test, CompareMatcher.isSimilarTo(control) - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure()); + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)).throwComparisonFailure()); } - } diff --git a/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java b/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java index 4174683a69e..7038e8f436e 100644 --- a/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/XmpExporterTest.java @@ -59,20 +59,20 @@ public void exportSingleEntry(@TempDirectory.TempDir Path testFolder) throws Exc exporter.export(databaseContext, file, encoding, Collections.singletonList(entry)); String actual = Files.readAllLines(file).stream().collect(Collectors.joining("\n")); //we are using \n to join, so we need it in the expected string as well, \r\n would fail String expected = " \n" + - " \n" + - " \n" + - " \n" + - " Alan Turing\n" + - " \n" + - " \n" + - " application/pdf\n" + - " \n" + - " \n" + - " Misc\n" + - " \n" + - " \n" + - " \n" + - " "; + " \n" + + " \n" + + " \n" + + " Alan Turing\n" + + " \n" + + " \n" + + " application/pdf\n" + + " \n" + + " \n" + + " Misc\n" + + " \n" + + " \n" + + " \n" + + " "; assertEquals(expected, actual); } @@ -93,38 +93,38 @@ public void writeMultipleEntriesInASingleFile(@TempDirectory.TempDir Path testFo String actual = Files.readAllLines(file).stream().collect(Collectors.joining("\n")); //we are using \n to join, so we need it in the expected string as well, \r\n would fail String expected = " \n" + - " \n" + - " \n" + - " \n" + - " Alan Turing\n" + - " \n" + - " \n" + - " application/pdf\n" + - " \n" + - " \n" + - " Misc\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " Michael Armbrust\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " bibtex/bibtexkey/Armbrust2010\n" + - " \n" + - " \n" + - " application/pdf\n" + - " \n" + - " \n" + - " Misc\n" + - " \n" + - " \n" + - " \n" + - " "; + " \n" + + " \n" + + " \n" + + " Alan Turing\n" + + " \n" + + " \n" + + " application/pdf\n" + + " \n" + + " \n" + + " Misc\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " Michael Armbrust\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " bibtex/bibtexkey/Armbrust2010\n" + + " \n" + + " \n" + + " application/pdf\n" + + " \n" + + " \n" + + " Misc\n" + + " \n" + + " \n" + + " \n" + + " "; assertEquals(expected, actual); } @@ -150,20 +150,20 @@ public void writeMultipleEntriesInDifferentFiles(@TempDirectory.TempDir Path tes String actualTuring = Files.readAllLines(fileTuring).stream().collect(Collectors.joining("\n")); //we are using \n to join, so we need it in the expected string as well, \r\n would fail String expectedTuring = " \n" + - " \n" + - " \n" + - " \n" + - " Alan Turing\n" + - " \n" + - " \n" + - " application/pdf\n" + - " \n" + - " \n" + - " Misc\n" + - " \n" + - " \n" + - " \n" + - " "; + " \n" + + " \n" + + " \n" + + " Alan Turing\n" + + " \n" + + " \n" + + " application/pdf\n" + + " \n" + + " \n" + + " Misc\n" + + " \n" + + " \n" + + " \n" + + " "; assertEquals(expectedTuring, actualTuring); @@ -171,25 +171,25 @@ public void writeMultipleEntriesInDifferentFiles(@TempDirectory.TempDir Path tes String actualArmbrust = Files.readAllLines(fileArmbrust).stream().collect(Collectors.joining("\n")); //we are using \n to join, so we need it in the expected string as well, \r\n would fail String expectedArmbrust = " \n" + - " \n" + - " \n" + - " \n" + - " Michael Armbrust\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " bibtex/bibtexkey/Armbrust2010\n" + - " \n" + - " \n" + - " application/pdf\n" + - " \n" + - " \n" + - " Misc\n" + - " \n" + - " \n" + - " \n" + - " "; + " \n" + + " \n" + + " \n" + + " Michael Armbrust\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " bibtex/bibtexkey/Armbrust2010\n" + + " \n" + + " \n" + + " application/pdf\n" + + " \n" + + " \n" + + " Misc\n" + + " \n" + + " \n" + + " \n" + + " "; assertEquals(expectedArmbrust, actualArmbrust); } @@ -208,15 +208,15 @@ public void exportSingleEntryWithPrivacyFilter(@TempDirectory.TempDir Path testF exporter.export(databaseContext, file, encoding, Collections.singletonList(entry)); String actual = Files.readAllLines(file).stream().collect(Collectors.joining("\n")); String expected = " \n" + - " \n" + - " application/pdf\n" + - " \n" + - " \n" + - " Misc\n" + - " \n" + - " \n" + - " \n" + - " "; + " \n" + + " application/pdf\n" + + " \n" + + " \n" + + " Misc\n" + + " \n" + + " \n" + + " \n" + + " "; assertEquals(expected, actual); } } diff --git a/src/test/java/org/jabref/logic/formatter/FormatterTest.java b/src/test/java/org/jabref/logic/formatter/FormatterTest.java index 90ffd962d72..316fc9142c7 100644 --- a/src/test/java/org/jabref/logic/formatter/FormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/FormatterTest.java @@ -33,19 +33,20 @@ static void setUp() { } /** - * When a new formatter is added by copy and pasting another formatter, it may happen that the getKey() method is not adapted. This results in duplicate keys, which this test tests for. + * When a new formatter is added by copy and pasting another formatter, it may happen that the getKey() + * method is not adapted. This results in duplicate keys, which this test tests for. */ @Test public void allFormatterKeysAreUnique() { // idea for uniqueness checking by https://stackoverflow.com/a/44032568/873282 - assertEquals(Collections.emptyList(), - getFormatters().collect(Collectors.groupingBy( - formatter -> formatter.getKey(), - Collectors.counting())) - .entrySet().stream() - .filter(e -> e.getValue() > 1) - .map(Map.Entry::getKey) - .collect(Collectors.toList())); + assertEquals(Collections.emptyList(), + getFormatters().collect(Collectors.groupingBy( + formatter -> formatter.getKey(), + Collectors.counting())) + .entrySet().stream() + .filter(e -> e.getValue() > 1) + .map(Map.Entry::getKey) + .collect(Collectors.toList())); } @ParameterizedTest 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 7bb7788e462..85b6ef5003e 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/AddBracesFormatterTest.java @@ -3,7 +3,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} @@ -72,5 +72,4 @@ public void formatDoesNotRemoveBracesInBrokenString() { public void formatExample() { assertEquals("{In CDMA}", formatter.format(formatter.getExampleInput())); } - } diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatterTest.java index f6bd4e789fa..46e4bea3508 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/CleanupUrlFormatterTest.java @@ -6,7 +6,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** - * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} + * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ class CleanupUrlFormatterTest { @@ -32,7 +32,7 @@ void extractURLFormLink() { @Test void formatExample() { assertEquals("http://www.focus.de/" + - "gesundheit/ratgeber/herz/test/lebenserwartung-werden-sie-100-jahre-alt_aid_363828.html", + "gesundheit/ratgeber/herz/test/lebenserwartung-werden-sie-100-jahre-alt_aid_363828.html", formatter.format(formatter.getExampleInput())); } } 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 3c2fe1b9f67..ea4f8407eb5 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/ClearFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/ClearFormatterTest.java @@ -9,7 +9,6 @@ * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ - public class ClearFormatterTest { private ClearFormatter formatter; 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 13ce11e3d05..81997715f25 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatterTest.java @@ -39,7 +39,6 @@ public void testUmlauts() { assertEquals("ä", formatter.format("ä")); assertEquals("ä", formatter.format("ä")); assertEquals("ä", formatter.format("ä")); - } @Test diff --git a/src/test/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java b/src/test/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java index 4e24f6ccaa2..202aaa8ddb3 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java @@ -45,5 +45,4 @@ public void escapePercentSignOnlnyOnceWithNumber() { public void formatExample() { assertEquals("{VLSI DSP}", formatter.format(formatter.getExampleInput())); } - } 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 c6253e15112..31c3f935989 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeMonthFormatterTest.java @@ -21,5 +21,4 @@ public void setUp() { public void formatExample() { assertEquals("#dec#", formatter.format(formatter.getExampleInput())); } - } 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 77468ca156f..b0b019ddbe0 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatterTest.java @@ -108,5 +108,4 @@ public void keepFormattedACMPages() { public void formatExample() { assertEquals("1--2", 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 7ffb7179bd5..b2f417cd587 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/RemoveBracesFormatterTest.java @@ -72,5 +72,4 @@ public void formatDoesNotRemoveBracesInBrokenString() { public void formatExample() { assertEquals("In CDMA", formatter.format(formatter.getExampleInput())); } - } 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 d0554334a0e..3154a1a91fb 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/TrimWhitespaceFormatterTest.java @@ -56,6 +56,4 @@ public void removeMixedWhitespaceChars() { 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 fe4d723ad06..a4d7f3fa7cb 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/UnicodeConverterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/UnicodeConverterTest.java @@ -10,7 +10,7 @@ */ public class UnicodeConverterTest { - private UnicodeToLatexFormatter formatter; + private UnicodeToLatexFormatter formatter; @BeforeEach public void setUp() { @@ -38,5 +38,4 @@ public void testUnicode() { public 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 43d1338831a..292a79b7869 100644 --- a/src/test/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/bibtexfields/UnitsToLatexFormatterTest.java @@ -27,5 +27,4 @@ public void test() { public 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 437f42b096a..61d7fdd9837 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/CapitalizeFormatterTest.java @@ -28,5 +28,4 @@ public void test() { public void formatExample() { assertEquals("I Have {a} Dream", formatter.format(formatter.getExampleInput())); } - } 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 abc194048c6..0629e48a3fe 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/LowerCaseFormatterTest.java @@ -28,5 +28,4 @@ public void test() { public 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 a21eb71c99c..5840c12a4c6 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/ProtectTermsFormatterTest.java @@ -20,8 +20,8 @@ public class ProtectTermsFormatterTest { @BeforeEach public void setUp() { formatter = new ProtectTermsFormatter( - new ProtectedTermsLoader(new ProtectedTermsPreferences(ProtectedTermsLoader.getInternalLists(), - Collections.emptyList(), Collections.emptyList(), Collections.emptyList()))); + new ProtectedTermsLoader(new ProtectedTermsPreferences(ProtectedTermsLoader.getInternalLists(), + Collections.emptyList(), Collections.emptyList(), Collections.emptyList()))); } @Test 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 9e03374df67..9116062136f 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/SentenceCaseFormatterTest.java @@ -29,5 +29,4 @@ public void test() { public void formatExample() { assertEquals("I have {Aa} dream", formatter.format(formatter.getExampleInput())); } - } 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 faccd196267..11e22b1123d 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/TitleCaseFormatterTest.java @@ -84,5 +84,4 @@ public void testTwoExperiencesTitle() { public void formatExample() { assertEquals("{BPMN} Conformance in Open Source Engines", formatter.format(formatter.getExampleInput())); } - } 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 fd1a2aa2b7a..2c669a6a5d2 100644 --- a/src/test/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/casechanger/UpperCaseFormatterTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - /** * Tests in addition to the general tests from {@link org.jabref.logic.formatter.FormatterTest} */ 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 99a3146e3ed..28d6140e248 100644 --- a/src/test/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatterTest.java +++ b/src/test/java/org/jabref/logic/formatter/minifier/MinifyNameListFormatterTest.java @@ -1,6 +1,5 @@ package org.jabref.logic.formatter.minifier; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/org/jabref/logic/importer/BibDatabaseTestsWithFiles.java b/src/test/java/org/jabref/logic/importer/BibDatabaseTestsWithFiles.java index f8317b118c6..0bfe55d3a03 100644 --- a/src/test/java/org/jabref/logic/importer/BibDatabaseTestsWithFiles.java +++ b/src/test/java/org/jabref/logic/importer/BibDatabaseTestsWithFiles.java @@ -28,7 +28,7 @@ public void setUp() { @Test public 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)) { + InputStreamReader fr = new InputStreamReader(stream, StandardCharsets.UTF_8)) { ParserResult result = new BibtexParser(importFormatPreferences, new DummyFileUpdateMonitor()).parse(fr); BibDatabase db = result.getDatabase(); @@ -41,5 +41,4 @@ public void resolveStrings() throws IOException { assertEquals("#unknown#", db.resolveForStrings("#unknown#")); } } - } diff --git a/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java b/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java index 29313bb46e0..fdb97e6ed88 100644 --- a/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java +++ b/src/test/java/org/jabref/logic/importer/DatabaseFileLookupTest.java @@ -26,11 +26,10 @@ public class DatabaseFileLookupTest { private BibEntry entry1; private BibEntry entry2; - @BeforeEach public void setUp() throws Exception { try (FileInputStream stream = new FileInputStream(ImportDataTest.UNLINKED_FILES_TEST_BIB); - InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) { + InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8)) { ParserResult result = new BibtexParser(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS), new DummyFileUpdateMonitor()).parse(reader); database = result.getDatabase(); entries = database.getEntries(); @@ -50,5 +49,4 @@ public void testTestDatabase() { assertNotNull(entry1); assertNotNull(entry2); } - } diff --git a/src/test/java/org/jabref/logic/importer/ImportDataTest.java b/src/test/java/org/jabref/logic/importer/ImportDataTest.java index a2fa5889d09..dc457791f75 100644 --- a/src/test/java/org/jabref/logic/importer/ImportDataTest.java +++ b/src/test/java/org/jabref/logic/importer/ImportDataTest.java @@ -23,7 +23,6 @@ public class ImportDataTest { public static final File UNLINKED_FILES_TEST_BIB = Paths .get("src/test/resources/org/jabref/util/unlinkedFilesTestBib.bib").toFile(); - /** * Tests the testing environment. */ @@ -45,5 +44,4 @@ public void testOpenNotExistingDirectory() { assertFalse(ImportDataTest.NOT_EXISTING_FOLDER.exists()); assertFalse(ImportDataTest.NOT_EXISTING_PDF.exists()); } - } diff --git a/src/test/java/org/jabref/logic/importer/ImportFormatReaderIntegrationTest.java b/src/test/java/org/jabref/logic/importer/ImportFormatReaderIntegrationTest.java index e861f07b999..0550e3b8ec3 100644 --- a/src/test/java/org/jabref/logic/importer/ImportFormatReaderIntegrationTest.java +++ b/src/test/java/org/jabref/logic/importer/ImportFormatReaderIntegrationTest.java @@ -57,15 +57,14 @@ void testImportUnknownFormatFromString(String resource, String format, int count private static Stream importFormats() { Collection result = new ArrayList<>(); - result.add(new Object[] {"fileformat/RisImporterTest1.ris", "ris", 1}); - result.add(new Object[] {"fileformat/IsiImporterTest1.isi", "isi", 1}); - result.add(new Object[] {"fileformat/SilverPlatterImporterTest1.txt", "silverplatter", 1}); - result.add(new Object[] {"fileformat/RepecNepImporterTest2.txt", "repecnep", 1}); - result.add(new Object[] {"fileformat/OvidImporterTest3.txt", "ovid", 1}); - result.add(new Object[] {"fileformat/Endnote.entries.enw", "refer", 5}); - result.add(new Object[] {"fileformat/MsBibImporterTest4.xml", "msbib", 1}); - result.add(new Object[] {"fileformat/MsBibImporterTest4.bib", "bibtex", 1}); + result.add(new Object[]{"fileformat/RisImporterTest1.ris", "ris", 1}); + result.add(new Object[]{"fileformat/IsiImporterTest1.isi", "isi", 1}); + result.add(new Object[]{"fileformat/SilverPlatterImporterTest1.txt", "silverplatter", 1}); + result.add(new Object[]{"fileformat/RepecNepImporterTest2.txt", "repecnep", 1}); + result.add(new Object[]{"fileformat/OvidImporterTest3.txt", "ovid", 1}); + result.add(new Object[]{"fileformat/Endnote.entries.enw", "refer", 5}); + result.add(new Object[]{"fileformat/MsBibImporterTest4.xml", "msbib", 1}); + result.add(new Object[]{"fileformat/MsBibImporterTest4.bib", "bibtex", 1}); return result.stream(); } - } diff --git a/src/test/java/org/jabref/logic/importer/ImportFormatReaderTestParameterless.java b/src/test/java/org/jabref/logic/importer/ImportFormatReaderTestParameterless.java index fc057c3f331..9ddc2962ef0 100644 --- a/src/test/java/org/jabref/logic/importer/ImportFormatReaderTestParameterless.java +++ b/src/test/java/org/jabref/logic/importer/ImportFormatReaderTestParameterless.java @@ -38,18 +38,15 @@ void importUnknownFormatThrowsExceptionIfNoMatchingImporterWasFound() throws Exc @Test void importUnknownFormatThrowsExceptionIfPathIsNull() throws Exception { assertThrows(NullPointerException.class, () -> reader.importUnknownFormat(null, fileMonitor)); - } @Test void importUnknownFormatThrowsExceptionIfDataIsNull() throws Exception { assertThrows(NullPointerException.class, () -> reader.importUnknownFormat(null)); - } @Test void importFromFileWithUnknownFormatThrowsException() throws Exception { assertThrows(ImportException.class, () -> reader.importFromFile("someunknownformat", Paths.get("somepath"))); } - } diff --git a/src/test/java/org/jabref/logic/importer/ImporterTest.java b/src/test/java/org/jabref/logic/importer/ImporterTest.java index c16eb4a2fb2..348cce8217d 100644 --- a/src/test/java/org/jabref/logic/importer/ImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/ImporterTest.java @@ -29,9 +29,9 @@ import org.junit.jupiter.params.provider.MethodSource; import org.mockito.Mockito; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -41,50 +41,50 @@ public class ImporterTest { @ParameterizedTest @MethodSource("instancesToTest") public void isRecognizedFormatWithNullForBufferedReaderThrowsException(Importer format) { - assertThrows(NullPointerException.class, ()-> format.isRecognizedFormat((BufferedReader) null)); + assertThrows(NullPointerException.class, () -> format.isRecognizedFormat((BufferedReader) null)); } @ParameterizedTest @MethodSource("instancesToTest") public void isRecognizedFormatWithNullForStringThrowsException(Importer format) { - assertThrows(NullPointerException.class, ()-> format.isRecognizedFormat((String) null)); + assertThrows(NullPointerException.class, () -> format.isRecognizedFormat((String) null)); } @ParameterizedTest @MethodSource("instancesToTest") public void importDatabaseWithNullForBufferedReaderThrowsException(Importer format) { - assertThrows(NullPointerException.class, ()-> format.importDatabase((BufferedReader) null)); + assertThrows(NullPointerException.class, () -> format.importDatabase((BufferedReader) null)); } @ParameterizedTest @MethodSource("instancesToTest") public void importDatabaseWithNullForStringThrowsException(Importer format) { - assertThrows(NullPointerException.class, ()-> format.importDatabase((String) null)); + assertThrows(NullPointerException.class, () -> format.importDatabase((String) null)); } @ParameterizedTest @MethodSource("instancesToTest") public void getFormatterNameDoesNotReturnNull(Importer format) { - assertNotNull(format.getName()); + assertNotNull(format.getName()); } @ParameterizedTest @MethodSource("instancesToTest") public void getFileTypeDoesNotReturnNull(Importer format) { - assertNotNull(format.getFileType()); + assertNotNull(format.getFileType()); } @ParameterizedTest @MethodSource("instancesToTest") public void getIdDoesNotReturnNull(Importer format) { - assertNotNull(format.getId()); + assertNotNull(format.getId()); } @ParameterizedTest @MethodSource("instancesToTest") public void getIdDoesNotContainWhitespace(Importer format) { Pattern whitespacePattern = Pattern.compile("\\s"); - assertFalse(whitespacePattern.matcher(format.getId()).find()); + assertFalse(whitespacePattern.matcher(format.getId()).find()); } @ParameterizedTest @@ -92,16 +92,15 @@ public void getIdDoesNotContainWhitespace(Importer format) { public void getIdStripsSpecialCharactersAndConvertsToLowercase(Importer format) { Importer importer = mock(Importer.class, Mockito.CALLS_REAL_METHODS); when(importer.getName()).thenReturn("*Test-Importer"); - assertEquals("testimporter", importer.getId()); + assertEquals("testimporter", importer.getId()); } @ParameterizedTest @MethodSource("instancesToTest") public void getDescriptionDoesNotReturnNull(Importer format) { - assertNotNull(format.getDescription()); + assertNotNull(format.getDescription()); } - public static Stream instancesToTest() { // all classes implementing {@link Importer} // sorted alphabetically @@ -131,5 +130,4 @@ public static Stream instancesToTest() { ); // @formatter:on } - } diff --git a/src/test/java/org/jabref/logic/importer/OpenDatabaseTest.java b/src/test/java/org/jabref/logic/importer/OpenDatabaseTest.java index 47ca7b116dc..d722690e7a3 100644 --- a/src/test/java/org/jabref/logic/importer/OpenDatabaseTest.java +++ b/src/test/java/org/jabref/logic/importer/OpenDatabaseTest.java @@ -38,7 +38,7 @@ public OpenDatabaseTest() throws URISyntaxException { bibWrongHeader = Paths.get(OpenDatabaseTest.class.getResource("wrong-header.bib").toURI()).toFile(); bibHeader = Paths.get(OpenDatabaseTest.class.getResource("encoding-header.bib").toURI()).toFile(); bibHeaderAndSignature = Paths.get(OpenDatabaseTest.class.getResource("jabref-header.bib").toURI()) - .toFile(); + .toFile(); bibEncodingWithoutNewline = Paths .get(OpenDatabaseTest.class.getResource("encodingWithoutNewline.bib").toURI()).toFile(); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ACSTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ACSTest.java index c11b94cb2bb..6bf36592f56 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ACSTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ACSTest.java @@ -31,7 +31,7 @@ void findByDOI() throws IOException { entry.setField("doi", "10.1021/bk-2006-STYG.ch014"); assertEquals( - Optional.of(new URL("https://pubs.acs.org/doi/pdf/10.1021/bk-2006-STYG.ch014")), + Optional.of(new URL("https://pubs.acs.org/doi/pdf/10.1021/bk-2006-STYG.ch014")), finder.findFullText(entry) ); } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/AbstractIsbnFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/AbstractIsbnFetcherTest.java index 096f11e840a..ffad948cba1 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/AbstractIsbnFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/AbstractIsbnFetcherTest.java @@ -51,5 +51,4 @@ public void searchByIdThrowsExceptionForLongInvalidISB() { public void searchByIdThrowsExceptionForInvalidISBN() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("jabref-4-ever")); } - } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java index e988822af5a..ae71b8849c7 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java @@ -64,7 +64,6 @@ public void findFullTextByDOI() throws IOException { entry.setField(FieldName.TITLE, "Pause Point Spectra in DNA Constant-Force Unzipping"); assertEquals(Optional.of(new URL("http://arxiv.org/pdf/cond-mat/0406246v1")), finder.findFullText(entry)); - } @Test @@ -198,17 +197,17 @@ public void searchEmptyId() throws Exception { } @Test - public void searchWithHttpUrl() throws Exception{ + public void searchWithHttpUrl() throws Exception { assertEquals(Optional.of(sliceTheoremPaper), finder.performSearchById("http://arxiv.org/abs/1405.2249")); } @Test - public void searchWithHttpsUrl() throws Exception{ + public void searchWithHttpsUrl() throws Exception { assertEquals(Optional.of(sliceTheoremPaper), finder.performSearchById("https://arxiv.org/abs/1405.2249")); } @Test - public void searchWithHttpsUrlNotTrimmed() throws Exception{ + public void searchWithHttpsUrlNotTrimmed() throws Exception { assertEquals(Optional.of(sliceTheoremPaper), finder.performSearchById("https : // arxiv . org / abs / 1405 . 2249 ")); } } 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 51e1ba7ad97..dcf548eca80 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DBLPFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DBLPFetcherTest.java @@ -28,24 +28,23 @@ public class DBLPFetcherTest { public void setUp() { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class); when(importFormatPreferences.getFieldContentParserPreferences()) - .thenReturn(mock(FieldContentParserPreferences.class)); + .thenReturn(mock(FieldContentParserPreferences.class)); dblpFetcher = new DBLPFetcher(importFormatPreferences); entry = new BibEntry(); entry.setType(BibtexEntryTypes.ARTICLE.getName()); entry.setCiteKey("DBLP:journals/stt/GeigerHL16"); entry.setField(FieldName.TITLE, - "Process Engine Benchmarking with Betsy in the Context of {ISO/IEC} Quality Standards"); + "Process Engine Benchmarking with Betsy in the Context of {ISO/IEC} Quality Standards"); entry.setField(FieldName.AUTHOR, "Matthias Geiger and Simon Harrer and J{\\\"{o}}rg Lenhard"); entry.setField(FieldName.JOURNAL, "Softwaretechnik-Trends"); entry.setField(FieldName.VOLUME, "36"); entry.setField(FieldName.NUMBER, "2"); entry.setField(FieldName.YEAR, "2016"); entry.setField(FieldName.URL, - "http://pi.informatik.uni-siegen.de/stt/36_2/./03_Technische_Beitraege/ZEUS2016/beitrag_2.pdf"); + "http://pi.informatik.uni-siegen.de/stt/36_2/./03_Technische_Beitraege/ZEUS2016/beitrag_2.pdf"); entry.setField("biburl", "https://dblp.org/rec/bib/journals/stt/GeigerHL16"); entry.setField("bibsource", "dblp computer science bibliography, https://dblp.org"); - } @Test @@ -68,5 +67,4 @@ public void findSingleEntryUsingComplexOperators() throws FetcherException { public void findNothing() throws Exception { assertEquals(Collections.emptyList(), dblpFetcher.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 fa76e65b9b4..8fbfd9277ea 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DiVATest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DiVATest.java @@ -44,7 +44,7 @@ public void testPerformSearchById() throws Exception { entry.setField("institution", "Linköping University, The Institute of Technology"); entry.setCiteKey("Gustafsson260746"); entry.setField("journal", - "IEEE transactions on circuits and systems. 2, Analog and digital signal processing (Print)"); + "IEEE transactions on circuits and systems. 2, Analog and digital signal processing (Print)"); entry.setField("number", "11"); entry.setField("pages", "974--978"); entry.setField("title", "Lower bounds for constant multiplication problems"); 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 d6411540e39..3c8c4d130f0 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/DoiFetcherTest.java @@ -48,7 +48,6 @@ public void setUp() { bibEntryDecker2007.setField("doi", "10.1109/icws.2007.59"); } - @Test public void testGetName() { assertEquals("DOI", fetcher.getName()); @@ -79,7 +78,6 @@ public void testPerformSearchEmptyDOI() { @Test public void testPerformSearchInvalidDOI() { assertThrows(FetcherException.class, () -> fetcher.performSearchById("10.1002/9781118257517F")); - } @Test 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 e03a54eb7ec..7b887663a76 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java @@ -161,7 +161,7 @@ public void searchByIdWithOldHtmlFormatWithoutDateCheck(String id) throws Fetche /** * Helper method for allNonWithdrawnIdsWithOldHtmlFormat. * - * @param year The year of the generated IDs (e.g. 1996) + * @param year The year of the generated IDs (e.g. 1996) * @param maxId The maximum ID to generate in the given year (e.g. 112) * @return A list of IDs in the from yyyy/iii (e.g. [1996/001, 1996/002, ..., 1996/112] */ diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IsbnFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/IsbnFetcherTest.java index a8a6f0fd40a..ed140ff3dc8 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IsbnFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IsbnFetcherTest.java @@ -38,7 +38,6 @@ public void setUp() { bibEntry.setField("ean", "9780134685991"); bibEntry.setField("isbn", "0134685997"); bibEntry.setField("url", "https://www.ebook.de/de/product/28983211/joshua_bloch_effective_java.html"); - } @Test @@ -85,14 +84,12 @@ public void searchByIdThrowsExceptionForInvalidISBN() { } /** - * This test searches for a valid ISBN. See https://www.amazon.de/dp/3728128155/?tag=jabref-21 - * However, this ISBN is not available on ebook.de. The fetcher should something as it falls back to Chimbori - * @throws FetcherException + * This test searches for a valid ISBN. See https://www.amazon.de/dp/3728128155/?tag=jabref-21 However, this ISBN is + * not available on ebook.de. The fetcher should something as it falls back to Chimbori */ @Test public void searchForIsbnAvailableAtChimboriButNonOnEbookDe() throws FetcherException { Optional fetchedEntry = fetcher.performSearchById("3728128155"); assertNotEquals(Optional.empty(), fetchedEntry); } - } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IsbnViaChimboriFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/IsbnViaChimboriFetcherTest.java index 7371043febc..5eb46520f88 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IsbnViaChimboriFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IsbnViaChimboriFetcherTest.java @@ -30,7 +30,7 @@ public void setUp() { bibEntry.setField("author", "Joshua Bloch"); bibEntry.setField("isbn", "978-0321356680"); bibEntry.setField("url", - "https://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683?SubscriptionId=AKIAIOBINVZYXZQZ2U3A&tag=chimbori05-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0321356683"); + "https://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683?SubscriptionId=AKIAIOBINVZYXZQZ2U3A&tag=chimbori05-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0321356683"); fetcher = new IsbnViaChimboriFetcher(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS)); } @@ -77,7 +77,7 @@ public void authorsAreCorrectlyFormatted() throws Exception { bibEntry.setField("author", "Marlon Dumas and Marcello La Rosa and Jan Mendling and Hajo A. Reijers"); bibEntry.setField("isbn", "3642434738"); bibEntry.setField("url", - "https://www.amazon.com/Fundamentals-Business-Process-Management-Marlon/dp/3642434738?SubscriptionId=AKIAIOBINVZYXZQZ2U3A&tag=chimbori05-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=3642434738"); + "https://www.amazon.com/Fundamentals-Business-Process-Management-Marlon/dp/3642434738?SubscriptionId=AKIAIOBINVZYXZQZ2U3A&tag=chimbori05-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=3642434738"); Optional fetchedEntry = fetcher.performSearchById("3642434738"); assertEquals(Optional.of(bibEntry), fetchedEntry); @@ -88,5 +88,4 @@ public void searchForIsbnAvailableAtChimboriButNonOnEbookDe() throws Exception { Optional fetchedEntry = fetcher.performSearchById("3728128155"); assertNotEquals(Optional.empty(), fetchedEntry); } - } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/IsbnViaEbookDeFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/IsbnViaEbookDeFetcherTest.java index a20318709b1..f84fe58799d 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/IsbnViaEbookDeFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/IsbnViaEbookDeFetcherTest.java @@ -80,13 +80,12 @@ public void authorsAreCorrectlyFormatted() throws Exception { } /** - * This test searches for a valid ISBN. See https://www.amazon.de/dp/3728128155/?tag=jabref-21 - * However, this ISBN is not available on ebook.de. The fetcher should return nothing rather than throwing an exeption. + * This test searches for a valid ISBN. See https://www.amazon.de/dp/3728128155/?tag=jabref-21 However, this ISBN is + * not available on ebook.de. The fetcher should return nothing rather than throwing an exeption. */ @Test public void searchForValidButNotFoundISBN() throws Exception { Optional fetchedEntry = fetcher.performSearchById("3728128155"); assertEquals(Optional.empty(), fetchedEntry); } - } diff --git a/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java b/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java index 5c2f2787854..e66d81f0948 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MathSciNetTest.java @@ -28,7 +28,7 @@ class MathSciNetTest { void setUp() throws Exception { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class); when(importFormatPreferences.getFieldContentParserPreferences()).thenReturn( - mock(FieldContentParserPreferences.class)); + mock(FieldContentParserPreferences.class)); fetcher = new MathSciNet(importFormatPreferences); ratiuEntry = new BibEntry(); 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 82a7116f7a2..c35684edf48 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/MrDLibFetcherTest.java @@ -56,5 +56,4 @@ public void testPerformSearchForHornecker2006() throws FetcherException { public void testGetName() { assertEquals("MDL_FETCHER", fetcher.getName()); } - } 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 728ef5de1b9..715c1fb6220 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/TitleFetcherTest.java @@ -63,5 +63,4 @@ public 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/fileformat/BibTeXMLImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTest.java index 6b904f75ffd..0b2b490c0e7 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTest.java @@ -7,7 +7,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - public class BibTeXMLImporterTest { private BibTeXMLImporter importer; diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTestFiles.java b/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTestFiles.java index 6ab7a54ce7d..e25c020989f 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTestFiles.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTestFiles.java @@ -41,5 +41,4 @@ public void testIsNotRecognizedFormat(String fileName) throws IOException { public void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(new BibTeXMLImporter(), fileName, FILE_ENDING); } - } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTestTypes.java b/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTestTypes.java index 84f9035a8e8..bf66acaf56a 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTestTypes.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibTeXMLImporterTestTypes.java @@ -38,7 +38,6 @@ public static Collection types() { }); } - @ParameterizedTest @MethodSource("types") public void importConvertsToCorrectBibType(String type) throws IOException { @@ -49,7 +48,7 @@ public void importConvertsToCorrectBibType(String type) throws IOException { + type + ">\n" + "\n" + ""; List bibEntries = new BibTeXMLImporter().importDatabase(new BufferedReader(new StringReader(bibteXMLInput))) - .getDatabase().getEntries(); + .getDatabase().getEntries(); BibEntry entry = new BibEntry(); entry.setField("author", "Max Mustermann"); 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 2a979f5030d..2ee415b14ab 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTest.java @@ -16,7 +16,6 @@ public class BiblioscapeImporterTest { private BiblioscapeImporter importer; - @BeforeEach public void setUp() throws Exception { importer = new BiblioscapeImporter(); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTestTypes.java b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTestTypes.java index 12c3d195189..7e37160a023 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTestTypes.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BiblioscapeImporterTestTypes.java @@ -17,7 +17,7 @@ public class BiblioscapeImporterTestTypes { private static Stream types() { - return Arrays.stream(new String[][] { + return Arrays.stream(new String[][]{ {"journal", "article"}, {"book section", "inbook"}, {"book", "book"}, @@ -36,7 +36,7 @@ public void importConvertsToCorrectBibType(String biblioscapeType, String bibtex + "--RT-- " + biblioscapeType + "\n" + "------"; List bibEntries = new BiblioscapeImporter().importDatabase(new BufferedReader(new StringReader(bsInput))) - .getDatabase().getEntries(); + .getDatabase().getEntries(); BibEntry entry = new BibEntry(); entry.setField("author", "Baklouti, F."); 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 6e631a788c2..77330b76028 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexImporterTest.java @@ -22,18 +22,14 @@ import static org.mockito.Mockito.mock; /** - * This class tests the BibtexImporter. - * That importer is only used for --importToOpen, which is currently untested + * This class tests the BibtexImporter. That importer is only used for --importToOpen, which is currently untested *

- * TODO: - * 1. Add test for --importToOpen - * 2. Move these tests to the code opening a bibtex file + * TODO: 1. Add test for --importToOpen 2. Move these tests to the code opening a bibtex file */ public class BibtexImporterTest { private BibtexImporter importer; - @BeforeEach public void setUp() { importer = new BibtexImporter(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS), new DummyFileUpdateMonitor()); @@ -68,23 +64,23 @@ public void testImportEntries() throws IOException, URISyntaxException { assertEquals(Optional.of("13"), entry.getField("number")); assertEquals(Optional.of("3027-3036"), entry.getField("pages")); assertEquals(Optional - .of("Effect of immobilization on catalytic characteristics of saturated {Pd-N}-heterocyclic " - + "carbenes in {Mizoroki-Heck} reactions"), + .of("Effect of immobilization on catalytic characteristics of saturated {Pd-N}-heterocyclic " + + "carbenes in {Mizoroki-Heck} reactions"), entry.getField("title")); assertEquals(Optional.of("691"), entry.getField("volume")); } else if (entry.getCiteKeyOptional().get().equals("stdmodel")) { assertEquals(Optional - .of("A \\texttt{set} with three members discussing the standard model of particle physics. " - + "The \\texttt{crossref} field in the \\texttt{@set} entry and the \\texttt{entryset} field in " - + "each set member entry is needed only when using BibTeX as the backend"), + .of("A \\texttt{set} with three members discussing the standard model of particle physics. " + + "The \\texttt{crossref} field in the \\texttt{@set} entry and the \\texttt{entryset} field in " + + "each set member entry is needed only when using BibTeX as the backend"), entry.getField("annotation")); assertEquals(Optional.of("stdmodel"), entry.getField("bibtexkey")); assertEquals(Optional.of("glashow,weinberg,salam"), entry.getField("entryset")); } else if (entry.getCiteKeyOptional().get().equals("set")) { assertEquals(Optional - .of("A \\texttt{set} with three members. The \\texttt{crossref} field in the \\texttt{@set} " - + "entry and the \\texttt{entryset} field in each set member entry is needed only when using " - + "BibTeX as the backend"), + .of("A \\texttt{set} with three members. The \\texttt{crossref} field in the \\texttt{@set} " + + "entry and the \\texttt{entryset} field in each set member entry is needed only when using " + + "BibTeX as the backend"), entry.getField("annotation")); assertEquals(Optional.of("set"), entry.getField("bibtexkey")); assertEquals(Optional.of("herrmann,aksin,yoon"), entry.getField("entryset")); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java index 0da7422a378..866a5a39e57 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/BibtexParserTest.java @@ -326,7 +326,7 @@ void parseRecognizesEntryWithAtInField() throws IOException { List parsed = result.getDatabase().getEntries(); BibEntry expected = new BibEntry("article").withField(BibEntry.KEY_FIELD, "test") - .withField("author", "Ed von T@st"); + .withField("author", "Ed von T@st"); assertEquals(Collections.singletonList(expected), parsed); } @@ -938,7 +938,6 @@ void parseRecognizesStringAndEntry() throws IOException { + " Isbn = 2707318256," + " Publisher = {Minuit}," + " Title = {Questions de sociologie}," + " Year = 2002" + "}")); - BibtexString parsedString = result.getDatabase().getStringValues().iterator().next(); Collection parsedEntries = result.getDatabase().getEntries(); BibEntry parsedEntry = parsedEntries.iterator().next(); @@ -1339,7 +1338,7 @@ void integrationTestSaveOrderConfig() throws IOException { Optional saveOrderConfig = result.getMetaData().getSaveOrderConfig(); assertEquals(new SaveOrderConfig(false, new SaveOrderConfig.SortCriterion("author", false), - new SaveOrderConfig.SortCriterion("year", true), new SaveOrderConfig.SortCriterion("abstract", false)), + new SaveOrderConfig.SortCriterion("year", true), new SaveOrderConfig.SortCriterion("abstract", false)), saveOrderConfig.get()); } @@ -1442,7 +1441,6 @@ void parseOtherTypeTest() throws Exception { assertEquals(Collections.singletonList(expectedEntry), entries); } - @Test void parseRecognizesDatabaseID() throws Exception { String expectedDatabaseID = "q1w2e3r4t5z6"; 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 3baafe04f27..262291911d8 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTest.java @@ -26,7 +26,6 @@ public void setUp() throws Exception { @Test public void testsGetExtensions() { assertEquals(StandardFileType.TXT, importer.getFileType()); - } @Test @@ -34,7 +33,6 @@ public void testGetDescription() { assertEquals("Importer for COPAC format.", importer.getDescription()); } - @Test public void testImportEmptyEntries() throws Exception { Path path = Paths.get(CopacImporterTest.class.getResource("Empty.txt").toURI()); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTestFiles.java b/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTestFiles.java index dd67ddcb7b7..7b66dc89513 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTestFiles.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/CopacImporterTestFiles.java @@ -39,5 +39,4 @@ public void testIsNotRecognizedFormat(String fileName) throws IOException { public void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(new CopacImporter(), fileName, FILE_ENDING); } - } 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 835708db5d5..bec95cbb8a4 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/EndnoteImporterTest.java @@ -126,7 +126,7 @@ public void testImportEntries0() throws IOException, URISyntaxException { public 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(); + .getEntries(); BibEntry entry = bibEntries.get(0); 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 c2eaa089a38..00e6b6aef81 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/ImporterTestEngine.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/ImporterTestEngine.java @@ -69,7 +69,7 @@ private static Path getPath(String fileName) throws IOException { public static void testImportMalformedFiles(Importer importer, String fileName) throws IOException { List entries = importer.importDatabase(getPath(fileName), StandardCharsets.UTF_8).getDatabase() - .getEntries(); + .getEntries(); assertEquals(entries, new ArrayList()); } } 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 99528b89042..a2ebd1bf1b7 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/InspecImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/InspecImporterTest.java @@ -22,14 +22,8 @@ public class InspecImporterTest { - private InspecImporter importer; - private static final String FILE_ENDING = ".txt"; - - @BeforeEach - public void setUp() throws Exception { - this.importer = new InspecImporter(); - } + private InspecImporter importer; private static Stream fileNames() throws IOException { Predicate fileName = name -> name.startsWith("InspecImportTest") @@ -43,6 +37,11 @@ private static Stream nonInspecfileNames() throws IOException { return ImporterTestEngine.getTestFiles(fileName).stream(); } + @BeforeEach + public void setUp() throws Exception { + this.importer = new InspecImporter(); + } + @ParameterizedTest @MethodSource("fileNames") public void testIsRecognizedFormatAccept(String fileName) throws IOException { @@ -126,5 +125,4 @@ public void testsGetExtensions() { public 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 f511f7c7803..ddcd6398676 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/IsiImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/IsiImporterTest.java @@ -25,9 +25,8 @@ */ public class IsiImporterTest { - private final IsiImporter importer = new IsiImporter(); - private static final String FILE_ENDING = ".isi"; + private final IsiImporter importer = new IsiImporter(); private static Stream fileNames() throws IOException { Predicate fileName = name -> name.startsWith("IsiImporterTest") @@ -228,7 +227,6 @@ public void testIsiAuthorsConvert() { "Joffe, Hadine and Hall, Janet E. and Gruber, Staci and Sarmiento, Ingrid A. and Cohen, Lee S. and Yurgelun-Todd, Deborah and Martin, Kathryn A.", IsiImporter.isiAuthorsConvert( "Joffe, Hadine; Hall, Janet E; Gruber, Staci; Sarmiento, Ingrid A; Cohen, Lee S; Yurgelun-Todd, Deborah; Martin, Kathryn A")); - } @Test @@ -266,7 +264,7 @@ public void testImportIEEEExport() throws IOException, URISyntaxException { assertEquals("article", entry.getType()); assertEquals(Optional.of("Geoscience and Remote Sensing Letters, IEEE"), entry.getField("journal")); assertEquals(Optional.of("Improving Urban Road Extraction in High-Resolution " - + "Images Exploiting Directional Filtering, Perceptual " + "Grouping, and Simple Topological Concepts"), + + "Images Exploiting Directional Filtering, Perceptual " + "Grouping, and Simple Topological Concepts"), entry.getField("title")); assertEquals(Optional.of("4"), entry.getField("volume")); assertEquals(Optional.of("3"), entry.getField("number")); 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 2444508639c..b20effa34aa 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTest.java @@ -8,13 +8,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** - * Articles in the medline format can be downloaded from http://www.ncbi.nlm.nih.gov/pubmed/. - * 1. Search for a term and make sure you have selected the PubMed database - * 2. Select the results you want to export by checking their checkboxes - * 3. Press on the 'Send to' drop down menu on top of the search results - * 4. Select 'File' as Destination and 'XML' as Format - * 5. Press 'Create File' to download your search results in a medline xml file - * + * Articles in the medline format can be downloaded from http://www.ncbi.nlm.nih.gov/pubmed/. 1. Search for a term and + * make sure you have selected the PubMed database 2. Select the results you want to export by checking their checkboxes + * 3. Press on the 'Send to' drop down menu on top of the search results 4. Select 'File' as Destination and 'XML' as + * Format 5. Press 'Create File' to download your search results in a medline xml file */ public class MedlineImporterTest { @@ -44,5 +41,4 @@ public void testsGetExtensions() { public void testGetDescription() { assertEquals("Importer for the Medline format.", importer.getDescription()); } - } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTestFiles.java b/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTestFiles.java index 91c49fd3d9b..fae9374c580 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTestFiles.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MedlineImporterTestFiles.java @@ -53,6 +53,4 @@ private static Stream malformedFileNames() throws IOException { public void testImportMalfomedFiles(String fileName) throws IOException { ImporterTestEngine.testImportMalformedFiles(new MedlineImporter(), fileName); } - - } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java index 2d66b44a0c5..a3c64cf378e 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MedlinePlainImporterTest.java @@ -27,13 +27,15 @@ import org.junit.jupiter.params.provider.MethodSource; import static junit.framework.TestCase.assertTrue; -import static 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.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; class MedlinePlainImporterTest { - private MedlinePlainImporter importer; - private static final String FILE_ENDING = ".txt"; + private MedlinePlainImporter importer; private static Stream fileNames() throws IOException { Predicate fileName = name -> name.startsWith("MedlinePlainImporterTest") @@ -77,7 +79,7 @@ void testImportMultipleEntriesInSingleFile() throws IOException, URISyntaxExcept .get(MedlinePlainImporter.class.getResource("MedlinePlainImporterTestMultipleEntries.txt").toURI()); List entries = importer.importDatabase(inputFile, StandardCharsets.UTF_8).getDatabase() - .getEntries(); + .getEntries(); BibEntry testEntry = entries.get(0); assertEquals(7, entries.size()); 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 be10df36e14..56cfec29750 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTest.java @@ -69,5 +69,4 @@ public final void testGetCommandLineId() { MsBibImporter testImporter = new MsBibImporter(); assertEquals("msbib", testImporter.getId()); } - } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTestFiles.java b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTestFiles.java index cae3447b6c8..e9928fa1190 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTestFiles.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/MsBibImporterTestFiles.java @@ -39,5 +39,4 @@ public void testIsNotRecognizedFormat(String fileName) throws IOException { public void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(new MsBibImporter(), fileName, FILE_ENDING); } - } 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 e9812c4738a..d734cb20727 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/OvidImporterTest.java @@ -26,9 +26,8 @@ public class OvidImporterTest { - private OvidImporter importer; - private static final String FILE_ENDING = ".txt"; + private OvidImporter importer; private static Stream fileNames() throws IOException { Predicate fileName = name -> name.startsWith("OvidImporterTest") @@ -153,7 +152,7 @@ public void testImportSingleEntries() throws IOException, URISyntaxException { Path file = Paths.get(OvidImporter.class.getResource("OvidImporterTest" + n + ".txt").toURI()); try (InputStream nis = OvidImporter.class.getResourceAsStream("OvidImporterTestBib" + n + ".bib")) { List entries = importer.importDatabase(file, StandardCharsets.UTF_8).getDatabase() - .getEntries(); + .getEntries(); assertNotNull(entries); assertEquals(1, entries.size()); BibEntryAssert.assertEquals(nis, entries.get(0)); diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTest.java index 396ba734d2f..db7396d047c 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTest.java @@ -44,5 +44,4 @@ public void doesNotHandleEncryptedPdfs() throws URISyntaxException { List result = importer.importDatabase(file, StandardCharsets.UTF_8).getDatabase().getEntries(); assertEquals(Collections.emptyList(), result); } - } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTestFiles.java b/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTestFiles.java index 74b84bc6a3d..7dc4cef6f26 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTestFiles.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/PdfContentImporterTestFiles.java @@ -32,5 +32,4 @@ public void testIsRecognizedFormat(String fileName) throws IOException { public void testImportEntries(String fileName) throws Exception { ImporterTestEngine.testImportEntries(new PdfContentImporter(mock(ImportFormatPreferences.class)), fileName, FILE_ENDING); } - } 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 f9aedbb7094..7e46c83d27f 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/RISImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/RISImporterTest.java @@ -48,5 +48,4 @@ public void testIfNotRecognizedFormat() throws IOException, URISyntaxException { Path file = Paths.get(RISImporterTest.class.getResource("RisImporterCorrupted.ris").toURI()); assertFalse(importer.isRecognizedFormat(file, StandardCharsets.UTF_8)); } - } diff --git a/src/test/java/org/jabref/logic/importer/fileformat/SilverPlatterImporterTest.java b/src/test/java/org/jabref/logic/importer/fileformat/SilverPlatterImporterTest.java index 3ecffde377f..5fdee2d9235 100644 --- a/src/test/java/org/jabref/logic/importer/fileformat/SilverPlatterImporterTest.java +++ b/src/test/java/org/jabref/logic/importer/fileformat/SilverPlatterImporterTest.java @@ -14,7 +14,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - class SilverPlatterImporterTest { private static final String FILE_ENDING = ".txt"; @@ -63,5 +62,4 @@ void testsGetExtensions() { void testGetDescription() { assertEquals("Imports a SilverPlatter exported file.", testImporter.getDescription()); } - } diff --git a/src/test/java/org/jabref/logic/importer/util/GroupsParserTest.java b/src/test/java/org/jabref/logic/importer/util/GroupsParserTest.java index f618009b947..765f93ddcfe 100644 --- a/src/test/java/org/jabref/logic/importer/util/GroupsParserTest.java +++ b/src/test/java/org/jabref/logic/importer/util/GroupsParserTest.java @@ -87,7 +87,6 @@ public void testImportSubGroups() throws Exception { GroupTreeNode parsedNode = GroupsParser.importGroups(orderedData, ',', fileMonitor); assertEquals(rootNode.getChildren(), parsedNode.getChildren()); - } @Test diff --git a/src/test/java/org/jabref/logic/integrity/BracesCorrectorTest.java b/src/test/java/org/jabref/logic/integrity/BracesCorrectorTest.java index dbe3c745b92..b14d6e5c49f 100644 --- a/src/test/java/org/jabref/logic/integrity/BracesCorrectorTest.java +++ b/src/test/java/org/jabref/logic/integrity/BracesCorrectorTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; - public class BracesCorrectorTest { @Test diff --git a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java index 879abb26d7e..10b75ae8a37 100644 --- a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java +++ b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java @@ -135,13 +135,13 @@ public void testJournaltitleChecks() { @Test public void testBibtexkeyChecks() { final BibDatabaseContext correctContext = createContext("bibtexkey", "Knuth2014"); - correctContext.getDatabase().getEntries().get(0).setField("author","Knuth"); - correctContext.getDatabase().getEntries().get(0).setField("year","2014"); + correctContext.getDatabase().getEntries().get(0).setField("author", "Knuth"); + correctContext.getDatabase().getEntries().get(0).setField("year", "2014"); assertCorrect(correctContext); final BibDatabaseContext wrongContext = createContext("bibtexkey", "Knuth2014a"); - wrongContext.getDatabase().getEntries().get(0).setField("author","Knuth"); - wrongContext.getDatabase().getEntries().get(0).setField("year","2014"); + wrongContext.getDatabase().getEntries().get(0).setField("author", "Knuth"); + wrongContext.getDatabase().getEntries().get(0).setField("year", "2014"); assertWrong(wrongContext); } @@ -410,5 +410,4 @@ private BibDatabaseContext withMode(BibDatabaseContext context, BibDatabaseMode context.setMode(mode); return context; } - } diff --git a/src/test/java/org/jabref/logic/integrity/NoBibTexFieldCheckerTest.java b/src/test/java/org/jabref/logic/integrity/NoBibTexFieldCheckerTest.java index 7539dc826a6..1ce9aae56a7 100644 --- a/src/test/java/org/jabref/logic/integrity/NoBibTexFieldCheckerTest.java +++ b/src/test/java/org/jabref/logic/integrity/NoBibTexFieldCheckerTest.java @@ -9,7 +9,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - public class NoBibTexFieldCheckerTest { private final NoBibtexFieldChecker checker = new NoBibtexFieldChecker(); @@ -96,5 +95,4 @@ public void reviewIsNotRecognizedAsBiblatexOnlyField() { entry.setField("review", "test"); assertEquals(Collections.emptyList(), checker.check(entry)); } - } diff --git a/src/test/java/org/jabref/logic/journals/AbbreviationParserTest.java b/src/test/java/org/jabref/logic/journals/AbbreviationParserTest.java index 15c761dd2b5..4381458a39c 100644 --- a/src/test/java/org/jabref/logic/journals/AbbreviationParserTest.java +++ b/src/test/java/org/jabref/logic/journals/AbbreviationParserTest.java @@ -10,6 +10,6 @@ public class AbbreviationParserTest { public void testReadJournalListFromResource() { AbbreviationParser ap = new AbbreviationParser(); ap.readJournalListFromResource("/journals/journalList.txt"); - assertFalse(ap.getAbbreviations().isEmpty()); + assertFalse(ap.getAbbreviations().isEmpty()); } } diff --git a/src/test/java/org/jabref/logic/journals/AbbreviationTest.java b/src/test/java/org/jabref/logic/journals/AbbreviationTest.java index cf1a769df72..bfd45940a51 100644 --- a/src/test/java/org/jabref/logic/journals/AbbreviationTest.java +++ b/src/test/java/org/jabref/logic/journals/AbbreviationTest.java @@ -47,5 +47,4 @@ public void testIsoAndMedlineAbbreviationsAreSame() { Abbreviation abbreviation = new Abbreviation(" Long Name ", " L N "); assertEquals(abbreviation.getIsoAbbreviation(), abbreviation.getMedlineAbbreviation()); } - } diff --git a/src/test/java/org/jabref/logic/journals/AbbreviationsTest.java b/src/test/java/org/jabref/logic/journals/AbbreviationsTest.java index ec4ed515926..47b6240c8a5 100644 --- a/src/test/java/org/jabref/logic/journals/AbbreviationsTest.java +++ b/src/test/java/org/jabref/logic/journals/AbbreviationsTest.java @@ -24,7 +24,7 @@ public void getNextAbbreviationAbbreviatesIEEEJournalTitle() { assertEquals("#IEEE_J_PROC#", abbreviations.getRepository(prefs) - .getNextAbbreviation("Proceedings of the IEEE").get()); + .getNextAbbreviation("Proceedings of the IEEE").get()); } @Test @@ -33,27 +33,27 @@ public void getNextAbbreviationExpandsIEEEAbbreviation() { assertEquals("Proceedings of the IEEE", abbreviations.getRepository(prefs) - .getNextAbbreviation("#IEEE_J_PROC#").get()); + .getNextAbbreviation("#IEEE_J_PROC#").get()); } @Test public void getNextAbbreviationAbbreviatesJournalTitle() { assertEquals("Proc. IEEE", abbreviations.getRepository(prefs) - .getNextAbbreviation("Proceedings of the IEEE").get()); + .getNextAbbreviation("Proceedings of the IEEE").get()); } @Test public void getNextAbbreviationRemovesPoint() { assertEquals("Proc IEEE", abbreviations.getRepository(prefs) - .getNextAbbreviation("Proc. IEEE").get()); + .getNextAbbreviation("Proc. IEEE").get()); } @Test public void getNextAbbreviationExpandsAbbreviation() { assertEquals("Proceedings of the IEEE", abbreviations.getRepository(prefs) - .getNextAbbreviation("Proc IEEE").get()); + .getNextAbbreviation("Proc IEEE").get()); } } diff --git a/src/test/java/org/jabref/logic/journals/JournalAbbreviationRepositoryTest.java b/src/test/java/org/jabref/logic/journals/JournalAbbreviationRepositoryTest.java index f8c99cff5d4..5582e0f7aa9 100644 --- a/src/test/java/org/jabref/logic/journals/JournalAbbreviationRepositoryTest.java +++ b/src/test/java/org/jabref/logic/journals/JournalAbbreviationRepositoryTest.java @@ -36,7 +36,6 @@ public void oneElement() { assertTrue(repository.isKnownName("L. N.")); assertTrue(repository.isKnownName("L N")); assertFalse(repository.isKnownName("?")); - } @Test @@ -65,7 +64,5 @@ public void testDuplicateKeys() { repository.addEntry(new Abbreviation("Long Name", "LA. N.")); assertEquals(1, repository.size()); assertEquals("LA. N.", repository.getIsoAbbreviation("Long Name").orElse("WRONG")); - } - } diff --git a/src/test/java/org/jabref/logic/journals/ShippedJournalAbbreviationDuplicateTest.java b/src/test/java/org/jabref/logic/journals/ShippedJournalAbbreviationDuplicateTest.java index dbff021a2df..bda85d58207 100644 --- a/src/test/java/org/jabref/logic/journals/ShippedJournalAbbreviationDuplicateTest.java +++ b/src/test/java/org/jabref/logic/journals/ShippedJournalAbbreviationDuplicateTest.java @@ -29,5 +29,4 @@ public void noDuplicatesInShippedIEEEStandardJournalAbbreviations() { assertFalse(repoBuiltIn.getAbbreviation(abbreviation.getMedlineAbbreviation()).isPresent(), "duplicate medline " + abbreviation.toString()); }); } - } diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java index 63848639692..6f8aa2c15de 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java @@ -93,27 +93,27 @@ void languageKeysShouldNotBeQuotedInFiles() throws IOException { assertEquals(Collections.EMPTY_LIST, quotedEntries, "Language keys must not be used quoted in code! Use \"This is a message\" instead of \"This_is_a_message\".\n" + - "Please correct the following entries:\n" + - quotedEntries - .stream() - .map(key -> String.format("\n%s (%s)\n", key.getKey(), key.getPath())) - .collect(Collectors.toList())); + "Please correct the following entries:\n" + + quotedEntries + .stream() + .map(key -> String.format("\n%s (%s)\n", key.getKey(), key.getPath())) + .collect(Collectors.toList())); } @Test void findMissingLocalizationKeys() throws IOException { List missingKeys = LocalizationParser.find(LocalizationBundleForTest.LANG) - .stream() - .sorted() - .distinct() - .collect(Collectors.toList()); + .stream() + .sorted() + .distinct() + .collect(Collectors.toList()); assertEquals(Collections.emptyList(), missingKeys, "DETECTED LANGUAGE KEYS WHICH ARE NOT IN THE ENGLISH LANGUAGE FILE\n" + - "PASTE THESE INTO THE ENGLISH LANGUAGE FILE\n" + - missingKeys.parallelStream() - .map(key -> String.format("\n%s=%s\n", key.getKey(), key.getKey().replaceAll("\\\\ ", " "))) - .collect(Collectors.joining("\n"))); + "PASTE THESE INTO THE ENGLISH LANGUAGE FILE\n" + + missingKeys.parallelStream() + .map(key -> String.format("\n%s=%s\n", key.getKey(), key.getKey().replaceAll("\\\\ ", " "))) + .collect(Collectors.joining("\n"))); } @Test @@ -122,10 +122,10 @@ void findObsoleteLocalizationKeys() throws IOException { assertEquals(Collections.emptySet(), obsoleteKeys, "Obsolete keys found in language properties file: \n" + - obsoleteKeys.stream().collect(Collectors.joining("\n")) + - "\n" + - "1. CHECK IF THE KEY IS REALLY NOT USED ANYMORE\n" + - "2. REMOVE THESE FROM THE ENGLISH LANGUAGE FILE\n"); + obsoleteKeys.stream().collect(Collectors.joining("\n")) + + "\n" + + "1. CHECK IF THE KEY IS REALLY NOT USED ANYMORE\n" + + "2. REMOVE THESE FROM THE ENGLISH LANGUAGE FILE\n"); } @Test diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationEntry.java b/src/test/java/org/jabref/logic/l10n/LocalizationEntry.java index 9c814d64849..ed4fd477853 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationEntry.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationEntry.java @@ -3,7 +3,7 @@ import java.nio.file.Path; import java.util.Objects; -class LocalizationEntry implements Comparable{ +class LocalizationEntry implements Comparable { private final Path path; private final String key; @@ -42,7 +42,6 @@ public boolean equals(Object o) { return false; } return bundle == that.bundle; - } @Override diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java index 0edc4975f8b..657d0e76649 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationKeyParamsTest.java @@ -20,5 +20,4 @@ public void testReplacePlaceholders() { public 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 42a492d44fa..407800bfb6f 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationKeyTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationKeyTest.java @@ -19,5 +19,4 @@ void underscoreIsPreserved() { LocalizationKey localizationKey = new LocalizationKey("test_with_underscore"); assertEquals("test_with_underscore", localizationKey.getPropertiesKey()); } - } diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationParser.java b/src/test/java/org/jabref/logic/l10n/LocalizationParser.java index 8ffdd5a7a96..ee9d254305b 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationParser.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationParser.java @@ -32,10 +32,10 @@ public static SortedSet find(LocalizationBundleForTest type) Set entries = findLocalizationEntriesInFiles(type); Set keysInJavaFiles = entries.stream() - .map(LocalizationEntry::getKey) - .distinct() - .sorted() - .collect(Collectors.toSet()); + .map(LocalizationEntry::getKey) + .distinct() + .sorted() + .collect(Collectors.toSet()); Set englishKeys; if (type == LocalizationBundleForTest.LANG) { @@ -117,11 +117,11 @@ public static SortedSet getKeysInPropertiesFile(String path) { Properties properties = getProperties(path); return properties.keySet().stream() - .sorted() - .map(Object::toString) - .map(String::trim) - .map(e -> new LocalizationKey(e).getPropertiesKey()) - .collect(Collectors.toCollection(TreeSet::new)); + .sorted() + .map(Object::toString) + .map(String::trim) + .map(e -> new LocalizationKey(e).getPropertiesKey()) + .collect(Collectors.toCollection(TreeSet::new)); } public static Properties getProperties(String path) { @@ -222,8 +222,8 @@ public boolean containsKey(String key) { } return result.stream() - .map(key -> new LocalizationEntry(path, new LocalizationKey(key).getPropertiesKey(), type)) - .collect(Collectors.toList()); + .map(key -> new LocalizationEntry(path, new LocalizationKey(key).getPropertiesKey(), type)) + .collect(Collectors.toList()); } static class JavaLocalizationEntryParser { diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationParserTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationParserTest.java index 2463a15cdc6..b6b0f5a69de 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationParserTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationParserTest.java @@ -50,5 +50,4 @@ private void assertLocalizationParameterParsing(String code, List expect private void assertLocalizationParameterParsing(String code, String expectedParameter) { assertLocalizationParameterParsing(code, Collections.singletonList(expectedParameter)); } - } diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationTest.java index 021c5c53bd1..37d22dacead 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationTest.java @@ -65,5 +65,4 @@ void testUnknownTranslation() { void testUnsetLanguageTranslation() { assertEquals("Groups", Localization.lang("Groups")); } - } diff --git a/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java b/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java index b3f669d4ca7..340fd35f7ad 100644 --- a/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java +++ b/src/test/java/org/jabref/logic/layout/LayoutEntryTest.java @@ -12,27 +12,24 @@ import static org.mockito.Mockito.mock; /** - * The test class LayoutEntryTest test the net.sf.jabref.export.layout.LayoutEntry. - * Indirectly the net.sf.jabref.export.layout.Layout is tested too. + * The test class LayoutEntryTest test the net.sf.jabref.export.layout.LayoutEntry. Indirectly the + * net.sf.jabref.export.layout.Layout is tested too. *

- * The LayoutEntry creates a human readable String assigned with HTML formatters. - * To test the Highlighting Feature, an instance of LayoutEntry will be instantiated via Layout and LayoutHelper. - * With these instance the doLayout() Method is called several times for each test case. - * To simulate a search, a BibEntry will be created, which will be used by LayoutEntry. + * The LayoutEntry creates a human readable String assigned with HTML formatters. To test the Highlighting Feature, an + * instance of LayoutEntry will be instantiated via Layout and LayoutHelper. With these instance the doLayout() Method + * is called several times for each test case. To simulate a search, a BibEntry will be created, which will be used by + * LayoutEntry. * - * There are five test cases: - * - The shown result text has no words which should be highlighted. - * - There is one word which will be highlighted ignoring case sensitivity. - * - There are two words which will be highlighted ignoring case sensitivity. - * - There is one word which will be highlighted case sensitivity. - * - There are more words which will be highlighted case sensitivity. + * There are five test cases: - The shown result text has no words which should be highlighted. - There is one word + * which will be highlighted ignoring case sensitivity. - There are two words which will be highlighted ignoring case + * sensitivity. - There is one word which will be highlighted case sensitivity. - There are more words which will be + * highlighted case sensitivity. */ public class LayoutEntryTest { private BibEntry mBTE; - @BeforeEach public void setUp() { mBTE = new BibEntry(); @@ -95,5 +92,4 @@ public void testParseMethodCalls() { assertEquals("test", (LayoutEntry.parseMethodsCalls("bla(test),foo(fark)").get(0)).get(1)); assertEquals("fark", (LayoutEntry.parseMethodsCalls("bla(test),foo(fark)").get(1)).get(1)); } - } diff --git a/src/test/java/org/jabref/logic/layout/LayoutTest.java b/src/test/java/org/jabref/logic/layout/LayoutTest.java index 899c62d1446..34c8ae2418f 100644 --- a/src/test/java/org/jabref/logic/layout/LayoutTest.java +++ b/src/test/java/org/jabref/logic/layout/LayoutTest.java @@ -98,7 +98,7 @@ void HTMLCharsWithDotlessIAndTiled() throws IOException { } @Test - // Test for http://discourse.jabref.org/t/the-wrapfilelinks-formatter/172 (the example in the help files) + // Test for http://discourse.jabref.org/t/the-wrapfilelinks-formatter/172 (the example in the help files) void wrapFileLinksExpandFile() throws IOException { when(layoutFormatterPreferences.getFileLinkPreferences()).thenReturn( new FileLinkPreferences(Collections.emptyList(), Collections.singletonList("src/test/resources/pdfs/"))); 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 9ae1cbc797c..9ed893e166d 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorAbbreviatorTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorAbbreviatorTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + /** * Is the save as the AuthorLastFirstAbbreviator. */ @@ -21,7 +22,5 @@ public void testFormat() { assertEquals(b.format("Smith, John"), a.format("Smith, John")); assertEquals(b.format("von Neumann, John and Smith, John and Black Brown, Peter"), a .format("von Neumann, John and Smith, John and Black Brown, Peter")); - } - } diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorAndToSemicolonReplacerTest.java b/src/test/java/org/jabref/logic/layout/format/AuthorAndToSemicolonReplacerTest.java index 94b37737595..317400fbad3 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorAndToSemicolonReplacerTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorAndToSemicolonReplacerTest.java @@ -14,11 +14,11 @@ class AuthorAndToSemicolonReplacerTest { private static Stream data() { return Stream.of( - Arguments.of("",""), + Arguments.of("", ""), Arguments.of("Someone, Van Something", "Someone, Van Something"), Arguments.of("John Smith and Black Brown, Peter", "John Smith; Black Brown, Peter"), Arguments.of("von Neumann, John and Smith, John and Black Brown, Peter", "von Neumann, John; Smith, John; Black Brown, Peter"), - Arguments.of("John von Neumann and John Smith and Peter Black Brown","John von Neumann; John Smith; Peter Black Brown")); + Arguments.of("John von Neumann and John Smith and Peter Black Brown", "John von Neumann; John Smith; Peter Black Brown")); } @ParameterizedTest 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 19a643988d0..f19b4681d6e 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacerTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorAndsCommaReplacerTest.java @@ -2,14 +2,14 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorAndsCommaReplacerTest { /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorAndsCommaReplacer#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorAndsCommaReplacer#format(java.lang.String)}. */ @Test public void testFormat() { 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 44a85ca7ce6..9c2bcb40c2c 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorAndsReplacerTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorAndsReplacerTest.java @@ -2,14 +2,14 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorAndsReplacerTest { /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorAndsReplacer#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorAndsReplacer#format(java.lang.String)}. */ @Test public void testFormat() { @@ -32,5 +32,4 @@ public void testFormat() { assertEquals("John von Neumann; John Smith & Peter Black Brown", a .format("John von Neumann and John Smith and Peter Black Brown")); } - } 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 9a91ff56c9b..b4f6f544589 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastCommasTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorFirstAbbrLastCommasTest { @Test @@ -28,5 +29,4 @@ public void testFormat() { assertEquals("J. von Neumann, J. Smith and P. Black Brown", a .format("John von Neumann and John Smith and Black Brown, Peter")); } - } 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 9871a0a9da5..f35de4b55ac 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastOxfordCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstAbbrLastOxfordCommasTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorFirstAbbrLastOxfordCommasTest { /** @@ -31,5 +32,4 @@ public void testFormat() { assertEquals("J. von Neumann, J. Smith, and P. Black Brown", a .format("John von Neumann and John Smith and Black Brown, Peter")); } - } 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 97a9c29b82c..1972b6b781e 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstCommasTest.java @@ -1,13 +1,13 @@ package org.jabref.logic.layout.format; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorFirstFirstCommasTest { /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorFirstFirstCommas#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorFirstFirstCommas#format(java.lang.String)}. */ @Test public void testFormat() { @@ -15,5 +15,4 @@ public void testFormat() { 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 d61d5840520..d71647dd45e 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstFirstTest.java @@ -1,13 +1,13 @@ package org.jabref.logic.layout.format; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorFirstFirstTest { /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorFirstFirst#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorFirstFirst#format(java.lang.String)}. */ @Test public void testFormat() { @@ -15,5 +15,4 @@ public void testFormat() { 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 8607bfffeb1..6ba9a15966d 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastCommasTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorFirstLastCommasTest { /** @@ -31,5 +32,4 @@ public void testFormat() { assertEquals("John von Neumann, John Smith and Peter Black Brown", a .format("John von Neumann and John Smith and Black Brown, Peter")); } - } 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 9f8a91fd569..14c31580339 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastOxfordCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorFirstLastOxfordCommasTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorFirstLastOxfordCommasTest { /** @@ -31,5 +32,4 @@ public void testFormat() { assertEquals("John von Neumann, John Smith, and Peter Black Brown", a .format("John von Neumann and John Smith and Black Brown, Peter")); } - } 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 795c7129f0c..937f7e0a71a 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 @@ -1,13 +1,13 @@ package org.jabref.logic.layout.format; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorLF_FFAbbrTest { /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorLF_FFAbbr#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorLF_FFAbbr#format(java.lang.String)}. */ @Test public void testFormat() { @@ -15,5 +15,4 @@ public void testFormat() { 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 1531cbfd0aa..c3bd13219bc 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 @@ -1,13 +1,13 @@ package org.jabref.logic.layout.format; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorLF_FFTest { /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorLF_FF#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorLF_FF#format(java.lang.String)}. */ @Test public void testFormat() { @@ -15,5 +15,4 @@ public void testFormat() { 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 63faf76cd37..e49653a18c2 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrCommasTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorLastFirstAbbrCommasTest { /** @@ -30,7 +31,5 @@ public void testFormat() { assertEquals("von Neumann, J., Smith, J. and Black Brown, P.", a .format("John von Neumann and John Smith and Black Brown, Peter")); - } - } 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 e3ada4bd62a..21a8e6a195d 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrOxfordCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbrOxfordCommasTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorLastFirstAbbrOxfordCommasTest { /** @@ -31,5 +32,4 @@ public void testFormat() { assertEquals("von Neumann, J., Smith, J., and Black Brown, P.", a .format("John von Neumann and John Smith and Black Brown, Peter")); } - } diff --git a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbreviatorTester.java b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbreviatorTester.java index 91bf403bd74..f28a1055396 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbreviatorTester.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstAbbreviatorTester.java @@ -5,8 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** - * Test case that verifies the functionalities of the - * formater AuthorLastFirstAbbreviator. + * Test case that verifies the functionalities of the formater AuthorLastFirstAbbreviator. */ class AuthorLastFirstAbbreviatorTester { @@ -60,5 +59,4 @@ void testFormat() { private String abbreviate(String name) { return new AuthorLastFirstAbbreviator().format(name); } - } 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 9e141ca1925..8a544a5a7d0 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstCommasTest.java @@ -2,14 +2,14 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorLastFirstCommasTest { /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorLastFirstCommas#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorLastFirstCommas#format(java.lang.String)}. */ @Test public void testFormat() { @@ -33,5 +33,4 @@ public void testFormat() { assertEquals("von Neumann, John, Smith, John and Black Brown, Peter", a .format("John von Neumann and John Smith and Black Brown, Peter")); } - } 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 930a0ae6a6d..e3beacbd4b4 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommasTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstOxfordCommasTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorLastFirstOxfordCommasTest { /** @@ -31,5 +32,4 @@ public void testFormat() { assertEquals("von Neumann, John, Smith, John, and Black Brown, Peter", a .format("John von Neumann and John Smith and Black Brown, Peter")); } - } 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 8d1822ec1b7..8d26609ee87 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorLastFirstTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorLastFirstTest { @Test @@ -28,5 +29,4 @@ public void testFormat() { assertEquals("von Neumann, John and Smith, John and Black Brown, Peter", a .format("John von Neumann and John Smith and Black Brown, Peter")); } - } 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 b6308e0daa9..35b8d4b0cae 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorNatBibTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorNatBibTest.java @@ -1,13 +1,13 @@ package org.jabref.logic.layout.format; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorNatBibTest { /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorNatBib#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorNatBib#format(java.lang.String)}. */ @Test public void testFormatThreeAuthors() { @@ -16,12 +16,10 @@ public void testFormatThreeAuthors() { } /** - * Test method for - * {@link org.jabref.logic.layout.format.AuthorLF_FF#format(java.lang.String)}. + * Test method for {@link org.jabref.logic.layout.format.AuthorLF_FF#format(java.lang.String)}. */ @Test public void testFormatTwoAuthors() { assertEquals("von Neumann and Smith", new AuthorNatBib().format("von Neumann,,John and John Smith")); } - } 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 568cae4a8d3..522c4caae58 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorOrgSciTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorOrgSciTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorOrgSciTest { @Test @@ -14,7 +15,6 @@ public void testOrgSci() { assertEquals("Flynn, J., S. Gartska", f.format("John Flynn and Sabine Gartska")); assertEquals("Garvin, D. A.", f.format("David A. Garvin")); assertEquals("Makridakis, S., S. C. Wheelwright, V. E. McGee", f.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee")); - } @Test 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 581d32c236f..fe0cb06ca4d 100644 --- a/src/test/java/org/jabref/logic/layout/format/AuthorsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/AuthorsTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.ParamLayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class AuthorsTest { @Test @@ -153,5 +154,4 @@ public void testEmptyEtAl() { assertEquals("Bruce, Bob Croydon", a.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles")); } - } 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 b7869a703ff..da23a764241 100644 --- a/src/test/java/org/jabref/logic/layout/format/CompositeFormatTest.java +++ b/src/test/java/org/jabref/logic/layout/format/CompositeFormatTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class CompositeFormatTest { @Test @@ -15,7 +16,7 @@ public void testEmptyComposite() { @Test public void testArrayComposite() { - LayoutFormatter f = new CompositeFormat(new LayoutFormatter[] {fieldText -> fieldText + fieldText, + LayoutFormatter f = new CompositeFormat(new LayoutFormatter[]{fieldText -> fieldText + fieldText, fieldText -> "A" + fieldText, fieldText -> "B" + fieldText}); assertEquals("BAff", f.format("f")); @@ -33,5 +34,4 @@ public void testDoubleComposite() { assertEquals(second.format(first.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee")), f.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee")); } - } 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 fae8c751630..e14af93ecbd 100644 --- a/src/test/java/org/jabref/logic/layout/format/DOICheckTest.java +++ b/src/test/java/org/jabref/logic/layout/format/DOICheckTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class DOICheckTest { @Test @@ -34,5 +35,4 @@ public void testFormat() { // Obviously a wrong doi, will not change anything. assertEquals("1", lf.format("1")); } - } 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 c4f40d3b835..8bb16e57265 100644 --- a/src/test/java/org/jabref/logic/layout/format/DOIStripTest.java +++ b/src/test/java/org/jabref/logic/layout/format/DOIStripTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class DOIStripTest { @Test @@ -20,7 +21,5 @@ public void testFormat() { assertEquals("10.1000/ISBN1-900512-44-0", lf.format("http://doi.acm.org/10.1000/ISBN1-900512-44-0")); - } - } 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 7ada16578a6..b9f878d25ae 100644 --- a/src/test/java/org/jabref/logic/layout/format/DateFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/DateFormatterTest.java @@ -2,10 +2,11 @@ import org.jabref.logic.layout.ParamLayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class DateFormatterTest { private ParamLayoutFormatter formatter; @@ -25,5 +26,4 @@ public void testRequestedFormat() { formatter.setArgument("MM/yyyy"); assertEquals("07/2016", formatter.format("2016-07-15")); } - } 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 c4c386d2975..c746de8c858 100644 --- a/src/test/java/org/jabref/logic/layout/format/DefaultTest.java +++ b/src/test/java/org/jabref/logic/layout/format/DefaultTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.ParamLayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class DefaultTest { @Test @@ -45,5 +46,4 @@ public void testNoArgumentSetEmptyInput() { ParamLayoutFormatter a = new Default(); assertEquals("", a.format("")); } - } 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 89d6850f593..0dd5c4f7c11 100644 --- a/src/test/java/org/jabref/logic/layout/format/EntryTypeFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/EntryTypeFormatterTest.java @@ -9,7 +9,6 @@ public class EntryTypeFormatterTest { private EntryTypeFormatter formatter; - @BeforeEach public void setUp() { formatter = new EntryTypeFormatter(); @@ -29,5 +28,4 @@ public void testCorrectFormatInBook() { public void testIncorrectTypeAarticle() { assertEquals("Aarticle", formatter.format("aarticle")); } - } 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 23c5c205232..f15ae958dc2 100644 --- a/src/test/java/org/jabref/logic/layout/format/FileLinkTest.java +++ b/src/test/java/org/jabref/logic/layout/format/FileLinkTest.java @@ -8,10 +8,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; - public class FileLinkTest { private FileLinkPreferences prefs; + @BeforeEach public void setUp() throws Exception { prefs = mock(FileLinkPreferences.class); @@ -60,5 +60,4 @@ public void testMultipleFilesPickNonExistant() { a.setArgument("doc"); assertEquals("", a.format("paper:test.pdf:PDF;presentation:pres.ppt:PPT")); } - } 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 5c20c5d7898..f0aa9836743 100644 --- a/src/test/java/org/jabref/logic/layout/format/FirstPageTest.java +++ b/src/test/java/org/jabref/logic/layout/format/FirstPageTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class FirstPageTest { @Test 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 42d6a488683..1bd1c441935 100644 --- a/src/test/java/org/jabref/logic/layout/format/HTMLCharsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/HTMLCharsTest.java @@ -64,7 +64,6 @@ public void testLaTeXHighlighting() { assertEquals("hallo", layout.format("\\underline{hallo}")); assertEquals("hallo", layout.format("\\sout{hallo}")); assertEquals("hallo", layout.format("\\texttt{hallo}")); - } @Test 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 6cd36359c4e..6b2094c3ce4 100644 --- a/src/test/java/org/jabref/logic/layout/format/HTMLParagraphsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/HTMLParagraphsTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class HTMLParagraphsTest { @Test @@ -17,7 +18,5 @@ public void testFormat() { assertEquals("

\nHello\nWorld\n

", f.format("Hello\nWorld")); assertEquals("

\nHello World\n

\n

\nWhat a lovely day\n

", f.format("Hello World\n \nWhat a lovely day\n")); assertEquals("

\nHello World\n

\n

\nCould not be any better\n

\n

\nWhat a lovely day\n

", f.format("Hello World\n \n\nCould not be any better\n\nWhat a lovely day\n")); - } - } 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 5ebd278be81..bb5dbbaceff 100644 --- a/src/test/java/org/jabref/logic/layout/format/IfPluralTest.java +++ b/src/test/java/org/jabref/logic/layout/format/IfPluralTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.ParamLayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class IfPluralTest { @Test 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 64dece591f0..6647038a126 100644 --- a/src/test/java/org/jabref/logic/layout/format/LastPageTest.java +++ b/src/test/java/org/jabref/logic/layout/format/LastPageTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class LastPageTest { @Test diff --git a/src/test/java/org/jabref/logic/layout/format/LatexToUnicodeFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/LatexToUnicodeFormatterTest.java index cf4dbb86723..0c6203356dc 100644 --- a/src/test/java/org/jabref/logic/layout/format/LatexToUnicodeFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/LatexToUnicodeFormatterTest.java @@ -31,7 +31,6 @@ public void testFormatTextit() { assertEquals("\uD835\uDC61\uD835\uDC52\uD835\uDC65\uD835\uDC61", formatter.format("\\textit{text}")); } - @Test public void testEscapedDollarSign() { assertEquals("$", formatter.format("\\$")); @@ -75,7 +74,6 @@ public void testIWithDiaresisAndEscapedI() { assertEquals("ı̈", formatter.format("\\\"{\\i}")); } - @Test public void testIWithDiaresisAndUnnecessaryBraces() { assertEquals("ï", formatter.format("{\\\"{i}}")); @@ -91,7 +89,6 @@ public void testPolishName() { assertEquals("Łęski", formatter.format("\\L\\k{e}ski")); } - @Test public void testDoubleCombiningAccents() { assertEquals("ώ", formatter.format("$\\acute{\\omega}$")); @@ -190,5 +187,4 @@ public void testConversionOfOrdinal4th() { public void testConversionOfOrdinal9th() { assertEquals("9ᵗʰ", formatter.format("9\\textsuperscript{th}")); } - } 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 0b5adc77462..41ff6b2ff5d 100644 --- a/src/test/java/org/jabref/logic/layout/format/NameFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/NameFormatterTest.java @@ -1,8 +1,9 @@ package org.jabref.logic.layout.format; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class NameFormatterTest { @Test @@ -27,7 +28,6 @@ public void testFormatStringStringBibtexEntry() { assertEquals("Doe Joe and Jane, M. and Kamp, J.~A.", l.format("Joe Doe and Mary Jane and John Arthur van Kamp", "1@*@{ll}, {ff}@@*@1@{ll} {ff}@2..-1@ and {ll}, {f}.")); - } @Test @@ -58,5 +58,4 @@ public void testFormat() { assertEquals("von Neumann John, Smith, John, Vandekamp, Mary~Ann and Black~Brown, Peter", a.format( "von Neumann, John and Smith, John and Vandekamp, Mary Ann and Black Brown, Peter", formatString)); } - } 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 e49493fe097..bd787b1ce39 100644 --- a/src/test/java/org/jabref/logic/layout/format/NoSpaceBetweenAbbreviationsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/NoSpaceBetweenAbbreviationsTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class NoSpaceBetweenAbbreviationsTest { @Test @@ -16,5 +17,4 @@ public void testFormat() { assertEquals("J.R.R. Tolkien", f.format("J. R. R. Tolkien")); assertEquals("J.R.R. Tolkien and J.F. Kennedy", f.format("J. R. R. Tolkien and J. F. Kennedy")); } - } 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 3e1f6e972b1..68c50e17384 100644 --- a/src/test/java/org/jabref/logic/layout/format/RTFCharsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RTFCharsTest.java @@ -2,12 +2,12 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + class RTFCharsTest { private LayoutFormatter formatter; @@ -88,7 +88,7 @@ void testComplicated5() { @Test void testComplicated6() { assertEquals("Pchn\\u261a\\u263c w t\\u281e \\u322l\\u243od\\u378z je\\u380za lub o\\u347sm skrzy\\u324n fig" - ,formatter.format("Pchnąć w tę łódź jeża lub ośm skrzyń fig")); + , formatter.format("Pchnąć w tę łódź jeża lub ośm skrzyń fig")); } @Test @@ -131,59 +131,58 @@ void testSpecialCharacters() { } @Test - void testRTFCharacters(){ - assertEquals("\\'e0",formatter.format("\\`{a}")); - assertEquals("\\'e8",formatter.format("\\`{e}")); - assertEquals("\\'ec",formatter.format("\\`{i}")); - assertEquals("\\'f2",formatter.format("\\`{o}")); - assertEquals("\\'f9",formatter.format("\\`{u}")); - - assertEquals("\\'e1",formatter.format("\\'a")); - assertEquals("\\'e9",formatter.format("\\'e")); - assertEquals("\\'ed",formatter.format("\\'i")); - assertEquals("\\'f3",formatter.format("\\'o")); - assertEquals("\\'fa",formatter.format("\\'u")); - - assertEquals("\\'e2",formatter.format("\\^a")); - assertEquals("\\'ea",formatter.format("\\^e")); - assertEquals("\\'ee",formatter.format("\\^i")); - assertEquals("\\'f4",formatter.format("\\^o")); - assertEquals("\\'fa",formatter.format("\\^u")); - - assertEquals("\\'e4",formatter.format("\\\"a")); - assertEquals("\\'eb",formatter.format("\\\"e")); - assertEquals("\\'ef",formatter.format("\\\"i")); - assertEquals("\\'f6",formatter.format("\\\"o")); - assertEquals("\\u252u",formatter.format("\\\"u")); - - assertEquals("\\'f1",formatter.format("\\~n")); + void testRTFCharacters() { + assertEquals("\\'e0", formatter.format("\\`{a}")); + assertEquals("\\'e8", formatter.format("\\`{e}")); + assertEquals("\\'ec", formatter.format("\\`{i}")); + assertEquals("\\'f2", formatter.format("\\`{o}")); + assertEquals("\\'f9", formatter.format("\\`{u}")); + + assertEquals("\\'e1", formatter.format("\\'a")); + assertEquals("\\'e9", formatter.format("\\'e")); + assertEquals("\\'ed", formatter.format("\\'i")); + assertEquals("\\'f3", formatter.format("\\'o")); + assertEquals("\\'fa", formatter.format("\\'u")); + + assertEquals("\\'e2", formatter.format("\\^a")); + assertEquals("\\'ea", formatter.format("\\^e")); + assertEquals("\\'ee", formatter.format("\\^i")); + assertEquals("\\'f4", formatter.format("\\^o")); + assertEquals("\\'fa", formatter.format("\\^u")); + + assertEquals("\\'e4", formatter.format("\\\"a")); + assertEquals("\\'eb", formatter.format("\\\"e")); + assertEquals("\\'ef", formatter.format("\\\"i")); + assertEquals("\\'f6", formatter.format("\\\"o")); + assertEquals("\\u252u", formatter.format("\\\"u")); + + assertEquals("\\'f1", formatter.format("\\~n")); } @Test void testRTFCharactersCapital() { - assertEquals("\\'c0",formatter.format("\\`A")); - assertEquals("\\'c8",formatter.format("\\`E")); - assertEquals("\\'cc",formatter.format("\\`I")); - assertEquals("\\'d2",formatter.format("\\`O")); - assertEquals("\\'d9",formatter.format("\\`U")); - - assertEquals("\\'c1",formatter.format("\\'A")); - assertEquals("\\'c9",formatter.format("\\'E")); - assertEquals("\\'cd",formatter.format("\\'I")); - assertEquals("\\'d3",formatter.format("\\'O")); - assertEquals("\\'da",formatter.format("\\'U")); - - assertEquals("\\'c2",formatter.format("\\^A")); - assertEquals("\\'ca",formatter.format("\\^E")); - assertEquals("\\'ce",formatter.format("\\^I")); - assertEquals("\\'d4",formatter.format("\\^O")); - assertEquals("\\'db",formatter.format("\\^U")); - - assertEquals("\\'c4",formatter.format("\\\"A")); - assertEquals("\\'cb",formatter.format("\\\"E")); - assertEquals("\\'cf",formatter.format("\\\"I")); - assertEquals("\\'d6",formatter.format("\\\"O")); - assertEquals("\\'dc",formatter.format("\\\"U")); + assertEquals("\\'c0", formatter.format("\\`A")); + assertEquals("\\'c8", formatter.format("\\`E")); + assertEquals("\\'cc", formatter.format("\\`I")); + assertEquals("\\'d2", formatter.format("\\`O")); + assertEquals("\\'d9", formatter.format("\\`U")); + + assertEquals("\\'c1", formatter.format("\\'A")); + assertEquals("\\'c9", formatter.format("\\'E")); + assertEquals("\\'cd", formatter.format("\\'I")); + assertEquals("\\'d3", formatter.format("\\'O")); + assertEquals("\\'da", formatter.format("\\'U")); + + assertEquals("\\'c2", formatter.format("\\^A")); + assertEquals("\\'ca", formatter.format("\\^E")); + assertEquals("\\'ce", formatter.format("\\^I")); + assertEquals("\\'d4", formatter.format("\\^O")); + assertEquals("\\'db", formatter.format("\\^U")); + + assertEquals("\\'c4", formatter.format("\\\"A")); + assertEquals("\\'cb", formatter.format("\\\"E")); + assertEquals("\\'cf", formatter.format("\\\"I")); + assertEquals("\\'d6", formatter.format("\\\"O")); + assertEquals("\\'dc", formatter.format("\\\"U")); } - } 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 31406596bfe..1961b3dfac5 100644 --- a/src/test/java/org/jabref/logic/layout/format/RemoveTildeTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RemoveTildeTest.java @@ -2,10 +2,11 @@ import org.jabref.logic.layout.LayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class RemoveTildeTest { private LayoutFormatter formatter; 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 e5653beb9f7..3d1eb4ebb9b 100644 --- a/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ReplaceTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.ParamLayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class ReplaceTest { @Test 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 3cf2333bab6..863683620fa 100644 --- a/src/test/java/org/jabref/logic/layout/format/RisKeywordsTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RisKeywordsTest.java @@ -6,7 +6,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - public class RisKeywordsTest { @Test 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 b3880bec7cb..cd8bfbec58a 100644 --- a/src/test/java/org/jabref/logic/layout/format/RisMonthTest.java +++ b/src/test/java/org/jabref/logic/layout/format/RisMonthTest.java @@ -4,7 +4,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - public class RisMonthTest { @Test 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 59ce12216b5..be565fcdc6f 100644 --- a/src/test/java/org/jabref/logic/layout/format/ToLowerCaseTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ToLowerCaseTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; - public class ToLowerCaseTest { @Test 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 b0ca246bdd9..adb559e5bf9 100644 --- a/src/test/java/org/jabref/logic/layout/format/ToUpperCaseTest.java +++ b/src/test/java/org/jabref/logic/layout/format/ToUpperCaseTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; - public class ToUpperCaseTest { @Test 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 58e9e54c94e..6184b8ccfff 100644 --- a/src/test/java/org/jabref/logic/layout/format/WrapContentTest.java +++ b/src/test/java/org/jabref/logic/layout/format/WrapContentTest.java @@ -2,9 +2,10 @@ import org.jabref.logic.layout.ParamLayoutFormatter; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class WrapContentTest { @Test diff --git a/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java b/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java index 05dfc422f2b..09799d584b4 100644 --- a/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java +++ b/src/test/java/org/jabref/logic/layout/format/WrapFileLinksTest.java @@ -10,12 +10,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; - public class WrapFileLinksTest { private WrapFileLinks formatter; - @BeforeEach public void setUp() { FileLinkPreferences preferences = new FileLinkPreferences(Collections.emptyList(), Collections.emptyList()); @@ -34,7 +32,6 @@ public void testNull() { public void testNoFormatSetNonEmptyString() { assertThrows(NullPointerException.class, () -> formatter.format("test.pdf")); - } @Test diff --git a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java index 328f90566ad..cbb37c47408 100644 --- a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java +++ b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java @@ -44,5 +44,4 @@ public void testGetLastName() { MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertEquals("Bach", msBibAuthor.getLastName()); } - } diff --git a/src/test/java/org/jabref/logic/net/URLDownloadTest.java b/src/test/java/org/jabref/logic/net/URLDownloadTest.java index 4c4de67475b..89ea7b33183 100644 --- a/src/test/java/org/jabref/logic/net/URLDownloadTest.java +++ b/src/test/java/org/jabref/logic/net/URLDownloadTest.java @@ -91,5 +91,4 @@ public void downloadOfHttpsSucceeds() throws IOException { Path path = ftp.toTemporaryFile(); assertNotNull(path); } - } diff --git a/src/test/java/org/jabref/logic/openoffice/OOBibStyleTest.java b/src/test/java/org/jabref/logic/openoffice/OOBibStyleTest.java index dff07571e76..84d4ff9e12a 100644 --- a/src/test/java/org/jabref/logic/openoffice/OOBibStyleTest.java +++ b/src/test/java/org/jabref/logic/openoffice/OOBibStyleTest.java @@ -59,7 +59,7 @@ public void testAuthorYear() throws IOException { @Test public void testAuthorYearAsFile() throws URISyntaxException, IOException { File defFile = Paths.get(OOBibStyleTest.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) - .toFile(); + .toFile(); OOBibStyle style = new OOBibStyle(defFile, layoutFormatterPreferences, StandardCharsets.UTF_8); assertTrue(style.isValid()); assertFalse(style.isFromResource()); @@ -115,7 +115,7 @@ public void testGetNumCitationMarkerUndefined() throws IOException { style.getNumCitationMarker(Arrays.asList(1, 2, 3, 0), 1, true)); assertEquals("[" + OOBibStyle.UNDEFINED_CITATION_MARKER + "; " + OOBibStyle.UNDEFINED_CITATION_MARKER + "; " - + OOBibStyle.UNDEFINED_CITATION_MARKER + "] ", + + OOBibStyle.UNDEFINED_CITATION_MARKER + "] ", style.getNumCitationMarker(Arrays.asList(0, 0, 0), 1, true)); } @@ -151,9 +151,9 @@ public void testGetCitationMarker() throws IOException { assertEquals("[Boström et al., 2006]", style.getCitationMarker(Arrays.asList(entry), entryDBMap, true, null, null)); assertEquals("Boström et al. [2006]", - style.getCitationMarker(Arrays.asList(entry), entryDBMap, false, null, new int[] {3})); + style.getCitationMarker(Arrays.asList(entry), entryDBMap, false, null, new int[]{3})); assertEquals("[Boström, Wäyrynen, Bodén, Beznosov & Kruchten, 2006]", - style.getCitationMarker(Arrays.asList(entry), entryDBMap, true, null, new int[] {5})); + style.getCitationMarker(Arrays.asList(entry), entryDBMap, true, null, new int[]{5})); } /** @@ -345,7 +345,7 @@ public void testGetCitationMarkerInParenthesisUniquefiers() throws IOException { assertEquals("[Beta, 2000; Beta, 2000; Epsilon, 2001]", style.getCitationMarker(entries, entryDBMap, true, null, null)); assertEquals("[Beta, 2000a,b; Epsilon, 2001]", - style.getCitationMarker(entries, entryDBMap, true, new String[] {"a", "b", ""}, new int[] {1, 1, 1})); + style.getCitationMarker(entries, entryDBMap, true, new String[]{"a", "b", ""}, new int[]{1, 1, 1})); } @Test @@ -381,7 +381,7 @@ public void testGetCitationMarkerInTextUniquefiers() throws IOException { assertEquals("Beta [2000]; Beta [2000]; Epsilon [2001]", style.getCitationMarker(entries, entryDBMap, false, null, null)); assertEquals("Beta [2000a,b]; Epsilon [2001]", - style.getCitationMarker(entries, entryDBMap, false, new String[] {"a", "b", ""}, new int[] {1, 1, 1})); + style.getCitationMarker(entries, entryDBMap, false, new String[]{"a", "b", ""}, new int[]{1, 1, 1})); } @Test @@ -416,7 +416,7 @@ public void testGetCitationMarkerInParenthesisUniquefiersThreeSameAuthor() throw } assertEquals("[Beta, 2000a,b,c]", - style.getCitationMarker(entries, entryDBMap, true, new String[] {"a", "b", "c"}, new int[] {1, 1, 1})); + style.getCitationMarker(entries, entryDBMap, true, new String[]{"a", "b", "c"}, new int[]{1, 1, 1})); } @Test @@ -451,7 +451,7 @@ public void testGetCitationMarkerInTextUniquefiersThreeSameAuthor() throws IOExc } assertEquals("Beta [2000a,b,c]", - style.getCitationMarker(entries, entryDBMap, false, new String[] {"a", "b", "c"}, new int[] {1, 1, 1})); + style.getCitationMarker(entries, entryDBMap, false, new String[]{"a", "b", "c"}, new int[]{1, 1, 1})); } @Test diff --git a/src/test/java/org/jabref/logic/openoffice/OOPreFormatterTest.java b/src/test/java/org/jabref/logic/openoffice/OOPreFormatterTest.java index 2c51434577e..8b76fbeacd0 100644 --- a/src/test/java/org/jabref/logic/openoffice/OOPreFormatterTest.java +++ b/src/test/java/org/jabref/logic/openoffice/OOPreFormatterTest.java @@ -4,7 +4,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - public class OOPreFormatterTest { @Test @@ -39,7 +38,6 @@ public void testUnsupportedSpecialCommands() { assertEquals("ftmchaaa", new OOPreFormatter().format("{\\ftmch\\aaa}")); } - @Test public void testEquations() { assertEquals("Σ", new OOPreFormatter().format("$\\Sigma$")); diff --git a/src/test/java/org/jabref/logic/openoffice/StyleLoaderTest.java b/src/test/java/org/jabref/logic/openoffice/StyleLoaderTest.java index 945b70fa356..3765fd37f39 100644 --- a/src/test/java/org/jabref/logic/openoffice/StyleLoaderTest.java +++ b/src/test/java/org/jabref/logic/openoffice/StyleLoaderTest.java @@ -30,19 +30,16 @@ public class StyleLoaderTest { private LayoutFormatterPreferences layoutPreferences; private Charset encoding; - @BeforeEach public void setUp() { preferences = mock(OpenOfficePreferences.class, Answers.RETURNS_DEEP_STUBS); layoutPreferences = mock(LayoutFormatterPreferences.class, Answers.RETURNS_DEEP_STUBS); encoding = StandardCharsets.UTF_8; - } @Test public void throwNPEWithNullPreferences() { assertThrows(NullPointerException.class, () -> loader = new StyleLoader(null, layoutPreferences, mock(Charset.class))); - } @Test @@ -69,7 +66,7 @@ public void testAddStyleLeadsToOneMoreStyle() throws URISyntaxException { loader = new StyleLoader(preferences, layoutPreferences, encoding); String filename = Paths.get(StyleLoader.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) - .toFile().getPath(); + .toFile().getPath(); loader.addStyleIfValid(filename); assertEquals(numberOfInternalStyles + 1, loader.getStyles().size()); } @@ -86,7 +83,7 @@ public void testAddInvalidStyleLeadsToNoMoreStyle() { @Test public void testInitalizeWithOneExternalFile() throws URISyntaxException { String filename = Paths.get(StyleLoader.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) - .toFile().getPath(); + .toFile().getPath(); when(preferences.getExternalStyles()).thenReturn(Collections.singletonList(filename)); loader = new StyleLoader(preferences, layoutPreferences, encoding); assertEquals(numberOfInternalStyles + 1, loader.getStyles().size()); @@ -103,7 +100,7 @@ public void testInitalizeWithIncorrectExternalFile() { @Test public void testInitalizeWithOneExternalFileRemoveStyle() throws URISyntaxException { String filename = Paths.get(StyleLoader.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) - .toFile().getPath(); + .toFile().getPath(); when(preferences.getExternalStyles()).thenReturn(Collections.singletonList(filename)); loader = new StyleLoader(preferences, layoutPreferences, encoding); @@ -124,7 +121,7 @@ public void testInitalizeWithOneExternalFileRemoveStyle() throws URISyntaxExcept @Test public void testInitalizeWithOneExternalFileRemoveStyleUpdatesPreferences() throws URISyntaxException { String filename = Paths.get(StyleLoader.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) - .toFile().getPath(); + .toFile().getPath(); when(preferences.getExternalStyles()).thenReturn(Collections.singletonList(filename)); loader = new StyleLoader(preferences, layoutPreferences, encoding); @@ -148,7 +145,7 @@ public void testAddSameStyleTwiceLeadsToOneMoreStyle() throws URISyntaxException loader = new StyleLoader(preferences, layoutPreferences, encoding); int beforeAdding = loader.getStyles().size(); String filename = Paths.get(StyleLoader.class.getResource(StyleLoader.DEFAULT_AUTHORYEAR_STYLE_PATH).toURI()) - .toFile().getPath(); + .toFile().getPath(); loader.addStyleIfValid(filename); loader.addStyleIfValid(filename); assertEquals(beforeAdding + 1, loader.getStyles().size()); @@ -158,7 +155,6 @@ public void testAddSameStyleTwiceLeadsToOneMoreStyle() throws URISyntaxException public void testAddNullStyleThrowsNPE() { loader = new StyleLoader(preferences, layoutPreferences, encoding); assertThrows(NullPointerException.class, () -> loader.addStyleIfValid(null)); - } @Test @@ -206,5 +202,4 @@ public void testRemoveInternalStyleReturnsFalseAndDoNotRemove() { assertFalse(loader.removeStyle(toremove.get(0))); assertEquals(numberOfInternalStyles, loader.getStyles().size()); } - } diff --git a/src/test/java/org/jabref/logic/pdf/PdfAnnotationImporterTest.java b/src/test/java/org/jabref/logic/pdf/PdfAnnotationImporterTest.java index 01bb95f00ea..fc0bb832b35 100644 --- a/src/test/java/org/jabref/logic/pdf/PdfAnnotationImporterTest.java +++ b/src/test/java/org/jabref/logic/pdf/PdfAnnotationImporterTest.java @@ -12,7 +12,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - public class PdfAnnotationImporterTest { private final AnnotationImporter importer = new PdfAnnotationImporter(); diff --git a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java index da3b4ddf5f1..c8fbdf7f7e6 100644 --- a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java +++ b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsListTest.java @@ -6,8 +6,8 @@ import java.util.ArrayList; import java.util.Arrays; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junitpioneer.jupiter.TempDirectory; @@ -99,5 +99,4 @@ public void testTermAddedToExternalList() { externalList.addProtectedTerm("CCC"); assertTrue(externalList.getTermList().contains("CCC")); } - } diff --git a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java index f73da3e5b45..0cc24dc3b8a 100644 --- a/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java +++ b/src/test/java/org/jabref/logic/protectedterms/ProtectedTermsLoaderTest.java @@ -12,8 +12,8 @@ import org.jabref.logic.l10n.Localization; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junitpioneer.jupiter.TempDirectory; @@ -30,7 +30,6 @@ class ProtectedTermsLoaderTest { void setUp() { loader = new ProtectedTermsLoader(new ProtectedTermsPreferences(ProtectedTermsLoader.getInternalLists(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList())); - } @Test @@ -43,7 +42,7 @@ void testGetProtectedTerms() throws URISyntaxException { assertTrue(loader.getProtectedTermsLists().isEmpty()); String filename = Paths.get( ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/namedterms.terms").toURI()) - .toFile().getPath(); + .toFile().getPath(); loader.addProtectedTermsListFromFile(filename, true); assertEquals(Arrays.asList("Einstein"), loader.getProtectedTerms()); } @@ -52,7 +51,7 @@ void testGetProtectedTerms() throws URISyntaxException { void testAddProtectedTermsListFromFile() throws URISyntaxException { String filename = Paths .get(ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/namedterms.terms") - .toURI()) + .toURI()) .toFile().getPath(); assertEquals(ProtectedTermsLoader.getInternalLists().size(), loader.getProtectedTermsLists().size()); loader.addProtectedTermsListFromFile(filename, false); @@ -63,7 +62,7 @@ void testAddProtectedTermsListFromFile() throws URISyntaxException { void testReadProtectedTermsListFromFileReadsDescription() throws URISyntaxException, FileNotFoundException { File file = Paths.get( ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/namedterms.terms").toURI()) - .toFile(); + .toFile(); ProtectedTermsList list = ProtectedTermsLoader.readProtectedTermsListFromFile(file, true); assertEquals("Term list", list.getDescription()); } @@ -72,7 +71,7 @@ void testReadProtectedTermsListFromFileReadsDescription() throws URISyntaxExcept void testReadProtectedTermsListFromFileDisabledWorks() throws URISyntaxException, FileNotFoundException { File file = Paths.get( ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/namedterms.terms").toURI()) - .toFile(); + .toFile(); ProtectedTermsList list = ProtectedTermsLoader.readProtectedTermsListFromFile(file, false); assertFalse(list.isEnabled()); } @@ -81,7 +80,7 @@ void testReadProtectedTermsListFromFileDisabledWorks() throws URISyntaxException void testReadProtectedTermsListFromFileEnabledWorks() throws URISyntaxException, FileNotFoundException { File file = Paths.get( ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/namedterms.terms").toURI()) - .toFile(); + .toFile(); ProtectedTermsList list = ProtectedTermsLoader.readProtectedTermsListFromFile(file, true); assertTrue(list.isEnabled()); } @@ -90,7 +89,7 @@ void testReadProtectedTermsListFromFileEnabledWorks() throws URISyntaxException, void testReadProtectedTermsListFromFileIsNotInternalList() throws URISyntaxException, FileNotFoundException { File file = Paths.get( ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/namedterms.terms").toURI()) - .toFile(); + .toFile(); ProtectedTermsList list = ProtectedTermsLoader.readProtectedTermsListFromFile(file, true); assertFalse(list.isInternalList()); } @@ -100,8 +99,8 @@ void testReadProtectedTermsListFromFileNoDescriptionGivesDefaultDescription() throws URISyntaxException, FileNotFoundException { File file = Paths.get( ProtectedTermsLoader.class.getResource("/org/jabref/logic/protectedterms/unnamedterms.terms") - .toURI()) - .toFile(); + .toURI()) + .toFile(); ProtectedTermsList list = ProtectedTermsLoader.readProtectedTermsListFromFile(file, true); assertEquals(Localization.lang("The text after the last line starting with # will be used"), list.getDescription()); diff --git a/src/test/java/org/jabref/logic/remote/RemoteCommunicationTest.java b/src/test/java/org/jabref/logic/remote/RemoteCommunicationTest.java index a5bfe728722..9f5a34ed95f 100644 --- a/src/test/java/org/jabref/logic/remote/RemoteCommunicationTest.java +++ b/src/test/java/org/jabref/logic/remote/RemoteCommunicationTest.java @@ -16,8 +16,8 @@ import static org.mockito.Mockito.verify; /** - * Tests for the case where the client and server are set-up correctly. - * Testing the exceptional cases happens in {@link RemoteSetupTest}. + * Tests for the case where the client and server are set-up correctly. Testing the exceptional cases happens in {@link + * RemoteSetupTest}. */ @DisabledOnCIServer("Tests fails sporadically on CI server") class RemoteCommunicationTest { diff --git a/src/test/java/org/jabref/logic/remote/RemotePreferencesTest.java b/src/test/java/org/jabref/logic/remote/RemotePreferencesTest.java index 3b7b5c85470..a1a5aab1a72 100644 --- a/src/test/java/org/jabref/logic/remote/RemotePreferencesTest.java +++ b/src/test/java/org/jabref/logic/remote/RemotePreferencesTest.java @@ -11,7 +11,6 @@ public class RemotePreferencesTest { private RemotePreferences preferences; - @BeforeEach public void setUp() { preferences = new RemotePreferences(1000, true); @@ -48,5 +47,4 @@ public void testIsDifferentPortTrue() { public void testIsDifferentPortFalse() { assertFalse(preferences.isDifferentPort(1000)); } - } diff --git a/src/test/java/org/jabref/logic/search/DatabaseSearcherTest.java b/src/test/java/org/jabref/logic/search/DatabaseSearcherTest.java index b5c18e1234d..e1ac0540649 100644 --- a/src/test/java/org/jabref/logic/search/DatabaseSearcherTest.java +++ b/src/test/java/org/jabref/logic/search/DatabaseSearcherTest.java @@ -18,7 +18,6 @@ public class DatabaseSearcherTest { private BibDatabase database; - @BeforeEach public void setUp() { database = new BibDatabase(); diff --git a/src/test/java/org/jabref/logic/search/SearchQueryHighlightObservableTest.java b/src/test/java/org/jabref/logic/search/SearchQueryHighlightObservableTest.java index 33011ec476a..fbe998e8a85 100644 --- a/src/test/java/org/jabref/logic/search/SearchQueryHighlightObservableTest.java +++ b/src/test/java/org/jabref/logic/search/SearchQueryHighlightObservableTest.java @@ -3,9 +3,8 @@ import java.util.Optional; import java.util.regex.Pattern; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; - +import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; @@ -15,7 +14,6 @@ import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.verify; - class SearchQueryHighlightObservableTest { @Captor ArgumentCaptor> captor; diff --git a/src/test/java/org/jabref/logic/search/SearchQueryTest.java b/src/test/java/org/jabref/logic/search/SearchQueryTest.java index 029b03ce147..2718943d6a6 100644 --- a/src/test/java/org/jabref/logic/search/SearchQueryTest.java +++ b/src/test/java/org/jabref/logic/search/SearchQueryTest.java @@ -10,7 +10,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; - public class SearchQueryTest { @Test @@ -183,7 +182,6 @@ public void isMatchedForNormalAndFieldBasedSearchMixed() { entry.setField("abstract", "text"); assertTrue(new SearchQuery("text AND author=asdf", true, true).isMatch(entry)); - } @Test @@ -194,5 +192,4 @@ public void testSimpleTerm() { assertFalse(result.isGrammarBasedSearch()); } - } diff --git a/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java b/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java index 64a1eeb381e..1594d8a93da 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSConnectionTest.java @@ -26,6 +26,6 @@ public void testGetConnection(DBMSType dbmsType) throws SQLException, InvalidDBM @Test public void testGetConnectionFail(DBMSType dbmsType) throws SQLException, InvalidDBMSConnectionPropertiesException { assertThrows(SQLException.class, - () -> new DBMSConnection(new DBMSConnectionProperties(dbmsType, "XXXX", 0, "XXXX", "XXXX", "XXXX", false)).getConnection()); + () -> new DBMSConnection(new DBMSConnectionProperties(dbmsType, "XXXX", 0, "XXXX", "XXXX", "XXXX", false)).getConnection()); } } diff --git a/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java b/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java index 72df4f9301e..1d84949752b 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSProcessorTest.java @@ -33,10 +33,10 @@ class DBMSProcessorTest { private static Stream getTestingDatabaseSystems() throws InvalidDBMSConnectionPropertiesException, SQLException { Collection result = new ArrayList<>(); for (DBMSType dbmsType : TestManager.getDBMSTypeTestParameter()) { - result.add(new Object[] { - dbmsType, - TestConnector.getTestDBMSConnection(dbmsType), - DBMSProcessor.getProcessorInstance(TestConnector.getTestDBMSConnection(dbmsType))}); + result.add(new Object[]{ + dbmsType, + TestConnector.getTestDBMSConnection(dbmsType), + DBMSProcessor.getProcessorInstance(TestConnector.getTestDBMSConnection(dbmsType))}); } return result.stream(); } diff --git a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java index 036309362e1..c9f6ff3ecd5 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java @@ -38,14 +38,18 @@ @DatabaseTest public class DBMSSynchronizerTest { + @Parameter + public DBMSType dbmsType; private DBMSSynchronizer dbmsSynchronizer; private DBMSConnection dbmsConnection; private DBMSProcessor dbmsProcessor; private BibDatabase bibDatabase; private GlobalBibtexKeyPattern pattern; - @Parameter - public DBMSType dbmsType; + @Parameters(name = "Test with {0} database system") + public static Collection getTestingDatabaseSystems() { + return TestManager.getDBMSTypeTestParameter(); + } @BeforeEach public void setUp() throws SQLException, DatabaseNotSupportedException, InvalidDBMSConnectionPropertiesException { @@ -63,12 +67,6 @@ public void setUp() throws SQLException, DatabaseNotSupportedException, InvalidD bibDatabase.registerListener(dbmsSynchronizer); dbmsSynchronizer.openSharedDatabase(dbmsConnection); - - } - - @Parameters(name = "Test with {0} database system") - public static Collection getTestingDatabaseSystems() { - return TestManager.getDBMSTypeTestParameter(); } @Test @@ -99,7 +97,6 @@ public void testFieldChangedEventListener() { assertEquals(1, actualEntries.size()); assertEquals(expectedEntry.getField("author"), actualEntries.get(0).getField("author")); assertEquals("The nano processor1", actualEntries.get(0).getField("title").get()); - } @Test @@ -200,7 +197,6 @@ public void testApplyMetaData() { dbmsSynchronizer.applyMetaData(); assertEquals("wirthlin, michael j1", bibEntry.getField("author").get()); - } private BibEntry getBibEntryExample(int index) { @@ -216,5 +212,4 @@ private BibEntry getBibEntryExample(int index) { public void clear() throws SQLException { TestManager.clearTables(dbmsConnection); } - } diff --git a/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java b/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java index 3c350aeb6d3..855f522a239 100644 --- a/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java +++ b/src/test/java/org/jabref/logic/shared/DBMSTypeTest.java @@ -46,5 +46,4 @@ public void testGetDefaultPort() { assertEquals(5432, DBMSType.POSTGRESQL.getDefaultPort()); assertEquals(1521, DBMSType.ORACLE.getDefaultPort()); } - } diff --git a/src/test/java/org/jabref/logic/shared/SynchronizationTestEventListener.java b/src/test/java/org/jabref/logic/shared/SynchronizationTestEventListener.java index 99a554422a9..efef81b7cbc 100644 --- a/src/test/java/org/jabref/logic/shared/SynchronizationTestEventListener.java +++ b/src/test/java/org/jabref/logic/shared/SynchronizationTestEventListener.java @@ -12,7 +12,6 @@ public class SynchronizationTestEventListener { private SharedEntryNotPresentEvent sharedEntryNotPresentEvent; private UpdateRefusedEvent updateRefusedEvent; - @Subscribe public void listen(SharedEntryNotPresentEvent event) { this.sharedEntryNotPresentEvent = event; diff --git a/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java b/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java index 276167728f1..058216af789 100644 --- a/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java +++ b/src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java @@ -29,15 +29,17 @@ @DatabaseTest public class SynchronizationTestSimulator { + @Parameter + public DBMSType dbmsType; private BibDatabaseContext clientContextA; private BibDatabaseContext clientContextB; - private SynchronizationTestEventListener eventListenerB; // used to monitor occurring events - private DBMSConnection dbmsConnection; - @Parameter - public DBMSType dbmsType; + @Parameters(name = "Test with {0} database system") + public static Collection getTestingDatabaseSystems() { + return TestManager.getDBMSTypeTestParameter(); + } @BeforeEach public void setUp() throws SQLException, DatabaseNotSupportedException, InvalidDBMSConnectionPropertiesException { @@ -57,11 +59,6 @@ public void setUp() throws SQLException, DatabaseNotSupportedException, InvalidD clientContextB.getDBMSSynchronizer().registerListener(eventListenerB); } - @Parameters(name = "Test with {0} database system") - public static Collection getTestingDatabaseSystems() { - return TestManager.getDBMSTypeTestParameter(); - } - @Test public void simulateEntryInsertionAndManualPull() { //client A inserts an entry diff --git a/src/test/java/org/jabref/logic/shared/TestManager.java b/src/test/java/org/jabref/logic/shared/TestManager.java index 1413275de95..6c9ec6fd5b6 100644 --- a/src/test/java/org/jabref/logic/shared/TestManager.java +++ b/src/test/java/org/jabref/logic/shared/TestManager.java @@ -9,8 +9,8 @@ import org.jabref.model.database.shared.DBMSType; /** - * This class provides helping methods for database tests. - * Furthermore it determines database systems which are ready to be used for tests. + * This class provides helping methods for database tests. Furthermore it determines database systems which are ready to + * be used for tests. */ public class TestManager { @@ -41,11 +41,11 @@ public static void clearTables(DBMSConnection dbmsConnection) throws SQLExceptio dbmsConnection.getConnection().createStatement().executeUpdate("DROP TABLE IF EXISTS \"METADATA\""); } else if (dbmsType == DBMSType.ORACLE) { dbmsConnection.getConnection().createStatement() - .executeUpdate("BEGIN\n" + "EXECUTE IMMEDIATE 'DROP TABLE \"FIELD\"';\n" - + "EXECUTE IMMEDIATE 'DROP TABLE \"ENTRY\"';\n" - + "EXECUTE IMMEDIATE 'DROP TABLE \"METADATA\"';\n" - + "EXECUTE IMMEDIATE 'DROP SEQUENCE \"ENTRY_SEQ\"';\n" + "EXCEPTION\n" + "WHEN OTHERS THEN\n" - + "IF SQLCODE != -942 THEN\n" + "RAISE;\n" + "END IF;\n" + "END;"); + .executeUpdate("BEGIN\n" + "EXECUTE IMMEDIATE 'DROP TABLE \"FIELD\"';\n" + + "EXECUTE IMMEDIATE 'DROP TABLE \"ENTRY\"';\n" + + "EXECUTE IMMEDIATE 'DROP TABLE \"METADATA\"';\n" + + "EXECUTE IMMEDIATE 'DROP SEQUENCE \"ENTRY_SEQ\"';\n" + "EXCEPTION\n" + "WHEN OTHERS THEN\n" + + "IF SQLCODE != -942 THEN\n" + "RAISE;\n" + "END IF;\n" + "END;"); } } } diff --git a/src/test/java/org/jabref/logic/util/DevelopmentStageTest.java b/src/test/java/org/jabref/logic/util/DevelopmentStageTest.java index 5e520890608..b2d33d2eed7 100644 --- a/src/test/java/org/jabref/logic/util/DevelopmentStageTest.java +++ b/src/test/java/org/jabref/logic/util/DevelopmentStageTest.java @@ -1,7 +1,5 @@ package org.jabref.logic.util; - - import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -34,5 +32,4 @@ public void parseNull() { public void parseUnknownString() { assertEquals(Version.DevelopmentStage.UNKNOWN, Version.DevelopmentStage.parse("asdf")); } - } diff --git a/src/test/java/org/jabref/logic/util/JavaVersionTest.java b/src/test/java/org/jabref/logic/util/JavaVersionTest.java index 5f67d084363..443b404f803 100644 --- a/src/test/java/org/jabref/logic/util/JavaVersionTest.java +++ b/src/test/java/org/jabref/logic/util/JavaVersionTest.java @@ -8,18 +8,13 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; - /** * Tests for ensuring we can compare most appearing version strings */ public class JavaVersionTest { private static List java = new ArrayList<>(); - private static List java9 = new ArrayList<>(); - - private final static JavaVersion nullCheck = new JavaVersion(null); - private final static JavaVersion noSenseCheck = new JavaVersion("U.N.K.N.O.W.N"); - + private static List java9 = new ArrayList<>(); static { java.add("1.6.0_10"); // Oracle @@ -54,8 +49,8 @@ public void isJava9() throws Exception { } // For impossible comparisons we assume it's not java 9 - assertFalse(nullCheck.isJava9()); - assertFalse(noSenseCheck.isJava9()); + assertFalse(new JavaVersion(null).isJava9()); + assertFalse(new JavaVersion("U.N.K.N.O.W.N").isJava9()); } @Test @@ -68,11 +63,10 @@ public void isAtLeast() throws Exception { // Check if we optimistically return true if we cannot determine the result assertTrue(java8Example.isAtLeast(null)); - assertTrue(nullCheck.isAtLeast(version8)); - assertTrue(noSenseCheck.isAtLeast(version8)); + assertTrue(new JavaVersion(null).isAtLeast(version8)); + assertTrue(new JavaVersion("U.N.K.N.O.W.N").isAtLeast(version8)); assertTrue(java8Example.isAtLeast("useless")); - // Check against all java 9 entries in both directions for (String version9 : java9) { assertFalse(java8Example.isAtLeast(version9)); diff --git a/src/test/java/org/jabref/logic/util/UpdateFieldTest.java b/src/test/java/org/jabref/logic/util/UpdateFieldTest.java index d79d4014bff..57a15b34621 100644 --- a/src/test/java/org/jabref/logic/util/UpdateFieldTest.java +++ b/src/test/java/org/jabref/logic/util/UpdateFieldTest.java @@ -13,12 +13,10 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; - public class UpdateFieldTest { private BibEntry entry; - @BeforeEach public void setUp() throws Exception { entry = new BibEntry(); @@ -168,5 +166,4 @@ public void testUpdateNonDisplayableFieldHasNotChanged() { UpdateField.updateNonDisplayableField(entry, "year", "2016"); assertFalse(entry.hasChanged()); } - } diff --git a/src/test/java/org/jabref/logic/util/VersionTest.java b/src/test/java/org/jabref/logic/util/VersionTest.java index b2f90644b65..7601f29910e 100644 --- a/src/test/java/org/jabref/logic/util/VersionTest.java +++ b/src/test/java/org/jabref/logic/util/VersionTest.java @@ -1,6 +1,5 @@ package org.jabref.logic.util; - import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -283,5 +282,4 @@ public void alphaShouldBeUpdatedToStables() { List availableVersions = Arrays.asList(Version.parse("2.8-beta"), stable); assertEquals(Optional.of(stable), alpha.shouldBeUpdatedTo(availableVersions)); } - } diff --git a/src/test/java/org/jabref/logic/util/io/CiteKeyBasedFileFinderTest.java b/src/test/java/org/jabref/logic/util/io/CiteKeyBasedFileFinderTest.java index 9d3a8374416..0629afe3a97 100644 --- a/src/test/java/org/jabref/logic/util/io/CiteKeyBasedFileFinderTest.java +++ b/src/test/java/org/jabref/logic/util/io/CiteKeyBasedFileFinderTest.java @@ -1,8 +1,8 @@ package org.jabref.logic.util.io; import java.io.IOException; -import java.nio.file.*; -import java.nio.file.attribute.BasicFileAttributes; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -10,7 +10,6 @@ import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibtexEntryTypes; -import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; 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 7073e65415e..4103e8b7d23 100644 --- a/src/test/java/org/jabref/logic/util/io/FileUtilTest.java +++ b/src/test/java/org/jabref/logic/util/io/FileUtilTest.java @@ -2,7 +2,10 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.nio.file.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -19,7 +22,11 @@ import org.junitpioneer.jupiter.TempDirectory; import org.mockito.Answers; -import static 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.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; @ExtendWith(TempDirectory.class) @@ -137,9 +144,9 @@ void testGetLinkedFileNameByYearAuthorFirstpage() { // bibkey - title String fileNamePattern = "[year]_[auth]_[firstpage]"; BibEntry entry = new BibEntry(); - entry.setField( "author", "O. Kitsune" ); - entry.setField( "year", "1868" ); - entry.setField( "pages", "567-579" ); + entry.setField("author", "O. Kitsune"); + entry.setField("year", "1868"); + entry.setField("pages", "567-579"); assertEquals("1868_Kitsune_567", FileUtil.createFileNameFromPattern(null, entry, fileNamePattern)); } @@ -215,42 +222,42 @@ void uniquePathSubstrings() { } @Test - void testCopyFileFromEmptySourcePathToEmptyDestinationPathWithOverrideExistFile(){ + void testCopyFileFromEmptySourcePathToEmptyDestinationPathWithOverrideExistFile() { assertFalse(FileUtil.copyFile(nonExistingTestPath, nonExistingTestPath, true)); } @Test - void testCopyFileFromEmptySourcePathToEmptyDestinationPathWithoutOverrideExistFile(){ + void testCopyFileFromEmptySourcePathToEmptyDestinationPathWithoutOverrideExistFile() { assertFalse(FileUtil.copyFile(nonExistingTestPath, nonExistingTestPath, false)); } @Test - void testCopyFileFromEmptySourcePathToExistDestinationPathWithOverrideExistFile(){ + void testCopyFileFromEmptySourcePathToExistDestinationPathWithOverrideExistFile() { assertFalse(FileUtil.copyFile(nonExistingTestPath, existingTestFile, true)); } @Test - void testCopyFileFromEmptySourcePathToExistDestinationPathWithoutOverrideExistFile(){ + void testCopyFileFromEmptySourcePathToExistDestinationPathWithoutOverrideExistFile() { assertFalse(FileUtil.copyFile(nonExistingTestPath, existingTestFile, false)); } @Test - void testCopyFileFromExistSourcePathToExistDestinationPathWithOverrideExistFile(){ + void testCopyFileFromExistSourcePathToExistDestinationPathWithOverrideExistFile() { assertTrue(FileUtil.copyFile(existingTestFile, existingTestFile, true)); } @Test - void testCopyFileFromExistSourcePathToExistDestinationPathWithoutOverrideExistFile(){ + void testCopyFileFromExistSourcePathToExistDestinationPathWithoutOverrideExistFile() { assertFalse(FileUtil.copyFile(existingTestFile, existingTestFile, false)); } @Test - void testCopyFileFromExistSourcePathToOtherExistDestinationPathWithOverrideExistFile(){ + void testCopyFileFromExistSourcePathToOtherExistDestinationPathWithOverrideExistFile() { assertTrue(FileUtil.copyFile(existingTestFile, otherExistingTestFile, true)); } @Test - void testCopyFileFromExistSourcePathToOtherExistDestinationPathWithoutOverrideExistFile(){ + void testCopyFileFromExistSourcePathToOtherExistDestinationPathWithoutOverrideExistFile() { assertFalse(FileUtil.copyFile(existingTestFile, otherExistingTestFile, false)); } @@ -290,27 +297,27 @@ void testRenameFileWithFromFileIsNullAndToFileExist() { } @Test - void testRenameFileWithFromFileNotExistAndToFileNotExist(){ + void testRenameFileWithFromFileNotExistAndToFileNotExist() { assertFalse(FileUtil.renameFile(nonExistingTestPath, nonExistingTestPath)); } @Test - void testRenameFileWithFromFileNotExistAndToFileExist(){ + void testRenameFileWithFromFileNotExistAndToFileExist() { assertFalse(FileUtil.renameFile(nonExistingTestPath, existingTestFile)); } @Test - void testRenameFileWithFromFileExistAndToFileNotExist(){ + void testRenameFileWithFromFileExistAndToFileNotExist() { assertTrue(FileUtil.renameFile(existingTestFile, nonExistingTestPath)); } @Test - void testRenameFileWithFromFileExistAndToFileExist(){ + void testRenameFileWithFromFileExistAndToFileExist() { assertTrue(FileUtil.renameFile(existingTestFile, existingTestFile)); } @Test - void testRenameFileWithFromFileExistAndOtherToFileExist(){ + void testRenameFileWithFromFileExistAndOtherToFileExist() { assertFalse(FileUtil.renameFile(existingTestFile, otherExistingTestFile)); } @@ -362,9 +369,9 @@ void testGetLinkedDirNameDefaultFullTitle() { assertEquals("PDF/1998/Åuthör/1234 - mytitle", FileUtil.createDirNameFromPattern(null, entry, fileNamePattern)); } + @Test - public void testIsBibFile() throws IOException - { + public void testIsBibFile() throws IOException { Path bibFile = Files.createFile(rootDir.resolve("test.bib")); assertTrue(FileUtil.isBibFile(bibFile)); diff --git a/src/test/java/org/jabref/logic/util/io/RegExpBasedFileFinderTests.java b/src/test/java/org/jabref/logic/util/io/RegExpBasedFileFinderTests.java index b550ca52a2d..d024017ff34 100644 --- a/src/test/java/org/jabref/logic/util/io/RegExpBasedFileFinderTests.java +++ b/src/test/java/org/jabref/logic/util/io/RegExpBasedFileFinderTests.java @@ -17,7 +17,7 @@ public class RegExpBasedFileFinderTests { - private static final String filesDirectory = "src/test/resources/org/jabref/logic/importer/unlinkedFilesTestFolder"; + private static final String FILES_DIRECTORY = "src/test/resources/org/jabref/logic/importer/unlinkedFilesTestFolder"; private BibDatabase database; private BibEntry entry; @@ -52,7 +52,7 @@ public void testFindFiles() throws Exception { List extensions = Collections.singletonList("pdf"); - List dirs = Collections.singletonList(Paths.get(filesDirectory)); + List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("**/[bibtexkey].*\\\\.[extension]", ','); //when @@ -68,7 +68,7 @@ public void testYearAuthFirspageFindFiles() throws Exception { //given List extensions = Collections.singletonList("pdf"); - List dirs = Collections.singletonList(Paths.get(filesDirectory)); + List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("**/[year]_[auth]_[firstpage].*\\\\.[extension]", ','); //when @@ -90,7 +90,7 @@ public void testAuthorWithDiacritics() throws Exception { List extensions = Collections.singletonList("pdf"); - List dirs = Collections.singletonList(Paths.get(filesDirectory)); + List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("**/[year]_[auth]_[firstpage]\\\\.[extension]", ','); //when @@ -110,7 +110,7 @@ public void testFindFileInSubdirectory() throws Exception { List extensions = Collections.singletonList("pdf"); - List dirs = Collections.singletonList(Paths.get(filesDirectory)); + List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("**/[bibtexkey].*\\\\.[extension]", ','); //when @@ -130,7 +130,7 @@ public void testFindFileNonRecursive() throws Exception { List extensions = Collections.singletonList("pdf"); - List dirs = Collections.singletonList(Paths.get(filesDirectory)); + List dirs = Collections.singletonList(Paths.get(FILES_DIRECTORY)); RegExpBasedFileFinder fileFinder = new RegExpBasedFileFinder("*/[bibtexkey].*\\\\.[extension]", ','); //when @@ -169,5 +169,4 @@ public void testExpandBrackets() { RegExpBasedFileFinder.expandBrackets("[author] have published [title] in [journal].", entry, database, ',')); } - } 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 29b691b4e13..bf53b938ef4 100644 --- a/src/test/java/org/jabref/logic/util/strings/StringLengthComparatorTest.java +++ b/src/test/java/org/jabref/logic/util/strings/StringLengthComparatorTest.java @@ -9,7 +9,6 @@ public class StringLengthComparatorTest { private StringLengthComparator slc; - @BeforeEach public void setUp() { slc = new StringLengthComparator(); @@ -21,5 +20,4 @@ public void test() { assertEquals(0, slc.compare("AA", "AA")); assertEquals(1, slc.compare("AA", "AAA")); } - } diff --git a/src/test/java/org/jabref/logic/xmp/XmpUtilReaderTest.java b/src/test/java/org/jabref/logic/xmp/XmpUtilReaderTest.java index ea5dfe702c1..92160685052 100644 --- a/src/test/java/org/jabref/logic/xmp/XmpUtilReaderTest.java +++ b/src/test/java/org/jabref/logic/xmp/XmpUtilReaderTest.java @@ -14,12 +14,10 @@ import org.jabref.logic.importer.fileformat.BibtexParser; import org.jabref.model.entry.BibEntry; import org.jabref.model.util.DummyFileUpdateMonitor; -import org.jabref.model.util.FileUpdateMonitor; import com.google.common.io.Resources; import org.apache.xmpbox.XMPMetadata; import org.apache.xmpbox.schema.DublinCoreSchema; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Answers; @@ -30,10 +28,7 @@ class XmpUtilReaderTest { - private static final FileUpdateMonitor fileMonitor = new DummyFileUpdateMonitor(); - private XmpPreferences xmpPreferences; - private BibtexParser parser; /** @@ -49,7 +44,7 @@ void setUp() { when(xmpPreferences.getKeywordSeparator()).thenReturn(','); - parser = new BibtexParser(importFormatPreferences, fileMonitor); + parser = new BibtexParser(importFormatPreferences, new DummyFileUpdateMonitor()); } /** @@ -104,5 +99,4 @@ void testReadPDMetadata() throws IOException, URISyntaxException, ParseException assertEquals(entryFromBibFile.get(), entries.get(0)); } - } diff --git a/src/test/java/org/jabref/logic/xmp/XmpUtilWriterTest.java b/src/test/java/org/jabref/logic/xmp/XmpUtilWriterTest.java index bad198f9d0f..f3d57c6bfae 100644 --- a/src/test/java/org/jabref/logic/xmp/XmpUtilWriterTest.java +++ b/src/test/java/org/jabref/logic/xmp/XmpUtilWriterTest.java @@ -13,8 +13,8 @@ import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junitpioneer.jupiter.TempDirectory; @@ -25,11 +25,10 @@ @ExtendWith(TempDirectory.class) class XmpUtilWriterTest { - private XmpPreferences xmpPreferences; - private static BibEntry olly2018; private static BibEntry toral2006; private static BibEntry vapnik2000; + private XmpPreferences xmpPreferences; private void initBibEntries() { @@ -113,7 +112,6 @@ void testWriteXmp(@TempDirectory.TempDir Path tempDir) throws IOException, Trans // compare the two entries assertEquals(entry, entryWritten); - } /** @@ -130,7 +128,6 @@ void testWriteMultipleBibEntries(@TempDirectory.TempDir Path tempDir) throws IOE List entryList = XmpUtilReader.readXmp(Paths.get(pdfFile.toAbsolutePath().toString()), xmpPreferences); assertEquals(3, entryList.size()); - } private Path createDefaultFile(String fileName, Path tempDir) throws IOException { diff --git a/src/test/java/org/jabref/migrations/PreferencesMigrationsTest.java b/src/test/java/org/jabref/migrations/PreferencesMigrationsTest.java index 0b7128da0da..c646bab55bb 100644 --- a/src/test/java/org/jabref/migrations/PreferencesMigrationsTest.java +++ b/src/test/java/org/jabref/migrations/PreferencesMigrationsTest.java @@ -17,16 +17,15 @@ class PreferencesMigrationsTest { private JabRefPreferences prefs; private Preferences mainPrefsNode; - private final String[] oldStylePatterns = new String[] {"\\bibtexkey", - "\\bibtexkey\\begin{title} - \\format[RemoveBrackets]{\\title}\\end{title}"}; - private final String[] newStylePatterns = new String[] {"[bibtexkey]", - "[bibtexkey] - [fulltitle]"}; + private final String[] oldStylePatterns = new String[]{"\\bibtexkey", + "\\bibtexkey\\begin{title} - \\format[RemoveBrackets]{\\title}\\end{title}"}; + private final String[] newStylePatterns = new String[]{"[bibtexkey]", + "[bibtexkey] - [fulltitle]"}; @BeforeEach void setUp() { prefs = mock(JabRefPreferences.class); mainPrefsNode = mock(Preferences.class); - } @Test @@ -39,7 +38,6 @@ void testOldStyleBibtexkeyPattern0() { verify(prefs).put(JabRefPreferences.IMPORT_FILENAMEPATTERN, newStylePatterns[0]); verify(mainPrefsNode).put(JabRefPreferences.IMPORT_FILENAMEPATTERN, newStylePatterns[0]); - } @Test @@ -53,7 +51,6 @@ void testOldStyleBibtexkeyPattern1() { verify(prefs).put(JabRefPreferences.IMPORT_FILENAMEPATTERN, newStylePatterns[1]); verify(mainPrefsNode).put(JabRefPreferences.IMPORT_FILENAMEPATTERN, newStylePatterns[1]); - } @Test @@ -67,50 +64,49 @@ void testArbitraryBibtexkeyPattern() { verify(prefs, never()).put(JabRefPreferences.IMPORT_FILENAMEPATTERN, arbitraryPattern); verify(mainPrefsNode, never()).put(JabRefPreferences.IMPORT_FILENAMEPATTERN, arbitraryPattern); - } @Test void testPreviewStyle() { String oldPreviewStyle = "" - + "\\bibtextype\\begin{bibtexkey} (\\bibtexkey)" - + "\\end{bibtexkey}
__NEWLINE__" - + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}
\\end{author}__NEWLINE__" - + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} " - + "(\\format[IfPlural(Eds.,Ed.)]{\\editor})
\\end{editor}__NEWLINE__" - + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}
__NEWLINE__" - + "\\begin{chapter} \\format[HTMLChars]{\\chapter}
\\end{chapter}__NEWLINE__" - + "\\begin{journal} \\format[HTMLChars]{\\journal}, \\end{journal}__NEWLINE__" - // Include the booktitle field for @inproceedings, @proceedings, etc. - + "\\begin{booktitle} \\format[HTMLChars]{\\booktitle}, \\end{booktitle}__NEWLINE__" - + "\\begin{school} \\format[HTMLChars]{\\school}, \\end{school}__NEWLINE__" - + "\\begin{institution} \\format[HTMLChars]{\\institution}, \\end{institution}__NEWLINE__" - + "\\begin{publisher} \\format[HTMLChars]{\\publisher}, \\end{publisher}__NEWLINE__" - + "\\begin{year}\\year\\end{year}\\begin{volume}, \\volume\\end{volume}" - + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}__NEWLINE__" - + "\\begin{abstract}

Abstract: \\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__" - + "\\begin{review}

Review: \\format[HTMLChars]{\\review} \\end{review}" - + "__NEWLINE__

"; + + "\\bibtextype\\begin{bibtexkey} (\\bibtexkey)" + + "\\end{bibtexkey}
__NEWLINE__" + + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}
\\end{author}__NEWLINE__" + + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} " + + "(\\format[IfPlural(Eds.,Ed.)]{\\editor})
\\end{editor}__NEWLINE__" + + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}
__NEWLINE__" + + "\\begin{chapter} \\format[HTMLChars]{\\chapter}
\\end{chapter}__NEWLINE__" + + "\\begin{journal} \\format[HTMLChars]{\\journal}, \\end{journal}__NEWLINE__" + // Include the booktitle field for @inproceedings, @proceedings, etc. + + "\\begin{booktitle} \\format[HTMLChars]{\\booktitle}, \\end{booktitle}__NEWLINE__" + + "\\begin{school} \\format[HTMLChars]{\\school}, \\end{school}__NEWLINE__" + + "\\begin{institution} \\format[HTMLChars]{\\institution}, \\end{institution}__NEWLINE__" + + "\\begin{publisher} \\format[HTMLChars]{\\publisher}, \\end{publisher}__NEWLINE__" + + "\\begin{year}\\year\\end{year}\\begin{volume}, \\volume\\end{volume}" + + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}__NEWLINE__" + + "\\begin{abstract}

Abstract: \\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__" + + "\\begin{review}

Review: \\format[HTMLChars]{\\review} \\end{review}" + + "__NEWLINE__

"; String newPreviewStyle = "" - + "\\bibtextype\\begin{bibtexkey} (\\bibtexkey)" - + "\\end{bibtexkey}
__NEWLINE__" - + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}
\\end{author}__NEWLINE__" - + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} " - + "(\\format[IfPlural(Eds.,Ed.)]{\\editor})
\\end{editor}__NEWLINE__" - + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}
__NEWLINE__" - + "\\begin{chapter} \\format[HTMLChars]{\\chapter}
\\end{chapter}__NEWLINE__" - + "\\begin{journal} \\format[HTMLChars]{\\journal}, \\end{journal}__NEWLINE__" - // Include the booktitle field for @inproceedings, @proceedings, etc. - + "\\begin{booktitle} \\format[HTMLChars]{\\booktitle}, \\end{booktitle}__NEWLINE__" - + "\\begin{school} \\format[HTMLChars]{\\school}, \\end{school}__NEWLINE__" - + "\\begin{institution} \\format[HTMLChars]{\\institution}, \\end{institution}__NEWLINE__" - + "\\begin{publisher} \\format[HTMLChars]{\\publisher}, \\end{publisher}__NEWLINE__" - + "\\begin{year}\\year\\end{year}\\begin{volume}, \\volume\\end{volume}" - + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}__NEWLINE__" - + "\\begin{abstract}

Abstract: \\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__" - + "\\begin{comment}

Comment: \\format[HTMLChars]{\\comment} \\end{comment}" - + "__NEWLINE__

"; + + "\\bibtextype\\begin{bibtexkey} (\\bibtexkey)" + + "\\end{bibtexkey}
__NEWLINE__" + + "\\begin{author} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\author}
\\end{author}__NEWLINE__" + + "\\begin{editor} \\format[Authors(LastFirst,Initials,Semicolon,Amp),HTMLChars]{\\editor} " + + "(\\format[IfPlural(Eds.,Ed.)]{\\editor})
\\end{editor}__NEWLINE__" + + "\\begin{title} \\format[HTMLChars]{\\title} \\end{title}
__NEWLINE__" + + "\\begin{chapter} \\format[HTMLChars]{\\chapter}
\\end{chapter}__NEWLINE__" + + "\\begin{journal} \\format[HTMLChars]{\\journal}, \\end{journal}__NEWLINE__" + // Include the booktitle field for @inproceedings, @proceedings, etc. + + "\\begin{booktitle} \\format[HTMLChars]{\\booktitle}, \\end{booktitle}__NEWLINE__" + + "\\begin{school} \\format[HTMLChars]{\\school}, \\end{school}__NEWLINE__" + + "\\begin{institution} \\format[HTMLChars]{\\institution}, \\end{institution}__NEWLINE__" + + "\\begin{publisher} \\format[HTMLChars]{\\publisher}, \\end{publisher}__NEWLINE__" + + "\\begin{year}\\year\\end{year}\\begin{volume}, \\volume\\end{volume}" + + "\\begin{pages}, \\format[FormatPagesForHTML]{\\pages} \\end{pages}__NEWLINE__" + + "\\begin{abstract}

Abstract: \\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__" + + "\\begin{comment}

Comment: \\format[HTMLChars]{\\comment} \\end{comment}" + + "__NEWLINE__

"; prefs.setPreviewStyle(oldPreviewStyle); when(prefs.getPreviewStyle()).thenReturn(oldPreviewStyle); @@ -118,6 +114,5 @@ void testPreviewStyle() { PreferencesMigrations.upgradePreviewStyleFromReviewToComment(prefs); verify(prefs).setPreviewStyle(newPreviewStyle); - } } diff --git a/src/test/java/org/jabref/model/EntryTypesTest.java b/src/test/java/org/jabref/model/EntryTypesTest.java index d58cc7ff904..8a77703ee1a 100644 --- a/src/test/java/org/jabref/model/EntryTypesTest.java +++ b/src/test/java/org/jabref/model/EntryTypesTest.java @@ -15,10 +15,9 @@ import org.jabref.model.entry.FieldName; import org.jabref.model.entry.IEEETranEntryTypes; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; - +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -147,7 +146,6 @@ void registeredCustomizedStandardEntryTypeIsContainedInListOfCustomizedEntryType assertEquals(Arrays.asList(overwrittenStandardType), EntryTypes.getAllModifiedStandardTypes(mode)); } - @ParameterizedTest @MethodSource("standardArticleTypeAndMode") void standardTypeIsStillAcessibleIfOverwritten(EntryType standardArticleType, BibDatabaseMode mode) { @@ -176,5 +174,4 @@ void overwriteStandardTypeRequiredFieldsDoesNotAffectOtherMode(BibDatabaseMode m EntryTypes.addOrModifyCustomEntryType(overwrittenStandardType, mode); assertFalse(EntryTypes.getAllValues(otherMode).contains(overwrittenStandardType)); } - } diff --git a/src/test/java/org/jabref/model/TreeNodeTest.java b/src/test/java/org/jabref/model/TreeNodeTest.java index 577c2420d8d..4ae97c6c2ea 100644 --- a/src/test/java/org/jabref/model/TreeNodeTest.java +++ b/src/test/java/org/jabref/model/TreeNodeTest.java @@ -29,7 +29,6 @@ public void setUp() { @Test public void constructorChecksThatClassImplementsCorrectInterface() { assertThrows(UnsupportedOperationException.class, () -> new WrongTreeNodeImplementation()); - } @Test diff --git a/src/test/java/org/jabref/model/TreeNodeTestData.java b/src/test/java/org/jabref/model/TreeNodeTestData.java index 939e9629292..c4f669ec9a6 100644 --- a/src/test/java/org/jabref/model/TreeNodeTestData.java +++ b/src/test/java/org/jabref/model/TreeNodeTestData.java @@ -2,11 +2,7 @@ public class TreeNodeTestData { /** - * Gets the marked node in the following tree: - * Root - * A - * A (= parent) - * B (<-- this) + * Gets the marked node in the following tree: Root A A (= parent) B (<-- this) */ public static TreeNodeMock getNodeInSimpleTree(TreeNodeMock root) { root.addChild(new TreeNodeMock()); @@ -22,21 +18,8 @@ public static TreeNodeMock getNodeInSimpleTree() { } /** - * Gets the marked node in the following tree: - * Root - * A - * A - * A (= grand parent) - * B - * B (= parent) - * C (<-- this) - * D (= child) - * C - * C - * C - * B - * B - * A + * Gets the marked node in the following tree: Root A A A (= grand parent) B B (= parent) C (<-- this) D (= child) C + * C C B B A */ public static TreeNodeMock getNodeInComplexTree(TreeNodeMock root) { root.addChild(new TreeNodeMock()); @@ -66,12 +49,7 @@ public static TreeNodeMock getNodeInComplexTree() { } /** - * Gets the marked in the following tree: - * Root - * A - * A - * A (<- this) - * A + * Gets the marked in the following tree: Root A A A (<- this) A */ public static TreeNodeMock getNodeAsChild(TreeNodeMock root) { root.addChild(new TreeNodeMock()); diff --git a/src/test/java/org/jabref/model/database/BibDatabaseModeDetectionTest.java b/src/test/java/org/jabref/model/database/BibDatabaseModeDetectionTest.java index a157a4e3de9..3902da07a58 100644 --- a/src/test/java/org/jabref/model/database/BibDatabaseModeDetectionTest.java +++ b/src/test/java/org/jabref/model/database/BibDatabaseModeDetectionTest.java @@ -68,5 +68,4 @@ public void ignoreUnknownTypesForBiblatexDecision() { assertEquals(BibDatabaseMode.BIBLATEX, BibDatabaseModeDetection.inferMode(BibDatabases.createDatabase(entries))); } - } diff --git a/src/test/java/org/jabref/model/database/BibDatabaseTest.java b/src/test/java/org/jabref/model/database/BibDatabaseTest.java index 4a11fdc737d..84fcbb426e7 100644 --- a/src/test/java/org/jabref/model/database/BibDatabaseTest.java +++ b/src/test/java/org/jabref/model/database/BibDatabaseTest.java @@ -58,7 +58,6 @@ public void insertEntryWithSameIdThrowsException() { BibEntry entry1 = new BibEntry(); entry1.setId(entry0.getId()); assertThrows(KeyCollisionException.class, () -> database.insertEntry(entry1)); - } @Test @@ -127,7 +126,6 @@ public void addSameStringLabelTwiceThrowsKeyCollisionException() { final BibtexString finalString = new BibtexString("DSP", "Digital Signal Processor"); assertThrows(KeyCollisionException.class, () -> database.addString(finalString)); - } @Test @@ -139,7 +137,6 @@ public void addSameStringIdTwiceThrowsKeyCollisionException() { finalString.setId("duplicateid"); assertThrows(KeyCollisionException.class, () -> database.addString(finalString)); - } @Test @@ -319,5 +316,4 @@ public void setPreambleWorks() { database.setPreamble("Oh yeah!"); assertEquals(Optional.of("Oh yeah!"), database.getPreamble()); } - } diff --git a/src/test/java/org/jabref/model/database/DuplicationCheckerTest.java b/src/test/java/org/jabref/model/database/DuplicationCheckerTest.java index e280a41d5c7..28782f83642 100644 --- a/src/test/java/org/jabref/model/database/DuplicationCheckerTest.java +++ b/src/test/java/org/jabref/model/database/DuplicationCheckerTest.java @@ -11,7 +11,6 @@ public class DuplicationCheckerTest { private BibDatabase database; - @BeforeEach public void setUp() { database = new BibDatabase(); @@ -46,7 +45,6 @@ public void changeCiteKey() { assertEquals(1, database.getDuplicationChecker().getNumberOfKeyOccurrences("BBB")); } - @Test public void setCiteKeySameKeyDifferentEntries() { BibEntry entry0 = new BibEntry(); @@ -64,7 +62,7 @@ public void setCiteKeySameKeyDifferentEntries() { } @Test - public void removeMultipleCiteKeys(){ + public void removeMultipleCiteKeys() { BibEntry entry0 = new BibEntry(); entry0.setCiteKey("AAA"); database.insertEntry(entry0); @@ -87,7 +85,7 @@ public void removeMultipleCiteKeys(){ } @Test - public void addEmptyCiteKey(){ + public void addEmptyCiteKey() { BibEntry entry = new BibEntry(); entry.setCiteKey(""); database.insertEntry(entry); @@ -96,7 +94,7 @@ public void addEmptyCiteKey(){ } @Test - public void removeEmptyCiteKey(){ + public void removeEmptyCiteKey() { BibEntry entry = new BibEntry(); entry.setCiteKey("AAA"); database.insertEntry(entry); @@ -106,5 +104,4 @@ public void removeEmptyCiteKey(){ database.removeEntry(entry); assertEquals(0, database.getDuplicationChecker().getNumberOfKeyOccurrences("AAA")); } - } diff --git a/src/test/java/org/jabref/model/database/KeyChangeListenerTest.java b/src/test/java/org/jabref/model/database/KeyChangeListenerTest.java index 2540b5ed75e..52ed7cbd403 100644 --- a/src/test/java/org/jabref/model/database/KeyChangeListenerTest.java +++ b/src/test/java/org/jabref/model/database/KeyChangeListenerTest.java @@ -18,7 +18,6 @@ public class KeyChangeListenerTest { private BibEntry entry3; private BibEntry entry4; - @BeforeEach public void setUp() { db = new BibDatabase(); @@ -41,7 +40,6 @@ public void setUp() { entry4 = new BibEntry(); entry4.setCiteKey("Entry4"); db.insertEntry(entry4); - } @Test @@ -89,5 +87,4 @@ public void testRelatedAllEntriesRemoved() { db.removeEntry(entry3); assertEquals(Optional.empty(), entry2.getField("related")); } - } diff --git a/src/test/java/org/jabref/model/entry/AuthorListParameterTest.java b/src/test/java/org/jabref/model/entry/AuthorListParameterTest.java index ee1d3d5defc..5739ed944ca 100644 --- a/src/test/java/org/jabref/model/entry/AuthorListParameterTest.java +++ b/src/test/java/org/jabref/model/entry/AuthorListParameterTest.java @@ -9,7 +9,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; - public class AuthorListParameterTest { private static Stream data() { diff --git a/src/test/java/org/jabref/model/entry/AuthorListTest.java b/src/test/java/org/jabref/model/entry/AuthorListTest.java index d5856c04165..0916af571f0 100644 --- a/src/test/java/org/jabref/model/entry/AuthorListTest.java +++ b/src/test/java/org/jabref/model/entry/AuthorListTest.java @@ -29,7 +29,6 @@ public void testFixAuthorNatbib() { assertTrue(AuthorList .fixAuthorNatbib("John von Neumann and John Smith and Black Brown, Peter").equals(AuthorList .fixAuthorNatbib("John von Neumann and John Smith and Black Brown, Peter"))); - } @Test @@ -55,8 +54,8 @@ public void testFixAuthorFirstNameFirstCommas() { // Check caching assertTrue(AuthorList.fixAuthorFirstNameFirstCommas( "John von Neumann and John Smith and Black Brown, Peter", true, false).equals( - AuthorList - .fixAuthorFirstNameFirstCommas("John von Neumann and John Smith and Black Brown, Peter", true, false))); + AuthorList + .fixAuthorFirstNameFirstCommas("John von Neumann and John Smith and Black Brown, Peter", true, false))); assertEquals("John Smith and Peter Black Brown", AuthorList .fixAuthorFirstNameFirstCommas("John Smith and Black Brown, Peter", false, false)); @@ -86,8 +85,8 @@ public void testFixAuthorFirstNameFirstCommas() { // Check caching assertTrue(AuthorList.fixAuthorFirstNameFirstCommas( "John von Neumann and John Smith and Black Brown, Peter", true, true).equals( - AuthorList - .fixAuthorFirstNameFirstCommas("John von Neumann and John Smith and Black Brown, Peter", true, true))); + AuthorList + .fixAuthorFirstNameFirstCommas("John von Neumann and John Smith and Black Brown, Peter", true, true))); assertEquals("John Smith and Peter Black Brown", AuthorList .fixAuthorFirstNameFirstCommas("John Smith and Black Brown, Peter", false, true)); @@ -105,7 +104,6 @@ public void testFixAuthorFirstNameFirstCommas() { assertEquals("J. P. von Neumann", AuthorList.fixAuthorFirstNameFirstCommas( "John Peter von Neumann", true, true)); - } @Test @@ -125,7 +123,6 @@ public void testFixAuthorFirstNameFirst() { assertTrue(AuthorList .fixAuthorFirstNameFirst("John von Neumann and John Smith and Black Brown, Peter").equals(AuthorList .fixAuthorFirstNameFirst("John von Neumann and John Smith and Black Brown, Peter"))); - } @Test @@ -230,8 +227,8 @@ public void testFixAuthorLastNameFirst() { assertTrue(AuthorList.fixAuthorLastNameFirst( "John von Neumann and John Smith and Black Brown, Peter", false).equals( - AuthorList - .fixAuthorLastNameFirst("John von Neumann and John Smith and Black Brown, Peter", false))); + AuthorList + .fixAuthorLastNameFirst("John von Neumann and John Smith and Black Brown, Peter", false))); // Test Abbreviate == true assertEquals("Smith, J.", AuthorList.fixAuthorLastNameFirst("John Smith", true)); @@ -248,9 +245,8 @@ public void testFixAuthorLastNameFirst() { assertTrue(AuthorList.fixAuthorLastNameFirst( "John von Neumann and John Smith and Black Brown, Peter", true).equals( - AuthorList - .fixAuthorLastNameFirst("John von Neumann and John Smith and Black Brown, Peter", true))); - + AuthorList + .fixAuthorLastNameFirst("John von Neumann and John Smith and Black Brown, Peter", true))); } @Test @@ -263,8 +259,8 @@ public void testFixAuthorLastNameOnlyCommas() { assertTrue(AuthorList.fixAuthorLastNameOnlyCommas( "John von Neumann and John Smith and Black Brown, Peter", false).equals( - AuthorList - .fixAuthorLastNameOnlyCommas("John von Neumann and John Smith and Black Brown, Peter", false))); + AuthorList + .fixAuthorLastNameOnlyCommas("John von Neumann and John Smith and Black Brown, Peter", false))); assertEquals("von Neumann, Smith and Black Brown", AuthorList .fixAuthorLastNameOnlyCommas( @@ -276,8 +272,8 @@ public void testFixAuthorLastNameOnlyCommas() { assertTrue(AuthorList.fixAuthorLastNameOnlyCommas( "John von Neumann and John Smith and Black Brown, Peter", true).equals( - AuthorList - .fixAuthorLastNameOnlyCommas("John von Neumann and John Smith and Black Brown, Peter", true))); + AuthorList + .fixAuthorLastNameOnlyCommas("John von Neumann and John Smith and Black Brown, Peter", true))); assertEquals("von Neumann, Smith, and Black Brown", AuthorList .fixAuthorLastNameOnlyCommas( @@ -365,7 +361,6 @@ public void testGetAuthor() { assertEquals("von Neumann", author.getLastOnly()); assertEquals("Neumann, Jr, J.", author.getNameForAlphabetization()); assertEquals(Optional.of("von"), author.getVon()); - } @Test @@ -506,7 +501,7 @@ public void testGetAuthorsLastFirstAnds() { .parse("John von Neumann and John Smith and Black Brown, Peter") .getAsLastFirstNamesWithAnd(false)); assertEquals("von Last, Jr, First", AuthorList.parse("von Last, Jr ,First") - .getAsLastFirstNamesWithAnd(false)); + .getAsLastFirstNamesWithAnd(false)); assertEquals("Smith, J.", AuthorList.parse("John Smith").getAsLastFirstNamesWithAnd( true)); @@ -515,8 +510,7 @@ public void testGetAuthorsLastFirstAnds() { assertEquals("von Neumann, J. and Smith, J. and Black Brown, P.", AuthorList.parse( "John von Neumann and John Smith and Black Brown, Peter").getAsLastFirstNamesWithAnd(true)); assertEquals("von Last, Jr, F.", AuthorList.parse("von Last, Jr ,First") - .getAsLastFirstNamesWithAnd(true)); - + .getAsLastFirstNamesWithAnd(true)); } @Test @@ -571,7 +565,7 @@ public void testGetAuthorsFirstFirst() { @Test public void testGetAuthorsFirstFirstAnds() { assertEquals("John Smith", AuthorList.parse("John Smith") - .getAsFirstLastNamesWithAnd()); + .getAsFirstLastNamesWithAnd()); assertEquals("John Smith and Peter Black Brown", AuthorList.parse( "John Smith and Black Brown, Peter").getAsFirstLastNamesWithAnd()); assertEquals("John von Neumann and John Smith and Peter Black Brown", AuthorList @@ -584,11 +578,11 @@ public void testGetAuthorsFirstFirstAnds() { @Test public void testGetAuthorsForAlphabetization() { assertEquals("Smith, J.", AuthorList.parse("John Smith") - .getForAlphabetization()); + .getForAlphabetization()); assertEquals("Neumann, J.", AuthorList.parse("John von Neumann") - .getForAlphabetization()); + .getForAlphabetization()); assertEquals("Neumann, J.", AuthorList.parse("J. von Neumann") - .getForAlphabetization()); + .getForAlphabetization()); assertEquals("Neumann, J. and Smith, J. and Black Brown, Jr., P.", AuthorList .parse("John von Neumann and John Smith and de Black Brown, Jr., Peter") .getForAlphabetization()); @@ -677,5 +671,4 @@ public void correctNamesWithOneComma() throws Exception { expected = new Author("José María", "J. M.", null, "Rodriguez Fernandez", null); assertEquals(new AuthorList(expected), AuthorList.parse("Rodriguez Fernandez, José María")); } - } diff --git a/src/test/java/org/jabref/model/entry/AuthorTest.java b/src/test/java/org/jabref/model/entry/AuthorTest.java index c5c40902927..431d6798e61 100644 --- a/src/test/java/org/jabref/model/entry/AuthorTest.java +++ b/src/test/java/org/jabref/model/entry/AuthorTest.java @@ -35,5 +35,4 @@ public void addDotIfAbbreviationDoNotAddDot() { assertEquals("Moore, O. and O. Moore and Moore, O. O.", Author.addDotIfAbbreviation("Moore, O. and O. Moore and Moore, O. O.")); } - } diff --git a/src/test/java/org/jabref/model/entry/BibEntryTest.java b/src/test/java/org/jabref/model/entry/BibEntryTest.java index 886439451a0..5f7e95f52ac 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTest.java @@ -131,6 +131,4 @@ public void testGetResolvedKeywords() { assertEquals(new KeywordList(new Keyword("kw"), new Keyword("kw2"), new Keyword("kw3")), actual); } - - } diff --git a/src/test/java/org/jabref/model/entry/BibEntryTests.java b/src/test/java/org/jabref/model/entry/BibEntryTests.java index eb6b414225f..2f39ddb131c 100644 --- a/src/test/java/org/jabref/model/entry/BibEntryTests.java +++ b/src/test/java/org/jabref/model/entry/BibEntryTests.java @@ -36,7 +36,6 @@ public void setUp() { emptyEntry = new BibEntry(); emptyEntry.setType("article"); emptyEntry.setChanged(false); - } @Test @@ -211,7 +210,6 @@ public void getFieldOrAliasLatexFreeComplexConversionInAlias() { @Test public void setNullField() { assertThrows(NullPointerException.class, () -> emptyEntry.setField(null)); - } @Test @@ -222,7 +220,6 @@ public void addNullKeywordThrowsNPE() { @Test public void putNullKeywordListThrowsNPE() { assertThrows(NullPointerException.class, () -> keywordEntry.putKeywords((KeywordList) null, ',')); - } @Test @@ -410,7 +407,6 @@ public void testGroupAndSearchHits() { assertTrue(be.isSearchHit()); be.setSearchHit(false); assertFalse(be.isSearchHit()); - } @Test diff --git a/src/test/java/org/jabref/model/entry/BibtexStringTest.java b/src/test/java/org/jabref/model/entry/BibtexStringTest.java index 440c950394d..1341ac43b33 100644 --- a/src/test/java/org/jabref/model/entry/BibtexStringTest.java +++ b/src/test/java/org/jabref/model/entry/BibtexStringTest.java @@ -33,7 +33,6 @@ public void test() { bs2.setContent("Oscar Gustafsson"); assertEquals("aOG", bs2.getName()); assertEquals("Oscar Gustafsson", bs2.getContent()); - } @Test diff --git a/src/test/java/org/jabref/model/entry/CanonicalBibEntryTest.java b/src/test/java/org/jabref/model/entry/CanonicalBibEntryTest.java index cb1a79ad172..8a3eb16d7c9 100644 --- a/src/test/java/org/jabref/model/entry/CanonicalBibEntryTest.java +++ b/src/test/java/org/jabref/model/entry/CanonicalBibEntryTest.java @@ -26,5 +26,4 @@ public void canonicalRepresentationWithNewlines() { String canonicalRepresentation = CanonicalBibtexEntry.getCanonicalRepresentation(e); assertEquals("@article{key,\n abstract = {line 1\nline 2}\n}", canonicalRepresentation); } - } diff --git a/src/test/java/org/jabref/model/entry/EntryLinkListTest.java b/src/test/java/org/jabref/model/entry/EntryLinkListTest.java index 77a5c71d059..e187bccd57e 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 @@ public class EntryLinkListTest { - private static final String key = "test"; + private static final String KEY = "test"; private BibDatabase database; private List links; @@ -24,7 +24,7 @@ public class EntryLinkListTest { @BeforeEach public void before() { database = new BibDatabase(); - links = EntryLinkList.parse(key, database); + links = EntryLinkList.parse(KEY, database); link = links.get(0); source = create("source"); target = create("target"); @@ -39,7 +39,7 @@ private BibEntry create(String citeKey) { @Test public void givenFieldValueAndDatabaseWhenParsingThenExpectKey() { - assertEquals(key, link.getKey()); + assertEquals(KEY, link.getKey()); } @Test @@ -54,7 +54,7 @@ public void givenFieldValueAndDatabaseWhenParsingThenExpectEmptyLinkedEntry() { @Test public void givenFieldValueAndDatabaseWhenParsingThenExpectLink() { - ParsedEntryLink expected = new ParsedEntryLink(key, database); + ParsedEntryLink expected = new ParsedEntryLink(KEY, database); assertEquals(expected, link); } diff --git a/src/test/java/org/jabref/model/entry/FieldNameTest.java b/src/test/java/org/jabref/model/entry/FieldNameTest.java index ae0eb69c2d2..9220fcb86d6 100644 --- a/src/test/java/org/jabref/model/entry/FieldNameTest.java +++ b/src/test/java/org/jabref/model/entry/FieldNameTest.java @@ -15,5 +15,4 @@ public void testOrFieldsTwoTerms() { public void testOrFieldsThreeTerms() { assertEquals("aaa/bbb/ccc", FieldName.orFields("aaa", "bbb", "ccc")); } - } diff --git a/src/test/java/org/jabref/model/entry/FileFieldWriterTest.java b/src/test/java/org/jabref/model/entry/FileFieldWriterTest.java index d9b6fb0f1e7..84aba43fcbf 100644 --- a/src/test/java/org/jabref/model/entry/FileFieldWriterTest.java +++ b/src/test/java/org/jabref/model/entry/FileFieldWriterTest.java @@ -103,10 +103,10 @@ public void testQuoteNull() { @Test public void testEncodeStringArray() { - assertEquals("a:b;c:d", FileFieldWriter.encodeStringArray(new String[][] {{"a", "b"}, {"c", "d"}})); - assertEquals("a:;c:d", FileFieldWriter.encodeStringArray(new String[][] {{"a", ""}, {"c", "d"}})); - assertEquals("a:" + null + ";c:d", FileFieldWriter.encodeStringArray(new String[][] {{"a", null}, {"c", "d"}})); - assertEquals("a:\\:b;c\\;:d", FileFieldWriter.encodeStringArray(new String[][] {{"a", ":b"}, {"c;", "d"}})); + assertEquals("a:b;c:d", FileFieldWriter.encodeStringArray(new String[][]{{"a", "b"}, {"c", "d"}})); + assertEquals("a:;c:d", FileFieldWriter.encodeStringArray(new String[][]{{"a", ""}, {"c", "d"}})); + assertEquals("a:" + null + ";c:d", FileFieldWriter.encodeStringArray(new String[][]{{"a", null}, {"c", "d"}})); + assertEquals("a:\\:b;c\\;:d", FileFieldWriter.encodeStringArray(new String[][]{{"a", ":b"}, {"c;", "d"}})); } @Test @@ -114,6 +114,4 @@ public void testFileFieldWriterGetStringRepresentation() { LinkedFile file = new LinkedFile("test", "X:\\Users\\abc.pdf", "PDF"); assertEquals("test:X\\:/Users/abc.pdf:PDF", FileFieldWriter.getStringRepresentation(file)); } - - } diff --git a/src/test/java/org/jabref/model/entry/IEEETranEntryTypesTest.java b/src/test/java/org/jabref/model/entry/IEEETranEntryTypesTest.java index 6d87b4bfcfb..dfeb26bf53f 100644 --- a/src/test/java/org/jabref/model/entry/IEEETranEntryTypesTest.java +++ b/src/test/java/org/jabref/model/entry/IEEETranEntryTypesTest.java @@ -16,5 +16,4 @@ public void ctlTypeContainsYesNoFields() { assertTrue(ctlFields.containsAll(ynFields)); } - } diff --git a/src/test/java/org/jabref/model/entry/IdGeneratorTest.java b/src/test/java/org/jabref/model/entry/IdGeneratorTest.java index f49e00b11c1..2775dd19590 100644 --- a/src/test/java/org/jabref/model/entry/IdGeneratorTest.java +++ b/src/test/java/org/jabref/model/entry/IdGeneratorTest.java @@ -17,7 +17,5 @@ public void testCreateNeutralId() { assertFalse(set.contains(string)); set.add(string); } - } - } diff --git a/src/test/java/org/jabref/model/entry/KeywordListTest.java b/src/test/java/org/jabref/model/entry/KeywordListTest.java index bb24fb66c68..6dbb9b08db5 100644 --- a/src/test/java/org/jabref/model/entry/KeywordListTest.java +++ b/src/test/java/org/jabref/model/entry/KeywordListTest.java @@ -88,5 +88,4 @@ public void parseTwoHierarchicalChains() throws Exception { assertEquals(new KeywordList(expectedOne, expectedTwo), KeywordList.parse("Parent1 > Node1 > Child1, Parent2 > Node2 > Child2", ',', '>')); } - } diff --git a/src/test/java/org/jabref/model/entry/MonthTest.java b/src/test/java/org/jabref/model/entry/MonthTest.java index d99b7c3c472..20914aabc44 100644 --- a/src/test/java/org/jabref/model/entry/MonthTest.java +++ b/src/test/java/org/jabref/model/entry/MonthTest.java @@ -137,7 +137,7 @@ public void parseCorrectlyByFullNameGerman() { @Test public void parseCorrectlyByShortNameGermanLowercase() { - assertEquals(Optional.of(Month.JANUARY), Month.parse("jan")); + assertEquals(Optional.of(Month.JANUARY), Month.parse("jan")); assertEquals(Optional.of(Month.FEBRUARY), Month.parse("feb")); assertEquals(Optional.of(Month.MARCH), Month.parse("mär")); assertEquals(Optional.of(Month.MARCH), Month.parse("mae")); 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 e1e8636c1f1..4d45bb239cf 100644 --- a/src/test/java/org/jabref/model/entry/identifier/DOITest.java +++ b/src/test/java/org/jabref/model/entry/identifier/DOITest.java @@ -148,7 +148,5 @@ public void noDOIFoundInsideArbitraryText() { public void parseDOIWithWhiteSpace() { String doiWithSpace = "https : / / doi.org / 10 .1109 /V LHCC.20 04.20"; assertEquals("https://doi.org/10.1109/VLHCC.2004.20", DOI.parse(doiWithSpace).get().getURIAsASCIIString()); - } - } 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 acd4d4149fe..55dcfe847ca 100644 --- a/src/test/java/org/jabref/model/entry/identifier/ISBNTest.java +++ b/src/test/java/org/jabref/model/entry/identifier/ISBNTest.java @@ -70,5 +70,4 @@ public void testIsIsbn13Correct() { public void testIsIsbn13Incorrect() { assertFalse(new ISBN("0-123456-47-9").isIsbn13()); } - } diff --git a/src/test/java/org/jabref/model/entry/specialfields/SpecialFieldTest.java b/src/test/java/org/jabref/model/entry/specialfields/SpecialFieldTest.java index 23cff29c279..9036c7bffe2 100644 --- a/src/test/java/org/jabref/model/entry/specialfields/SpecialFieldTest.java +++ b/src/test/java/org/jabref/model/entry/specialfields/SpecialFieldTest.java @@ -10,7 +10,6 @@ public class SpecialFieldTest { - @Test public void getSpecialFieldInstanceFromFieldNameValid() { assertEquals(Optional.of(SpecialField.RANKING), diff --git a/src/test/java/org/jabref/model/event/TestEventListener.java b/src/test/java/org/jabref/model/event/TestEventListener.java index 7619adb51a8..c8e3b2cd1d5 100644 --- a/src/test/java/org/jabref/model/event/TestEventListener.java +++ b/src/test/java/org/jabref/model/event/TestEventListener.java @@ -11,7 +11,6 @@ public class TestEventListener { private BibEntry bibEntry; - @Subscribe public void listen(EntryAddedEvent event) { this.bibEntry = event.getBibEntry(); @@ -30,5 +29,4 @@ public void listen(EntryChangedEvent event) { public BibEntry getBibEntry() { return this.bibEntry; } - } diff --git a/src/test/java/org/jabref/model/groups/SearchGroupTest.java b/src/test/java/org/jabref/model/groups/SearchGroupTest.java index 24849ff6e8a..bdc24d22b56 100644 --- a/src/test/java/org/jabref/model/groups/SearchGroupTest.java +++ b/src/test/java/org/jabref/model/groups/SearchGroupTest.java @@ -8,7 +8,6 @@ public class SearchGroupTest { - @Test public void containsFindsWordWithRegularExpression() { SearchGroup group = new SearchGroup("myExplicitGroup", GroupHierarchyType.INDEPENDENT, "anyfield=rev*", true, true); diff --git a/src/test/java/org/jabref/model/pdf/FileAnnotationTest.java b/src/test/java/org/jabref/model/pdf/FileAnnotationTest.java index a96aa095835..4d907144d4c 100644 --- a/src/test/java/org/jabref/model/pdf/FileAnnotationTest.java +++ b/src/test/java/org/jabref/model/pdf/FileAnnotationTest.java @@ -8,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; - public class FileAnnotationTest { @Test 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 acd7e385b6b..be77c6773e3 100644 --- a/src/test/java/org/jabref/model/search/matchers/MatcherSetsTest.java +++ b/src/test/java/org/jabref/model/search/matchers/MatcherSetsTest.java @@ -8,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; - public class MatcherSetsTest { @Test @@ -46,5 +45,4 @@ public 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/ContainBasedSearchRuleTest.java b/src/test/java/org/jabref/model/search/rules/ContainBasedSearchRuleTest.java index a31483330f4..b60ec5ebc83 100644 --- a/src/test/java/org/jabref/model/search/rules/ContainBasedSearchRuleTest.java +++ b/src/test/java/org/jabref/model/search/rules/ContainBasedSearchRuleTest.java @@ -40,7 +40,6 @@ public void testBasicSearchParsing() { assertEquals(false, bsCaseInsensitive.applyRule(query, be)); assertEquals(false, bsCaseSensitiveRegexp.applyRule(query, be)); assertEquals(true, bsCaseInsensitiveRegexp.applyRule(query, be)); - } public BibEntry makeBibtexEntry() { 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 c75ee11dc4b..732f4114f5f 100644 --- a/src/test/java/org/jabref/model/search/rules/SentenceAnalyzerTest.java +++ b/src/test/java/org/jabref/model/search/rules/SentenceAnalyzerTest.java @@ -11,10 +11,9 @@ public class SentenceAnalyzerTest { @Test public void testGetWords() { - assertEquals(Arrays.asList("a","b"), new SentenceAnalyzer("a b").getWords()); - assertEquals(Arrays.asList("a","b"), new SentenceAnalyzer(" a b ").getWords()); + assertEquals(Arrays.asList("a", "b"), new SentenceAnalyzer("a b").getWords()); + assertEquals(Arrays.asList("a", "b"), new SentenceAnalyzer(" a b ").getWords()); assertEquals(Collections.singletonList("b "), new SentenceAnalyzer("\"b \" ").getWords()); assertEquals(Collections.singletonList(" a"), new SentenceAnalyzer(" \\ a").getWords()); } - } diff --git a/src/test/java/org/jabref/model/strings/StringUtilTest.java b/src/test/java/org/jabref/model/strings/StringUtilTest.java index 19872c9d294..383b97c1cc0 100644 --- a/src/test/java/org/jabref/model/strings/StringUtilTest.java +++ b/src/test/java/org/jabref/model/strings/StringUtilTest.java @@ -57,7 +57,6 @@ void testQuoteMoreComplicated() { assertEquals("a::b:%c:;", StringUtil.quote("a:b%c;", "%;", ':')); } - @Test void testUnifyLineBreaks() { // Mac < v9 @@ -129,7 +128,7 @@ void testJoin() { assertEquals("", StringUtil.join(s, "\\", 3, s.length)); - assertEquals("", StringUtil.join(new String[] {}, "\\", 0, 0)); + assertEquals("", StringUtil.join(new String[]{}, "\\", 0, 0)); } @Test @@ -192,7 +191,6 @@ void testIsInCurlyBrackets() { assertFalse(StringUtil.isInCurlyBrackets("}")); assertFalse(StringUtil.isInCurlyBrackets("a{}a")); assertFalse(StringUtil.isInCurlyBrackets("{\\AA}sa {\\AA}Stor{\\aa}")); - } @Test diff --git a/src/test/java/org/jabref/performance/BibtexEntryGenerator.java b/src/test/java/org/jabref/performance/BibtexEntryGenerator.java index 676e008ccd6..f69932fe26a 100644 --- a/src/test/java/org/jabref/performance/BibtexEntryGenerator.java +++ b/src/test/java/org/jabref/performance/BibtexEntryGenerator.java @@ -23,5 +23,4 @@ private String generateBibtexEntry(int i) { " publisher={Wiley Online Library}\n" + "}\n"; } - } diff --git a/src/test/java/org/jabref/support/CIServerCondition.java b/src/test/java/org/jabref/support/CIServerCondition.java index cc7ad59251c..3aa8812a3fe 100644 --- a/src/test/java/org/jabref/support/CIServerCondition.java +++ b/src/test/java/org/jabref/support/CIServerCondition.java @@ -34,8 +34,8 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con Optional disabled = AnnotationUtils.findAnnotation(element, DisabledOnCIServer.class); if (disabled.isPresent()) { String reason = disabled.map(DisabledOnCIServer::value) - .filter(StringUtil::isNotBlank) - .orElseGet(() -> element.get() + " is disabled on CI server"); + .filter(StringUtil::isNotBlank) + .orElseGet(() -> element.get() + " is disabled on CI server"); return ConditionEvaluationResult.disabled(reason); } diff --git a/src/test/java/org/jabref/testutils/TestUtils.java b/src/test/java/org/jabref/testutils/TestUtils.java index 83120f4c62c..3c03bfa2714 100644 --- a/src/test/java/org/jabref/testutils/TestUtils.java +++ b/src/test/java/org/jabref/testutils/TestUtils.java @@ -8,8 +8,7 @@ public class TestUtils { private static final String PATH_TO_TEST_BIBTEX = "src/test/resources/org/jabref/bibtexFiles/test.bib"; /** - * Initialize JabRef. Can be cleaned up with - * {@link TestUtils#closeJabRef()} + * Initialize JabRef. Can be cleaned up with {@link TestUtils#closeJabRef()} * * @see TestUtils#closeJabRef() */ @@ -25,5 +24,4 @@ public static void closeJabRef() { if (JabRefGUI.getMainFrame() != null) { } } - }