From a76d50ddcce4d757f18b8990ec4bc62417f51f2e Mon Sep 17 00:00:00 2001 From: Jerven Bolleman Date: Thu, 11 May 2023 21:47:47 +0200 Subject: [PATCH] GH-4544 Openrewrite changes to the test classes. A few reverts regarding pom changes. Signed-off-by: Jerven Bolleman --- core/common/io/pom.xml | 5 + .../rdf4j/common/io/ByteArrayUtilTest.java | 30 +-- .../eclipse/rdf4j/common/io/ZipUtilTest.java | 4 +- .../rdf4j/common/net/ParsedIRITest.java | 171 +++++++-------- .../rdf4j/common/net/ParsedURITest.java | 70 +++--- core/common/iterator/pom.xml | 5 + .../iteration/AutoClosingIterationTest.java | 8 +- .../common/iteration/SilentIterationTest.java | 6 +- core/common/text/pom.xml | 5 + .../rdf4j/common/text/StringUtilTest.java | 6 +- core/common/transaction/pom.xml | 5 + .../transaction/IsolationLevelsTest.java | 10 +- core/http/client/pom.xml | 5 + .../client/BackgroundGraphResultHangTest.java | 4 +- .../http/client/RDF4JProtocolSessionTest.java | 14 +- .../client/SPARQLProtocolSessionTest.java | 16 +- .../http/client/SesameHTTPClientTest.java | 6 +- core/http/protocol/pom.xml | 5 + .../rdf4j/http/protocol/ProtocolTest.java | 28 +-- .../transaction/TransactionReaderTest.java | 10 +- .../transaction/TransactionWriterTest.java | 4 +- core/model-api/pom.xml | 5 + .../rdf4j/model/base/CoreDatatypeTest.java | 10 +- core/model/pom.xml | 5 + .../rdf4j/model/datatypes/DateTimeTest.java | 2 +- .../model/datatypes/XMLDatatypeUtilTest.java | 28 +-- .../model/impl/ContextStatementTest.java | 12 +- ...lConcurrentModificationAndUpgradeTest.java | 4 +- .../rdf4j/model/impl/DynamicModelTest.java | 8 +- .../model/impl/SimpleValueFactoryTest.java | 4 +- .../model/util/GraphComparisonsTest.java | 14 +- .../rdf4j/model/util/LiteralsTest.java | 199 +++++++++--------- .../rdf4j/model/util/ModelBuilderTest.java | 32 +-- .../rdf4j/model/util/ModelCollectorTest.java | 14 +- .../eclipse/rdf4j/model/util/ModelsTest.java | 100 ++++----- .../rdf4j/model/util/NamespacesTest.java | 46 ++-- .../rdf4j/model/util/RDFCollectionsTest.java | 26 +-- .../rdf4j/model/util/RDFContainersTest.java | 18 +- .../rdf4j/model/util/StatementsTest.java | 48 ++--- .../eclipse/rdf4j/model/util/URIUtilTest.java | 64 +++--- .../eclipse/rdf4j/model/util/ValuesTest.java | 158 +++++++------- .../rdf4j/model/util/VocabulariesTest.java | 8 +- core/query/pom.xml | 5 + .../common/iteration/LimitIterationTest.java | 6 +- .../common/iteration/OffsetIterationTest.java | 6 +- .../common/iteration/UnionIterationTest.java | 4 +- .../eclipse/rdf4j/query/QueryResultsTest.java | 59 +++--- core/queryalgebra/evaluation/pom.xml | 5 + .../evaluation/ArrayBindingSetTest.java | 21 +- .../evaluation/QueryBindingSetTest.java | 38 ++-- .../evaluation/function/datetime/NowTest.java | 8 +- .../function/datetime/TimezoneTest.java | 12 +- .../evaluation/function/datetime/TzTest.java | 12 +- .../function/hash/HashLeadingZeroTest.java | 4 +- .../evaluation/function/hash/MD5Test.java | 4 +- .../evaluation/function/hash/SHA1Test.java | 4 +- .../evaluation/function/hash/SHA256Test.java | 4 +- .../evaluation/function/hash/SHA384Test.java | 4 +- .../evaluation/function/hash/SHA512Test.java | 4 +- .../evaluation/function/numeric/RandTest.java | 10 +- .../function/numeric/RoundTest.java | 12 +- .../function/string/ConcatTest.java | 16 +- .../function/string/LowerCaseTest.java | 18 +- .../evaluation/function/string/RegexTest.java | 18 +- .../function/string/ReplaceTest.java | 20 +- .../function/string/StrAfterTest.java | 30 +-- .../function/string/StrBeforeTest.java | 30 +-- .../function/string/SubstringTest.java | 40 ++-- .../function/string/UpperCaseTest.java | 18 +- .../function/triple/IsTripleFunctionTest.java | 15 +- .../triple/StatementFunctionTest.java | 36 ++-- .../triple/TripleObjectFunctionTest.java | 12 +- .../triple/TriplePredicateFunctionTest.java | 12 +- .../triple/TripleSubjectFunctionTest.java | 12 +- .../evaluation/function/xsd/TestDateCast.java | 26 +-- .../function/xsd/TestDateTimeCast.java | 12 +- .../function/xsd/TestStringCast.java | 16 +- .../impl/BindingSetAssignmentInlinerTest.java | 18 +- .../impl/ConstantOptimizerTest.java | 4 +- .../impl/EvaluationStatisticsTest.java | 32 +-- .../EvaluationStrategyWithRDFStarTest.java | 16 +- .../evaluation/impl/FilterOptimizerTest.java | 8 +- .../impl/MinimalContextNowTest.java | 24 ++- .../impl/ParentReferenceCleanerTest.java | 4 +- .../impl/ProjectionRemovalOptimizerTest.java | 14 +- .../impl/QueryCostEstimatesTest.java | 4 +- .../impl/QueryJoinOptimizerTest.java | 29 +-- .../impl/QueryModelNormalizerTest.java | 8 +- .../RegexAsStringFunctionOptimizierTest.java | 22 +- .../impl/StrictEvaluationStrategyTest.java | 20 +- .../impl/UnionScopeChangeOptimizerTest.java | 14 +- .../iterator/GroupIteratorTest.java | 30 +-- .../iterator/HashJoinIterationTest.java | 8 +- .../evaluation/iterator/JoinIteratorTest.java | 4 +- .../iterator/OrderIteratorTest.java | 14 +- .../iterator/ZeroLengthPathIterationTest.java | 6 +- .../util/LiteralComparatorTest.java | 53 ++--- .../algebra/evaluation/util/MathUtilTest.java | 8 +- .../evaluation/util/OrderComparatorTest.java | 25 +-- .../util/QueryEvaluationUtilTest.java | 22 +- .../util/QueryEvaluationUtilityTest.java | 22 +- .../evaluation/util/ValueComparatorTest.java | 49 ++--- .../util/XMLDatatypeMathUtilTest.java | 4 +- core/queryalgebra/geosparql/pom.xml | 5 + .../function/geosparql/BufferTest.java | 14 +- .../function/geosparql/DistanceTest.java | 8 +- .../function/geosparql/EhContainsTest.java | 4 +- .../function/geosparql/SfContainsTest.java | 4 +- .../function/geosparql/SfEqualsTest.java | 4 +- .../function/geosparql/SfWithinTest.java | 11 +- core/queryalgebra/model/pom.xml | 5 + .../algebra/AbstractQueryModelNodeTest.java | 4 +- .../query/algebra/ProjectionElemListTest.java | 6 +- .../query/algebra/ProjectionElemTest.java | 6 +- .../query/algebra/helpers/TupleExprsTest.java | 12 +- core/queryparser/api/pom.xml | 5 + .../query/parser/QueryParserUtilTest.java | 4 +- .../query/parser/QueryPrologLexerTest.java | 53 +++-- core/queryparser/sparql/pom.xml | 5 + .../query/parser/sparql/SPARQLParserTest.java | 106 +++++----- .../parser/sparql/SPARQLQueriesTest.java | 10 +- .../SPARQLUpdateDataBlockParserTest.java | 6 +- .../sparql/TestPropPathMisbehaviour.java | 18 +- .../sparql/TestServiceUpdateExprBuilder.java | 4 +- .../parser/sparql/TestSparqlStarParser.java | 136 ++++++------ .../parser/sparql/TupleExprBuilderTest.java | 48 ++--- .../WildcardProjectionProcessorTest.java | 10 +- core/queryrender/pom.xml | 5 + .../rdf4j/queryrender/RenderUtilsTest.java | 4 +- .../queryrender/SPARQLQueryRenderTest.java | 30 +-- core/queryresultio/sparqljson/pom.xml | 5 + .../sparqljson/SPARQLJSONBooleanTest.java | 10 +- .../SPARQLJSONParserCustomTest.java | 74 +++---- .../SPARQLJSONTupleBackgroundTest.java | 12 +- .../sparqljson/SPARQLJSONTupleTest.java | 26 +-- core/queryresultio/sparqlxml/pom.xml | 5 + .../sparqlxml/SPARQLXMLParserCustomTest.java | 14 +- .../sparqlxml/SPARQLXMLTupleTest.java | 6 +- core/queryresultio/text/pom.xml | 5 + .../csv/SPARQLCSVTupleBackgroundTest.java | 10 +- .../SPARQLCSVTupleQueryResultWriterTest.java | 2 +- .../resultio/text/csv/SPARQLCSVTupleTest.java | 10 +- .../text/tsv/SPARQLTSVCustomTest.java | 6 +- .../tsv/SPARQLTSVTupleBackgroundTest.java | 10 +- .../resultio/text/tsv/SPARQLTSVTupleTest.java | 10 +- .../config/RepositoryConfigTest.java | 10 +- .../repository/config/TestConfigTemplate.java | 26 +-- .../rdf4j/repository/util/RDFLoaderTest.java | 12 +- core/repository/contextaware/pom.xml | 5 + .../ContextAwareConnectionTest.java | 26 +-- core/repository/event/pom.xml | 5 + .../repository/event/InterceptorTest.java | 6 +- .../rdf4j/repository/event/NotifyingTest.java | 6 +- .../http/HTTPRepositoryConnectionTest.java | 8 +- .../manager/LocalRepositoryManagerTest.java | 8 +- .../manager/RemoteRepositoryManagerTest.java | 12 +- .../manager/RepositoryManagerTest.java | 8 +- core/repository/sail/pom.xml | 5 + .../sail/SailRepositoryConnectionTest.java | 20 +- .../config/TestProxyRepositoryFactory.java | 10 +- core/repository/sparql/pom.xml | 5 + .../sparql/SPARQLConnectionTest.java | 20 +- .../sparql/SPARQLRepositoryTest.java | 4 +- .../config/SPARQLRepositoryConfigTest.java | 10 +- .../config/SPARQLRepositoryFactoryTest.java | 4 +- .../RepositoryFederatedServiceTest.java | 4 +- .../sparql/query/QueryStringUtilTest.java | 14 +- .../query/SPARQLQueryBindingSetTest.java | 4 +- core/rio/api/pom.xml | 5 + .../eclipse/rdf4j/rio/ParserConfigTest.java | 24 +-- .../org/eclipse/rdf4j/rio/RioConfigTest.java | 20 +- .../java/org/eclipse/rdf4j/rio/RioTest.java | 14 +- .../rio/helpers/AbstractRDFParserTest.java | 10 +- .../rio/helpers/BasicParserSettingsTest.java | 6 +- .../rio/helpers/BooleanRioSettingTest.java | 4 +- .../rdf4j/rio/helpers/NTriplesUtilTest.java | 16 +- .../rio/helpers/RDFParserHelperTest.java | 46 ++-- .../rdf4j/rio/helpers/RDFStarUtilTest.java | 8 +- .../rio/helpers/RioFileTypeDetectorTest.java | 4 +- .../rio/helpers/StatementCollectorTest.java | 29 +-- .../rio/helpers/StringRioSettingTest.java | 2 +- core/rio/datatypes/pom.xml | 5 + .../DBPediaCelsiusDatatypeHandlerTest.java | 2 +- .../RDFLangStringDatatypeHandlerTest.java | 2 +- core/rio/hdt/pom.xml | 5 + .../org/eclipse/rdf4j/rio/hdt/CRC16Test.java | 6 +- .../org/eclipse/rdf4j/rio/hdt/CRC32Test.java | 6 +- .../org/eclipse/rdf4j/rio/hdt/CRC8Test.java | 6 +- .../eclipse/rdf4j/rio/hdt/HDTParserTest.java | 10 +- .../org/eclipse/rdf4j/rio/hdt/VByteTest.java | 8 +- core/rio/jsonld/pom.xml | 5 + .../jsonld/JSONLDHierarchicalWriterTest.java | 54 ++--- .../JSONLDInternalTripleCallbackTest.java | 4 +- .../rio/jsonld/JSONLDParserCustomTest.java | 74 +++---- .../jsonld/JSONLDWriterBackgroundTest.java | 2 +- .../rdf4j/rio/jsonld/JSONLDWriterTest.java | 9 +- .../rio/ndjsonld/NDJSONLDParserTest.java | 6 +- core/rio/n3/pom.xml | 5 + .../eclipse/rdf4j/rio/n3/N3ParserTest.java | 6 +- core/rio/nquads/pom.xml | 5 + .../nquads/AbstractNQuadsParserUnitTest.java | 2 +- core/rio/ntriples/pom.xml | 5 + .../AbstractNTriplesParserUnitTest.java | 4 +- core/rio/rdfjson/pom.xml | 5 + .../rio/rdfjson/RDFJSONMimeTypeTest.java | 6 +- .../rio/rdfjson/RDFJSONParserCustomTest.java | 72 +++---- core/rio/rdfxml/pom.xml | 5 + .../rio/rdfxml/RDFXMLParserCustomTest.java | 18 +- .../rdf4j/rio/rdfxml/RDFXMLParserTest.java | 20 +- .../RDFXMLPrettyWriterBackgroundTest.java | 6 +- .../rio/rdfxml/RDFXMLPrettyWriterTest.java | 8 +- .../rdf4j/rio/rdfxml/RDFXMLWriterTest.java | 8 +- core/rio/trig/pom.xml | 5 + .../rdf4j/rio/trig/TriGParserCustomTest.java | 42 ++-- .../TriGStarMimeTypeRDFFormatTest.java | 14 +- .../rio/trigstar/TriGStarParserTest.java | 12 +- core/rio/trix/pom.xml | 5 + .../rdf4j/rio/trix/TriXParserTest.java | 18 +- core/rio/turtle/pom.xml | 5 + .../rio/turtle/CustomTurtleParserTest.java | 84 ++++---- .../rdf4j/rio/turtle/TurtleMimeTypeTest.java | 8 +- .../rdf4j/rio/turtle/TurtleParserTest.java | 88 ++++---- .../rio/turtle/TurtlePrettyWriterTest.java | 4 +- .../rdf4j/rio/turtle/TurtleUtilTest.java | 52 ++--- .../rdf4j/rio/turtle/TurtleWriterTest.java | 28 +-- .../TestGH3323StackoverflowRDFStar.java | 4 +- .../TurtleStarMimeTypeRDFFormatTest.java | 14 +- .../rio/turtlestar/TurtleStarParserTest.java | 20 +- core/sail/api/pom.xml | 5 + .../rdf4j/sail/helpers/AbstractSailTest.java | 12 +- .../NotifyingSailConnectionWrapperTest.java | 12 +- core/sail/base/pom.xml | 5 + .../rdf4j/sail/base/ChangesetTest.java | 4 +- .../sail/base/SnapshotSailStoreTest.java | 4 +- .../sail/base/config/BaseSailConfigTest.java | 4 +- core/sail/elasticsearch-store/pom.xml | 5 + .../ElasticsearchStoreIT.java | 34 +-- .../ElasticsearchStoreTransactionsIT.java | 62 +++--- .../ElasticsearchStoreWalIT.java | 22 +- .../sail/elasticsearchstore/InferenceIT.java | 22 +- .../ElasticsearchGraphQueryResultIT.java | 4 +- .../ElasticsearchStoreConcurrencyIT.java | 6 +- .../ElasticsearchStoreConnectionIT.java | 4 +- .../ElasticsearchStoreContextIT.java | 4 +- .../compliance/ElasticsearchStoreIT.java | 4 +- .../ElasticsearchStoreInterruptIT.java | 4 +- .../ElasticsearchStoreIsolationLevelIT.java | 6 +- .../ElasticsearchStoreRepositoryIT.java | 2 +- .../ElasticsearchStoreSparqlOrderByIT.java | 4 +- .../ElasticsearchStoreSparqlRegexIT.java | 4 +- .../ElasticsearchStoreTupleQueryResultIT.java | 6 +- .../config/ElasticsearchStoreConfigTest.java | 14 +- .../config/ElasticsearchStoreFactoryTest.java | 10 +- core/sail/extensible-store/pom.xml | 5 + .../TransactionIsolationAndWalTests.java | 4 +- .../EvaluationStatisticsTest.java | 8 +- core/sail/inferencer/pom.xml | 5 + .../inferencer/fc/InferredContextTest.java | 20 +- .../inferencer/fc/MemInferencingTest.java | 10 +- ...erencerNativeRepositoryConnectionTest.java | 4 +- ...FSchemaMemoryRepositoryConnectionTest.java | 12 +- core/sail/lmdb/pom.xml | 5 + .../rdf4j/sail/lmdb/CardinalityTest.java | 8 +- .../rdf4j/sail/lmdb/ContextStoreTest.java | 20 +- .../rdf4j/sail/lmdb/DefaultIndexTest.java | 8 +- .../lmdb/LmdbOptimisticIsolationTest.java | 12 +- .../rdf4j/sail/lmdb/LmdbSailStoreTest.java | 56 ++--- .../sail/lmdb/LmdbStoreConnectionTest.java | 4 +- .../sail/lmdb/LmdbStoreConsistencyIT.java | 6 +- .../rdf4j/sail/lmdb/LmdbStoreDirLockTest.java | 8 +- .../sail/lmdb/LmdbStoreErrorHandlingTest.java | 6 +- .../sail/lmdb/LmdbStoreRepositoryTest.java | 2 - .../rdf4j/sail/lmdb/LmdbStoreTest.java | 4 +- .../sail/lmdb/LmdbStoreTmpDatadirTest.java | 30 +-- .../lmdb/LongMultithreadedTransactions.java | 6 +- .../rdf4j/sail/lmdb/QueryBenchmarkTest.java | 35 +-- .../rdf4j/sail/lmdb/SailSourceModelTest.java | 6 +- .../lmdb/TestLmdbStoreMemoryOverflow.java | 8 +- .../rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java | 4 +- .../rdf4j/sail/lmdb/TripleStoreTest.java | 30 +-- .../eclipse/rdf4j/sail/lmdb/VarintTest.java | 16 +- core/sail/lucene-api/pom.xml | 5 + .../sail/lucene/DistanceQuerySpecTest.java | 6 +- .../sail/lucene/GeoRelationQuerySpecTest.java | 6 +- .../rdf4j/sail/lucene/LangSpecTest.java | 10 +- .../sail/lucene/QuerySpecBuilderTest.java | 16 +- .../rdf4j/sail/lucene/QuerySpecTest.java | 6 +- core/sail/lucene/pom.xml | 10 +- .../lucene/LuceneFuzzinessPrefixTest.java | 10 +- .../lucene/LuceneIndexIdFilteringTest.java | 12 +- .../rdf4j/sail/lucene/MultiParamTest.java | 73 ++++--- .../rdf4j/sail/lucene/TypeSpecTest.java | 12 +- .../lucene/impl/LuceneIndexLocationTest.java | 8 +- .../sail/lucene/impl/LuceneIndexTest.java | 16 +- core/sail/memory/pom.xml | 5 + .../sail/memory/InferredMemStatementTest.java | 6 +- .../sail/memory/MemTripleSourceTest.java | 169 +++++++-------- .../memory/MemoryOptimisticIsolationTest.java | 12 +- .../memory/MemorySparqlAggregatesTest.java | 10 +- .../rdf4j/sail/memory/MemoryStoreTest.java | 4 +- .../sail/memory/QueryPlanRetrievalTest.java | 36 ++-- .../sail/memory/SnapshotMonitorTest.java | 58 ++--- .../sail/memory/StoreSerializationTest.java | 12 +- .../memory/config/MemoryStoreConfigTest.java | 2 +- .../memory/model/MemStatementListTestIT.java | 12 +- .../sail/memory/model/MemTripleTest.java | 8 +- .../rdf4j/sail/memory/model/MemURITest.java | 11 +- .../memory/model/MemValueFactoryTest.java | 4 +- .../memory/model/WeakObjectRegistryTest.java | 4 +- core/sail/model/pom.xml | 6 + core/sail/nativerdf/pom.xml | 5 + .../sail/nativerdf/ContextStoreTest.java | 20 +- .../sail/nativerdf/DefaultIndexTest.java | 7 +- .../LimitedSizeNativeStoreConnectionTest.java | 6 +- .../LongMultithreadedTransactions.java | 6 +- .../nativerdf/MemoryOverflowToDiskTest.java | 4 +- .../NativeOptimisticIsolationTest.java | 12 +- .../sail/nativerdf/NativeSailStoreTest.java | 16 +- .../nativerdf/NativeStoreConnectionTest.java | 4 +- .../nativerdf/NativeStoreConsistencyIT.java | 4 +- .../nativerdf/NativeStoreDirLockTest.java | 5 +- .../nativerdf/NativeStoreRepositoryTest.java | 2 - .../rdf4j/sail/nativerdf/NativeStoreTest.java | 4 +- .../nativerdf/NativeStoreTmpDatadirTest.java | 16 +- .../sail/nativerdf/NativeStoreTxnTest.java | 12 +- .../sail/nativerdf/QueryBenchmarkTest.java | 20 +- .../sail/nativerdf/SailSourceModelTest.java | 6 +- .../TestNativeStoreMemoryOverflow.java | 8 +- .../nativerdf/TestNativeStoreUpgrade.java | 6 +- .../nativerdf/TripleStoreRecoveryTest.java | 7 +- .../sail/nativerdf/btree/BTreeBenchmark.java | 22 +- .../rdf4j/sail/nativerdf/btree/BTreeTest.java | 22 +- core/sail/shacl/pom.xml | 5 + .../rdf4j/sail/shacl/AbstractShaclTest.java | 33 +-- .../rdf4j/sail/shacl/DeadlockTest.java | 4 +- .../rdf4j/sail/shacl/EqualsJoinTest.java | 22 +- .../sail/shacl/ExtendedFeaturesetTest.java | 10 +- .../rdf4j/sail/shacl/InnerJoinTest.java | 33 +-- .../shacl/MultithreadedNativeStoreIT.java | 6 +- .../shacl/MultithreadedNativeStoreRDFSIT.java | 6 +- .../rdf4j/sail/shacl/NativeStoreTest.java | 6 +- .../rdf4j/sail/shacl/NoChangeTest.java | 4 +- .../rdf4j/sail/shacl/NoShapesTest.java | 4 +- .../rdf4j/sail/shacl/PrepareCommitTest.java | 40 ++-- .../sail/shacl/RdfsShaclConnectionTest.java | 22 +- .../sail/shacl/ReduceNumberOfPlansTest.java | 19 +- .../rdf4j/sail/shacl/SerializableTest.java | 26 +-- ...ailSupportedPredicatesDocumentationIT.java | 13 +- .../eclipse/rdf4j/sail/shacl/ShaclTest.java | 14 +- .../ShaclTestWithoutRdfsReasonerTest.java | 6 +- .../rdf4j/sail/shacl/ShapesGraphTest.java | 20 +- .../rdf4j/sail/shacl/ShutdownTest.java | 34 +-- .../TargetNodeMinCountEdgeCaseTests.java | 14 +- .../eclipse/rdf4j/sail/shacl/TempTest.java | 19 +- .../sail/shacl/TrackAddedStatementsTest.java | 96 +++++---- .../shacl/TransactionSettingsFactoryTest.java | 6 +- .../sail/shacl/TransactionSettingsTest.java | 112 +++++----- .../shacl/TransactionValidationLimitTest.java | 10 +- .../shacl/TransactionalIsolationSlowIT.java | 6 +- .../shacl/TransactionalIsolationTest.java | 40 ++-- .../shacl/TruncatedValidationReportTest.java | 107 +++++----- .../eclipse/rdf4j/sail/shacl/UniqueTest.java | 19 +- .../rdf4j/sail/shacl/UnknownShapesTest.java | 15 +- .../sail/shacl/ValidationReportTest.java | 36 ++-- .../rdf4j/sail/shacl/VisualizerTest.java | 8 +- .../rdf4j/sail/shacl/W3cComplianceTest.java | 6 +- .../rdf4j/sail/shacl/ast/ParsingTest.java | 17 +- .../rdf4j/sail/shacl/ast/TargetChainTest.java | 6 +- .../rdf4j/sail/shacl/ast/paths/PathTest.java | 29 +-- .../shacl/ast/paths/SparqlPathStringTest.java | 18 +- .../ast/planNodes/ValidationTupleTest.java | 9 +- .../targets/StableQueryGenerationTest.java | 6 +- .../sail/shacl/benchmark/BenchmarkIT.java | 4 +- .../shacl/config/ShaclSailConfigTest.java | 44 ++-- .../shacl/config/ShaclSailFactoryTest.java | 10 +- core/sparqlbuilder/pom.xml | 5 + .../constraint/ExpressionsTest.java | 24 +-- .../builder/PropertyPathTest.java | 48 ++--- .../core/PrefixDeclarationsTest.java | 32 +-- .../sparqlbuilder/core/SparqlBuilderTest.java | 18 +- .../core/query/ModifyQueryTest.java | 4 +- .../core/query/QueryWithPrefixesTest.java | 14 +- .../sparqlbuilder/examples/BaseExamples.java | 2 +- .../examples/sparql11spec/Section11Test.java | 14 +- .../examples/sparql11spec/Section12Test.java | 4 +- .../examples/sparql11spec/Section13Test.java | 16 +- .../examples/sparql11spec/Section15Test.java | 12 +- .../examples/sparql11spec/Section16Test.java | 14 +- .../examples/sparql11spec/Section17Test.java | 6 +- .../examples/sparql11spec/Section2Test.java | 24 +-- .../examples/sparql11spec/Section3Test.java | 6 +- .../examples/sparql11spec/Section4Test.java | 10 +- .../examples/sparql11spec/Section5Test.java | 8 +- .../examples/sparql11spec/Section6Test.java | 8 +- .../examples/sparql11spec/Section7Test.java | 4 +- .../examples/sparql11spec/Section8Test.java | 12 +- .../examples/sparql11spec/Section9Test.java | 42 ++-- .../examples/updatespec/Section3Test.java | 42 ++-- .../sparqlbuilder/rdf/RdfLiteralTest.java | 26 +-- .../util/SparqlBuilderUtilsTest.java | 12 +- .../eclipse/rdf4j/spin/SpinParserTest.java | 2 +- .../eclipse/rdf4j/spin/SpinRendererTest.java | 2 +- 402 files changed, 3611 insertions(+), 3303 deletions(-) diff --git a/core/common/io/pom.xml b/core/common/io/pom.xml index 975868f9e26..ecaf3a399d9 100644 --- a/core/common/io/pom.xml +++ b/core/common/io/pom.xml @@ -24,6 +24,11 @@ org.slf4j slf4j-api + + org.junit.jupiter + junit-jupiter + test + org.openjdk.jmh jmh-core diff --git a/core/common/io/src/test/java/org/eclipse/rdf4j/common/io/ByteArrayUtilTest.java b/core/common/io/src/test/java/org/eclipse/rdf4j/common/io/ByteArrayUtilTest.java index 1d8bb468a60..0ca2eee9332 100644 --- a/core/common/io/src/test/java/org/eclipse/rdf4j/common/io/ByteArrayUtilTest.java +++ b/core/common/io/src/test/java/org/eclipse/rdf4j/common/io/ByteArrayUtilTest.java @@ -20,10 +20,10 @@ import org.junit.jupiter.api.Test; -public class ByteArrayUtilTest { +class ByteArrayUtilTest { @Test - public void testMatchesPattern() { + void testMatchesPattern() { assertTrue(ByteArrayUtil.matchesPattern(new byte[] {}, new byte[] { 0, 32 }, new byte[] { 0, 16 })); assertTrue(ByteArrayUtil.matchesPattern(new byte[] { 4 }, new byte[] { 0 }, new byte[] { 2 })); @@ -31,7 +31,7 @@ public void testMatchesPattern() { } @Test - public void testRegionMatches() { + void testRegionMatches() { assertTrue(ByteArrayUtil.regionMatches(new byte[] {}, new byte[] { 1, 0 }, 0)); assertTrue(ByteArrayUtil.regionMatches(new byte[] { 2, 3, 4, 5 }, new byte[] { 1, 2, 3, 4, 5, 6 }, 1)); @@ -40,7 +40,7 @@ public void testRegionMatches() { } @Test - public void testCompareRegion() { + void testCompareRegion() { assertEquals(0, ByteArrayUtil.compareRegion(new byte[] {}, 0, new byte[] {}, 0, 0)); assertEquals(0, ByteArrayUtil.compareRegion(new byte[] { 0, 2 }, 0, new byte[] { 0, 1 }, 0, 1)); @@ -49,7 +49,7 @@ public void testCompareRegion() { } @Test - public void testFind() { + void testFind() { assertEquals(-1, ByteArrayUtil.find(new byte[] {}, 0, 1, (byte) 0)); assertEquals(-1, ByteArrayUtil.find(new byte[] { 0, 1, 2, 3, 4, 5, 6 }, 0, 20, (byte) 7)); assertEquals(-1, ByteArrayUtil.find(new byte[] { 0, 1, 2, 3, 4, 5, 6 }, -5, 20, (byte) 7)); @@ -59,7 +59,7 @@ public void testFind() { } @Test - public void testFindArray() { + void testFindArray() { assertEquals(0, ByteArrayUtil.find(new byte[] {}, 0, 1, new byte[] {})); assertEquals(2, ByteArrayUtil.find(new byte[] { 0, 1, 2, 3, 4, 5, 6 }, 0, 7, new byte[] { 2, 3 })); assertEquals(2, ByteArrayUtil.find(new byte[] { 0, 1, 2, 3, 4, 5, 6 }, 0, 20, new byte[] { 2, 3 })); @@ -69,7 +69,7 @@ public void testFindArray() { } @Test - public void testGetInt() { + void testGetInt() { assertEquals(0, ByteArrayUtil.getInt(new byte[] { 0, 0, 0, 0, 0, 0 }, 0)); assertEquals((1 << 24) + (2 << 16) + (3 << 8) + 4, ByteArrayUtil.getInt(new byte[] { 1, 2, 3, 4 }, 0)); assertEquals((1 << 24) + (2 << 16) + (3 << 8) + 4, ByteArrayUtil.getInt(new byte[] { 10, 1, 2, 3, 4, 10 }, 1)); @@ -78,7 +78,7 @@ public void testGetInt() { } @Test - public void testGetLong() { + void testGetLong() { assertEquals(0L, ByteArrayUtil.getLong(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }, 0)); assertEquals(1L, ByteArrayUtil.getLong(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }, 0)); assertEquals(1L << 56, ByteArrayUtil.getLong(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 }, 0)); @@ -88,7 +88,7 @@ public void testGetLong() { } @Test - public void testToBitSet() { + void testToBitSet() { assertEquals(new BitSet(), ByteArrayUtil.toBitSet(new byte[] {})); final BitSet bitSet = ByteArrayUtil.toBitSet(new byte[] { 1, 2, 3, 4 }); @@ -96,7 +96,7 @@ public void testToBitSet() { } @Test - public void testToByteArray() { + void testToByteArray() { final BitSet bitSet = new BitSet(); assertArrayEquals(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, ByteArrayUtil.toByteArray(bitSet)); @@ -109,7 +109,7 @@ public void testToByteArray() { } @Test - public void testToHexString() { + void testToHexString() { assertEquals("", ByteArrayUtil.toHexString(new byte[] {})); assertEquals("1a", ByteArrayUtil.toHexString(new byte[] { 0x1A })); assertEquals("1a2b3c", ByteArrayUtil.toHexString(new byte[] { 0x1A, 0x2B, 0x3C })); @@ -117,7 +117,7 @@ public void testToHexString() { } @Test - public void testPutLong() { + void testPutLong() { final byte[] byteArray = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ByteArrayUtil.putLong(1L, byteArray, 0); @@ -134,7 +134,7 @@ public void testPutLong() { } @Test - public void testPutInt() { + void testPutInt() { final byte[] byteArray = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ByteArrayUtil.putInt(1, byteArray, 0); @@ -151,7 +151,7 @@ public void testPutInt() { } @Test - public void testGet() { + void testGet() { assertArrayEquals(new byte[] {}, ByteArrayUtil.get(new byte[] {}, 0)); assertArrayEquals(new byte[] { 3, 4 }, ByteArrayUtil.get(new byte[] { 1, 2, 3, 4 }, 2)); assertArrayEquals(new byte[] { 3, 4, 5 }, ByteArrayUtil.get(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }, 2, 3)); @@ -159,7 +159,7 @@ public void testGet() { } @Test - public void testPut() { + void testPut() { final byte[] byteArray = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ByteArrayUtil.put(new byte[] { 1, 2, 3, 4 }, byteArray, 0); diff --git a/core/common/io/src/test/java/org/eclipse/rdf4j/common/io/ZipUtilTest.java b/core/common/io/src/test/java/org/eclipse/rdf4j/common/io/ZipUtilTest.java index 1ed0b7818d6..098b0f2ada3 100644 --- a/core/common/io/src/test/java/org/eclipse/rdf4j/common/io/ZipUtilTest.java +++ b/core/common/io/src/test/java/org/eclipse/rdf4j/common/io/ZipUtilTest.java @@ -29,7 +29,7 @@ public class ZipUtilTest { public File dir; @Test - public void testWriteEntryNormal() throws IOException { + void testWriteEntryNormal() throws IOException { File f = new File(dir, "testok.zip"); f.createNewFile(); @@ -49,7 +49,7 @@ public void testWriteEntryNormal() throws IOException { } @Test - public void testWriteEntryPathTraversing() throws IOException { + void testWriteEntryPathTraversing() throws IOException { File f = new File(dir, "testnotok.zip"); f.createNewFile(); diff --git a/core/common/io/src/test/java/org/eclipse/rdf4j/common/net/ParsedIRITest.java b/core/common/io/src/test/java/org/eclipse/rdf4j/common/net/ParsedIRITest.java index 2fa71a554bd..eac3ebb3235 100644 --- a/core/common/io/src/test/java/org/eclipse/rdf4j/common/net/ParsedIRITest.java +++ b/core/common/io/src/test/java/org/eclipse/rdf4j/common/net/ParsedIRITest.java @@ -13,6 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; 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.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -52,7 +53,7 @@ public class ParsedIRITest { public static final String FRAGMENT = "http://example.com/#fragment"; @Test - public void hostWithLeadingDigit() { + void hostWithLeadingDigit() { String[] hosts = { "1example.com", "1.example.com" }; for (String host : hosts) { assertEquals(host, ParsedIRI.create("http://" + host).getHost()); @@ -60,12 +61,12 @@ public void hostWithLeadingDigit() { } @Test - public void testIncorrectIPv4() throws URISyntaxException { + void testIncorrectIPv4() throws URISyntaxException { assertThrows(URISyntaxException.class, () -> new ParsedIRI("http://127.0.0.256/")); } @Test - public void testUnknownSchemeHostProcessing() throws URISyntaxException { + void testUnknownSchemeHostProcessing() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("bundleresource://385.fwk19480900/test.ttl"); assertThat(uri.isAbsolute()); assertThat(uri.getScheme()).isEqualTo("bundleresource"); @@ -74,12 +75,12 @@ public void testUnknownSchemeHostProcessing() throws URISyntaxException { } @Test - public void testHttpSchemeHostProcessing() throws URISyntaxException { + void testHttpSchemeHostProcessing() throws URISyntaxException { assertThrows(URISyntaxException.class, () -> new ParsedIRI("http://385.fwk19480900/test.ttl")); } @Test - public void absoluteHttpUriIsDescribedCorrectly() throws URISyntaxException { + void absoluteHttpUriIsDescribedCorrectly() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("http://example.test/"); assertTrue(uri.isAbsolute()); assertEquals("http", uri.getScheme()); @@ -87,7 +88,7 @@ public void absoluteHttpUriIsDescribedCorrectly() throws URISyntaxException { } @Test - public void absoluteHttpUriWithHashIsDescribedCorrectly() throws URISyntaxException { + void absoluteHttpUriWithHashIsDescribedCorrectly() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("http://example.test#"); assertTrue(uri.isAbsolute()); assertEquals("http", uri.getScheme()); @@ -95,34 +96,34 @@ public void absoluteHttpUriWithHashIsDescribedCorrectly() throws URISyntaxExcept } @Test - public void absoluteIpAddrDescribedCorrectly() throws URISyntaxException { + void absoluteIpAddrDescribedCorrectly() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("http://127.0.0.1/path"); assertTrue(uri.isAbsolute()); - assertEquals(uri.getHost(), "127.0.0.1"); - assertEquals(uri.getPort(), -1); - assertEquals(uri.getPath(), "/path"); + assertEquals("127.0.0.1", uri.getHost()); + assertEquals(-1, uri.getPort()); + assertEquals("/path", uri.getPath()); } @Test - public void absoluteIpAddrNoPath() throws URISyntaxException { + void absoluteIpAddrNoPath() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("http://178.62.246.130"); assertTrue(uri.isAbsolute()); - assertEquals(uri.getHost(), "178.62.246.130"); - assertEquals(uri.getPort(), -1); - assertEquals(uri.getPath(), ""); + assertEquals("178.62.246.130", uri.getHost()); + assertEquals(-1, uri.getPort()); + assertEquals("", uri.getPath()); } @Test - public void absoluteIpAddrWithPortDescribedCorrectly() throws URISyntaxException { + void absoluteIpAddrWithPortDescribedCorrectly() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("http://127.0.0.1:3333/path"); assertTrue(uri.isAbsolute()); - assertEquals(uri.getHost(), "127.0.0.1"); - assertEquals(uri.getPort(), 3333); - assertEquals(uri.getPath(), "/path"); + assertEquals("127.0.0.1", uri.getHost()); + assertEquals(3333, uri.getPort()); + assertEquals("/path", uri.getPath()); } @Test - public void uriReferenceIsDescribedCorrectly() throws URISyntaxException { + void uriReferenceIsDescribedCorrectly() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("/path"); assertFalse(uri.isAbsolute()); assertNull(uri.getScheme()); @@ -130,7 +131,7 @@ public void uriReferenceIsDescribedCorrectly() throws URISyntaxException { } @Test - public void jarUrisAppearAsAbsoluteAndHierarchical() throws URISyntaxException { + void jarUrisAppearAsAbsoluteAndHierarchical() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("jar:http://example.test/bar/baz.jar!/COM/foo/Quux.class"); assertTrue(uri.isAbsolute()); assertFalse(uri.isOpaque()); @@ -139,43 +140,43 @@ public void jarUrisAppearAsAbsoluteAndHierarchical() throws URISyntaxException { } @Test - public void osgiBundleUri() throws URISyntaxException { + void osgiBundleUri() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("bundle://159.0:1/org/eclipse/rdf4j/repository/config/system.ttl"); assertTrue(uri.isAbsolute()); assertEquals("bundle", uri.getScheme()); } @Test - public void jarUriWithHttpStringifiesToOriginalForm() throws URISyntaxException { + void jarUriWithHttpStringifiesToOriginalForm() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("jar:http://example.test/bar/baz.jar!/COM/foo/Quux.class"); assertEquals("jar:http://example.test/bar/baz.jar!/COM/foo/Quux.class", uri.toString()); } @Test - public void jarUriWithFileStringifiesToOriginalForm() throws URISyntaxException { + void jarUriWithFileStringifiesToOriginalForm() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("jar:file:///some-file.jar!/another-file"); assertEquals("jar:file:///some-file.jar!/another-file", uri.toString()); } @Test - public void resolvesAnAbsoluteUriRelativeToABaseJarUri() throws URISyntaxException { + void resolvesAnAbsoluteUriRelativeToABaseJarUri() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("jar:file:///some-file.jar!/some-nested-file"); assertEquals("http://example.test/", uri.resolve("http://example.test/")); } @Test - public void resolvesAPathRelativeUriRelativeToABaseJarUri() throws URISyntaxException { + void resolvesAPathRelativeUriRelativeToABaseJarUri() throws URISyntaxException { ParsedIRI uri = new ParsedIRI("jar:file:///some-file.jar!/some-nested-file"); assertEquals("jar:file:///some-file.jar!/another-file", uri.resolve("another-file")); } @Test - public void testDotSegments() throws URISyntaxException { + void testDotSegments() throws URISyntaxException { assertEquals("http://example.org/up", new ParsedIRI("http://example.org/").resolve("../up")); } @Test - public void testFileScheme() throws URISyntaxException { + void testFileScheme() throws URISyntaxException { assertEquals("file:/file.txt", new ParsedIRI("file:///file.txt").normalize().toString()); assertEquals("file:/file.txt", new ParsedIRI("file://localhost/file.txt").normalize().toString()); assertEquals("file:/file.txt", new ParsedIRI("file:/file.txt").normalize().toString()); @@ -191,7 +192,7 @@ public void testFileScheme() throws URISyntaxException { } @Test - public void testURN() throws URISyntaxException { + void testURN() throws URISyntaxException { assertEquals("urn:test:foo", new ParsedIRI("urn:test:foo").toString()); assertEquals("urn", new ParsedIRI("urn:test:foo").getScheme()); assertEquals("test:foo", new ParsedIRI("urn:test:foo").getPath()); @@ -199,7 +200,7 @@ public void testURN() throws URISyntaxException { } @Test - public void testRoundTripQueryString() throws Exception { + void testRoundTripQueryString() throws Exception { assertRoundTrip( "http://localhost:8080/pipelines/render-html.xpl?result&template=http%3A%2F%2Flocalhost%3A8080%2Fconcept-view.xhtml%3Ftemplate%26realm%3Dhttp%3A%2F%2Flocalhost%3A8080%2F&this=http%3A%2F%2Flocalhost%3A8080%2Fsun&query=view"); } @@ -209,146 +210,146 @@ private void assertRoundTrip(String uri) throws URISyntaxException { } @Test - public void testParentFile() throws URISyntaxException { + void testParentFile() throws URISyntaxException { assertResolves("../dir", "http://example.com/dir/dir/file", "http://example.com/dir/dir"); } @Test - public void testRootFile() throws URISyntaxException { + void testRootFile() throws URISyntaxException { assertResolves("/dir", "http://example.com/dir/dir", "http://example.com/dir"); } @Test - public void testFrag() throws URISyntaxException { + void testFrag() throws URISyntaxException { assertResolves("#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/file?qs#frag"); } @Test - public void testIdentity() throws URISyntaxException { + void testIdentity() throws URISyntaxException { assertResolves("", "http://example.com/dir/dir/file?qs", "http://example.com/dir/dir/file?qs"); } @Test - public void testOpaque() throws URISyntaxException { + void testOpaque() throws URISyntaxException { assertResolves("urn:test", "http://example.com/dir/dir/file?qs#frag", "urn:test"); } @Test - public void testFragment() throws URISyntaxException { + void testFragment() throws URISyntaxException { assertResolves("#frag2", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/file?qs#frag2"); } @Test - public void testFragment2() throws URISyntaxException { + void testFragment2() throws URISyntaxException { assertResolves("#example", "http://example.com#", "http://example.com#example"); } @Test - public void testQueryString() throws URISyntaxException { + void testQueryString() throws URISyntaxException { assertResolves("?qs2#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/file?qs2#frag"); } @Test - public void testDirectory() throws URISyntaxException { + void testDirectory() throws URISyntaxException { assertResolves(".", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/"); } @Test - public void testSameDirectory() throws URISyntaxException { + void testSameDirectory() throws URISyntaxException { assertResolves("file2?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/file2?qs#frag"); } @Test - public void testNestedDirectory() throws URISyntaxException { + void testNestedDirectory() throws URISyntaxException { assertResolves("nested/file?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/nested/file?qs#frag"); } @Test - public void testParentDirectory() throws URISyntaxException { + void testParentDirectory() throws URISyntaxException { assertResolves("../file?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/file?qs#frag"); } @Test - public void testOtherDirectory() throws URISyntaxException { + void testOtherDirectory() throws URISyntaxException { assertResolves("../dir2/file?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir2/file?qs#frag"); } @Test - public void testSameAuthority() throws URISyntaxException { + void testSameAuthority() throws URISyntaxException { assertResolves("/dir2/dir/file?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir2/dir/file?qs#frag"); } @Test - public void testIdentityDir() throws URISyntaxException { + void testIdentityDir() throws URISyntaxException { assertResolves("", "http://example.com/dir/dir/", "http://example.com/dir/dir/"); } @Test - public void testOpaqueDir() throws URISyntaxException { + void testOpaqueDir() throws URISyntaxException { assertResolves("urn:test", "http://example.com/dir/dir/", "urn:test"); } @Test - public void testFragmentDir() throws URISyntaxException { + void testFragmentDir() throws URISyntaxException { assertResolves("#frag2", "http://example.com/dir/dir/", "http://example.com/dir/dir/#frag2"); } @Test - public void testQueryStringDir() throws URISyntaxException { + void testQueryStringDir() throws URISyntaxException { assertResolves("?qs2", "http://example.com/dir/dir/", "http://example.com/dir/dir/?qs2"); } @Test - public void testDirectoryDir() throws URISyntaxException { + void testDirectoryDir() throws URISyntaxException { assertResolves("file", "http://example.com/dir/dir/", "http://example.com/dir/dir/file"); } @Test - public void testSameDirectoryDir() throws URISyntaxException { + void testSameDirectoryDir() throws URISyntaxException { assertResolves("file2?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir/dir/file2?qs#frag"); } @Test - public void testNestedDirectoryDir() throws URISyntaxException { + void testNestedDirectoryDir() throws URISyntaxException { assertResolves("nested/", "http://example.com/dir/dir/", "http://example.com/dir/dir/nested/"); } @Test - public void testNestedDirectoryFileDir() throws URISyntaxException { + void testNestedDirectoryFileDir() throws URISyntaxException { assertResolves("nested/file?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir/dir/nested/file?qs#frag"); } @Test - public void testParentDirectoryDir() throws URISyntaxException { + void testParentDirectoryDir() throws URISyntaxException { assertResolves("../file?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir/file?qs#frag"); } @Test - public void testOtherDirectoryDir() throws URISyntaxException { + void testOtherDirectoryDir() throws URISyntaxException { assertResolves("../dir2/", "http://example.com/dir/dir/", "http://example.com/dir/dir2/"); } @Test - public void testOtherDirectoryFileDir() throws URISyntaxException { + void testOtherDirectoryFileDir() throws URISyntaxException { assertResolves("../dir2/file?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir/dir2/file?qs#frag"); } @Test - public void testSameAuthorityDir() throws URISyntaxException { + void testSameAuthorityDir() throws URISyntaxException { assertResolves("/dir2/dir/file?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir2/dir/file?qs#frag"); } @Test - public void testNormalExamples() throws URISyntaxException { + void testNormalExamples() throws URISyntaxException { String base = "http://a/b/c/d;p?q"; assertResolves("g:h", base, "g:h"); assertResolves("g", base, "http://a/b/c/g"); @@ -376,7 +377,7 @@ public void testNormalExamples() throws URISyntaxException { } @Test - public void testAbnormalExamples() throws URISyntaxException { + void testAbnormalExamples() throws URISyntaxException { String base = "http://a/b/c/d;p?q"; assertResolves("../../../g", base, "http://a/g"); assertResolves("../../../../g", base, "http://a/g"); @@ -400,7 +401,7 @@ public void testAbnormalExamples() throws URISyntaxException { } @Test - public void testResolveOpaque() throws URISyntaxException { + void testResolveOpaque() throws URISyntaxException { assertResolves("", "urn:test:foo#bar", "urn:test:foo"); assertResolves("", "urn:test:foo", "urn:test:foo"); assertResolves("#bar", "urn:test:foo", "urn:test:foo#bar"); @@ -408,7 +409,7 @@ public void testResolveOpaque() throws URISyntaxException { } @Test - public void testDoubleSlash() throws URISyntaxException { + void testDoubleSlash() throws URISyntaxException { assertResolves("../xyz", "http://ab//de//ghi", "http://ab//de/xyz"); } @@ -417,7 +418,7 @@ private void assertResolves(String relative, String base, String absolute) throw } @Test - public void testUnreservedInPath() throws Exception { + void testUnreservedInPath() throws Exception { for (char g : UNRESERVED.toCharArray()) { assertEquals(BASE + g, new ParsedIRI(BASE + g).normalize().toString()); assertEquals(BASE + g, new ParsedIRI(BASE + encode(g)).normalize().toString()); @@ -426,7 +427,7 @@ public void testUnreservedInPath() throws Exception { } @Test - public void testDigitInPath() throws Exception { + void testDigitInPath() throws Exception { for (char g : DIGIT.toCharArray()) { assertEquals(BASE + g, new ParsedIRI(BASE + g).normalize().toString()); assertEquals(BASE + g, new ParsedIRI(BASE + encode(g)).normalize().toString()); @@ -435,7 +436,7 @@ public void testDigitInPath() throws Exception { } @Test - public void testUpperInPath() throws Exception { + void testUpperInPath() throws Exception { for (char g : UPPER.toCharArray()) { assertEquals(BASE + g, new ParsedIRI(BASE + g).normalize().toString()); assertEquals(BASE + g, new ParsedIRI(BASE + encode(g)).normalize().toString()); @@ -444,7 +445,7 @@ public void testUpperInPath() throws Exception { } @Test - public void testLowerInPath() throws Exception { + void testLowerInPath() throws Exception { for (char g : LOWER.toCharArray()) { assertEquals(BASE + g, new ParsedIRI(BASE + g).normalize().toString()); assertEquals(BASE + g, new ParsedIRI(BASE + encode(g)).normalize().toString()); @@ -453,7 +454,7 @@ public void testLowerInPath() throws Exception { } @Test - public void testGenDelimInPath() throws Exception { + void testGenDelimInPath() throws Exception { for (char g : ":/@".toCharArray()) { assertEquals(BASE + g, new ParsedIRI(BASE + g).normalize().toString()); assertEquals(BASE + encode(g), new ParsedIRI(BASE + encode(g)).normalize().toString()); @@ -462,7 +463,7 @@ public void testGenDelimInPath() throws Exception { } @Test - public void testSubDelimInPath() throws Exception { + void testSubDelimInPath() throws Exception { for (char g : SUB.toCharArray()) { assertEquals(BASE + g, new ParsedIRI(BASE + g).normalize().toString()); assertEquals(BASE + encode(g), new ParsedIRI(BASE + encode(g)).normalize().toString()); @@ -471,7 +472,7 @@ public void testSubDelimInPath() throws Exception { } @Test - public void testIllegalInPath() throws Exception { + void testIllegalInPath() throws Exception { for (char g : ILLEGAL.toCharArray()) { try { new ParsedIRI(BASE + g); @@ -483,7 +484,7 @@ public void testIllegalInPath() throws Exception { } @Test - public void testGenDelimsInQuery() throws Exception { + void testGenDelimsInQuery() throws Exception { for (char g : ":/?@".toCharArray()) { assertEquals(QUERY + g, new ParsedIRI(QUERY + g).normalize().toString()); assertEquals(QUERY + encode(g), new ParsedIRI(QUERY + encode(g)).normalize().toString()); @@ -491,7 +492,7 @@ public void testGenDelimsInQuery() throws Exception { } @Test - public void testSubDelimsInQuery() throws Exception { + void testSubDelimsInQuery() throws Exception { for (char g : SUB.toCharArray()) { assertEquals(QUERY + g, new ParsedIRI(QUERY + g).normalize().toString()); assertEquals(QUERY + encode(g), new ParsedIRI(QUERY + encode(g)).normalize().toString()); @@ -499,7 +500,7 @@ public void testSubDelimsInQuery() throws Exception { } @Test - public void testIllegalInQuery() throws Exception { + void testIllegalInQuery() throws Exception { for (char g : ILLEGAL.toCharArray()) { try { new ParsedIRI(QUERY + g); @@ -511,7 +512,7 @@ public void testIllegalInQuery() throws Exception { } @Test - public void testGenDelimsInFragment() throws Exception { + void testGenDelimsInFragment() throws Exception { for (char g : ":/?@".toCharArray()) { assertEquals(FRAGMENT + g, new ParsedIRI(FRAGMENT + g).normalize().toString()); assertEquals(FRAGMENT + encode(g), new ParsedIRI(FRAGMENT + encode(g)).normalize().toString()); @@ -519,7 +520,7 @@ public void testGenDelimsInFragment() throws Exception { } @Test - public void testSubDelimsInFragment() throws Exception { + void testSubDelimsInFragment() throws Exception { for (char g : SUB.toCharArray()) { assertEquals(FRAGMENT + g, new ParsedIRI(FRAGMENT + g).normalize().toString()); assertEquals(FRAGMENT + encode(g), new ParsedIRI(FRAGMENT + encode(g)).normalize().toString()); @@ -527,7 +528,7 @@ public void testSubDelimsInFragment() throws Exception { } @Test - public void testIllegalInFragment() throws Exception { + void testIllegalInFragment() throws Exception { for (char g : ILLEGAL.toCharArray()) { try { new ParsedIRI(FRAGMENT + g); @@ -552,14 +553,14 @@ private String encode(Character chr) throws UnsupportedEncodingException { } @Test - public void testPercentEncoding() throws URISyntaxException { + void testPercentEncoding() throws URISyntaxException { assertEquals("http://example.org/~user", new ParsedIRI("http://example.org/~user").normalize().toString()); assertEquals("http://example.org/~user", new ParsedIRI("http://example.org/%7euser").normalize().toString()); assertEquals("http://example.org/~user", new ParsedIRI("http://example.org/%7Euser").normalize().toString()); } @Test - public void testPortNormalization() throws URISyntaxException { + void testPortNormalization() throws URISyntaxException { assertEquals("http://example.org/", new ParsedIRI("http://example.org").normalize().toString()); assertEquals("http://example.org/", new ParsedIRI("http://example.org/").normalize().toString()); assertEquals("http://example.org/", new ParsedIRI("http://example.org:/").normalize().toString()); @@ -567,7 +568,7 @@ public void testPortNormalization() throws URISyntaxException { } @Test - public void testToASCII() throws URISyntaxException { + void testToASCII() throws URISyntaxException { assertEquals("http://r\u00E9sum\u00E9.example.org/", new ParsedIRI("http://r\u00E9sum\u00E9.example.org/").toString()); assertEquals("http://xn--rsum-bpad.example.org/", @@ -583,7 +584,7 @@ public void testToASCII() throws URISyntaxException { } @Test - public void testToASCIIQuery() throws URISyntaxException { + void testToASCIIQuery() throws URISyntaxException { assertEquals("http://validator.w3.org/check?uri=http%3A%2F%2Fr%C3%A9sum%C3%A9.example.org", new ParsedIRI("http://validator.w3.org/check?uri=http%3A%2F%2Frésumé.example.org").toASCIIString()); assertEquals("uri=http%3A%2F%2Fr\u00E9sum\u00E9.example.org", @@ -592,10 +593,10 @@ public void testToASCIIQuery() throws URISyntaxException { } @Test - public void testVietnam() throws URISyntaxException { + void testVietnam() throws URISyntaxException { String correct = "/Vi\u1EC7t%20Nam"; String incorrect = "/Vi\u00EA\u0323t%20Nam"; // containing a LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW - assertFalse(correct.equals(incorrect)); + assertNotEquals(correct, incorrect); assertEquals("http://example.org" + correct, new ParsedIRI("http://example.org" + incorrect).normalize().toString()); assertEquals("http://example.org/Vi%E1%BB%87t%20Nam", @@ -605,13 +606,13 @@ public void testVietnam() throws URISyntaxException { } @Test - public void testRedRose() throws URISyntaxException { + void testRedRose() throws URISyntaxException { assertEquals("http://www.example.org/red%09ros%C3%A9#red", new ParsedIRI("http://www.example.org/red%09ros\u00E9#red").toASCIIString()); } @Test - public void testWrongEacute() throws URISyntaxException { + void testWrongEacute() throws URISyntaxException { assertEquals("http://www.example.org/r%E9sum%E9.html", new ParsedIRI("http://www.example.org/r%E9sum%E9.html").toString()); assertEquals("http://www.example.org/r%E9sum%E9.html", @@ -623,18 +624,18 @@ public void testWrongEacute() throws URISyntaxException { } @Test - public void testDurst() throws URISyntaxException { + void testDurst() throws URISyntaxException { assertURI2IRI("http://www.example.org/D%C3%BCrst", "http://www.example.org/D\u00FCrst"); assertURI2IRI("http://www.example.org/D%FCrst", "http://www.example.org/D%FCrst"); } @Test - public void testDeseret() throws URISyntaxException { + void testDeseret() throws URISyntaxException { assertURI2IRI("http://www.example.org/U+10400/%F0%90%90%80", "http://www.example.org/U+10400/\uD801\uDC00"); } @Test - public void testPunycodeEncoding() throws URISyntaxException { + void testPunycodeEncoding() throws URISyntaxException { assertEquals("http://xn--99zt52a.example.org/%E2%80%AE", new ParsedIRI("http://xn--99zt52a.example.org/%e2%80%ae").normalize().toASCIIString()); assertEquals("http://\u7D0D\u8C46.example.org/\u202E", @@ -647,7 +648,7 @@ private void assertURI2IRI(String uri, String iri) throws URISyntaxException { } @Test - public void testCreate() { + void testCreate() { assertEquals("http://example.org/poorly%20constructed", ParsedIRI.create("http://example.org/poorly constructed").toString()); assertEquals("Just%20some%0AText!?", ParsedIRI.create("Just some\nText!?").toString()); @@ -655,7 +656,7 @@ public void testCreate() { } @Test - public void testCreateInvalid() { + void testCreateInvalid() { try { assertEquals("http://example.org:-80/", ParsedIRI.create("http://example.org:-80/").toString()); fail(); diff --git a/core/common/io/src/test/java/org/eclipse/rdf4j/common/net/ParsedURITest.java b/core/common/io/src/test/java/org/eclipse/rdf4j/common/net/ParsedURITest.java index 9fb18fd9474..3978de2a5e3 100644 --- a/core/common/io/src/test/java/org/eclipse/rdf4j/common/net/ParsedURITest.java +++ b/core/common/io/src/test/java/org/eclipse/rdf4j/common/net/ParsedURITest.java @@ -23,10 +23,10 @@ * @author Joseph Walton * @author James Leigh */ -public class ParsedURITest { +class ParsedURITest { @Test - public void absoluteHttpUriIsDescribedCorrectly() { + void absoluteHttpUriIsDescribedCorrectly() { ParsedURI uri = new ParsedURI("http://example.test/"); assertTrue(uri.isAbsolute()); assertTrue(uri.isHierarchical()); @@ -35,7 +35,7 @@ public void absoluteHttpUriIsDescribedCorrectly() { } @Test - public void uriReferenceIsDescribedCorrectly() { + void uriReferenceIsDescribedCorrectly() { ParsedURI uri = new ParsedURI("/path"); assertFalse(uri.isAbsolute()); assertTrue(uri.isHierarchical()); @@ -44,7 +44,7 @@ public void uriReferenceIsDescribedCorrectly() { } @Test - public void jarUrisAppearAsAbsoluteAndHierarchical() { + void jarUrisAppearAsAbsoluteAndHierarchical() { ParsedURI uri = new ParsedURI("jar:http://example.test/bar/baz.jar!/COM/foo/Quux.class"); assertTrue(uri.isAbsolute()); assertTrue(uri.isHierarchical()); @@ -56,37 +56,37 @@ public void jarUrisAppearAsAbsoluteAndHierarchical() { } @Test - public void jarUriWithHttpStringifiesToOriginalForm() { + void jarUriWithHttpStringifiesToOriginalForm() { ParsedURI uri = new ParsedURI("jar:http://example.test/bar/baz.jar!/COM/foo/Quux.class"); assertEquals("jar:http://example.test/bar/baz.jar!/COM/foo/Quux.class", uri.toString()); } @Test - public void jarUriWithFileStringifiesToOriginalForm() { + void jarUriWithFileStringifiesToOriginalForm() { ParsedURI uri = new ParsedURI("jar:file:///some-file.jar!/another-file"); assertEquals("jar:file:///some-file.jar!/another-file", uri.toString()); } @Test - public void resolvesAnAbsoluteUriRelativeToABaseJarUri() { + void resolvesAnAbsoluteUriRelativeToABaseJarUri() { ParsedURI uri = new ParsedURI("jar:file:///some-file.jar!/some-nested-file"); assertEquals("http://example.test/", uri.resolve("http://example.test/").toString()); } @Test - public void resolvesAPathRelativeUriRelativeToABaseJarUri() { + void resolvesAPathRelativeUriRelativeToABaseJarUri() { ParsedURI uri = new ParsedURI("jar:file:///some-file.jar!/some-nested-file"); assertEquals("jar:file:///some-file.jar!/another-file", uri.resolve("another-file").toString()); } @Test - public void resolvesAPathAbsoluteUriRelativeToABaseJarUri() { + void resolvesAPathAbsoluteUriRelativeToABaseJarUri() { ParsedURI uri = new ParsedURI("jar:file:///some-file.jar!/nested-directory/some-nested-file"); assertEquals("jar:file:///some-file.jar!/another-file", uri.resolve("/another-file").toString()); } @Test - public void testRoundTripQueryString() throws Exception { + void testRoundTripQueryString() throws Exception { assertRoundTrip( "http://localhost:8080/callimachus/pipelines/render-html.xpl?result&template=http%3A%2F%2Flocalhost%3A8080%2Fcallimachus%2Fconcept-view.xhtml%3Ftemplate%26realm%3Dhttp%3A%2F%2Flocalhost%3A8080%2F&this=http%3A%2F%2Flocalhost%3A8080%2Fsun&query=view"); } @@ -96,135 +96,135 @@ private void assertRoundTrip(String uri) throws URISyntaxException { } @Test - public void testParentFile() throws URISyntaxException { + void testParentFile() throws URISyntaxException { assertResolves("../dir", "http://example.com/dir/dir/file", "http://example.com/dir/dir"); } @Test - public void testRootFile() throws URISyntaxException { + void testRootFile() throws URISyntaxException { assertResolves("/dir", "http://example.com/dir/dir", "http://example.com/dir"); } @Test - public void testFrag() throws URISyntaxException { + void testFrag() throws URISyntaxException { assertResolves("#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/file?qs#frag"); } @Test - public void testIdentity() throws URISyntaxException { + void testIdentity() throws URISyntaxException { assertResolves("", "http://example.com/dir/dir/file?qs", "http://example.com/dir/dir/file?qs"); } @Test - public void testOpaque() throws URISyntaxException { + void testOpaque() throws URISyntaxException { assertResolves("urn:test", "http://example.com/dir/dir/file?qs#frag", "urn:test"); } @Test - public void testFragment() throws URISyntaxException { + void testFragment() throws URISyntaxException { assertResolves("#frag2", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/file?qs#frag2"); } @Test - public void testQueryString() throws URISyntaxException { + void testQueryString() throws URISyntaxException { assertResolves("?qs2#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/file?qs2#frag"); } @Test - public void testDirectory() throws URISyntaxException { + void testDirectory() throws URISyntaxException { assertResolves(".", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/"); } @Test - public void testSameDirectory() throws URISyntaxException { + void testSameDirectory() throws URISyntaxException { assertResolves("file2?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/file2?qs#frag"); } @Test - public void testNestedDirectory() throws URISyntaxException { + void testNestedDirectory() throws URISyntaxException { assertResolves("nested/file?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir/nested/file?qs#frag"); } @Test - public void testParentDirectory() throws URISyntaxException { + void testParentDirectory() throws URISyntaxException { assertResolves("../file?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/file?qs#frag"); } @Test - public void testOtherDirectory() throws URISyntaxException { + void testOtherDirectory() throws URISyntaxException { assertResolves("../dir2/file?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir/dir2/file?qs#frag"); } @Test - public void testSameAuthority() throws URISyntaxException { + void testSameAuthority() throws URISyntaxException { assertResolves("/dir2/dir/file?qs#frag", "http://example.com/dir/dir/file?qs#frag", "http://example.com/dir2/dir/file?qs#frag"); } @Test - public void testIdentityDir() throws URISyntaxException { + void testIdentityDir() throws URISyntaxException { assertResolves("", "http://example.com/dir/dir/", "http://example.com/dir/dir/"); } @Test - public void testOpaqueDir() throws URISyntaxException { + void testOpaqueDir() throws URISyntaxException { assertResolves("urn:test", "http://example.com/dir/dir/", "urn:test"); } @Test - public void testFragmentDir() throws URISyntaxException { + void testFragmentDir() throws URISyntaxException { assertResolves("#frag2", "http://example.com/dir/dir/", "http://example.com/dir/dir/#frag2"); } @Test - public void testQueryStringDir() throws URISyntaxException { + void testQueryStringDir() throws URISyntaxException { assertResolves("?qs2", "http://example.com/dir/dir/", "http://example.com/dir/dir/?qs2"); } @Test - public void testDirectoryDir() throws URISyntaxException { + void testDirectoryDir() throws URISyntaxException { assertResolves("file", "http://example.com/dir/dir/", "http://example.com/dir/dir/file"); } @Test - public void testSameDirectoryDir() throws URISyntaxException { + void testSameDirectoryDir() throws URISyntaxException { assertResolves("file2?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir/dir/file2?qs#frag"); } @Test - public void testNestedDirectoryDir() throws URISyntaxException { + void testNestedDirectoryDir() throws URISyntaxException { assertResolves("nested/", "http://example.com/dir/dir/", "http://example.com/dir/dir/nested/"); } @Test - public void testNestedDirectoryFileDir() throws URISyntaxException { + void testNestedDirectoryFileDir() throws URISyntaxException { assertResolves("nested/file?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir/dir/nested/file?qs#frag"); } @Test - public void testParentDirectoryDir() throws URISyntaxException { + void testParentDirectoryDir() throws URISyntaxException { assertResolves("../file?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir/file?qs#frag"); } @Test - public void testOtherDirectoryDir() throws URISyntaxException { + void testOtherDirectoryDir() throws URISyntaxException { assertResolves("../dir2/", "http://example.com/dir/dir/", "http://example.com/dir/dir2/"); } @Test - public void testOtherDirectoryFileDir() throws URISyntaxException { + void testOtherDirectoryFileDir() throws URISyntaxException { assertResolves("../dir2/file?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir/dir2/file?qs#frag"); } @Test - public void testSameAuthorityDir() throws URISyntaxException { + void testSameAuthorityDir() throws URISyntaxException { assertResolves("/dir2/dir/file?qs#frag", "http://example.com/dir/dir/", "http://example.com/dir2/dir/file?qs#frag"); } diff --git a/core/common/iterator/pom.xml b/core/common/iterator/pom.xml index d88973f3ff6..e556825c63c 100644 --- a/core/common/iterator/pom.xml +++ b/core/common/iterator/pom.xml @@ -19,6 +19,11 @@ org.slf4j slf4j-api + + org.junit.jupiter + junit-jupiter + test + org.openjdk.jmh jmh-core diff --git a/core/common/iterator/src/test/java/org/eclipse/rdf4j/common/iteration/AutoClosingIterationTest.java b/core/common/iterator/src/test/java/org/eclipse/rdf4j/common/iteration/AutoClosingIterationTest.java index 92f403d7927..7ab91e4c358 100644 --- a/core/common/iterator/src/test/java/org/eclipse/rdf4j/common/iteration/AutoClosingIterationTest.java +++ b/core/common/iterator/src/test/java/org/eclipse/rdf4j/common/iteration/AutoClosingIterationTest.java @@ -20,10 +20,10 @@ import org.junit.jupiter.api.Test; -public class AutoClosingIterationTest { +class AutoClosingIterationTest { @Test - public void testClosingStreamWithFilter() { + void testClosingStreamWithFilter() { CloseableIterationForTesting iterator = getIterator(Arrays.asList("a", "b", "c")); @@ -36,7 +36,7 @@ public void testClosingStreamWithFilter() { } @Test - public void testClosingStreamWithAssertionError() { + void testClosingStreamWithAssertionError() { CloseableIterationForTesting iterator = getIterator(Arrays.asList("a", "b", "c")); @@ -57,7 +57,7 @@ public void testClosingStreamWithAssertionError() { } @Test - public void testClosingStreamWithAssertionErrorFinally() throws Exception { + void testClosingStreamWithAssertionErrorFinally() throws Exception { CloseableIterationForTesting iterator = getIterator(Arrays.asList("a", "b", "c")); diff --git a/core/common/iterator/src/test/java/org/eclipse/rdf4j/common/iteration/SilentIterationTest.java b/core/common/iterator/src/test/java/org/eclipse/rdf4j/common/iteration/SilentIterationTest.java index cfbe7bdbf40..e0ffa4a8a70 100644 --- a/core/common/iterator/src/test/java/org/eclipse/rdf4j/common/iteration/SilentIterationTest.java +++ b/core/common/iterator/src/test/java/org/eclipse/rdf4j/common/iteration/SilentIterationTest.java @@ -23,7 +23,7 @@ import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) -public class SilentIterationTest { +class SilentIterationTest { @Mock private CloseableIteration delegate; @@ -32,13 +32,13 @@ public class SilentIterationTest { private SilentIteration subject; @Test - public void hasNextSwallowsException() throws Exception { + void hasNextSwallowsException() throws Exception { when(delegate.hasNext()).thenThrow(new RuntimeException()); assertThat(subject.hasNext()).isFalse(); } @Test - public void nextConvertsException() throws Exception { + void nextConvertsException() throws Exception { when(delegate.next()).thenThrow(new RuntimeException()); assertThatExceptionOfType(NoSuchElementException.class).isThrownBy(subject::next); } diff --git a/core/common/text/pom.xml b/core/common/text/pom.xml index 98a6d5f3d4f..27550e3b18a 100644 --- a/core/common/text/pom.xml +++ b/core/common/text/pom.xml @@ -25,6 +25,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + org.openjdk.jmh jmh-core diff --git a/core/common/text/src/test/java/org/eclipse/rdf4j/common/text/StringUtilTest.java b/core/common/text/src/test/java/org/eclipse/rdf4j/common/text/StringUtilTest.java index 9dd03ab1cf1..f29fe9c171f 100644 --- a/core/common/text/src/test/java/org/eclipse/rdf4j/common/text/StringUtilTest.java +++ b/core/common/text/src/test/java/org/eclipse/rdf4j/common/text/StringUtilTest.java @@ -20,12 +20,12 @@ /** * @author Bart Hanssens */ -public class StringUtilTest { +class StringUtilTest { private final String str = "http://example.com/?q=a&b='+ °àµ~<\"'\u00AA\u0AAA\uAAAA" + new String(Character.toChars(0x1AAAA)); @Test - public void testEncodeParsedASCII() throws IOException { + void testEncodeParsedASCII() throws IOException { // can't use toASCIIString, since it only does percent-encoding // String parsed = ParsedIRI.create(str).toASCIIString(); String parsed = "http://example.com/?q=a&b='+%20\\u00B0\\u00E0\\u00B5~%3C%22'\\u00AA\\u0AAA\\uAAAA\\U0001AAAA"; @@ -36,7 +36,7 @@ public void testEncodeParsedASCII() throws IOException { } @Test - public void testEncodeParsed() throws IOException { + void testEncodeParsed() throws IOException { String parsed = ParsedIRI.create(str).toString(); StringBuffer out = new StringBuffer(); diff --git a/core/common/transaction/pom.xml b/core/common/transaction/pom.xml index 4d48d0406a5..9a85f269da4 100644 --- a/core/common/transaction/pom.xml +++ b/core/common/transaction/pom.xml @@ -24,6 +24,11 @@ org.slf4j slf4j-api + + org.junit.jupiter + junit-jupiter + test + org.openjdk.jmh jmh-core diff --git a/core/common/transaction/src/test/java/org/eclipse/rdf4j/common/transaction/IsolationLevelsTest.java b/core/common/transaction/src/test/java/org/eclipse/rdf4j/common/transaction/IsolationLevelsTest.java index e0eec088d7d..c234fb32cfb 100644 --- a/core/common/transaction/src/test/java/org/eclipse/rdf4j/common/transaction/IsolationLevelsTest.java +++ b/core/common/transaction/src/test/java/org/eclipse/rdf4j/common/transaction/IsolationLevelsTest.java @@ -25,7 +25,7 @@ /** * @author jeen */ -public class IsolationLevelsTest { +class IsolationLevelsTest { /** * Test method for @@ -33,7 +33,7 @@ public class IsolationLevelsTest { * . */ @Test - public void testIsCompatibleWith() { + void testIsCompatibleWith() { assertTrue(IsolationLevels.SNAPSHOT.isCompatibleWith(IsolationLevels.READ_COMMITTED)); assertTrue(IsolationLevels.SERIALIZABLE.isCompatibleWith(IsolationLevels.READ_COMMITTED)); assertTrue(IsolationLevels.SNAPSHOT.isCompatibleWith(IsolationLevels.READ_UNCOMMITTED)); @@ -46,7 +46,7 @@ public void testIsCompatibleWith() { * . */ @Test - public void testGetCompatibleIsolationLevel() { + void testGetCompatibleIsolationLevel() { List supportedLevels = new ArrayList<>(); supportedLevels.add(IsolationLevels.NONE); @@ -59,7 +59,7 @@ public void testGetCompatibleIsolationLevel() { } @Test - public void testGetCompatibleIsolationLevelNoneFound() { + void testGetCompatibleIsolationLevelNoneFound() { List supportedLevels = new ArrayList<>(); supportedLevels.add(IsolationLevels.NONE); @@ -73,7 +73,7 @@ public void testGetCompatibleIsolationLevelNoneFound() { } @Test - public void testGetCompatibleIsolationLevelNullParams() { + void testGetCompatibleIsolationLevelNullParams() { try { IsolationLevel compatibleLevel = IsolationLevels.getCompatibleIsolationLevel(IsolationLevels.SNAPSHOT, null); diff --git a/core/http/client/pom.xml b/core/http/client/pom.xml index dbdfb1a8b76..ce74f5e5ab8 100644 --- a/core/http/client/pom.xml +++ b/core/http/client/pom.xml @@ -99,6 +99,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-queryresultio-sparqljson diff --git a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/BackgroundGraphResultHangTest.java b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/BackgroundGraphResultHangTest.java index fecf1113a3a..cb5d016e9ca 100644 --- a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/BackgroundGraphResultHangTest.java +++ b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/BackgroundGraphResultHangTest.java @@ -31,7 +31,7 @@ /** * @author Damyan Ognyanov */ -public class BackgroundGraphResultHangTest { +class BackgroundGraphResultHangTest { static class DummyParser extends AbstractRDFParser { @@ -54,7 +54,7 @@ public void parse(Reader reader, String baseURI) throws IOException, RDFParseExc @Test @Timeout(value = 1, unit = TimeUnit.SECONDS) - public void testBGRHang() { + void testBGRHang() { String data = "@not-rdf"; Exception exception = assertThrows(QueryEvaluationException.class, () -> { BackgroundGraphResult gRes = new BackgroundGraphResult(new DummyParser(), diff --git a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSessionTest.java b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSessionTest.java index 72a075bf4de..313c253dcd0 100644 --- a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSessionTest.java +++ b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSessionTest.java @@ -37,7 +37,7 @@ * @author Jeen Broekstra */ @ExtendWith(MockServerExtension.class) -public class RDF4JProtocolSessionTest extends SPARQLProtocolSessionTest { +class RDF4JProtocolSessionTest extends SPARQLProtocolSessionTest { private final String testHeader = "X-testing-header"; private final String testValue = "foobar"; @@ -57,7 +57,7 @@ RDF4JProtocolSession createProtocolSession() { } @Test - public void testCreateRepositoryExecutesPut(MockServerClient client) throws Exception { + void testCreateRepositoryExecutesPut(MockServerClient client) throws Exception { client.when( request() .withMethod("PUT") @@ -78,7 +78,7 @@ public void testCreateRepositoryExecutesPut(MockServerClient client) throws Exce } @Test - public void testUpdateRepositoryExecutesPost(MockServerClient client) throws Exception { + void testUpdateRepositoryExecutesPost(MockServerClient client) throws Exception { RepositoryConfig config = new RepositoryConfig("test"); client.when( @@ -102,7 +102,7 @@ public void testUpdateRepositoryExecutesPost(MockServerClient client) throws Exc } @Test - public void testSize(MockServerClient client) throws Exception { + void testSize(MockServerClient client) throws Exception { client.when( request() .withMethod("GET") @@ -124,7 +124,7 @@ public void testSize(MockServerClient client) throws Exception { } @Test - public void testGetRepositoryConfig(MockServerClient client) throws Exception { + void testGetRepositoryConfig(MockServerClient client) throws Exception { client.when( request() .withMethod("GET") @@ -151,7 +151,7 @@ public void testGetRepositoryConfig(MockServerClient client) throws Exception { } @Test - public void testRepositoryList(MockServerClient client) throws Exception { + void testRepositoryList(MockServerClient client) throws Exception { client.when( request() .withMethod("GET") @@ -174,7 +174,7 @@ public void testRepositoryList(MockServerClient client) throws Exception { } @Test - public void testClose(MockServerClient client) throws Exception { + void testClose(MockServerClient client) throws Exception { // re-init protocol session with cache-timeout set sparqlSession.close(); System.setProperty(Protocol.CACHE_TIMEOUT_PROPERTY, "1"); diff --git a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/SPARQLProtocolSessionTest.java b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/SPARQLProtocolSessionTest.java index 552658d15a2..b648b998813 100644 --- a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/SPARQLProtocolSessionTest.java +++ b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/SPARQLProtocolSessionTest.java @@ -60,7 +60,7 @@ * @author Jeen Broekstra */ @ExtendWith(MockServerExtension.class) -public class SPARQLProtocolSessionTest { +class SPARQLProtocolSessionTest { SPARQLProtocolSession sparqlSession; String serverURL; @@ -75,13 +75,13 @@ SPARQLProtocolSession createProtocolSession() { } @BeforeEach - public void setUp(MockServerClient client) throws Exception { + void setUp(MockServerClient client) throws Exception { serverURL = "http://localhost:" + client.getPort() + "/rdf4j-server"; sparqlSession = createProtocolSession(); } @Test - public void testConnectionTimeoutRetry(MockServerClient client) throws Exception { + void testConnectionTimeoutRetry(MockServerClient client) throws Exception { // Simulate that the server wants to close the connection after idle timeout // But instead of just shutting down the connection it sends `408` once and then // shuts down the connection. @@ -119,7 +119,7 @@ public void testConnectionTimeoutRetry(MockServerClient client) throws Exception } @Test - public void testConnectionPoolTimeoutRetry(MockServerClient client) throws Exception { + void testConnectionPoolTimeoutRetry(MockServerClient client) throws Exception { // Let 2 connections succeed, this is just so we can fill the connection pool with more than one connection client.when( request() @@ -182,7 +182,7 @@ public void testConnectionPoolTimeoutRetry(MockServerClient client) throws Excep } @Test - public void testTupleQuery_NoPassthrough(MockServerClient client) throws Exception { + void testTupleQuery_NoPassthrough(MockServerClient client) throws Exception { client.when( request() .withMethod("POST") @@ -207,7 +207,7 @@ public void testTupleQuery_NoPassthrough(MockServerClient client) throws Excepti } @Test - public void testTupleQuery_Passthrough(MockServerClient client) throws Exception { + void testTupleQuery_Passthrough(MockServerClient client) throws Exception { client.when( request() .withMethod("POST") @@ -232,7 +232,7 @@ public void testTupleQuery_Passthrough(MockServerClient client) throws Exception } @Test - public void testTupleQuery_Passthrough_ConfiguredFalse(MockServerClient client) throws Exception { + void testTupleQuery_Passthrough_ConfiguredFalse(MockServerClient client) throws Exception { client.when( request() .withMethod("POST") @@ -258,7 +258,7 @@ public void testTupleQuery_Passthrough_ConfiguredFalse(MockServerClient client) } @Test - public void getContentTypeSerialisationTest() { + void getContentTypeSerialisationTest() { { HttpResponse httpResponse = withContentType("application/shacl-validation-report+n-quads"); RDFFormat format = SPARQLProtocolSession.getContentTypeSerialisation(httpResponse); diff --git a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/SesameHTTPClientTest.java b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/SesameHTTPClientTest.java index 1ee6df0889e..33d55b2ff37 100644 --- a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/SesameHTTPClientTest.java +++ b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/SesameHTTPClientTest.java @@ -17,12 +17,12 @@ import org.junit.jupiter.api.Test; @Disabled("FIXME: Migrate this test to Apache HTTP Client 4 methods") -public class SesameHTTPClientTest { +class SesameHTTPClientTest { private final RDF4JProtocolSession httpClient = new RDF4JProtocolSession(null, null); @Test - public void setUsernameAndPassword_should_succeed_with_server_url_but_no_query_url() { + void setUsernameAndPassword_should_succeed_with_server_url_but_no_query_url() { httpClient.setServerURL("http://www.repo.org/server"); @@ -35,7 +35,7 @@ public void setUsernameAndPassword_should_succeed_with_server_url_but_no_query_u } @Test - public void setUsernameAndPassword_should_throw_exception_when_serverUrl_not_set() { + void setUsernameAndPassword_should_throw_exception_when_serverUrl_not_set() { Exception exception = assertThrows(IllegalStateException.class, () -> { httpClient.setUsernameAndPassword("user01", "secret"); diff --git a/core/http/protocol/pom.xml b/core/http/protocol/pom.xml index 38fc6d1ef93..bbe0794bfc1 100644 --- a/core/http/protocol/pom.xml +++ b/core/http/protocol/pom.xml @@ -20,6 +20,11 @@ rdf4j-rio-ntriples ${project.version} + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-model diff --git a/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/ProtocolTest.java b/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/ProtocolTest.java index 88c695ce5ae..9b84e819b75 100644 --- a/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/ProtocolTest.java +++ b/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/ProtocolTest.java @@ -36,7 +36,7 @@ import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.junit.jupiter.api.Test; -public class ProtocolTest { +class ProtocolTest { private static final String serverLocation = "http://localhost/openrdf"; @@ -45,25 +45,25 @@ public class ProtocolTest { private static final String repositoryLocation = serverLocation + "/" + REPOSITORIES + "/" + repositoryID; @Test - public void testGetProtocolLocation() { + void testGetProtocolLocation() { String result = getProtocolLocation(serverLocation); assertEquals(result, serverLocation + "/" + PROTOCOL); } @Test - public void testGetConfigLocation() { + void testGetConfigLocation() { String result = getConfigLocation(serverLocation); assertEquals(result, serverLocation + "/" + CONFIG); } @Test - public void testGetRepositoriesLocation() { + void testGetRepositoriesLocation() { String result = getRepositoriesLocation(serverLocation); assertEquals(result, serverLocation + "/" + REPOSITORIES); } @Test - public void testGetServerLocation() { + void testGetServerLocation() { String repositoryLocation = getRepositoryLocation(serverLocation, repositoryID); String result = getServerLocation(repositoryLocation); @@ -71,7 +71,7 @@ public void testGetServerLocation() { } @Test - public void testGetRepositoryID() { + void testGetRepositoryID() { String repositoryLocation = getRepositoryLocation(serverLocation, repositoryID); String result = getRepositoryID(repositoryLocation); @@ -79,31 +79,31 @@ public void testGetRepositoryID() { } @Test - public void testGetRepositoryLocation() { + void testGetRepositoryLocation() { String result = getRepositoryLocation(serverLocation, repositoryID); - assertEquals(result, repositoryLocation); + assertEquals(repositoryLocation, result); } @Test - public void testGetRepositoryConfigLocation() { + void testGetRepositoryConfigLocation() { String result = getRepositoryConfigLocation(repositoryLocation); assertEquals(result, repositoryLocation + "/" + CONFIG); } @Test - public void testGetContextsLocation() { + void testGetContextsLocation() { String result = getContextsLocation(repositoryLocation); assertEquals(result, repositoryLocation + "/" + CONTEXTS); } @Test - public void testGetNamespacesLocation() { + void testGetNamespacesLocation() { String result = getNamespacesLocation(repositoryLocation); assertEquals(result, repositoryLocation + "/" + NAMESPACES); } @Test - public void testEncodeValueRoundtrip() { + void testEncodeValueRoundtrip() { final ValueFactory vf = SimpleValueFactory.getInstance(); IRI uri = vf.createIRI("http://example.org/foo-bar"); @@ -130,7 +130,7 @@ public void testEncodeValueRoundtrip() { } @Test - public void testDecodeContext() { + void testDecodeContext() { ValueFactory vf = SimpleValueFactory.getInstance(); assertEquals(vf.createBNode("bnode1"), Protocol.decodeContext("_:bnode1", vf)); @@ -146,7 +146,7 @@ public void testDecodeContext() { } @Test - public void testParseIRIvsTriple() { + void testParseIRIvsTriple() { Exception exception = assertThrows(IllegalArgumentException.class, () -> Protocol.decodeURI("<<>>", SimpleValueFactory.getInstance())); } diff --git a/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/transaction/TransactionReaderTest.java b/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/transaction/TransactionReaderTest.java index cdba6efbb0a..0c02032c268 100644 --- a/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/transaction/TransactionReaderTest.java +++ b/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/transaction/TransactionReaderTest.java @@ -32,7 +32,7 @@ /** * @author jeen */ -public class TransactionReaderTest { +class TransactionReaderTest { private static final ValueFactory vf = SimpleValueFactory.getInstance(); @@ -51,7 +51,7 @@ public class TransactionReaderTest { private static final IRI context2 = vf.createIRI("http://example.org/context2"); @Test - public void testRoundtrip() throws Exception { + void testRoundtrip() throws Exception { AddStatementOperation operation = new AddStatementOperation(bob, knows, alice, context1, context2); @@ -87,7 +87,7 @@ public void testRoundtrip() throws Exception { * @throws Exception */ @Test - public void testRoundtripRDFStar() throws Exception { + void testRoundtripRDFStar() throws Exception { AddStatementOperation rdfStarOperation = new AddStatementOperation(alice, knows, vf.createTriple(bob, knows, alice), context1); @@ -118,7 +118,7 @@ public void testRoundtripRDFStar() throws Exception { } @Test - public void testControlCharHandling() throws Exception { + void testControlCharHandling() throws Exception { AddStatementOperation operation = new AddStatementOperation(bob, knows, controlCharText); List txn = new ArrayList<>(); @@ -137,7 +137,7 @@ public void testControlCharHandling() throws Exception { for (TransactionOperation op : parsedTxn) { assertTrue(op instanceof AddStatementOperation); AddStatementOperation addOp = (AddStatementOperation) op; - assertTrue(addOp.getObject().equals(controlCharText)); + assertEquals(controlCharText, addOp.getObject()); } } diff --git a/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/transaction/TransactionWriterTest.java b/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/transaction/TransactionWriterTest.java index 772368cad6e..2b98360246b 100644 --- a/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/transaction/TransactionWriterTest.java +++ b/core/http/protocol/src/test/java/org/eclipse/rdf4j/http/protocol/transaction/TransactionWriterTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -public class TransactionWriterTest { +class TransactionWriterTest { private static Stream serializedLiterals() { return Stream.of( arguments(literal("Hello World"), @@ -38,7 +38,7 @@ private static Stream serializedLiterals() { @ParameterizedTest @MethodSource("serializedLiterals") - public void testSerializeLiteral(Literal literal, String expectedString) throws Exception { + void testSerializeLiteral(Literal literal, String expectedString) throws Exception { TransactionWriter writer = new TransactionWriter(); StringWriter sw = new StringWriter(); diff --git a/core/model-api/pom.xml b/core/model-api/pom.xml index 8a3e3b65ab1..a05f65ff4ed 100644 --- a/core/model-api/pom.xml +++ b/core/model-api/pom.xml @@ -15,6 +15,11 @@ rdf4j-common-annotation ${project.version} + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/model-api/src/test/java/org/eclipse/rdf4j/model/base/CoreDatatypeTest.java b/core/model-api/src/test/java/org/eclipse/rdf4j/model/base/CoreDatatypeTest.java index 0a69772b4be..b5dbcea2c8a 100644 --- a/core/model-api/src/test/java/org/eclipse/rdf4j/model/base/CoreDatatypeTest.java +++ b/core/model-api/src/test/java/org/eclipse/rdf4j/model/base/CoreDatatypeTest.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; -public class CoreDatatypeTest { +class CoreDatatypeTest { @Test - public void testOrderOfXSD() { + void testOrderOfXSD() { ArrayList datatypes = getXSDDatatypesShuffled(); List datatypeIRIs = getXSDDatatypesShuffled().stream() @@ -45,7 +45,7 @@ public void testOrderOfXSD() { } @Test - public void testOrderOfRDF() { + void testOrderOfRDF() { ArrayList datatypes = getRDFDatatypesShuffled(); List datatypeIRIs = getRDFDatatypesShuffled().stream() @@ -81,7 +81,7 @@ private ArrayList getRDFDatatypesShuffled() { } @Test - public void testToString() { + void testToString() { for (CoreDatatype value : CoreDatatypeHelper.getReverseLookup().values()) { assertSame(value.toString(), value.getIri().toString()); } @@ -89,7 +89,7 @@ public void testToString() { } @Test - public void testUnknownDatatype() { + void testUnknownDatatype() { assertEquals(CoreDatatype.NONE, CoreDatatype.from(new AbstractIRI.GenericIRI("http://example.com"))); } diff --git a/core/model/pom.xml b/core/model/pom.xml index 35502114b46..7f81d6bfeda 100644 --- a/core/model/pom.xml +++ b/core/model/pom.xml @@ -57,6 +57,11 @@ guava-testlib test + + org.junit.jupiter + junit-jupiter + test + org.junit.jupiter junit-jupiter-params diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/DateTimeTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/DateTimeTest.java index 531c980d071..1ea108f119d 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/DateTimeTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/DateTimeTest.java @@ -121,7 +121,7 @@ class ValidDateTest { @ParameterizedTest(name = "{0}") @MethodSource("org.eclipse.rdf4j.model.datatypes.DateTimeTest#validDates") - public void runTest(String dateString) { + void runTest(String dateString) { if (!XMLDatatypeUtil.isValidDateTime(dateString)) { String errMsg = "string should be valid but is not: " + dateString; logError(errMsg); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/XMLDatatypeUtilTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/XMLDatatypeUtilTest.java index c4e48dd4df2..4738f838919 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/XMLDatatypeUtilTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/datatypes/XMLDatatypeUtilTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.datatypes; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.base.CoreDatatype; @@ -24,7 +24,7 @@ * * @author Jeen Broekstra */ -public class XMLDatatypeUtilTest { +class XMLDatatypeUtilTest { private static final String[] VALID_FLOATS = { "1", "1.0", "1.0E6", "-1.0E6", "15.00001E2", "1500000000000", "1E104", "0.1E105", "INF", "-INF", "NaN" }; @@ -168,7 +168,7 @@ public class XMLDatatypeUtilTest { private static final String[] INVALID_URI = { "http://datypic.com#frag1#frag2", "http://datypic.com#f% rag" }; @Test - public void testNormalize() { + void testNormalize() { assertEquals("-1.0E-1", XMLDatatypeUtil.normalize("-0.1", XSD.DOUBLE)); assertEquals("1.0E-1", XMLDatatypeUtil.normalize("0.1", XSD.DOUBLE)); assertEquals("1.001E2", XMLDatatypeUtil.normalize("100.1", XSD.DOUBLE)); @@ -182,7 +182,7 @@ public void testNormalize() { * . */ @Test - public void testIsValidValue() { + void testIsValidValue() { testValidation(VALID_FLOATS, XSD.FLOAT, true); testValidation(INVALID_FLOATS, XSD.FLOAT, false); @@ -243,37 +243,37 @@ private void testValidation(String[] values, IRI datatype, boolean validValues) } @Test - public void testParseDouble() { + void testParseDouble() { for (String value : VALID_FLOATS) { XMLDatatypeUtil.parseDouble(value); } } @Test - public void testParseFloat() { + void testParseFloat() { for (String value : VALID_FLOATS) { XMLDatatypeUtil.parseFloat(value); } } @Test - public void testCompareDateTimeStamp() { + void testCompareDateTimeStamp() { int sameOffset = XMLDatatypeUtil.compare("2019-12-06T00:00:00Z", "2019-12-06T00:00:00+00:00", XSD.DATETIMESTAMP); - assertTrue("Not the same", sameOffset == 0); + assertEquals(0, sameOffset, "Not the same"); int offset1 = XMLDatatypeUtil.compare("2019-12-06T14:00:00+02:00", "2019-12-06T13:00:00+02:00", XSD.DATETIMESTAMP); - assertTrue("Wrong order", offset1 > 0); + assertTrue(offset1 > 0, "Wrong order"); int offset2 = XMLDatatypeUtil.compare("2019-12-06T12:00:00+02:00", "2019-12-06T13:00:00-04:00", XSD.DATETIMESTAMP); - assertTrue("Wrong order", offset2 < 0); + assertTrue(offset2 < 0, "Wrong order"); } @Test - public void testToStringNaN() { + void testToStringNaN() { Double d = Double.NaN; - assertEquals(XMLDatatypeUtil.toString(d), XMLDatatypeUtil.NaN); + assertEquals(XMLDatatypeUtil.NaN, XMLDatatypeUtil.toString(d)); } } diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/ContextStatementTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/ContextStatementTest.java index d674859ec47..a205b84f3fb 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/ContextStatementTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/ContextStatementTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.impl; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.HashSet; import java.util.Set; @@ -23,7 +23,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ContextStatementTest { +class ContextStatementTest { private static final ValueFactory vf = SimpleValueFactory.getInstance(); @@ -40,15 +40,15 @@ public class ContextStatementTest { private static final IRI g2 = vf.createIRI("urn:g2"); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void test() { + void test() { Statement st1 = vf.createStatement(s1, p1, o1); Statement st2 = vf.createStatement(s1, p1, o1, g1); Statement st3 = vf.createStatement(s1, p1, o2); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/DynamicModelConcurrentModificationAndUpgradeTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/DynamicModelConcurrentModificationAndUpgradeTest.java index 39185821d65..17a0d81b64d 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/DynamicModelConcurrentModificationAndUpgradeTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/DynamicModelConcurrentModificationAndUpgradeTest.java @@ -25,7 +25,7 @@ import org.eclipse.rdf4j.model.vocabulary.RDFS; import org.junit.jupiter.api.Test; -public class DynamicModelConcurrentModificationAndUpgradeTest { +class DynamicModelConcurrentModificationAndUpgradeTest { /** * Add multiple statements while forcing an upgrade to make sure we then get an exception because the underlying @@ -34,7 +34,7 @@ public class DynamicModelConcurrentModificationAndUpgradeTest { * @throws InterruptedException */ @Test - public void testConcurrentAddAndUpgrade() throws InterruptedException { + void testConcurrentAddAndUpgrade() throws InterruptedException { for (int i = 0; i < 100; i++) { Exception exception = runTest(); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/DynamicModelTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/DynamicModelTest.java index 3c84d9b2d55..d82ad100ddf 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/DynamicModelTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/DynamicModelTest.java @@ -17,10 +17,10 @@ import org.eclipse.rdf4j.model.Namespace; import org.junit.jupiter.api.Test; -public class DynamicModelTest { +class DynamicModelTest { @Test - public void testAddNamespace() { + void testAddNamespace() { SimpleNamespace ns = new SimpleNamespace("ex", "example:namespace"); Model model = new DynamicModelFactory().createEmptyModel(); @@ -33,7 +33,7 @@ public void testAddNamespace() { } @Test - public void testAddNamespacePrefixAndName() { + void testAddNamespacePrefixAndName() { String prefix = "ex"; String name = "example:namespace"; @@ -49,7 +49,7 @@ public void testAddNamespacePrefixAndName() { } @Test - public void testRemoveNamespace() { + void testRemoveNamespace() { Namespace ns = new SimpleNamespace("ex", "example:namespace"); Model model = new DynamicModelFactory().createEmptyModel(); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/SimpleValueFactoryTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/SimpleValueFactoryTest.java index 7f2d244c97c..8c6c1b46647 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/impl/SimpleValueFactoryTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/impl/SimpleValueFactoryTest.java @@ -17,7 +17,7 @@ /** * @author jeen */ -public class SimpleValueFactoryTest extends ValueFactoryTest { +class SimpleValueFactoryTest extends ValueFactoryTest { private ValueFactory f; @@ -30,7 +30,7 @@ protected ValueFactory factory() { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { f = SimpleValueFactory.getInstance(); } diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/GraphComparisonsTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/GraphComparisonsTest.java index b700dacf86b..f298778d2ae 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/GraphComparisonsTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/GraphComparisonsTest.java @@ -31,7 +31,7 @@ import com.google.common.hash.HashFunction; import com.google.common.hash.Hashing; -public class GraphComparisonsTest { +class GraphComparisonsTest { private static final String ex = "http://example.org/"; @@ -40,7 +40,7 @@ public class GraphComparisonsTest { g = bnode("g"), h = bnode("h"), i = bnode("i"); @Test - public void testCanonicalHashing() { + void testCanonicalHashing() { Model example49 = buildExample49Model(); Map mapping = GraphComparisons.hashBNodes(example49).getCurrentNodeMapping(); @@ -61,7 +61,7 @@ public void testCanonicalHashing() { } @Test - public void testIsoCanonicalize() { + void testIsoCanonicalize() { Model example49 = buildExample49Model(); Model canonicalized = GraphComparisons.isoCanonicalize(example49); @@ -70,7 +70,7 @@ public void testIsoCanonicalize() { } @Test - public void testIsoCanonicalize_list() { + void testIsoCanonicalize_list() { List list = Arrays.asList("b", "a", "c", "d", "e"); Model rdfCollection1 = RDFCollections.asRDF(list, a, new TreeModel()); @@ -87,7 +87,7 @@ public void testIsoCanonicalize_list() { } @Test - public void testIsomorphic() { + void testIsomorphic() { Model example49 = buildExample49Model(); Model isomorphic = buildExample49ModelIsomorphic(); @@ -95,7 +95,7 @@ public void testIsomorphic() { } @Test - public void testHashTuple() { + void testHashTuple() { HashFunction hashFunction = Hashing.murmur3_128(); HashCode hash1 = hashFunction.hashString("abcd", Charsets.UTF_8); @@ -109,7 +109,7 @@ public void testHashTuple() { } @Test - public void testHashBag() { + void testHashBag() { HashFunction hashFunction = Hashing.murmur3_128(); HashCode hash1 = hashFunction.hashString("abcd", Charsets.UTF_8); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/LiteralsTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/LiteralsTest.java index 2ea7f0e1595..17304992820 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/LiteralsTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/LiteralsTest.java @@ -14,6 +14,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; 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.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -43,7 +44,7 @@ * * @author Peter Ansell */ -public class LiteralsTest { +class LiteralsTest { private static final ValueFactory vf = SimpleValueFactory.getInstance(); private static final Model model = new LinkedHashModel(); @@ -98,7 +99,7 @@ public class LiteralsTest { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#normalizeLanguageTag(String)} . */ @Test - public void testNormaliseBCP47Tag() throws Exception { + void testNormaliseBCP47Tag() throws Exception { for (String[] expectedNormalization : expectedTagNormalizations) { assertThat(Literals.normalizeLanguageTag(expectedNormalization[0])).isEqualTo(expectedNormalization[1]); @@ -115,7 +116,7 @@ public void testNormaliseBCP47Tag() throws Exception { */ @Disabled @Test - public final void testGetLabelLiteralString() throws Exception { + final void testGetLabelLiteralString() throws Exception { fail("Not yet implemented"); // TODO } @@ -125,7 +126,7 @@ public final void testGetLabelLiteralString() throws Exception { */ @Disabled @Test - public final void testGetLabelValueString() throws Exception { + final void testGetLabelValueString() throws Exception { fail("Not yet implemented"); // TODO } @@ -135,7 +136,7 @@ public final void testGetLabelValueString() throws Exception { */ @Disabled @Test - public final void testGetByteValueLiteralByte() throws Exception { + final void testGetByteValueLiteralByte() throws Exception { fail("Not yet implemented"); // TODO } @@ -144,7 +145,7 @@ public final void testGetByteValueLiteralByte() throws Exception { */ @Disabled @Test - public final void testGetByteValueValueByte() throws Exception { + final void testGetByteValueValueByte() throws Exception { fail("Not yet implemented"); // TODO } @@ -154,7 +155,7 @@ public final void testGetByteValueValueByte() throws Exception { */ @Disabled @Test - public final void testGetShortValueLiteralShort() throws Exception { + final void testGetShortValueLiteralShort() throws Exception { fail("Not yet implemented"); // TODO } @@ -164,7 +165,7 @@ public final void testGetShortValueLiteralShort() throws Exception { */ @Disabled @Test - public final void testGetShortValueValueShort() throws Exception { + final void testGetShortValueValueShort() throws Exception { fail("Not yet implemented"); // TODO } @@ -173,7 +174,7 @@ public final void testGetShortValueValueShort() throws Exception { */ @Disabled @Test - public final void testGetIntValueLiteralInt() throws Exception { + final void testGetIntValueLiteralInt() throws Exception { fail("Not yet implemented"); // TODO } @@ -182,7 +183,7 @@ public final void testGetIntValueLiteralInt() throws Exception { */ @Disabled @Test - public final void testGetIntValueValueInt() throws Exception { + final void testGetIntValueValueInt() throws Exception { fail("Not yet implemented"); // TODO } @@ -192,7 +193,7 @@ public final void testGetIntValueValueInt() throws Exception { */ @Disabled @Test - public final void testGetLongValueLiteralLong() throws Exception { + final void testGetLongValueLiteralLong() throws Exception { fail("Not yet implemented"); // TODO } @@ -201,7 +202,7 @@ public final void testGetLongValueLiteralLong() throws Exception { */ @Disabled @Test - public final void testGetLongValueValueLong() throws Exception { + final void testGetLongValueValueLong() throws Exception { fail("Not yet implemented"); // TODO } @@ -212,7 +213,7 @@ public final void testGetLongValueValueLong() throws Exception { */ @Disabled @Test - public final void testGetIntegerValueLiteralBigInteger() throws Exception { + final void testGetIntegerValueLiteralBigInteger() throws Exception { fail("Not yet implemented"); // TODO } @@ -223,7 +224,7 @@ public final void testGetIntegerValueLiteralBigInteger() throws Exception { */ @Disabled @Test - public final void testGetIntegerValueValueBigInteger() throws Exception { + final void testGetIntegerValueValueBigInteger() throws Exception { fail("Not yet implemented"); // TODO } @@ -234,7 +235,7 @@ public final void testGetIntegerValueValueBigInteger() throws Exception { */ @Disabled @Test - public final void testGetDecimalValueLiteralBigDecimal() throws Exception { + final void testGetDecimalValueLiteralBigDecimal() throws Exception { fail("Not yet implemented"); // TODO } @@ -245,7 +246,7 @@ public final void testGetDecimalValueLiteralBigDecimal() throws Exception { */ @Disabled @Test - public final void testGetDecimalValueValueBigDecimal() throws Exception { + final void testGetDecimalValueValueBigDecimal() throws Exception { fail("Not yet implemented"); // TODO } @@ -255,7 +256,7 @@ public final void testGetDecimalValueValueBigDecimal() throws Exception { */ @Disabled @Test - public final void testGetFloatValueLiteralFloat() throws Exception { + final void testGetFloatValueLiteralFloat() throws Exception { fail("Not yet implemented"); // TODO } @@ -265,7 +266,7 @@ public final void testGetFloatValueLiteralFloat() throws Exception { */ @Disabled @Test - public final void testGetFloatValueValueFloat() throws Exception { + final void testGetFloatValueValueFloat() throws Exception { fail("Not yet implemented"); // TODO } @@ -275,7 +276,7 @@ public final void testGetFloatValueValueFloat() throws Exception { */ @Disabled @Test - public final void testGetDoubleValueLiteralDouble() throws Exception { + final void testGetDoubleValueLiteralDouble() throws Exception { fail("Not yet implemented"); // TODO } @@ -285,7 +286,7 @@ public final void testGetDoubleValueLiteralDouble() throws Exception { */ @Disabled @Test - public final void testGetDoubleValueValueDouble() throws Exception { + final void testGetDoubleValueValueDouble() throws Exception { fail("Not yet implemented"); // TODO } @@ -295,7 +296,7 @@ public final void testGetDoubleValueValueDouble() throws Exception { */ @Disabled @Test - public final void testGetBooleanValueLiteralBoolean() throws Exception { + final void testGetBooleanValueLiteralBoolean() throws Exception { fail("Not yet implemented"); // TODO } @@ -305,7 +306,7 @@ public final void testGetBooleanValueLiteralBoolean() throws Exception { */ @Disabled @Test - public final void testGetBooleanValueValueBoolean() throws Exception { + final void testGetBooleanValueValueBoolean() throws Exception { fail("Not yet implemented"); // TODO } @@ -316,7 +317,7 @@ public final void testGetBooleanValueValueBoolean() throws Exception { */ @Disabled @Test - public final void testGetCalendarValueLiteralXMLGregorianCalendar() throws Exception { + final void testGetCalendarValueLiteralXMLGregorianCalendar() throws Exception { fail("Not yet implemented"); // TODO } @@ -327,12 +328,12 @@ public final void testGetCalendarValueLiteralXMLGregorianCalendar() throws Excep */ @Disabled @Test - public final void testGetCalendarValueValueXMLGregorianCalendar() throws Exception { + final void testGetCalendarValueValueXMLGregorianCalendar() throws Exception { fail("Not yet implemented"); // TODO } @Test - public final void testGetDurationValueLiteralDuration() throws Exception { + final void testGetDurationValueLiteralDuration() throws Exception { DatatypeFactory dtFactory = DatatypeFactory.newInstance(); Duration fallback = dtFactory.newDuration(true, 1, 1, 1, 1, 1, 1); @@ -340,7 +341,7 @@ public final void testGetDurationValueLiteralDuration() throws Exception { Duration result = Literals.getDurationValue(vf.createLiteral("P5Y"), fallback); assertNotNull(result); - assertFalse(result.equals(fallback)); + assertNotEquals(result, fallback); assertEquals(5, result.getYears()); } @@ -350,7 +351,7 @@ public final void testGetDurationValueLiteralDuration() throws Exception { * . */ @Test - public void testCreateLiteralObjectNull() throws Exception { + void testCreateLiteralObjectNull() throws Exception { Object obj = null; try { @@ -367,12 +368,12 @@ public void testCreateLiteralObjectNull() throws Exception { * . */ @Test - public void testCreateLiteralObjectBoolean() throws Exception { + void testCreateLiteralObjectBoolean() throws Exception { Object obj = Boolean.TRUE; Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.BOOLEAN); + assertEquals(XSD.BOOLEAN, l.getDatatype()); assertTrue(l.booleanValue()); } @@ -383,13 +384,13 @@ public void testCreateLiteralObjectBoolean() throws Exception { * . */ @Test - public void testCreateLiteralObjectByte() throws Exception { + void testCreateLiteralObjectByte() throws Exception { Object obj = new Integer(42).byteValue(); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.BYTE); - assertEquals(l.getLabel(), "42"); + assertEquals(XSD.BYTE, l.getDatatype()); + assertEquals("42", l.getLabel()); } @@ -399,13 +400,13 @@ public void testCreateLiteralObjectByte() throws Exception { * . */ @Test - public void testCreateLiteralObjectDouble() throws Exception { + void testCreateLiteralObjectDouble() throws Exception { Object obj = new Double(42); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.DOUBLE); - assertEquals(l.getLabel(), "42.0"); + assertEquals(XSD.DOUBLE, l.getDatatype()); + assertEquals("42.0", l.getLabel()); } @@ -415,13 +416,13 @@ public void testCreateLiteralObjectDouble() throws Exception { * . */ @Test - public void testCreateLiteralObjectFloat() throws Exception { + void testCreateLiteralObjectFloat() throws Exception { Object obj = new Float(42); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.FLOAT); - assertEquals(l.getLabel(), "42.0"); + assertEquals(XSD.FLOAT, l.getDatatype()); + assertEquals("42.0", l.getLabel()); } @@ -431,13 +432,13 @@ public void testCreateLiteralObjectFloat() throws Exception { * . */ @Test - public void testCreateLiteralObjectInteger() throws Exception { + void testCreateLiteralObjectInteger() throws Exception { Object obj = new Integer(4); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.INT); - assertEquals(l.getLabel(), "4"); + assertEquals(XSD.INT, l.getDatatype()); + assertEquals("4", l.getLabel()); } @@ -447,13 +448,13 @@ public void testCreateLiteralObjectInteger() throws Exception { * . */ @Test - public void testCreateLiteralObjectLong() throws Exception { + void testCreateLiteralObjectLong() throws Exception { Object obj = new Long(42); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.LONG); - assertEquals(l.getLabel(), "42"); + assertEquals(XSD.LONG, l.getDatatype()); + assertEquals("42", l.getLabel()); } @@ -463,12 +464,12 @@ public void testCreateLiteralObjectLong() throws Exception { * . */ @Test - public void testCreateLiteralObjectShort() throws Exception { + void testCreateLiteralObjectShort() throws Exception { Object obj = Short.parseShort("42"); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.SHORT); + assertEquals(XSD.SHORT, l.getDatatype()); assertEquals("42", l.getLabel()); } @@ -479,7 +480,7 @@ public void testCreateLiteralObjectShort() throws Exception { * . */ @Test - public void testCreateLiteralObjectXMLGregorianCalendar() throws Exception { + void testCreateLiteralObjectXMLGregorianCalendar() throws Exception { GregorianCalendar c = new GregorianCalendar(); c.setTime(new Date()); @@ -487,7 +488,7 @@ public void testCreateLiteralObjectXMLGregorianCalendar() throws Exception { Object obj = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.DATETIME); + assertEquals(XSD.DATETIME, l.getDatatype()); // TODO check lexical value? } catch (DatatypeConfigurationException e) { e.printStackTrace(); @@ -502,12 +503,12 @@ public void testCreateLiteralObjectXMLGregorianCalendar() throws Exception { * . */ @Test - public void testCreateLiteralObjectDate() throws Exception { + void testCreateLiteralObjectDate() throws Exception { Object obj = new Date(); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.DATETIME); + assertEquals(XSD.DATETIME, l.getDatatype()); } @@ -517,13 +518,13 @@ public void testCreateLiteralObjectDate() throws Exception { * . */ @Test - public void testCreateLiteralObjectString() throws Exception { + void testCreateLiteralObjectString() throws Exception { Object obj = "random unique string"; Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.STRING); - assertEquals(l.getLabel(), "random unique string"); + assertEquals(XSD.STRING, l.getDatatype()); + assertEquals("random unique string", l.getLabel()); } @@ -533,12 +534,12 @@ public void testCreateLiteralObjectString() throws Exception { * . */ @Test - public void testCreateLiteralObjectObject() throws Exception { + void testCreateLiteralObjectObject() throws Exception { Object obj = new Object(); Literal l = Literals.createLiteral(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.STRING); + assertEquals(XSD.STRING, l.getDatatype()); } @@ -548,7 +549,7 @@ public void testCreateLiteralObjectObject() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectNull() throws Exception { + void testCreateLiteralOrFailObjectNull() throws Exception { Object obj = null; try { @@ -565,12 +566,12 @@ public void testCreateLiteralOrFailObjectNull() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectBoolean() throws Exception { + void testCreateLiteralOrFailObjectBoolean() throws Exception { Object obj = Boolean.TRUE; Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.BOOLEAN); + assertEquals(XSD.BOOLEAN, l.getDatatype()); assertTrue(l.booleanValue()); } @@ -581,13 +582,13 @@ public void testCreateLiteralOrFailObjectBoolean() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectByte() throws Exception { + void testCreateLiteralOrFailObjectByte() throws Exception { Object obj = new Integer(42).byteValue(); Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.BYTE); - assertEquals(l.getLabel(), "42"); + assertEquals(XSD.BYTE, l.getDatatype()); + assertEquals("42", l.getLabel()); } @@ -597,13 +598,13 @@ public void testCreateLiteralOrFailObjectByte() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectDouble() throws Exception { + void testCreateLiteralOrFailObjectDouble() throws Exception { Object obj = new Double(42); Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.DOUBLE); - assertEquals(l.getLabel(), "42.0"); + assertEquals(XSD.DOUBLE, l.getDatatype()); + assertEquals("42.0", l.getLabel()); } @@ -613,13 +614,13 @@ public void testCreateLiteralOrFailObjectDouble() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectFloat() throws Exception { + void testCreateLiteralOrFailObjectFloat() throws Exception { Object obj = new Float(42); Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.FLOAT); - assertEquals(l.getLabel(), "42.0"); + assertEquals(XSD.FLOAT, l.getDatatype()); + assertEquals("42.0", l.getLabel()); } @@ -629,13 +630,13 @@ public void testCreateLiteralOrFailObjectFloat() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectInteger() throws Exception { + void testCreateLiteralOrFailObjectInteger() throws Exception { Object obj = new Integer(4); Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.INT); - assertEquals(l.getLabel(), "4"); + assertEquals(XSD.INT, l.getDatatype()); + assertEquals("4", l.getLabel()); } @@ -645,13 +646,13 @@ public void testCreateLiteralOrFailObjectInteger() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectLong() throws Exception { + void testCreateLiteralOrFailObjectLong() throws Exception { Object obj = new Long(42); Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.LONG); - assertEquals(l.getLabel(), "42"); + assertEquals(XSD.LONG, l.getDatatype()); + assertEquals("42", l.getLabel()); } @@ -661,12 +662,12 @@ public void testCreateLiteralOrFailObjectLong() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectShort() throws Exception { + void testCreateLiteralOrFailObjectShort() throws Exception { Object obj = Short.parseShort("42"); Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.SHORT); + assertEquals(XSD.SHORT, l.getDatatype()); assertEquals("42", l.getLabel()); } @@ -677,7 +678,7 @@ public void testCreateLiteralOrFailObjectShort() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectXMLGregorianCalendar() throws Exception { + void testCreateLiteralOrFailObjectXMLGregorianCalendar() throws Exception { GregorianCalendar c = new GregorianCalendar(); c.setTime(new Date()); @@ -685,7 +686,7 @@ public void testCreateLiteralOrFailObjectXMLGregorianCalendar() throws Exception Object obj = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.DATETIME); + assertEquals(XSD.DATETIME, l.getDatatype()); // TODO check lexical value? } catch (DatatypeConfigurationException e) { e.printStackTrace(); @@ -700,12 +701,12 @@ public void testCreateLiteralOrFailObjectXMLGregorianCalendar() throws Exception * . */ @Test - public void testCreateLiteralOrFailObjectDate() throws Exception { + void testCreateLiteralOrFailObjectDate() throws Exception { Object obj = new Date(); Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.DATETIME); + assertEquals(XSD.DATETIME, l.getDatatype()); } @@ -715,13 +716,13 @@ public void testCreateLiteralOrFailObjectDate() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectString() throws Exception { + void testCreateLiteralOrFailObjectString() throws Exception { Object obj = "random unique string"; Literal l = Literals.createLiteralOrFail(SimpleValueFactory.getInstance(), obj); assertNotNull(l); - assertEquals(l.getDatatype(), XSD.STRING); - assertEquals(l.getLabel(), "random unique string"); + assertEquals(XSD.STRING, l.getDatatype()); + assertEquals("random unique string", l.getLabel()); } @@ -731,7 +732,7 @@ public void testCreateLiteralOrFailObjectString() throws Exception { * . */ @Test - public void testCreateLiteralOrFailObjectObject() throws Exception { + void testCreateLiteralOrFailObjectObject() throws Exception { Object obj = new Object(); try { @@ -748,7 +749,7 @@ public void testCreateLiteralOrFailObjectObject() throws Exception { * . */ @Test - public void testCanCreateLiteralObjectNull() throws Exception { + void testCanCreateLiteralObjectNull() throws Exception { Object obj = null; assertFalse(Literals.canCreateLiteral(obj)); @@ -758,7 +759,7 @@ public void testCanCreateLiteralObjectNull() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectBoolean() throws Exception { + void testCanCreateLiteralObjectBoolean() throws Exception { Object obj = Boolean.TRUE; assertTrue(Literals.canCreateLiteral(obj)); @@ -769,7 +770,7 @@ public void testCanCreateLiteralObjectBoolean() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectByte() throws Exception { + void testCanCreateLiteralObjectByte() throws Exception { Object obj = new Integer(42).byteValue(); assertTrue(Literals.canCreateLiteral(obj)); @@ -780,7 +781,7 @@ public void testCanCreateLiteralObjectByte() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectDouble() throws Exception { + void testCanCreateLiteralObjectDouble() throws Exception { Object obj = new Double(42); assertTrue(Literals.canCreateLiteral(obj)); @@ -791,7 +792,7 @@ public void testCanCreateLiteralObjectDouble() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectFloat() throws Exception { + void testCanCreateLiteralObjectFloat() throws Exception { Object obj = new Float(42); assertTrue(Literals.canCreateLiteral(obj)); @@ -802,7 +803,7 @@ public void testCanCreateLiteralObjectFloat() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectInteger() throws Exception { + void testCanCreateLiteralObjectInteger() throws Exception { Object obj = new Integer(4); assertTrue(Literals.canCreateLiteral(obj)); @@ -813,7 +814,7 @@ public void testCanCreateLiteralObjectInteger() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectLong() throws Exception { + void testCanCreateLiteralObjectLong() throws Exception { Object obj = new Long(42); assertTrue(Literals.canCreateLiteral(obj)); @@ -824,7 +825,7 @@ public void testCanCreateLiteralObjectLong() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectShort() throws Exception { + void testCanCreateLiteralObjectShort() throws Exception { Object obj = Short.parseShort("42"); assertTrue(Literals.canCreateLiteral(obj)); @@ -835,7 +836,7 @@ public void testCanCreateLiteralObjectShort() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectXMLGregorianCalendar() throws Exception { + void testCanCreateLiteralObjectXMLGregorianCalendar() throws Exception { GregorianCalendar c = new GregorianCalendar(); c.setTime(new Date()); @@ -848,7 +849,7 @@ public void testCanCreateLiteralObjectXMLGregorianCalendar() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectDate() throws Exception { + void testCanCreateLiteralObjectDate() throws Exception { Object obj = new Date(); assertTrue(Literals.canCreateLiteral(obj)); @@ -859,7 +860,7 @@ public void testCanCreateLiteralObjectDate() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectString() throws Exception { + void testCanCreateLiteralObjectString() throws Exception { Object obj = "random unique string"; assertTrue(Literals.canCreateLiteral(obj)); @@ -870,7 +871,7 @@ public void testCanCreateLiteralObjectString() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#canCreateLiteral(Object)} . */ @Test - public void testCanCreateLiteralObjectObject() throws Exception { + void testCanCreateLiteralObjectObject() throws Exception { Object obj = new Object(); assertFalse(Literals.canCreateLiteral(obj)); @@ -881,7 +882,7 @@ public void testCanCreateLiteralObjectObject() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Literals#getLabel(Optional, String)}} . */ @Test - public void testGetLabelForOptional() throws Exception { + void testGetLabelForOptional() throws Exception { Literal lit = vf.createLiteral(1.0); model.add(foo, bar, lit); @@ -889,14 +890,14 @@ public void testGetLabelForOptional() throws Exception { Optional result = Models.object(model); String label = Literals.getLabel(result, "fallback"); assertNotNull(label); - assertTrue(label.equals("1.0")); + assertEquals("1.0", label); } /** * Test method for {@link org.eclipse.rdf4j.model.util.Literals#getLabel(Optional, String)}} . */ @Test - public void testGetLabelForOptionalInFallback() throws Exception { + void testGetLabelForOptionalInFallback() throws Exception { Literal lit = vf.createLiteral(1.0); model.add(foo, bar, lit); @@ -904,6 +905,6 @@ public void testGetLabelForOptionalInFallback() throws Exception { Optional result = Models.object(model); String label = Literals.getLabel((Optional) null, "fallback"); assertNotNull(label); - assertTrue(label.equals("fallback")); + assertEquals("fallback", label); } } diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelBuilderTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelBuilderTest.java index f5eee9f2f95..7ea1bdcf00f 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelBuilderTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelBuilderTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.impl.LinkedHashModel; @@ -24,20 +24,20 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ModelBuilderTest { +class ModelBuilderTest { private ModelBuilder testBuilder; private Model model; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { model = new LinkedHashModel(); testBuilder = new ModelBuilder(model); } @Test - public void testAddPredicateObject1() { + void testAddPredicateObject1() { try { testBuilder.add(RDF.TYPE, RDFS.CLASS); fail("add should have failed with model exception: subject not set"); @@ -47,7 +47,7 @@ public void testAddPredicateObject1() { } @Test - public void testAddPredicateObject2() { + void testAddPredicateObject2() { testBuilder.subject(RDF.TYPE); testBuilder.add(RDF.TYPE, RDFS.CLASS); @@ -55,21 +55,21 @@ public void testAddPredicateObject2() { } @Test - public void testAddWithStringSubject() { + void testAddWithStringSubject() { testBuilder.add("foaf:Person", RDF.TYPE, RDFS.CLASS); assertTrue(model.contains(FOAF.PERSON, RDF.TYPE, RDFS.CLASS)); } @Test - public void testAddWithUnknownStringSubject() { + void testAddWithUnknownStringSubject() { testBuilder.add("ex:Person", RDF.TYPE, RDFS.CLASS); assertTrue(model.contains(SimpleValueFactory.getInstance().createIRI("ex:Person"), RDF.TYPE, RDFS.CLASS)); } @Test - public void testAddWithIllegalStringSubject() { + void testAddWithIllegalStringSubject() { try { testBuilder.add("Johnny", RDF.TYPE, RDFS.CLASS); fail("should have failed on illegal IRI for subject"); @@ -80,20 +80,20 @@ public void testAddWithIllegalStringSubject() { } @Test - public void testAddInteger() { + void testAddInteger() { testBuilder.subject(FOAF.PERSON).add("rdfs:label", 9); assertTrue(model.contains(FOAF.PERSON, RDFS.LABEL, SimpleValueFactory.getInstance().createLiteral(9))); } @Test - public void testAddObjectStringIRI() { + void testAddObjectStringIRI() { testBuilder.subject(FOAF.PERSON).add("rdf:type", "rdfs:Class"); assertTrue(model.contains(FOAF.PERSON, RDF.TYPE, RDFS.CLASS)); } @Test - public void testAddNamedGraph() { + void testAddNamedGraph() { testBuilder.namedGraph(RDF.ALT).subject(FOAF.PERSON).add("rdf:type", RDFS.CLASS); assertTrue(model.contains(FOAF.PERSON, RDF.TYPE, RDFS.CLASS, RDF.ALT)); @@ -109,7 +109,7 @@ public void testAddNamedGraph() { } @Test - public void testAddNamedGraph2() { + void testAddNamedGraph2() { testBuilder.namedGraph("rdf:Alt").subject(FOAF.PERSON).add("rdf:type", RDFS.CLASS); assertTrue(model.contains(FOAF.PERSON, RDF.TYPE, RDFS.CLASS, RDF.ALT)); @@ -120,14 +120,14 @@ public void testAddNamedGraph2() { } @Test - public void testNSAddedForDatatype() { + void testNSAddedForDatatype() { testBuilder.add("ex:Person", FOAF.AGE, 42); assertTrue(model.getNamespaces().contains(XSD.NS)); } @Test - public void testNSNotAddedForDatatypeString() { + void testNSNotAddedForDatatypeString() { testBuilder.add("ex:Person", FOAF.NAME, "John Doe"); assertFalse(model.getNamespaces().contains(XSD.NS)); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelCollectorTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelCollectorTest.java index dab6b7a2fbb..d6e2452ec20 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelCollectorTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelCollectorTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.HashSet; import java.util.Set; @@ -26,27 +26,27 @@ /** * @author Bart.Hanssens */ -public class ModelCollectorTest { +class ModelCollectorTest { private final int nrStmts = 1000; private final Set stmts = new HashSet<>(); private final ValueFactory F = SimpleValueFactory.getInstance(); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { for (int i = 0; i < nrStmts; i++) { stmts.add(F.createStatement(F.createIRI("http://www.example.com/" + i), RDFS.LABEL, F.createLiteral(i))); } } @Test - public void testCollector() { + void testCollector() { Model m = stmts.stream().collect(ModelCollector.toModel()); - assertEquals("Number of statements does not match", m.size(), nrStmts); + assertEquals(m.size(), nrStmts, "Number of statements does not match"); } @Test - public void testCollectorParallel() { + void testCollectorParallel() { Model m = stmts.parallelStream().collect(ModelCollector.toModel()); - assertEquals("Number of statements does not match", m.size(), nrStmts); + assertEquals(m.size(), nrStmts, "Number of statements does not match"); } } diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelsTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelsTest.java index 0e48d4daa87..4fbfa062fae 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelsTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ModelsTest.java @@ -11,10 +11,10 @@ package org.eclipse.rdf4j.model.util; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +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.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import java.util.Optional; @@ -57,7 +57,7 @@ public class ModelsTest { private BNode baz; @BeforeEach - public void setUp() { + void setUp() { model1 = new LinkedHashModel(); model2 = new LinkedHashModel(); @@ -67,7 +67,7 @@ public void setUp() { } @Test - public void testModelsIsomorphic() { + void testModelsIsomorphic() { // two identical statements, no bnodes model1.add(foo, RDF.TYPE, bar); @@ -81,7 +81,7 @@ public void testModelsIsomorphic() { // add same statement again model2.add(foo, RDF.TYPE, bar); - assertTrue("Duplicate statement should not be considered", Models.isomorphic(model1, model2)); + assertTrue(Models.isomorphic(model1, model2), "Duplicate statement should not be considered"); // two identical statements with bnodes added. model1.add(foo, RDF.TYPE, VF.createBNode()); @@ -112,7 +112,7 @@ public void testModelsIsomorphic() { } @Test - public void testModelsIsomorphicContext() { + void testModelsIsomorphicContext() { model1.add(foo, RDF.TYPE, bar); model2.add(foo, RDF.TYPE, bar, foo); assertFalse(Models.isomorphic(model1, model2)); @@ -124,7 +124,7 @@ public void testModelsIsomorphicContext() { } @Test - public void testModelsIsomorphic_BlankNodeContext() { + void testModelsIsomorphic_BlankNodeContext() { model1.add(foo, RDF.TYPE, bar); model2.add(foo, RDF.TYPE, bar); @@ -137,7 +137,7 @@ public void testModelsIsomorphic_BlankNodeContext() { } @Test - public void testIsSubset() { + void testIsSubset() { // two empty sets assertTrue(Models.isSubset(model1, model2)); @@ -260,11 +260,11 @@ public void testSubjectBNode() { Resource result = Models.subjectBNode(model1).orElse(null); assertNotNull(result); - assertTrue(result.equals(baz)); + assertEquals(result, baz); } @Test - public void testSetProperty() { + void testSetProperty() { Literal lit1 = VF.createLiteral(1.0); model1.add(foo, bar, lit1); model1.add(foo, bar, foo); @@ -282,7 +282,7 @@ public void testSetProperty() { } @Test - public void testGetProperty() { + void testGetProperty() { Literal lit1 = VF.createLiteral(1.0); model1.add(foo, bar, lit1); model1.add(foo, bar, foo); @@ -294,7 +294,7 @@ public void testGetProperty() { } @Test - public void testGetProperties() { + void testGetProperties() { Literal lit1 = VF.createLiteral(1.0); model1.add(foo, bar, lit1); model1.add(foo, bar, foo); @@ -308,7 +308,7 @@ public void testGetProperties() { } @Test - public void testGetPropertyLiteral() { + void testGetPropertyLiteral() { Literal lit1 = VF.createLiteral(1.0); model1.add(foo, bar, lit1); model1.add(foo, bar, foo); @@ -320,7 +320,7 @@ public void testGetPropertyLiteral() { } @Test - public void testGetPropertyLiteral2() { + void testGetPropertyLiteral2() { model1.add(foo, bar, foo); Optional l = Models.getPropertyLiteral(model1, foo, bar); @@ -328,7 +328,7 @@ public void testGetPropertyLiteral2() { } @Test - public void testGetPropertyIRI() { + void testGetPropertyIRI() { Literal lit1 = VF.createLiteral(1.0); model1.add(foo, bar, lit1); model1.add(foo, bar, foo); @@ -340,7 +340,7 @@ public void testGetPropertyIRI() { } @Test - public void testGetPropertyIRI2() { + void testGetPropertyIRI2() { Literal lit1 = VF.createLiteral(1.0); model1.add(foo, bar, lit1); @@ -350,7 +350,7 @@ public void testGetPropertyIRI2() { } @Test - public void testGetPropertyInvalidInput() { + void testGetPropertyInvalidInput() { Literal lit1 = VF.createLiteral(1.0); model1.add(foo, bar, lit1); model1.add(foo, bar, foo); @@ -371,7 +371,7 @@ public void testGetPropertyInvalidInput() { } @Test - public void testSetPropertyWithContext1() { + void testSetPropertyWithContext1() { Literal lit1 = VF.createLiteral(1.0); IRI graph1 = VF.createIRI("urn:g1"); IRI graph2 = VF.createIRI("urn:g2"); @@ -394,7 +394,7 @@ public void testSetPropertyWithContext1() { } @Test - public void testSetPropertyWithContext2() { + void testSetPropertyWithContext2() { Literal lit1 = VF.createLiteral(1.0); IRI graph1 = VF.createIRI("urn:g1"); IRI graph2 = VF.createIRI("urn:g2"); @@ -417,7 +417,7 @@ public void testSetPropertyWithContext2() { } @Test - public void testStripContextsCompletely() { + void testStripContextsCompletely() { IRI graph1 = VF.createIRI("urn:g1"); IRI graph2 = VF.createIRI("urn:g2"); Literal lit1 = VF.createLiteral(1.0); @@ -437,7 +437,7 @@ public void testStripContextsCompletely() { } @Test - public void testStripContextsSpecificContext() { + void testStripContextsSpecificContext() { IRI graph1 = VF.createIRI("urn:g1"); IRI graph2 = VF.createIRI("urn:g2"); Literal lit1 = VF.createLiteral(1.0); @@ -456,76 +456,76 @@ public void testStripContextsSpecificContext() { } @Test - public void testConvertReificationToRDFStar() { + void testConvertReificationToRDFStar() { Model reificationModel = RDFStarTestHelper.createRDFReificationModel(); Model referenceRDFStarModel = RDFStarTestHelper.createRDFStarModel(); Model rdfStarModel1 = Models.convertReificationToRDFStar(VF, reificationModel); - assertTrue("RDF reification conversion to RDF-star with explicit VF, model-to-model", - Models.isomorphic(rdfStarModel1, referenceRDFStarModel)); + assertTrue(Models.isomorphic(rdfStarModel1, referenceRDFStarModel), + "RDF reification conversion to RDF-star with explicit VF, model-to-model"); Model rdfStarModel2 = Models.convertReificationToRDFStar(reificationModel); - assertTrue("RDF reification conversion to RDF-star with implicit VF, model-to-model", - Models.isomorphic(rdfStarModel2, referenceRDFStarModel)); + assertTrue(Models.isomorphic(rdfStarModel2, referenceRDFStarModel), + "RDF reification conversion to RDF-star with implicit VF, model-to-model"); Model rdfStarModel3 = new TreeModel(); Models.convertReificationToRDFStar(VF, reificationModel, (Consumer) rdfStarModel3::add); - assertTrue("RDF reification conversion to RDF-star with explicit VF, model-to-consumer", - Models.isomorphic(rdfStarModel3, referenceRDFStarModel)); + assertTrue(Models.isomorphic(rdfStarModel3, referenceRDFStarModel), + "RDF reification conversion to RDF-star with explicit VF, model-to-consumer"); Model rdfStarModel4 = new TreeModel(); Models.convertReificationToRDFStar(reificationModel, rdfStarModel4::add); - assertTrue("RDF reification conversion to RDF-star with implicit VF, model-to-consumer", - Models.isomorphic(rdfStarModel4, referenceRDFStarModel)); + assertTrue(Models.isomorphic(rdfStarModel4, referenceRDFStarModel), + "RDF reification conversion to RDF-star with implicit VF, model-to-consumer"); } @Test - public void testConvertIncompleteReificationToRDFStar() { + void testConvertIncompleteReificationToRDFStar() { // Incomplete RDF reification (missing type, subject, predicate or object) should not add statements // and should not remove any of the existing incomplete reification statements. Model incompleteReificationModel = RDFStarTestHelper.createIncompleteRDFReificationModel(); Model rdfStarModel1 = Models.convertReificationToRDFStar(VF, incompleteReificationModel); - assertTrue("Incomplete RDF reification conversion to RDF-star with explicit VF, model-to-model", - Models.isomorphic(rdfStarModel1, incompleteReificationModel)); + assertTrue(Models.isomorphic(rdfStarModel1, incompleteReificationModel), + "Incomplete RDF reification conversion to RDF-star with explicit VF, model-to-model"); Model rdfStarModel2 = Models.convertReificationToRDFStar(incompleteReificationModel); - assertTrue("Incomplete RDF reification conversion to RDF-star with implicit VF, model-to-model", - Models.isomorphic(rdfStarModel2, incompleteReificationModel)); + assertTrue(Models.isomorphic(rdfStarModel2, incompleteReificationModel), + "Incomplete RDF reification conversion to RDF-star with implicit VF, model-to-model"); Model rdfStarModel3 = new TreeModel(); Models.convertReificationToRDFStar(VF, incompleteReificationModel, (Consumer) rdfStarModel3::add); - assertTrue("Incomplete RDF reification conversion to RDF-star with explicit VF, model-to-consumer", - Models.isomorphic(rdfStarModel3, incompleteReificationModel)); + assertTrue(Models.isomorphic(rdfStarModel3, incompleteReificationModel), + "Incomplete RDF reification conversion to RDF-star with explicit VF, model-to-consumer"); Model rdfStarModel4 = new TreeModel(); Models.convertReificationToRDFStar(incompleteReificationModel, rdfStarModel4::add); - assertTrue("Incomplete RDF reification conversion to RDF-star with implicit VF, model-to-consumer", - Models.isomorphic(rdfStarModel4, incompleteReificationModel)); + assertTrue(Models.isomorphic(rdfStarModel4, incompleteReificationModel), + "Incomplete RDF reification conversion to RDF-star with implicit VF, model-to-consumer"); } @Test - public void testConvertRDFStarToReification() { + void testConvertRDFStarToReification() { Model rdfStarModel = RDFStarTestHelper.createRDFStarModel(); Model referenceModel = RDFStarTestHelper.createRDFReificationModel(); Model reificationModel1 = Models.convertRDFStarToReification(VF, rdfStarModel); - assertTrue("RDF-star conversion to reification with explicit VF, model-to-model", - Models.isomorphic(reificationModel1, referenceModel)); + assertTrue(Models.isomorphic(reificationModel1, referenceModel), + "RDF-star conversion to reification with explicit VF, model-to-model"); Model reificationModel2 = Models.convertRDFStarToReification(rdfStarModel); - assertTrue("RDF-star conversion to reification with implicit VF, model-to-model", - Models.isomorphic(reificationModel2, referenceModel)); + assertTrue(Models.isomorphic(reificationModel2, referenceModel), + "RDF-star conversion to reification with implicit VF, model-to-model"); Model reificationModel3 = new TreeModel(); Models.convertRDFStarToReification(VF, rdfStarModel, (Consumer) reificationModel3::add); - assertTrue("RDF-star conversion to reification with explicit VF, model-to-consumer", - Models.isomorphic(reificationModel3, referenceModel)); + assertTrue(Models.isomorphic(reificationModel3, referenceModel), + "RDF-star conversion to reification with explicit VF, model-to-consumer"); Model reificationModel4 = new TreeModel(); Models.convertRDFStarToReification(rdfStarModel, reificationModel4::add); - assertTrue("RDF-star conversion to reification with explicit VF, model-to-consumer", - Models.isomorphic(reificationModel4, referenceModel)); + assertTrue(Models.isomorphic(reificationModel4, referenceModel), + "RDF-star conversion to reification with explicit VF, model-to-consumer"); } } diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/NamespacesTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/NamespacesTest.java index 5dc2fcb40cc..1f22e66f0b5 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/NamespacesTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/NamespacesTest.java @@ -10,11 +10,11 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +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.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collection; import java.util.Collections; @@ -38,7 +38,7 @@ /** * @author Peter Ansell */ -public class NamespacesTest { +class NamespacesTest { private String testPrefix1; @@ -49,7 +49,7 @@ public class NamespacesTest { private String testName2; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { testPrefix1 = "ns1"; testPrefix2 = "ns2"; testName1 = "http://example.org/ns1#"; @@ -60,7 +60,7 @@ public void setUp() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#asMap(java.util.Set)}. */ @Test - public final void testAsMapEmpty() { + final void testAsMapEmpty() { Map map = Namespaces.asMap(Collections.emptySet()); assertTrue(map.isEmpty()); @@ -70,7 +70,7 @@ public final void testAsMapEmpty() { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#asMap(java.util.Set)}. */ @Test - public final void testAsMapOne() { + final void testAsMapOne() { Set input = new HashSet<>(); input.add(new SimpleNamespace(RDF.PREFIX, RDF.NAMESPACE)); @@ -87,7 +87,7 @@ public final void testAsMapOne() { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#asMap(java.util.Set)}. */ @Test - public final void testAsMapMultiple() { + final void testAsMapMultiple() { Set input = new HashSet<>(); input.add(new SimpleNamespace(RDF.PREFIX, RDF.NAMESPACE)); input.add(new SimpleNamespace(RDFS.PREFIX, RDFS.NAMESPACE)); @@ -116,7 +116,7 @@ public final void testAsMapMultiple() { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapClear() throws Exception { + final void testWrapClear() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); // Check no exceptions when calling clear on empty backing set @@ -137,7 +137,7 @@ public final void testWrapClear() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapContainsKey() throws Exception { + final void testWrapContainsKey() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); // Check no exceptions when calling containsKey on empty backing set @@ -156,7 +156,7 @@ public final void testWrapContainsKey() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapContainsValue() throws Exception { + final void testWrapContainsValue() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); // Check no exceptions when calling containsKey on empty backing set @@ -175,7 +175,7 @@ public final void testWrapContainsValue() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapEntrySet() throws Exception { + final void testWrapEntrySet() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); @@ -204,7 +204,7 @@ public final void testWrapEntrySet() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapGet() throws Exception { + final void testWrapGet() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); assertNull(testMap.get(testPrefix1)); @@ -220,7 +220,7 @@ public final void testWrapGet() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapIsEmpty() throws Exception { + final void testWrapIsEmpty() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); assertTrue(testMap.isEmpty()); @@ -236,7 +236,7 @@ public final void testWrapIsEmpty() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapKeySet() throws Exception { + final void testWrapKeySet() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); @@ -264,12 +264,12 @@ public final void testWrapKeySet() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapPut() throws Exception { + final void testWrapPut() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); String put1 = testMap.put(testPrefix1, testName1); - assertNull("Should have returned null from put on an empty backing set", put1); + assertNull(put1, "Should have returned null from put on an empty backing set"); assertEquals(1, testSet.size()); assertTrue(testSet.contains(new SimpleNamespace(testPrefix1, testName1))); assertTrue(testMap.containsKey(testPrefix1)); @@ -293,7 +293,7 @@ public final void testWrapPut() throws Exception { assertFalse(testMap.containsValue(testName2)); String put3 = testMap.put(testPrefix1, testName1); - assertNull("Should have returned null from put on an empty backing set", put3); + assertNull(put3, "Should have returned null from put on an empty backing set"); assertEquals(1, testSet.size()); assertTrue(testSet.contains(new SimpleNamespace(testPrefix1, testName1))); assertTrue(testMap.containsKey(testPrefix1)); @@ -304,7 +304,7 @@ public final void testWrapPut() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapPutAll() throws Exception { + final void testWrapPutAll() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); @@ -360,7 +360,7 @@ public final void testWrapPutAll() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapRemove() throws Exception { + final void testWrapRemove() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); @@ -416,7 +416,7 @@ public final void testWrapRemove() throws Exception { * Test method for {@link org.eclipse.rdf4j.model.util.Namespaces#wrap(java.util.Set)}. */ @Test - public final void testWrapValues() throws Exception { + final void testWrapValues() throws Exception { Set testSet = new LinkedHashSet<>(); Map testMap = Namespaces.wrap(testSet); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFCollectionsTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFCollectionsTest.java index 8dc4bd940f0..4f36738a086 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFCollectionsTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFCollectionsTest.java @@ -10,10 +10,10 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +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.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.CALLS_REAL_METHODS; import static org.mockito.Mockito.atLeastOnce; @@ -35,7 +35,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class RDFCollectionsTest { +class RDFCollectionsTest { private final static ValueFactory vf = SimpleValueFactory.getInstance(); @@ -48,7 +48,7 @@ public class RDFCollectionsTest { private Literal c; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { a = Literals.createLiteral(vf, "A"); b = Literals.createLiteral(vf, "B"); c = Literals.createLiteral(vf, "C"); @@ -59,7 +59,7 @@ public void setUp() throws Exception { } @Test - public void testConversionRoundtrip() { + void testConversionRoundtrip() { IRI head = vf.createIRI("urn:head"); Model m = RDFCollections.asRDF(values, head, new TreeModel()); assertNotNull(m); @@ -75,7 +75,7 @@ public void testConversionRoundtrip() { } @Test - public void testNonWellformedCollection_MissingTerminator() { + void testNonWellformedCollection_MissingTerminator() { Resource head = vf.createBNode(); Model m = RDFCollections.asRDF(values, head, new TreeModel()); m.remove(null, RDF.REST, RDF.NIL); @@ -83,7 +83,7 @@ public void testNonWellformedCollection_MissingTerminator() { } @Test - public void testNonWellformedCollection_Cycle() { + void testNonWellformedCollection_Cycle() { Resource head = vf.createBNode("z"); Model m = RDFCollections.asRDF(values, head, new TreeModel()); @@ -96,7 +96,7 @@ public void testNonWellformedCollection_Cycle() { } @Test - public void testNonWellformedCollection_IncorrectHeadNode() { + void testNonWellformedCollection_IncorrectHeadNode() { Resource head = vf.createBNode(); Model m = RDFCollections.asRDF(values, head, new TreeModel()); @@ -105,7 +105,7 @@ public void testNonWellformedCollection_IncorrectHeadNode() { } @Test - public void testInjectedValueFactoryIsUsed() { + void testInjectedValueFactoryIsUsed() { Resource head = vf.createBNode(); ValueFactory injected = mock(SimpleValueFactory.class, CALLS_REAL_METHODS); RDFCollections.asRDF(values, head, new TreeModel(), injected); @@ -113,7 +113,7 @@ public void testInjectedValueFactoryIsUsed() { } @Test - public void testExtract() { + void testExtract() { Resource head = vf.createBNode(); Model m = RDFCollections.asRDF(values, head, new TreeModel()); @@ -129,7 +129,7 @@ public void testExtract() { } @Test - public void testRemove() { + void testRemove() { Resource head = vf.createBNode(); Model m = RDFCollections.asRDF(values, head, new TreeModel()); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFContainersTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFContainersTest.java index b3db876c6b0..28f298947b0 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFContainersTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/RDFContainersTest.java @@ -11,9 +11,9 @@ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.CALLS_REAL_METHODS; import static org.mockito.Mockito.atLeastOnce; @@ -35,7 +35,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class RDFContainersTest { +class RDFContainersTest { private final static ValueFactory vf = SimpleValueFactory.getInstance(); @@ -54,7 +54,7 @@ public class RDFContainersTest { private IRI RDF_3; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { a = Literals.createLiteral(vf, "A"); b = Literals.createLiteral(vf, "B"); c = Literals.createLiteral(vf, "C"); @@ -69,7 +69,7 @@ public void setUp() throws Exception { } @Test - public void testConversionRoundtrip() { + void testConversionRoundtrip() { IRI container = vf.createIRI("urn:container"); Model m = RDFContainers.toRDF(RDF.BAG, values, container, new TreeModel()); assertNotNull(m); @@ -87,7 +87,7 @@ public void testConversionRoundtrip() { } @Test - public void testInjectedValueFactoryIsUsed() { + void testInjectedValueFactoryIsUsed() { Resource container = vf.createBNode(); ValueFactory injected = mock(SimpleValueFactory.class, CALLS_REAL_METHODS); RDFContainers.toRDF(RDF.BAG, values, container, new TreeModel(), injected); @@ -95,7 +95,7 @@ public void testInjectedValueFactoryIsUsed() { } @Test - public void testExtract() { + void testExtract() { Resource container = vf.createBNode(); Model m = RDFContainers.toRDF(RDF.BAG, values, container, new TreeModel()); @@ -108,7 +108,7 @@ public void testExtract() { } @Test - public void testRemove() { + void testRemove() { Resource container = vf.createBNode(); Model m = RDFContainers.toRDF(RDF.BAG, values, container, new TreeModel()); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/StatementsTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/StatementsTest.java index 53281bd9aab..4ed43558dac 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/StatementsTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/StatementsTest.java @@ -12,10 +12,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.Resource; @@ -29,12 +29,12 @@ import org.eclipse.rdf4j.model.vocabulary.RDF; import org.junit.jupiter.api.Test; -public class StatementsTest { +class StatementsTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @Test - public void testMultipleContexts() { + void testMultipleContexts() { Resource c1 = vf.createIRI("urn:c1"); Resource c2 = vf.createIRI("urn:c1"); Resource c3 = vf.createIRI("urn:c1"); @@ -48,14 +48,14 @@ public void testMultipleContexts() { } @Test - public void testNoContext() { + void testNoContext() { Model m = Statements.create(vf, FOAF.AGE, RDF.TYPE, RDF.PROPERTY, new TreeModel()); assertFalse(m.isEmpty()); assertTrue(m.contains(FOAF.AGE, RDF.TYPE, RDF.PROPERTY)); } @Test - public void stripContextWithContextInput() { + void stripContextWithContextInput() { Resource c1 = vf.createIRI("urn:c1"); Statement st = vf.createStatement(FOAF.AGE, RDF.TYPE, RDF.PROPERTY, c1); @@ -63,14 +63,14 @@ public void stripContextWithContextInput() { } @Test - public void stripContextWithNoContextInput() { + void stripContextWithNoContextInput() { Statement st = vf.createStatement(FOAF.AGE, RDF.TYPE, RDF.PROPERTY); assertThat(Statements.stripContext(st)).isEqualTo(st); } @Test - public void testInvalidInput() { + void testInvalidInput() { assertThatThrownBy(() -> { Statements.consume(vf, FOAF.AGE, RDF.TYPE, RDF.PROPERTY, st -> fail("should have resulted in Exception"), @@ -85,40 +85,40 @@ public void testInvalidInput() { } @Test - public void testRDFStarReification() { + void testRDFStarReification() { Model rdfStarModel = RDFStarTestHelper.createRDFStarModel(); Model reifiedModel = RDFStarTestHelper.createRDFReificationModel(); Model convertedModel1 = new LinkedHashModel(); rdfStarModel.forEach((s) -> Statements.convertRDFStarToReification(s, convertedModel1::add)); - assertTrue("RDF-star conversion to reification with implicit VF", - Models.isomorphic(reifiedModel, convertedModel1)); + assertTrue(Models.isomorphic(reifiedModel, convertedModel1), + "RDF-star conversion to reification with implicit VF"); Model convertedModel2 = new LinkedHashModel(); rdfStarModel.forEach((s) -> Statements.convertRDFStarToReification(vf, s, convertedModel2::add)); - assertTrue("RDF-star conversion to reification with explicit VF", - Models.isomorphic(reifiedModel, convertedModel2)); + assertTrue(Models.isomorphic(reifiedModel, convertedModel2), + "RDF-star conversion to reification with explicit VF"); Model convertedModel3 = new LinkedHashModel(); rdfStarModel.forEach((s) -> Statements.convertRDFStarToReification(vf, (t) -> vf.createBNode(t.stringValue()), s, convertedModel3::add)); - assertTrue("RDF-star conversion to reification with explicit VF and custom BNode mapping", - Models.isomorphic(reifiedModel, convertedModel3)); + assertTrue(Models.isomorphic(reifiedModel, convertedModel3), + "RDF-star conversion to reification with explicit VF and custom BNode mapping"); } @Test - public void testTripleToResourceMapper() { + void testTripleToResourceMapper() { Triple t1 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"), vf.createLiteral("data")); Triple t2 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"), vf.createLiteral("data")); - assertEquals("Identical triples must produce the same blank node", - Statements.TRIPLE_BNODE_MAPPER.apply(t1), Statements.TRIPLE_BNODE_MAPPER.apply(t2)); + assertEquals(Statements.TRIPLE_BNODE_MAPPER.apply(t1), Statements.TRIPLE_BNODE_MAPPER.apply(t2), + "Identical triples must produce the same blank node"); } @Test - public void testToTriple() { + void testToTriple() { Triple t1 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"), vf.createLiteral("data")); @@ -129,7 +129,7 @@ public void testToTriple() { } @Test - public void testStatement() { + void testStatement() { Resource context = vf.createIRI("http://example.org/context"); Triple t1 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"), @@ -142,7 +142,7 @@ public void testStatement() { } @Test - public void testStatement_Context() { + void testStatement_Context() { Resource context = vf.createIRI("http://example.org/context"); Triple t1 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"), @@ -155,7 +155,7 @@ public void testStatement_Context() { } @Test - public void testStatement_NullContext() { + void testStatement_NullContext() { Triple t1 = vf.createTriple(vf.createIRI("http://example.com/1"), vf.createIRI("http://example.com/2"), vf.createLiteral("data")); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/URIUtilTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/URIUtilTest.java index f4c0c25507c..30cbacd0542 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/URIUtilTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/URIUtilTest.java @@ -10,18 +10,18 @@ *******************************************************************************/ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; /** * @author Arjohn Kampman */ -public class URIUtilTest { +class URIUtilTest { @Test - public void testIsCorrectURISplit() throws Exception { + void testIsCorrectURISplit() throws Exception { assertTrue(URIUtil.isCorrectURISplit("http://www.example.org/page#", "")); assertTrue(URIUtil.isCorrectURISplit("http://www.example.org/page#", "1")); assertTrue(URIUtil.isCorrectURISplit("http://www.example.org/page#", "1/2")); @@ -46,41 +46,41 @@ public void testIsCorrectURISplit() throws Exception { } @Test - public void testIsValidURIReference() throws Exception { + void testIsValidURIReference() throws Exception { assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar/")); - assertTrue("whitespace should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar with a lot of space/")); - assertTrue("unwise chars should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar/unwise{}")); - assertTrue("query params in single quotes should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar?query='blah'")); - assertTrue("query params in double quotes should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar?query=\"blah\"&foo=bar")); - assertTrue("short simple urns should be allowed", URIUtil.isValidURIReference("urn:p1")); - assertTrue("Escaped special char should be allowed", - URIUtil.isValidURIReference("http://example.org/foo\\u00ea/bar/")); - assertTrue("fragment identifier should be allowed", - URIUtil.isValidURIReference("http://example.org/foo/bar#fragment1")); - assertTrue("Unescaped special char should be allowed", - URIUtil.isValidURIReference("http://example.org/foo®/bar/")); - assertFalse("control char should not be allowed", - URIUtil.isValidURIReference("http://example.org/foo\u0001/bar/")); - assertFalse("relative uri should fail", URIUtil.isValidURIReference("foo/bar/")); - assertFalse("single column is not a valid uri", URIUtil.isValidURIReference(":")); - assertTrue("reserved char is allowed in non-conflicting spot", - URIUtil.isValidURIReference("http://foo.com/b!ar/")); - assertFalse("reserved char should not be allowed in conflicting spot", - URIUtil.isValidURIReference("http;://foo.com/bar/")); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar with a lot of space/"), + "whitespace should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar/unwise{}"), + "unwise chars should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar?query='blah'"), + "query params in single quotes should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar?query=\"blah\"&foo=bar"), + "query params in double quotes should be allowed"); + assertTrue(URIUtil.isValidURIReference("urn:p1"), "short simple urns should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo\\u00ea/bar/"), + "Escaped special char should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo/bar#fragment1"), + "fragment identifier should be allowed"); + assertTrue(URIUtil.isValidURIReference("http://example.org/foo®/bar/"), + "Unescaped special char should be allowed"); + assertFalse(URIUtil.isValidURIReference("http://example.org/foo\u0001/bar/"), + "control char should not be allowed"); + assertFalse(URIUtil.isValidURIReference("foo/bar/"), "relative uri should fail"); + assertFalse(URIUtil.isValidURIReference(":"), "single column is not a valid uri"); + assertTrue(URIUtil.isValidURIReference("http://foo.com/b!ar/"), + "reserved char is allowed in non-conflicting spot"); + assertFalse(URIUtil.isValidURIReference("http;://foo.com/bar/"), + "reserved char should not be allowed in conflicting spot"); } @Test - public void controlCharacterInURI() { - assertFalse("URI containing Unicode control char should be invalid", - URIUtil.isValidURIReference("http://example.org/foo\u001F/bar/")); + void controlCharacterInURI() { + assertFalse(URIUtil.isValidURIReference("http://example.org/foo\u001F/bar/"), + "URI containing Unicode control char should be invalid"); } @Test - public void isValidLocalName() { + void isValidLocalName() { assertTrue(URIUtil.isValidLocalName("2bar")); assertTrue(URIUtil.isValidLocalName("foobar")); assertTrue(URIUtil.isValidLocalName("_foobar")); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ValuesTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ValuesTest.java index 0914743a420..d0f448b6d5d 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/ValuesTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/ValuesTest.java @@ -17,8 +17,8 @@ import static org.eclipse.rdf4j.model.util.Values.literal; import static org.eclipse.rdf4j.model.util.Values.namespace; import static org.eclipse.rdf4j.model.util.Values.triple; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -57,58 +57,58 @@ * * @author Jeen Broekstra */ -public class ValuesTest { +class ValuesTest { private ValueFactory vf; @BeforeEach - public void setUp() { + void setUp() { vf = mock(ValueFactory.class); } @Test - public void testValidIri1() { + void testValidIri1() { IRI validIRI = iri("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); assertThat(validIRI).isEqualTo(RDF.TYPE); } @Test - public void testIri1_InjectedValueFactory() { + void testIri1_InjectedValueFactory() { iri(vf, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); verify(vf).createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); } @Test - public void testValidIri2() { + void testValidIri2() { IRI validIRI = iri(RDF.NAMESPACE, "type"); assertThat(validIRI).isEqualTo(RDF.TYPE); } @Test - public void testIri2_InjectedValueFactory() { + void testIri2_InjectedValueFactory() { iri(vf, RDF.NAMESPACE, "type"); verify(vf).createIRI(RDF.NAMESPACE, "type"); } @Test - public void testInvalidIri1() { + void testInvalidIri1() { assertThrows(IllegalArgumentException.class, () -> iri("http://an invalid iri/")); } @Test - public void testInvalidIri2() { + void testInvalidIri2() { assertThrows(IllegalArgumentException.class, () -> iri("http://valid-namespace.org/", "invalid localname")); } @Test - public void testIriNull() { + void testIriNull() { assertThatThrownBy(() -> iri(null)) .isInstanceOf(NullPointerException.class) .hasMessageContaining("iri may not be null"); } @Test - public void testIriNamespaceNull() { + void testIriNamespaceNull() { String namespace = null; assertThatThrownBy(() -> iri(namespace, "type")) .isInstanceOf(NullPointerException.class) @@ -116,7 +116,7 @@ public void testIriNamespaceNull() { } @Test - public void testIriLocalNameNull() { + void testIriLocalNameNull() { assertThatThrownBy(() -> iri(RDF.NAMESPACE, null)) .isInstanceOf(NullPointerException.class) .hasMessageContaining("localName may not be null"); @@ -124,7 +124,7 @@ public void testIriLocalNameNull() { } @Test - public void testIriFromPrefixedName() { + void testIriFromPrefixedName() { Model m = new TreeModel(); m.setNamespace(RDF.NS); m.setNamespace(namespace("ex", "http://example.org/")); @@ -135,7 +135,7 @@ public void testIriFromPrefixedName() { } @Test - public void testIriFromPrefixedName_invalid1() { + void testIriFromPrefixedName_invalid1() { Model m = new TreeModel(); m.setNamespace(RDF.NS); m.setNamespace(namespace("ex", "http://example.org/")); @@ -145,7 +145,7 @@ public void testIriFromPrefixedName_invalid1() { } @Test - public void testIriFromPrefixedName_invalid2() { + void testIriFromPrefixedName_invalid2() { Model m = new TreeModel(); m.setNamespace(RDF.NS); @@ -154,20 +154,20 @@ public void testIriFromPrefixedName_invalid2() { } @Test - public void testBNode() { + void testBNode() { BNode bnode = bnode(); assertThat(bnode).isNotNull(); assertThat(bnode.getID()).isNotNull(); } @Test - public void testBNode_InjectedValueFactory() { + void testBNode_InjectedValueFactory() { bnode(vf); verify(vf).createBNode(); } @Test - public void testBNodeWithId() { + void testBNodeWithId() { String nodeId = "foobar"; BNode bnode = bnode(nodeId); assertThat(bnode).isNotNull(); @@ -175,14 +175,14 @@ public void testBNodeWithId() { } @Test - public void testBNodeWithId_InjectedValueFactory() { + void testBNodeWithId_InjectedValueFactory() { String nodeId = "foobar"; bnode(vf, nodeId); verify(vf).createBNode(nodeId); } @Test - public void testBnodeNull() { + void testBnodeNull() { String nodeId = null; assertThatThrownBy(() -> bnode(nodeId)) .isInstanceOf(NullPointerException.class) @@ -190,7 +190,7 @@ public void testBnodeNull() { } @Test - public void testStringLiteral() { + void testStringLiteral() { String lexValue = "a literal"; Literal literal = literal(lexValue); @@ -200,14 +200,14 @@ public void testStringLiteral() { } @Test - public void testStringLiteral_InjectedValueFactory() { + void testStringLiteral_InjectedValueFactory() { String lexValue = "a literal"; literal(vf, lexValue); verify(vf).createLiteral(lexValue); } @Test - public void testStringLiteralNull() { + void testStringLiteralNull() { String lexicalValue = null; assertThatThrownBy(() -> literal(lexicalValue)) .isInstanceOf(NullPointerException.class) @@ -215,7 +215,7 @@ public void testStringLiteralNull() { } @Test - public void testLanguageTaggedLiteral() { + void testLanguageTaggedLiteral() { String lexValue = "a literal"; String languageTag = "en"; Literal literal = literal(lexValue, languageTag); @@ -227,7 +227,7 @@ public void testLanguageTaggedLiteral() { } @Test - public void testLanguageTaggedLiteral_InjectedValueFactory() { + void testLanguageTaggedLiteral_InjectedValueFactory() { String lexValue = "a literal"; String languageTag = "en"; literal(vf, lexValue, languageTag); @@ -235,7 +235,7 @@ public void testLanguageTaggedLiteral_InjectedValueFactory() { } @Test - public void testLanguageTaggedLiteralNull1() { + void testLanguageTaggedLiteralNull1() { String lexicalValue = null; String languageTag = "en"; assertThatThrownBy(() -> literal(lexicalValue, languageTag)) @@ -244,7 +244,7 @@ public void testLanguageTaggedLiteralNull1() { } @Test - public void testLanguageTaggedLiteralNull2() { + void testLanguageTaggedLiteralNull2() { String lexicalValue = "a literal"; String languageTag = null; assertThatThrownBy(() -> literal(lexicalValue, languageTag)) @@ -253,7 +253,7 @@ public void testLanguageTaggedLiteralNull2() { } @Test - public void testValidTypedLiteral() { + void testValidTypedLiteral() { String lexValue = "42"; Literal literal = literal(lexValue, CoreDatatype.XSD.INT); @@ -264,26 +264,26 @@ public void testValidTypedLiteral() { } @Test - public void testTypedLiteral_InjectedValueFactory() { + void testTypedLiteral_InjectedValueFactory() { String lexValue = "42"; literal(vf, lexValue, XSD.INT); verify(vf).createLiteral(lexValue, XSD.INT); } @Test - public void testInvalidTypedLiteral() { + void testInvalidTypedLiteral() { String lexValue = "fourty two"; assertThrows(IllegalArgumentException.class, () -> literal(lexValue, XSD.INT)); } @Test - public void testInvalidTypedLiteralCoreDatatype() { + void testInvalidTypedLiteralCoreDatatype() { String lexValue = "fourty two"; assertThrows(IllegalArgumentException.class, () -> literal(lexValue, CoreDatatype.XSD.INT)); } @Test - public void testTypedLiteralNullLexValue() { + void testTypedLiteralNullLexValue() { String lexValue = null; assertThatThrownBy(() -> literal(lexValue, XSD.INT)) .isInstanceOf(NullPointerException.class) @@ -291,7 +291,7 @@ public void testTypedLiteralNullLexValue() { } @Test - public void testTypedLiteralNullDatatype() { + void testTypedLiteralNullDatatype() { String lexValue = "42"; IRI datatype = null; assertThatThrownBy(() -> literal(lexValue, datatype)) @@ -300,7 +300,7 @@ public void testTypedLiteralNullDatatype() { } @Test - public void testTypedLiteralNullCoreDatatype() { + void testTypedLiteralNullCoreDatatype() { String lexValue = "42"; CoreDatatype datatype = null; assertThatThrownBy(() -> literal(lexValue, datatype)) @@ -309,7 +309,7 @@ public void testTypedLiteralNullCoreDatatype() { } @Test - public void testBooleanLiteral() { + void testBooleanLiteral() { Literal literal = literal(true); assertThat(literal.getLabel()).isEqualTo("true"); assertThat(literal.booleanValue()).isTrue(); @@ -324,13 +324,13 @@ public void testBooleanLiteral() { } @Test - public void testBooleanLiteral_InjectedValueFactory() { + void testBooleanLiteral_InjectedValueFactory() { literal(vf, true); verify(vf).createLiteral(true); } @Test - public void testByteLiteral() { + void testByteLiteral() { byte value = 42; Literal literal = literal(value); assertThat(literal.getLabel()).isEqualTo("42"); @@ -340,14 +340,14 @@ public void testByteLiteral() { } @Test - public void testByteLiteral_InjectedValueFactory() { + void testByteLiteral_InjectedValueFactory() { byte value = 42; literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testShortLiteral() { + void testShortLiteral() { short value = 42; Literal literal = literal(value); assertThat(literal.getLabel()).isEqualTo("42"); @@ -357,14 +357,14 @@ public void testShortLiteral() { } @Test - public void testShortLiteral_InjectedValueFactory() { + void testShortLiteral_InjectedValueFactory() { short value = 42; literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testIntLiteral() { + void testIntLiteral() { int value = 42; Literal literal = literal(value); assertThat(literal.getLabel()).isEqualTo("42"); @@ -374,14 +374,14 @@ public void testIntLiteral() { } @Test - public void testIntLiteral_InjectedValueFactory() { + void testIntLiteral_InjectedValueFactory() { int value = 42; literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testLongLiteral() { + void testLongLiteral() { long value = Long.MAX_VALUE; Literal literal = literal(value); assertThat(literal.longValue()).isEqualTo(value); @@ -390,14 +390,14 @@ public void testLongLiteral() { } @Test - public void testLongLiteral_InjectedValueFactory() { + void testLongLiteral_InjectedValueFactory() { long value = 42; literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testFloatLiteral() { + void testFloatLiteral() { float value = 42.313f; Literal literal = literal(value); assertThat(literal.floatValue()).isEqualTo(value); @@ -406,14 +406,14 @@ public void testFloatLiteral() { } @Test - public void testFloatLiteral_InjectedValueFactory() { + void testFloatLiteral_InjectedValueFactory() { float value = 42.313f; literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testDoubleLiteral() { + void testDoubleLiteral() { double value = 42.313; Literal literal = literal(value); assertThat(literal.doubleValue()).isEqualTo(value); @@ -422,14 +422,14 @@ public void testDoubleLiteral() { } @Test - public void testDoubleLiteral_InjectedValueFactory() { + void testDoubleLiteral_InjectedValueFactory() { double value = 42.313; literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testBigDecimalLiteral() { + void testBigDecimalLiteral() { BigDecimal value = new BigDecimal(42.313); Literal literal = literal(value); assertThat(literal.decimalValue()).isEqualTo(value); @@ -438,14 +438,14 @@ public void testBigDecimalLiteral() { } @Test - public void testBigDecimalLiteral_InjectedValueFactory() { + void testBigDecimalLiteral_InjectedValueFactory() { BigDecimal value = new BigDecimal(42.313); literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testBigDecimalLiteralNull() { + void testBigDecimalLiteralNull() { BigDecimal value = null; assertThatThrownBy(() -> literal(value)) @@ -455,7 +455,7 @@ public void testBigDecimalLiteralNull() { } @Test - public void testBigIntegerLiteral() { + void testBigIntegerLiteral() { BigInteger value = BigInteger.valueOf(42_000_000_000_000_000l); Literal literal = literal(value); assertThat(literal.integerValue()).isEqualTo(value); @@ -464,14 +464,14 @@ public void testBigIntegerLiteral() { } @Test - public void testBigIntegerLiteral_InjectedValueFactory() { + void testBigIntegerLiteral_InjectedValueFactory() { BigInteger value = BigInteger.valueOf(42_000_000_000_000_000l); literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testBigIntegerLiteralNull() { + void testBigIntegerLiteralNull() { BigInteger value = null; assertThatThrownBy(() -> literal(value)) @@ -480,7 +480,7 @@ public void testBigIntegerLiteralNull() { } @Test - public void testTemporalAccessorLiteral() { + void testTemporalAccessorLiteral() { LocalDateTime value = LocalDateTime.parse("2020-09-30T01:02:03.004"); Literal literal = literal(value); @@ -492,14 +492,14 @@ public void testTemporalAccessorLiteral() { } @Test - public void testTemporalAccessorLiteral_InjectedValueFactory() { + void testTemporalAccessorLiteral_InjectedValueFactory() { LocalDateTime value = LocalDateTime.parse("2020-09-30T01:02:03.004"); literal(vf, value); verify(vf).createLiteral(value); } @Test - public void testTemporalAccessorLiteralNull() { + void testTemporalAccessorLiteralNull() { final LocalDateTime value = null; assertThatThrownBy(() -> literal(value)) @@ -509,7 +509,7 @@ public void testTemporalAccessorLiteralNull() { } @Test - public void testTriple() { + void testTriple() { Triple triple = triple(RDF.ALT, RDF.TYPE, RDFS.CONTAINER); assertThat(triple).isNotNull(); @@ -519,13 +519,13 @@ public void testTriple() { } @Test - public void testTriple_InjectedValueFactory() { + void testTriple_InjectedValueFactory() { triple(vf, RDF.ALT, RDF.TYPE, RDFS.CONTAINER); verify(vf).createTriple(RDF.ALT, RDF.TYPE, RDFS.CONTAINER); } @Test - public void testTripleNull() { + void testTripleNull() { assertThatThrownBy(() -> triple(null, RDF.TYPE, RDFS.CONTAINER)) .isInstanceOf(NullPointerException.class) .hasMessageContaining("subject may not be null"); @@ -540,7 +540,7 @@ public void testTripleNull() { } @Test - public void testTripleFromStatement() { + void testTripleFromStatement() { Statement st = SimpleValueFactory.getInstance().createStatement(RDF.ALT, RDF.TYPE, RDFS.CONTAINER); Triple triple = triple(st); assertThat(triple).isNotNull(); @@ -550,34 +550,34 @@ public void testTripleFromStatement() { } @Test - public void testTripleFromStatement_InjectedValueFactory() { + void testTripleFromStatement_InjectedValueFactory() { Statement st = SimpleValueFactory.getInstance().createStatement(RDF.ALT, RDF.TYPE, RDFS.CONTAINER); triple(vf, st); verify(vf).createTriple(RDF.ALT, RDF.TYPE, RDFS.CONTAINER); } @Test - public void testTripleFromStatementNull() { + void testTripleFromStatementNull() { assertThatThrownBy(() -> triple(null)) .isInstanceOf(NullPointerException.class) .hasMessageContaining("statement may not be null"); } @Test - public void testGetValueFactory() { + void testGetValueFactory() { ValueFactory vf = Values.getValueFactory(); assertThat(vf).isNotNull(); } @Test() - public void testLiteralObjectNull() throws Exception { + void testLiteralObjectNull() throws Exception { Object obj = null; assertThatThrownBy(() -> literal(obj)).isInstanceOf(NullPointerException.class) .hasMessageContaining("object may not be null"); } @Test - public void testLiteralObjectBoolean() throws Exception { + void testLiteralObjectBoolean() throws Exception { Object obj = Boolean.TRUE; Literal l = literal(obj); assertThat(l).isNotNull(); @@ -586,7 +586,7 @@ public void testLiteralObjectBoolean() throws Exception { } @Test - public void testLiteralObjectByte() throws Exception { + void testLiteralObjectByte() throws Exception { Object obj = Integer.valueOf(42).byteValue(); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -595,7 +595,7 @@ public void testLiteralObjectByte() throws Exception { } @Test - public void testLiteralObjectDouble() throws Exception { + void testLiteralObjectDouble() throws Exception { Object obj = Double.valueOf(42.0); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -604,7 +604,7 @@ public void testLiteralObjectDouble() throws Exception { } @Test - public void testLiteralObjectFloat() throws Exception { + void testLiteralObjectFloat() throws Exception { Object obj = Float.valueOf(42); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -613,7 +613,7 @@ public void testLiteralObjectFloat() throws Exception { } @Test - public void testLiteralObjectBigDecimal() throws Exception { + void testLiteralObjectBigDecimal() throws Exception { Object obj = BigDecimal.valueOf(42.1); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -622,7 +622,7 @@ public void testLiteralObjectBigDecimal() throws Exception { } @Test - public void testLiteralObjectInteger() throws Exception { + void testLiteralObjectInteger() throws Exception { Object obj = Integer.valueOf(42); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -631,7 +631,7 @@ public void testLiteralObjectInteger() throws Exception { } @Test - public void testLiteralObjectBigInteger() throws Exception { + void testLiteralObjectBigInteger() throws Exception { Object obj = BigInteger.valueOf(42l); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -640,7 +640,7 @@ public void testLiteralObjectBigInteger() throws Exception { } @Test - public void testLiteralObjectShort() throws Exception { + void testLiteralObjectShort() throws Exception { Object obj = Short.parseShort("42"); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -649,7 +649,7 @@ public void testLiteralObjectShort() throws Exception { } @Test - public void testLiteralObjectXMLGregorianCalendar() throws Exception { + void testLiteralObjectXMLGregorianCalendar() throws Exception { GregorianCalendar c = new GregorianCalendar(); c.setTime(new Date()); try { @@ -663,7 +663,7 @@ public void testLiteralObjectXMLGregorianCalendar() throws Exception { } @Test - public void testLiteralObjectDate() throws Exception { + void testLiteralObjectDate() throws Exception { Object obj = new Date(); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -671,7 +671,7 @@ public void testLiteralObjectDate() throws Exception { } @Test - public void testLiteralTemporalPeriod() throws Exception { + void testLiteralTemporalPeriod() throws Exception { Object obj = Period.ofWeeks(42); Literal l = literal(obj); assertThat(l).isNotNull(); @@ -680,7 +680,7 @@ public void testLiteralTemporalPeriod() throws Exception { } @Test - public void testLiteralObjectString() throws Exception { + void testLiteralObjectString() throws Exception { Object obj = "random unique string"; Literal l = literal(obj); assertThat(l).isNotNull(); @@ -689,7 +689,7 @@ public void testLiteralObjectString() throws Exception { } @Test - public void testLiteralObjectObject() throws Exception { + void testLiteralObjectObject() throws Exception { Object obj = new Object(); Literal l = literal(obj); assertThat(l).isNotNull(); diff --git a/core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabulariesTest.java b/core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabulariesTest.java index 42bd44cadee..0789e08753e 100644 --- a/core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabulariesTest.java +++ b/core/model/src/test/java/org/eclipse/rdf4j/model/util/VocabulariesTest.java @@ -11,7 +11,7 @@ package org.eclipse.rdf4j.model.util; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Arrays; import java.util.HashSet; @@ -25,10 +25,10 @@ /** * @author Bart Hanssens */ -public class VocabulariesTest { +class VocabulariesTest { @Test - public void testVocabAllIRI() throws Exception { + void testVocabAllIRI() throws Exception { Set dcIRIs = new HashSet<>(Arrays.asList(DC.CONTRIBUTOR, DC.COVERAGE, DC.CREATOR, DC.DATE, DC.DESCRIPTION, DC.FORMAT, DC.IDENTIFIER, DC.LANGUAGE, DC.PUBLISHER, DC.RELATION, DC.RIGHTS, DC.SOURCE, DC.SUBJECT, DC.TITLE, DC.TYPE)); @@ -39,7 +39,7 @@ public void testVocabAllIRI() throws Exception { } @Test - public void testVocabAllIRIHYDRA() throws Exception { + void testVocabAllIRIHYDRA() throws Exception { Set hydraIRIs = new HashSet<>(Arrays.asList(HYDRA.API_DOCUMENTATION, HYDRA.CLASS, HYDRA.COLLECTION, HYDRA.ERROR, HYDRA.IRI_TEMPLATE, HYDRA.IRI_TEMPLATE_MAPPING, HYDRA.LINK, HYDRA.OPERATION, diff --git a/core/query/pom.xml b/core/query/pom.xml index 1182a0764f9..403ee50766c 100644 --- a/core/query/pom.xml +++ b/core/query/pom.xml @@ -36,6 +36,11 @@ org.apache.commons commons-text + + org.junit.jupiter + junit-jupiter + test + org.junit.platform junit-platform-suite-engine diff --git a/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/LimitIterationTest.java b/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/LimitIterationTest.java index ae21e208911..22446bff4bd 100644 --- a/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/LimitIterationTest.java +++ b/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/LimitIterationTest.java @@ -16,7 +16,7 @@ import org.junit.jupiter.api.Test; -public class LimitIterationTest extends CloseableIterationTest { +class LimitIterationTest extends CloseableIterationTest { protected static LimitIteration createLimitIteration(int limit) { return new LimitIteration<>(createStringList1Iteration(), limit); @@ -33,7 +33,7 @@ protected int getTestIterationSize() { } @Test - public void testInRangeOffset() throws Exception { + void testInRangeOffset() throws Exception { for (int limit = 0; limit < stringList1.size(); limit++) { Iteration iter = createLimitIteration(limit); List resultList = Iterations.asList(iter); @@ -43,7 +43,7 @@ public void testInRangeOffset() throws Exception { } @Test - public void testOutOfRangeOffset() throws Exception { + void testOutOfRangeOffset() throws Exception { Iteration iter = createLimitIteration(2 * stringList1.size()); List resultList = Iterations.asList(iter); assertEquals(stringList1, resultList); diff --git a/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/OffsetIterationTest.java b/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/OffsetIterationTest.java index 440523d1627..a85d2b565a1 100644 --- a/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/OffsetIterationTest.java +++ b/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/OffsetIterationTest.java @@ -17,7 +17,7 @@ import org.junit.jupiter.api.Test; -public class OffsetIterationTest extends CloseableIterationTest { +class OffsetIterationTest extends CloseableIterationTest { protected static OffsetIteration createOffsetIteration(int offset) { return new OffsetIteration<>(createStringList1Iteration(), offset); @@ -34,7 +34,7 @@ protected int getTestIterationSize() { } @Test - public void testInRangeOffset() throws Exception { + void testInRangeOffset() throws Exception { for (int offset = 0; offset < stringList1.size(); offset++) { Iteration iter = createOffsetIteration(offset); List resultList = Iterations.asList(iter); @@ -44,7 +44,7 @@ public void testInRangeOffset() throws Exception { } @Test - public void testOutOfRangeOffset() throws Exception { + void testOutOfRangeOffset() throws Exception { Iteration iter = createOffsetIteration(2 * stringList1.size()); List resultList = Iterations.asList(iter); assertEquals(Collections.emptyList(), resultList); diff --git a/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/UnionIterationTest.java b/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/UnionIterationTest.java index e44b225fb0a..d8f50f753c8 100644 --- a/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/UnionIterationTest.java +++ b/core/query/src/test/java/org/eclipse/rdf4j/common/iteration/UnionIterationTest.java @@ -14,7 +14,7 @@ import org.junit.jupiter.api.Test; -public class UnionIterationTest extends CloseableIterationTest { +class UnionIterationTest extends CloseableIterationTest { @Override protected CloseableIteration createTestIteration() { @@ -27,7 +27,7 @@ protected int getTestIterationSize() { } @Test - public void testArgumentsClosed() throws Exception { + void testArgumentsClosed() throws Exception { SingletonIteration iter1 = new SingletonIteration<>("1"); SingletonIteration iter2 = new SingletonIteration<>("2"); SingletonIteration iter3 = new SingletonIteration<>("3"); diff --git a/core/query/src/test/java/org/eclipse/rdf4j/query/QueryResultsTest.java b/core/query/src/test/java/org/eclipse/rdf4j/query/QueryResultsTest.java index 6fd45e8d40d..41f2140343e 100644 --- a/core/query/src/test/java/org/eclipse/rdf4j/query/QueryResultsTest.java +++ b/core/query/src/test/java/org/eclipse/rdf4j/query/QueryResultsTest.java @@ -11,6 +11,7 @@ package org.eclipse.rdf4j.query; import static org.assertj.core.api.Assertions.assertThat; +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.assertTrue; @@ -40,7 +41,7 @@ /** * @author Arjohn Kampman */ -public class QueryResultsTest { +class QueryResultsTest { private MutableTupleQueryResult tqr1; @@ -82,7 +83,7 @@ public class QueryResultsTest { private final IRI q = VF.createIRI("urn:q"); @BeforeEach - public void setUp() { + void setUp() { tqr1 = new MutableTupleQueryResult(twoBindingNames); tqr2 = new MutableTupleQueryResult(twoBindingNames); tqr3 = new MutableTupleQueryResult(threeBindingNames); @@ -100,7 +101,7 @@ public void setUp() { } @Test - public void testAsModel() throws QueryEvaluationException { + void testAsModel() throws QueryEvaluationException { Model model = QueryResults.asModel(gqr); assertFalse(gqr.hasNext()); @@ -109,7 +110,7 @@ public void testAsModel() throws QueryEvaluationException { } @Test - public void testStreamGraphResult() { + void testStreamGraphResult() { List aboutA = gqr.stream() .filter(s -> s.getSubject().equals(a)) .collect(Collectors.toList()); @@ -117,12 +118,12 @@ public void testStreamGraphResult() { assertFalse(aboutA.isEmpty()); for (Statement st : aboutA) { - assertTrue(st.getSubject().equals(a)); + assertEquals(st.getSubject(), a); } } @Test - public void testStreamTupleResult() { + void testStreamTupleResult() { BindingSet a = new ListBindingSet(twoBindingNames, foo, lit1); BindingSet b = new ListBindingSet(twoBindingNames, bar, lit2); tqr1.append(a); @@ -138,12 +139,12 @@ public void testStreamTupleResult() { assertNotNull(list); assertFalse(list.isEmpty()); for (BindingSet bs : list) { - assertTrue(bs.getValue("a").equals(foo)); + assertEquals(bs.getValue("a"), foo); } } @Test - public void testGraphQueryResultEquals() throws QueryEvaluationException { + void testGraphQueryResultEquals() throws QueryEvaluationException { StubGraphQueryResult toCompare = new StubGraphQueryResult(); @@ -156,7 +157,7 @@ public void testGraphQueryResultEquals() throws QueryEvaluationException { } @Test - public void testDistinctGraphQueryResults() throws QueryEvaluationException { + void testDistinctGraphQueryResults() throws QueryEvaluationException { GraphQueryResult filtered = QueryResults.distinctResults(gqr); @@ -169,7 +170,7 @@ public void testDistinctGraphQueryResults() throws QueryEvaluationException { } @Test - public void testDistinctTupleQueryResults() throws QueryEvaluationException { + void testDistinctTupleQueryResults() throws QueryEvaluationException { BindingSet a = new ListBindingSet(twoBindingNames, foo, lit1); BindingSet b = new ListBindingSet(twoBindingNames, bar, lit2); @@ -190,7 +191,7 @@ public void testDistinctTupleQueryResults() throws QueryEvaluationException { } @Test - public void testBindingSetsCompatible() { + void testBindingSetsCompatible() { { BindingSet a = new ListBindingSet(twoBindingNames, foo, lit1); BindingSet b = new ListBindingSet(twoBindingNames, foo, lit2); @@ -261,7 +262,7 @@ public Map getNamespaces() throws QueryEvaluationException { } @Test - public void testEmptyQueryResult() throws QueryEvaluationException { + void testEmptyQueryResult() throws QueryEvaluationException { tqr1.append(EmptyBindingSet.getInstance()); tqr2.append(EmptyBindingSet.getInstance()); tqr3.append(EmptyBindingSet.getInstance()); @@ -270,7 +271,7 @@ public void testEmptyQueryResult() throws QueryEvaluationException { } @Test - public void testEmptyQueryResult2() throws QueryEvaluationException { + void testEmptyQueryResult2() throws QueryEvaluationException { tqr1.append(EmptyBindingSet.getInstance()); tqr3.append(EmptyBindingSet.getInstance()); @@ -278,7 +279,7 @@ public void testEmptyQueryResult2() throws QueryEvaluationException { } @Test - public void testEmptyQueryResult3() throws QueryEvaluationException { + void testEmptyQueryResult3() throws QueryEvaluationException { tqr1.append(EmptyBindingSet.getInstance()); tqr3.append(EmptyBindingSet.getInstance()); @@ -286,14 +287,14 @@ public void testEmptyQueryResult3() throws QueryEvaluationException { } @Test - public void testEmptyBindingSet() throws QueryEvaluationException { + void testEmptyBindingSet() throws QueryEvaluationException { tqr1.append(EmptyBindingSet.getInstance()); tqr2.append(EmptyBindingSet.getInstance()); assertTrue(QueryResults.equals(tqr1, tqr2)); } @Test - public void testNonBNodeBindingSet1() throws QueryEvaluationException { + void testNonBNodeBindingSet1() throws QueryEvaluationException { tqr1.append(new ListBindingSet(twoBindingNames, foo, lit1)); tqr1.append(new ListBindingSet(twoBindingNames, bar, lit2)); @@ -304,7 +305,7 @@ public void testNonBNodeBindingSet1() throws QueryEvaluationException { } @Test - public void testNonBNodeBindingSet2() throws QueryEvaluationException { + void testNonBNodeBindingSet2() throws QueryEvaluationException { tqr1.append(new ListBindingSet(twoBindingNames, foo, lit1)); tqr2.append(new ListBindingSet(twoBindingNames, foo, lit2)); @@ -312,7 +313,7 @@ public void testNonBNodeBindingSet2() throws QueryEvaluationException { } @Test - public void testNonBNodeBindingSet3() throws QueryEvaluationException { + void testNonBNodeBindingSet3() throws QueryEvaluationException { tqr3.append(new ListBindingSet(threeBindingNames, foo, lit1, bar)); tqr2.append(new ListBindingSet(twoBindingNames, foo, lit1)); @@ -320,7 +321,7 @@ public void testNonBNodeBindingSet3() throws QueryEvaluationException { } @Test - public void testNonBNodeBindingSet() throws QueryEvaluationException { + void testNonBNodeBindingSet() throws QueryEvaluationException { tqr1.append(new ListBindingSet(twoBindingNames, foo, lit1)); tqr2.append(new ListBindingSet(twoBindingNames, foo, lit2)); @@ -328,7 +329,7 @@ public void testNonBNodeBindingSet() throws QueryEvaluationException { } @Test - public void testBNodeBindingSet1() throws QueryEvaluationException { + void testBNodeBindingSet1() throws QueryEvaluationException { tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode1)); tqr1.append(new ListBindingSet(twoBindingNames, bar, bnode2)); @@ -339,7 +340,7 @@ public void testBNodeBindingSet1() throws QueryEvaluationException { } @Test - public void testBNodeBindingSet2() throws QueryEvaluationException { + void testBNodeBindingSet2() throws QueryEvaluationException { tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode1)); tqr2.append(new ListBindingSet(twoBindingNames, foo, lit1)); @@ -347,7 +348,7 @@ public void testBNodeBindingSet2() throws QueryEvaluationException { } @Test - public void testBNodeBindingSet3() throws QueryEvaluationException { + void testBNodeBindingSet3() throws QueryEvaluationException { tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode1)); tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2)); @@ -358,7 +359,7 @@ public void testBNodeBindingSet3() throws QueryEvaluationException { } @Test - public void testBNodeBindingSet4() throws QueryEvaluationException { + void testBNodeBindingSet4() throws QueryEvaluationException { tqr1.append(new ListBindingSet(twoBindingNames, bnode1, bnode2)); tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2)); @@ -369,7 +370,7 @@ public void testBNodeBindingSet4() throws QueryEvaluationException { } @Test - public void testBNodeBindingSet5() throws QueryEvaluationException { + void testBNodeBindingSet5() throws QueryEvaluationException { tqr1.append(new ListBindingSet(twoBindingNames, bnode1, bnode2)); tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2)); @@ -380,7 +381,7 @@ public void testBNodeBindingSet5() throws QueryEvaluationException { } @Test - public void testBNodeBindingSet6() throws QueryEvaluationException { + void testBNodeBindingSet6() throws QueryEvaluationException { tqr3.append(new ListBindingSet(threeBindingNames, foo, bnode2, bnode1)); tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2)); @@ -388,7 +389,7 @@ public void testBNodeBindingSet6() throws QueryEvaluationException { } @Test - public void testBNodeBindingSet7() throws QueryEvaluationException { + void testBNodeBindingSet7() throws QueryEvaluationException { tqr3.append(new ListBindingSet(threeBindingNames, foo, bnode2, bnode1)); tqr1.append(new ListBindingSet(twoBindingNames, foo, bnode2)); @@ -396,7 +397,7 @@ public void testBNodeBindingSet7() throws QueryEvaluationException { } @Test - public void testStreamTupleAllValuesOfResult1() { + void testStreamTupleAllValuesOfResult1() { BindingSet a = new ListBindingSet(twoBindingNames, foo, lit1); BindingSet b = new ListBindingSet(twoBindingNames, bar, lit2); tqr1.append(a); @@ -409,11 +410,11 @@ public void testStreamTupleAllValuesOfResult1() { assertNotNull(list); assertFalse(list.isEmpty()); - assertTrue(list.equals(Arrays.asList(foo, bar, foo, bar, bar))); + assertEquals(list, Arrays.asList(foo, bar, foo, bar, bar)); } @Test - public void testStreamTupleAllValuesOfResult2() { + void testStreamTupleAllValuesOfResult2() { BindingSet a = new ListBindingSet(twoBindingNames, foo, lit1); BindingSet b = new ListBindingSet(twoBindingNames, bar, lit2); tqr1.append(a); diff --git a/core/queryalgebra/evaluation/pom.xml b/core/queryalgebra/evaluation/pom.xml index 5c9fa7d5d73..c39214a98a8 100644 --- a/core/queryalgebra/evaluation/pom.xml +++ b/core/queryalgebra/evaluation/pom.xml @@ -51,6 +51,11 @@ org.slf4j slf4j-api + + org.junit.jupiter + junit-jupiter + test + org.apache.commons commons-math3 diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/ArrayBindingSetTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/ArrayBindingSetTest.java index 010c927301a..9dd3fc8a104 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/ArrayBindingSetTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/ArrayBindingSetTest.java @@ -11,8 +11,7 @@ package org.eclipse.rdf4j.query.algebra.evaluation; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import org.eclipse.rdf4j.model.ValueFactory; import org.eclipse.rdf4j.model.impl.SimpleValueFactory; @@ -22,7 +21,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ArrayBindingSetTest { +class ArrayBindingSetTest { private final MapBindingSet mbs = new MapBindingSet(); private final ArrayBindingSet qbs = new ArrayBindingSet("foo"); @@ -30,17 +29,17 @@ public class ArrayBindingSetTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @BeforeEach - public void setup() { + void setup() { qbs.getDirectSetBinding("foo").accept(vf.createIRI("urn:foo"), qbs); mbs.addBinding("foo", vf.createIRI("urn:foo")); } @Test - public void testEqualsMapBindingSet() { + void testEqualsMapBindingSet() { ArrayBindingSet bs = new ArrayBindingSet("foo"); - assertFalse(bs.equals(qbs)); - assertFalse(bs.equals(mbs)); + assertNotEquals(bs, qbs); + assertNotEquals(bs, mbs); bs.getDirectSetBinding("foo").accept(vf.createIRI("urn:foo"), bs); @@ -50,9 +49,9 @@ public void testEqualsMapBindingSet() { } @Test - public void testHashcodeMapBindingSet() { - assertTrue(qbs.equals(mbs)); - assertTrue(mbs.equals(qbs)); + void testHashcodeMapBindingSet() { + assertEquals(qbs, mbs); + assertEquals(mbs, qbs); assertEquals(qbs.hashCode(), mbs.hashCode(), "objects that return true on their equals() method must have identical hash codes"); } @@ -62,7 +61,7 @@ public void testHashcodeMapBindingSet() { * {@link BindingSet#hashCode()}. */ @Test - public void testEqualsHashcode() { + void testEqualsHashcode() { ArrayBindingSet bs1 = new ArrayBindingSet("x", "y", "z"); ArrayBindingSet bs2 = new ArrayBindingSet("x", "y", "z"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/QueryBindingSetTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/QueryBindingSetTest.java index 83bb7f55fa1..3465897b157 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/QueryBindingSetTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/QueryBindingSetTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class QueryBindingSetTest { +class QueryBindingSetTest { private final MapBindingSet mbs = new MapBindingSet(); private final QueryBindingSet qbs = new QueryBindingSet(); @@ -38,17 +38,17 @@ public class QueryBindingSetTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @BeforeEach - public void setup() { + void setup() { qbs.addBinding("foo", vf.createIRI("urn:foo")); mbs.addBinding("foo", vf.createIRI("urn:foo")); } @Test - public void testEqualsMapBindingSet() { + void testEqualsMapBindingSet() { QueryBindingSet bs = new QueryBindingSet(); - assertFalse(bs.equals(qbs)); - assertFalse(bs.equals(mbs)); + assertNotEquals(bs, qbs); + assertNotEquals(bs, mbs); bs.addBinding("foo", vf.createIRI("urn:foo")); @@ -58,7 +58,7 @@ public void testEqualsMapBindingSet() { } @Test - public void testAddAll() { + void testAddAll() { { QueryBindingSet bs = new QueryBindingSet(); bs.addAll(new QueryBindingSet()); @@ -90,7 +90,7 @@ public void testAddAll() { } @Test - public void testAdd() { + void testAdd() { try { QueryBindingSet bs = new QueryBindingSet(); bs.addBinding("foo", vf.createIRI("urn:foo")); @@ -106,7 +106,7 @@ public void testAdd() { } @Test - public void testNonSharedBackingMap() { + void testNonSharedBackingMap() { QueryBindingSet bs = new QueryBindingSet(); bs.addBinding("foo", vf.createIRI("urn:foo")); bs.addBinding("bar", vf.createIRI("urn:bar")); @@ -117,7 +117,7 @@ public void testNonSharedBackingMap() { } @Test - public void testSet() { + void testSet() { QueryBindingSet bs = new QueryBindingSet(); bs.setBinding("foo", vf.createIRI("urn:foo")); bs.setBinding("foo", vf.createIRI("urn:foo2")); @@ -126,7 +126,7 @@ public void testSet() { } @Test - public void testRemove() { + void testRemove() { QueryBindingSet bs = new QueryBindingSet(); bs.setBinding("foo", vf.createIRI("urn:foo")); bs.removeBinding("foo"); @@ -138,7 +138,7 @@ public void testRemove() { } @Test - public void retainAll() { + void retainAll() { QueryBindingSet bs = new QueryBindingSet(); bs.setBinding("foo", vf.createIRI("urn:foo")); final Collection asList = Arrays.asList("foo", "test"); @@ -147,7 +147,7 @@ public void retainAll() { } @Test - public void testBindingNames() { + void testBindingNames() { QueryBindingSet bs = new QueryBindingSet(); for (int i = 0; i < 128; i++) { final String name = String.valueOf(i); @@ -162,7 +162,7 @@ public void testBindingNames() { } @Test - public void testBindings() { + void testBindings() { QueryBindingSet bs = new QueryBindingSet(); for (int i = 0; i < 128; i++) { final String name = String.valueOf(i); @@ -177,7 +177,7 @@ public void testBindings() { } @Test - public void testGetValue() { + void testGetValue() { QueryBindingSet bs = new QueryBindingSet(); for (int i = 0; i < 128; i++) { final String name = String.valueOf(i); @@ -191,9 +191,9 @@ public void testGetValue() { } @Test - public void testHashcodeMapBindingSet() { - assertTrue(qbs.equals(mbs)); - assertTrue(mbs.equals(qbs)); + void testHashcodeMapBindingSet() { + assertEquals(qbs, mbs); + assertEquals(mbs, qbs); assertEquals(qbs.hashCode(), mbs.hashCode(), "objects that return true on their equals() method must have identical hash codes"); } @@ -203,7 +203,7 @@ public void testHashcodeMapBindingSet() { * {@link BindingSet#hashCode()}. */ @Test - public void testEqualsHashcode() { + void testEqualsHashcode() { QueryBindingSet bs1 = new QueryBindingSet(); QueryBindingSet bs2 = new QueryBindingSet(); @@ -219,7 +219,7 @@ public void testEqualsHashcode() { } @Test - public void testBigEqualsHashcode() { + void testBigEqualsHashcode() { QueryBindingSet bs1 = new QueryBindingSet(); QueryBindingSet bs2 = new QueryBindingSet(); for (int i = 0; i < 128; i++) { diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/NowTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/NowTest.java index 07e0282c401..bbed6ff761c 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/NowTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/NowTest.java @@ -26,7 +26,7 @@ /** * @author jeen */ -public class NowTest { +class NowTest { private Now now; @@ -36,7 +36,7 @@ public class NowTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { now = new Now(); } @@ -44,11 +44,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate() { + void testEvaluate() { try { Literal nowL = now.evaluate(f); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/TimezoneTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/TimezoneTest.java index 770350fedf7..3c4fb728891 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/TimezoneTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/TimezoneTest.java @@ -26,7 +26,7 @@ /** * @author jeen */ -public class TimezoneTest { +class TimezoneTest { private Timezone timezone; @@ -36,7 +36,7 @@ public class TimezoneTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { timezone = new Timezone(); } @@ -44,11 +44,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate1() { + void testEvaluate1() { try { Literal result = timezone.evaluate(f, f.createLiteral("2011-01-10T14:45:13.815-05:00", XSD.DATETIME)); @@ -65,7 +65,7 @@ public void testEvaluate1() { } @Test - public void testEvaluate2() { + void testEvaluate2() { try { Literal result = timezone.evaluate(f, f.createLiteral("2011-01-10T14:45:13.815Z", XSD.DATETIME)); @@ -82,7 +82,7 @@ public void testEvaluate2() { } @Test - public void testEvaluate3() { + void testEvaluate3() { try { timezone.evaluate(f, f.createLiteral("2011-01-10T14:45:13.815", XSD.DATETIME)); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/TzTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/TzTest.java index b907d48d95d..236152fdfa4 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/TzTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/datetime/TzTest.java @@ -26,7 +26,7 @@ /** * @author jeen */ -public class TzTest { +class TzTest { private Tz tz; @@ -36,7 +36,7 @@ public class TzTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { tz = new Tz(); } @@ -44,11 +44,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate1() { + void testEvaluate1() { try { Literal result = tz.evaluate(f, f.createLiteral("2011-01-10T14:45:13.815-05:00", XSD.DATETIME)); @@ -65,7 +65,7 @@ public void testEvaluate1() { } @Test - public void testEvaluate2() { + void testEvaluate2() { try { Literal result = tz.evaluate(f, f.createLiteral("2011-01-10T14:45:13.815Z", XSD.DATETIME)); @@ -82,7 +82,7 @@ public void testEvaluate2() { } @Test - public void testEvaluate3() { + void testEvaluate3() { try { Literal result = tz.evaluate(f, f.createLiteral("2011-01-10T14:45:13.815", XSD.DATETIME)); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/HashLeadingZeroTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/HashLeadingZeroTest.java index 970b0385505..add41ab35fc 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/HashLeadingZeroTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/HashLeadingZeroTest.java @@ -15,7 +15,7 @@ /** * @author Bart Hanssens */ -public class HashLeadingZeroTest extends HashFunctionTest { +class HashLeadingZeroTest extends HashFunctionTest { /** * Test if hash function adds multiple leading zeros (if needed). Test value and expected result provided by Vassil * Momtchev.. @@ -23,7 +23,7 @@ public class HashLeadingZeroTest extends HashFunctionTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { setHashFunction(new MD5()); setToHash("363"); setExpectedDigest("00411460f7c92d2124a67ea0f4cb5f85"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/MD5Test.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/MD5Test.java index 6c52040a304..3852df8ef72 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/MD5Test.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/MD5Test.java @@ -15,13 +15,13 @@ /** * @author jeen */ -public class MD5Test extends HashFunctionTest { +class MD5Test extends HashFunctionTest { /** * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { setHashFunction(new MD5()); setToHash("abc"); setExpectedDigest("900150983cd24fb0d6963f7d28e17f72"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA1Test.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA1Test.java index f717b286a0a..ef28ace87a9 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA1Test.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA1Test.java @@ -15,13 +15,13 @@ /** * @author jeen */ -public class SHA1Test extends HashFunctionTest { +class SHA1Test extends HashFunctionTest { /** * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { setHashFunction(new SHA1()); setToHash("abc"); setExpectedDigest("a9993e364706816aba3e25717850c26c9cd0d89d"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA256Test.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA256Test.java index f7c3ee27a45..a3df8690412 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA256Test.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA256Test.java @@ -15,13 +15,13 @@ /** * @author jeen */ -public class SHA256Test extends HashFunctionTest { +class SHA256Test extends HashFunctionTest { /** * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { setHashFunction(new SHA256()); setToHash("abc"); setExpectedDigest("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA384Test.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA384Test.java index 8f4fa0ed97e..f19b06ded49 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA384Test.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA384Test.java @@ -15,13 +15,13 @@ /** * @author jeen */ -public class SHA384Test extends HashFunctionTest { +class SHA384Test extends HashFunctionTest { /** * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { setHashFunction(new SHA384()); setToHash("abc"); setExpectedDigest( diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA512Test.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA512Test.java index 641e6945043..310829f0f26 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA512Test.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/hash/SHA512Test.java @@ -15,13 +15,13 @@ /** * @author jeen */ -public class SHA512Test extends HashFunctionTest { +class SHA512Test extends HashFunctionTest { /** * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { setHashFunction(new SHA512()); setToHash("abc"); setExpectedDigest( diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/numeric/RandTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/numeric/RandTest.java index 9c967c99e0d..58e24056996 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/numeric/RandTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/numeric/RandTest.java @@ -43,7 +43,7 @@ /** * @author jeen */ -public class RandTest { +class RandTest { private Rand rand; @@ -53,7 +53,7 @@ public class RandTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { rand = new Rand(); } @@ -61,11 +61,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate() { + void testEvaluate() { try { Literal random = rand.evaluate(f); @@ -83,7 +83,7 @@ public void testEvaluate() { } @Test - public void testPrepare() { + void testPrepare() { QueryValueEvaluationStep precompile = new StrictEvaluationStrategy(new TripleSource() { @Override diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/numeric/RoundTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/numeric/RoundTest.java index e2884ad16a2..7483206b4a8 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/numeric/RoundTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/numeric/RoundTest.java @@ -27,7 +27,7 @@ /** * @author jeen */ -public class RoundTest { +class RoundTest { private Round round; @@ -37,7 +37,7 @@ public class RoundTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { round = new Round(); } @@ -45,11 +45,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluateDouble() { + void testEvaluateDouble() { try { double dVal = 1.6; Literal rounded = round.evaluate(f, f.createLiteral(dVal)); @@ -64,7 +64,7 @@ public void testEvaluateDouble() { } @Test - public void testEvaluateInt() { + void testEvaluateInt() { try { int iVal = 1; Literal rounded = round.evaluate(f, f.createLiteral(iVal)); @@ -79,7 +79,7 @@ public void testEvaluateInt() { } @Test - public void testEvaluateBigDecimal() { + void testEvaluateBigDecimal() { try { BigDecimal bd = new BigDecimal(1234567.567); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/ConcatTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/ConcatTest.java index b45b493f7e9..6fa5902e24f 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/ConcatTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/ConcatTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ConcatTest { +class ConcatTest { private Concat concatFunc; @@ -40,12 +40,12 @@ public class ConcatTest { private static final Literal foo_nl = vf.createLiteral("foo", "nl"); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { concatFunc = new Concat(); } @Test - public void stringLiteralHandling() { + void stringLiteralHandling() { Literal result = concatFunc.evaluate(vf, foo, bar); assertThat(result.stringValue()).isEqualTo("foobar"); @@ -54,7 +54,7 @@ public void stringLiteralHandling() { } @Test - public void commonLanguageLiteralHandling() { + void commonLanguageLiteralHandling() { Literal result = concatFunc.evaluate(vf, foo_en, bar_en); assertThat(result.stringValue()).isEqualTo("foobar"); @@ -64,7 +64,7 @@ public void commonLanguageLiteralHandling() { } @Test - public void mixedLanguageLiteralHandling() { + void mixedLanguageLiteralHandling() { Literal result = concatFunc.evaluate(vf, foo_nl, bar_en); assertThat(result.stringValue()).isEqualTo("foobar"); @@ -73,7 +73,7 @@ public void mixedLanguageLiteralHandling() { } @Test - public void mixedLiteralHandling() { + void mixedLiteralHandling() { Literal result = concatFunc.evaluate(vf, foo, bar_en); assertThat(result.stringValue()).isEqualTo("foobar"); @@ -82,7 +82,7 @@ public void mixedLiteralHandling() { } @Test - public void nonStringLiteralHandling() { + void nonStringLiteralHandling() { try { concatFunc.evaluate(vf, RDF.TYPE, BooleanLiteral.TRUE); fail("CONCAT expected to fail on non-stringliteral argument"); @@ -92,7 +92,7 @@ public void nonStringLiteralHandling() { } @Test - public void nonLiteralHandling() { + void nonLiteralHandling() { try { concatFunc.evaluate(vf, RDF.TYPE, bar_en); fail("CONCAT expected to fail on non-literal argument"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/LowerCaseTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/LowerCaseTest.java index cd447b76700..8bb8a9fd097 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/LowerCaseTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/LowerCaseTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.algebra.evaluation.function.string; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.rdf4j.model.Literal; @@ -24,7 +24,7 @@ /** * @author jeen */ -public class LowerCaseTest { +class LowerCaseTest { private LowerCase lcaseFunc; @@ -34,7 +34,7 @@ public class LowerCaseTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { lcaseFunc = new LowerCase(); } @@ -42,39 +42,39 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate1() { + void testEvaluate1() { Literal pattern = f.createLiteral("foobar"); try { Literal result = lcaseFunc.evaluate(f, pattern); - assertTrue(result.getLabel().equals("foobar")); + assertEquals("foobar", result.getLabel()); } catch (ValueExprEvaluationException e) { fail(e.getMessage()); } } @Test - public void testEvaluate2() { + void testEvaluate2() { Literal pattern = f.createLiteral("FooBar"); try { Literal result = lcaseFunc.evaluate(f, pattern); - assertTrue(result.getLabel().equals("foobar")); + assertEquals("foobar", result.getLabel()); } catch (ValueExprEvaluationException e) { fail(e.getMessage()); } } @Test - public void testEvaluate3() { + void testEvaluate3() { Literal pattern = f.createLiteral("FooBar"); Literal startIndex = f.createLiteral(4); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/RegexTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/RegexTest.java index edcd1b4070a..1f24d1d9759 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/RegexTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/RegexTest.java @@ -34,24 +34,24 @@ /** * @author james */ -public class RegexTest { +class RegexTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); private SPARQLServiceResolver serviceResolver; @BeforeEach - public void setUp() { + void setUp() { serviceResolver = new SPARQLServiceResolver(); } @AfterEach - public void tearDown() { + void tearDown() { serviceResolver.shutDown(); } @Test - public void testEvaluate1() throws QueryEvaluationException { + void testEvaluate1() throws QueryEvaluationException { Literal expr = vf.createLiteral("foobar"); Literal pattern = vf.createLiteral("foobar"); @@ -66,7 +66,7 @@ public void testEvaluate1() throws QueryEvaluationException { } @Test - public void testEvaluate2() throws QueryEvaluationException { + void testEvaluate2() throws QueryEvaluationException { Literal expr = vf.createLiteral("foobar"); Literal pattern = vf.createLiteral("FooBar"); @@ -82,7 +82,7 @@ public void testEvaluate2() throws QueryEvaluationException { } @Test - public void testEvaluate3() throws QueryEvaluationException { + void testEvaluate3() throws QueryEvaluationException { Literal pattern = vf.createLiteral("FooBar"); Literal startIndex = vf.createLiteral(4); @@ -96,7 +96,7 @@ public void testEvaluate3() throws QueryEvaluationException { } @Test - public void testEvaluate4() throws QueryEvaluationException { + void testEvaluate4() throws QueryEvaluationException { Literal expr = vf.createLiteral("foobar", "en"); Literal pattern = vf.createLiteral("FooBar"); @@ -112,7 +112,7 @@ public void testEvaluate4() throws QueryEvaluationException { } @Test - public void testEvaluate5() throws QueryEvaluationException { + void testEvaluate5() throws QueryEvaluationException { Literal expr = vf.createLiteral("foobar", XSD.STRING); Literal pattern = vf.createLiteral("FooBar"); @@ -128,7 +128,7 @@ public void testEvaluate5() throws QueryEvaluationException { } @Test - public void testEvaluate6() throws QueryEvaluationException { + void testEvaluate6() throws QueryEvaluationException { Literal expr = vf.createLiteral("foobar", XSD.TOKEN); Literal pattern = vf.createLiteral("FooBar"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/ReplaceTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/ReplaceTest.java index 167ef721b85..b041bcc5566 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/ReplaceTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/ReplaceTest.java @@ -24,7 +24,7 @@ /** * @author jeen */ -public class ReplaceTest { +class ReplaceTest { private Replace replaceFunc; @@ -34,7 +34,7 @@ public class ReplaceTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { replaceFunc = new Replace(); } @@ -42,11 +42,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate1() { + void testEvaluate1() { Literal arg = f.createLiteral("foobar"); Literal pattern = f.createLiteral("ba"); @@ -62,7 +62,7 @@ public void testEvaluate1() { } @Test - public void testEvaluate2() { + void testEvaluate2() { Literal arg = f.createLiteral("foobar"); Literal pattern = f.createLiteral("BA"); @@ -78,7 +78,7 @@ public void testEvaluate2() { } @Test - public void testEvaluate3() { + void testEvaluate3() { Literal arg = f.createLiteral("foobar"); Literal pattern = f.createLiteral("BA"); @@ -95,7 +95,7 @@ public void testEvaluate3() { } @Test - public void testEvaluate4() { + void testEvaluate4() { Literal arg = f.createLiteral(10); Literal pattern = f.createLiteral("BA"); @@ -111,7 +111,7 @@ public void testEvaluate4() { } @Test - public void testEvaluate5() { + void testEvaluate5() { Literal arg = f.createLiteral("foobarfoobarbarfoo"); Literal pattern = f.createLiteral("ba"); @@ -126,7 +126,7 @@ public void testEvaluate5() { } @Test - public void testEvaluate6() { + void testEvaluate6() { Literal arg = f.createLiteral("foobarfoobarbarfooba"); Literal pattern = f.createLiteral("ba."); @@ -141,7 +141,7 @@ public void testEvaluate6() { } @Test - public void testEvaluate7() { + void testEvaluate7() { Literal arg = f.createLiteral("日本語", "ja"); Literal pattern = f.createLiteral("[^a-zA-Z0-9]"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/StrAfterTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/StrAfterTest.java index bac3cf51460..e21a105c066 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/StrAfterTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/StrAfterTest.java @@ -27,7 +27,7 @@ /** * @author jeen */ -public class StrAfterTest { +class StrAfterTest { private StrAfter strAfterFunc; @@ -37,7 +37,7 @@ public class StrAfterTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { strAfterFunc = new StrAfter(); } @@ -45,11 +45,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate1() { + void testEvaluate1() { Literal leftArg = f.createLiteral("foobar"); Literal rightArg = f.createLiteral("ba"); @@ -64,7 +64,7 @@ public void testEvaluate1() { } @Test - public void testEvaluate2() { + void testEvaluate2() { Literal leftArg = f.createLiteral("foobar"); Literal rightArg = f.createLiteral("xyz"); @@ -79,7 +79,7 @@ public void testEvaluate2() { } @Test - public void testEvaluate3() { + void testEvaluate3() { Literal leftArg = f.createLiteral("foobar", "en"); Literal rightArg = f.createLiteral("b"); @@ -96,7 +96,7 @@ public void testEvaluate3() { } @Test - public void testEvaluate4() { + void testEvaluate4() { Literal leftArg = f.createLiteral("foobar", XSD.STRING); Literal rightArg = f.createLiteral("b"); @@ -113,7 +113,7 @@ public void testEvaluate4() { } @Test - public void testEvaluate4a() { + void testEvaluate4a() { Literal leftArg = f.createLiteral("foobar"); Literal rightArg = f.createLiteral("b", XSD.STRING); @@ -130,7 +130,7 @@ public void testEvaluate4a() { } @Test - public void testEvaluate5() { + void testEvaluate5() { Literal leftArg = f.createLiteral("foobar", XSD.STRING); Literal rightArg = f.createLiteral("b", XSD.DATE); @@ -147,7 +147,7 @@ public void testEvaluate5() { } @Test - public void testEvaluate6() { + void testEvaluate6() { Literal leftArg = f.createLiteral(10); Literal rightArg = f.createLiteral("b"); @@ -163,7 +163,7 @@ public void testEvaluate6() { } @Test - public void testEvaluate7() { + void testEvaluate7() { IRI leftArg = f.createIRI("http://example.org/foobar"); Literal rightArg = f.createLiteral("b"); @@ -178,7 +178,7 @@ public void testEvaluate7() { } @Test - public void testEvaluate8() { + void testEvaluate8() { Literal leftArg = f.createLiteral("foobar", "en"); Literal rightArg = f.createLiteral("b", "nl"); @@ -192,7 +192,7 @@ public void testEvaluate8() { } @Test - public void testEvaluate9() { + void testEvaluate9() { Literal leftArg = f.createLiteral("foobar"); Literal rightArg = f.createLiteral("b", "nl"); @@ -206,7 +206,7 @@ public void testEvaluate9() { } @Test - public void testEvaluate10() { + void testEvaluate10() { Literal leftArg = f.createLiteral("foobar", "en"); Literal rightArg = f.createLiteral("b", XSD.STRING); @@ -223,7 +223,7 @@ public void testEvaluate10() { } @Test - public void testEvaluate11() { + void testEvaluate11() { Literal leftArg = f.createLiteral("foobar", "nl"); Literal rightArg = f.createLiteral("b", "nl"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/StrBeforeTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/StrBeforeTest.java index 888633271b9..219f4e8ac2d 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/StrBeforeTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/StrBeforeTest.java @@ -27,7 +27,7 @@ /** * @author jeen */ -public class StrBeforeTest { +class StrBeforeTest { private StrBefore strBeforeFunc; @@ -37,7 +37,7 @@ public class StrBeforeTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { strBeforeFunc = new StrBefore(); } @@ -45,11 +45,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate1() { + void testEvaluate1() { Literal leftArg = f.createLiteral("foobar"); Literal rightArg = f.createLiteral("ba"); @@ -64,7 +64,7 @@ public void testEvaluate1() { } @Test - public void testEvaluate2() { + void testEvaluate2() { Literal leftArg = f.createLiteral("foobar"); Literal rightArg = f.createLiteral("xyz"); @@ -79,7 +79,7 @@ public void testEvaluate2() { } @Test - public void testEvaluate3() { + void testEvaluate3() { Literal leftArg = f.createLiteral("foobar", "en"); Literal rightArg = f.createLiteral("b"); @@ -96,7 +96,7 @@ public void testEvaluate3() { } @Test - public void testEvaluate4() { + void testEvaluate4() { Literal leftArg = f.createLiteral("foobar", XSD.STRING); Literal rightArg = f.createLiteral("b"); @@ -113,7 +113,7 @@ public void testEvaluate4() { } @Test - public void testEvaluate4a() { + void testEvaluate4a() { Literal leftArg = f.createLiteral("foobar"); Literal rightArg = f.createLiteral("b", XSD.STRING); @@ -130,7 +130,7 @@ public void testEvaluate4a() { } @Test - public void testEvaluate5() { + void testEvaluate5() { Literal leftArg = f.createLiteral("foobar", XSD.STRING); Literal rightArg = f.createLiteral("b", XSD.DATE); @@ -147,7 +147,7 @@ public void testEvaluate5() { } @Test - public void testEvaluate6() { + void testEvaluate6() { Literal leftArg = f.createLiteral(10); Literal rightArg = f.createLiteral("b"); @@ -163,7 +163,7 @@ public void testEvaluate6() { } @Test - public void testEvaluate7() { + void testEvaluate7() { IRI leftArg = f.createIRI("http://example.org/foobar"); Literal rightArg = f.createLiteral("b"); @@ -178,7 +178,7 @@ public void testEvaluate7() { } @Test - public void testEvaluate8() { + void testEvaluate8() { Literal leftArg = f.createLiteral("foobar", "en"); Literal rightArg = f.createLiteral("b", "nl"); @@ -192,7 +192,7 @@ public void testEvaluate8() { } @Test - public void testEvaluate9() { + void testEvaluate9() { Literal leftArg = f.createLiteral("foobar"); Literal rightArg = f.createLiteral("b", "nl"); @@ -206,7 +206,7 @@ public void testEvaluate9() { } @Test - public void testEvaluate10() { + void testEvaluate10() { Literal leftArg = f.createLiteral("foobar", "en"); Literal rightArg = f.createLiteral("b", XSD.STRING); @@ -223,7 +223,7 @@ public void testEvaluate10() { } @Test - public void testEvaluate11() { + void testEvaluate11() { Literal leftArg = f.createLiteral("foobar", "nl"); Literal rightArg = f.createLiteral("b", "nl"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/SubstringTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/SubstringTest.java index 2959bd34007..2363624622f 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/SubstringTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/SubstringTest.java @@ -25,7 +25,7 @@ /** * @author jeen */ -public class SubstringTest { +class SubstringTest { private Substring substrFunc; @@ -35,7 +35,7 @@ public class SubstringTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { substrFunc = new Substring(); } @@ -43,11 +43,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate1() { + void testEvaluate1() { Literal pattern = f.createLiteral("foobar"); Literal startIndex = f.createLiteral(4); @@ -55,14 +55,14 @@ public void testEvaluate1() { try { Literal result = substrFunc.evaluate(f, pattern, startIndex); - assertTrue(result.getLabel().equals("bar")); + assertEquals("bar", result.getLabel()); } catch (ValueExprEvaluationException e) { fail(e.getMessage()); } } @Test - public void testEvaluate2() { + void testEvaluate2() { Literal pattern = f.createLiteral("foobar"); Literal startIndex = f.createLiteral(4); @@ -71,14 +71,14 @@ public void testEvaluate2() { try { Literal result = substrFunc.evaluate(f, pattern, startIndex, length); - assertTrue(result.getLabel().equals("ba")); + assertEquals("ba", result.getLabel()); } catch (ValueExprEvaluationException e) { fail(e.getMessage()); } } @Test - public void testEvaluate3() { + void testEvaluate3() { Literal pattern = f.createLiteral("foobar"); Literal startIndex = f.createLiteral(4); @@ -88,7 +88,7 @@ public void testEvaluate3() { } @Test - public void testEvaluate4() { + void testEvaluate4() { Literal pattern = f.createLiteral("foobar"); @@ -101,7 +101,7 @@ public void testEvaluate4() { } @Test - public void testEvaluateStartBefore1() { + void testEvaluateStartBefore1() { Literal pattern = f.createLiteral("ABC"); Literal startIndex = f.createLiteral(0); Literal length = f.createLiteral(1); @@ -115,7 +115,7 @@ public void testEvaluateStartBefore1() { } @Test - public void testXpathExamples1() { + void testXpathExamples1() { Literal pattern = f.createLiteral("motor car"); Literal startIndex = f.createLiteral(6); Literal result = substrFunc.evaluate(f, pattern, startIndex); @@ -123,7 +123,7 @@ public void testXpathExamples1() { } @Test - public void testXpathExamples2() { + void testXpathExamples2() { Literal pattern = f.createLiteral("metadata"); Literal startIndex = f.createLiteral(4); Literal length = f.createLiteral(3); @@ -132,7 +132,7 @@ public void testXpathExamples2() { } @Test - public void testXpathExamples3() { + void testXpathExamples3() { Literal pattern = f.createLiteral("12345"); Literal startIndex = f.createLiteral(1.5); Literal length = f.createLiteral(2.6); @@ -146,7 +146,7 @@ public void testXpathExamples3() { } @Test - public void testXpathExamples3int() { + void testXpathExamples3int() { Literal pattern = f.createLiteral("12345"); Literal startIndex = f.createLiteral(2); Literal length = f.createLiteral(3); @@ -155,7 +155,7 @@ public void testXpathExamples3int() { } @Test - public void testXpathExamples4() { + void testXpathExamples4() { Literal pattern = f.createLiteral("12345"); Literal startIndex = f.createLiteral(0); Literal length = f.createLiteral(3); @@ -164,7 +164,7 @@ public void testXpathExamples4() { } @Test - public void testXpathExamples5() { + void testXpathExamples5() { Literal pattern = f.createLiteral("12345"); Literal startIndex = f.createLiteral(5); Literal length = f.createLiteral(-3); @@ -173,7 +173,7 @@ public void testXpathExamples5() { } @Test - public void testXpathExamples6() { + void testXpathExamples6() { Literal pattern = f.createLiteral("12345"); Literal startIndex = f.createLiteral(-3); Literal length = f.createLiteral(5); @@ -182,7 +182,7 @@ public void testXpathExamples6() { } @Test - public void testXpathExamples7() { + void testXpathExamples7() { Literal pattern = f.createLiteral("12345"); Literal startIndex = f.createLiteral(1); Literal length = f.createLiteral(Float.NaN); @@ -195,7 +195,7 @@ public void testXpathExamples7() { } @Test - public void testXpathExample8Inspired() { + void testXpathExample8Inspired() { Literal pattern = f.createLiteral("12345"); Literal startIndex = f.createLiteral(-42); // This test was inspired by the xpath test cases. @@ -207,7 +207,7 @@ public void testXpathExample8Inspired() { } @Test - public void testXpathExamples9() { + void testXpathExamples9() { Literal pattern = f.createLiteral("12345"); Literal startIndex = f.createLiteral(Float.NEGATIVE_INFINITY); Literal length = f.createLiteral(Float.POSITIVE_INFINITY); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/UpperCaseTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/UpperCaseTest.java index b55122fae2e..edb2f22f998 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/UpperCaseTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/string/UpperCaseTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.algebra.evaluation.function.string; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.rdf4j.model.Literal; @@ -24,7 +24,7 @@ /** * @author jeen */ -public class UpperCaseTest { +class UpperCaseTest { private UpperCase ucaseFunc; @@ -34,7 +34,7 @@ public class UpperCaseTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { ucaseFunc = new UpperCase(); } @@ -42,39 +42,39 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluate1() { + void testEvaluate1() { Literal pattern = f.createLiteral("foobar"); try { Literal result = ucaseFunc.evaluate(f, pattern); - assertTrue(result.getLabel().equals("FOOBAR")); + assertEquals("FOOBAR", result.getLabel()); } catch (ValueExprEvaluationException e) { fail(e.getMessage()); } } @Test - public void testEvaluate2() { + void testEvaluate2() { Literal pattern = f.createLiteral("FooBar"); try { Literal result = ucaseFunc.evaluate(f, pattern); - assertTrue(result.getLabel().equals("FOOBAR")); + assertEquals("FOOBAR", result.getLabel()); } catch (ValueExprEvaluationException e) { fail(e.getMessage()); } } @Test - public void testEvaluate3() { + void testEvaluate3() { Literal pattern = f.createLiteral("FooBar"); Literal startIndex = f.createLiteral(4); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/IsTripleFunctionTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/IsTripleFunctionTest.java index 45c2a281f04..9b425a8508b 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/IsTripleFunctionTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/IsTripleFunctionTest.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.algebra.evaluation.function.triple; +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.junit.jupiter.api.Assertions.assertTrue; @@ -30,7 +31,7 @@ * * @author damyan.ognyanov */ -public class IsTripleFunctionTest { +class IsTripleFunctionTest { private IsTripleFunction function; @@ -40,7 +41,7 @@ public class IsTripleFunctionTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { function = new IsTripleFunction(); } @@ -48,11 +49,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluateWithTriple() { + void testEvaluateWithTriple() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -65,11 +66,11 @@ public void testEvaluateWithTriple() { value = function.evaluate(f, subj); assertNotNull(value); assertTrue(value instanceof Literal, "expect Literal"); - assertTrue(!((Literal) value).booleanValue(), "expect negative result"); + assertFalse(((Literal) value).booleanValue(), "expect negative result"); } @Test - public void testNegativeWrongArguments() { + void testNegativeWrongArguments() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -79,7 +80,7 @@ public void testNegativeWrongArguments() { } @Test - public void testNegativeNoArguments() { + void testNegativeNoArguments() { assertThrows(ValueExprEvaluationException.class, () -> function.evaluate(f)); } } diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/StatementFunctionTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/StatementFunctionTest.java index c9b314a33e4..fe9a08aa07b 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/StatementFunctionTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/StatementFunctionTest.java @@ -33,7 +33,7 @@ * * @author damyan.ognyanov */ -public class StatementFunctionTest { +class StatementFunctionTest { private StatementFunction function; @@ -43,7 +43,7 @@ public class StatementFunctionTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { function = new StatementFunction(); } @@ -51,11 +51,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluateIRIAndIRI() { + void testEvaluateIRIAndIRI() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -68,7 +68,7 @@ public void testEvaluateIRIAndIRI() { } @Test - public void testEvaluateIRIAndBNode() { + void testEvaluateIRIAndBNode() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); BNode obj = f.createBNode(); @@ -81,7 +81,7 @@ public void testEvaluateIRIAndBNode() { } @Test - public void testEvaluateIRIAndLiteral() { + void testEvaluateIRIAndLiteral() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); Literal obj = f.createLiteral(1); @@ -94,7 +94,7 @@ public void testEvaluateIRIAndLiteral() { } @Test - public void testEvaluateIRIAndTriple() { + void testEvaluateIRIAndTriple() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); Triple obj = f.createTriple(subj, subj, subj); @@ -107,7 +107,7 @@ public void testEvaluateIRIAndTriple() { } @Test - public void testEvaluateBNodeAndIRI() { + void testEvaluateBNodeAndIRI() { BNode subj = f.createBNode(); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -120,7 +120,7 @@ public void testEvaluateBNodeAndIRI() { } @Test - public void testEvaluateBNodeAndBNode() { + void testEvaluateBNodeAndBNode() { BNode subj = f.createBNode(); IRI pred = f.createIRI("urn:b"); BNode obj = f.createBNode(); @@ -133,7 +133,7 @@ public void testEvaluateBNodeAndBNode() { } @Test - public void testEvaluateBNodeAndLiteral() { + void testEvaluateBNodeAndLiteral() { BNode subj = f.createBNode(); IRI pred = f.createIRI("urn:b"); Literal obj = f.createLiteral(1); @@ -146,7 +146,7 @@ public void testEvaluateBNodeAndLiteral() { } @Test - public void testEvaluateBNodeAndTriple() { + void testEvaluateBNodeAndTriple() { BNode subj = f.createBNode(); IRI pred = f.createIRI("urn:b"); Triple obj = f.createTriple(pred, pred, pred); @@ -159,7 +159,7 @@ public void testEvaluateBNodeAndTriple() { } @Test - public void testEvaluateTripleAndIRI() { + void testEvaluateTripleAndIRI() { IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); Triple subj = f.createTriple(pred, pred, pred); @@ -172,7 +172,7 @@ public void testEvaluateTripleAndIRI() { } @Test - public void testEvaluateTripleAndBNode() { + void testEvaluateTripleAndBNode() { IRI pred = f.createIRI("urn:b"); BNode obj = f.createBNode(); Triple subj = f.createTriple(pred, pred, pred); @@ -185,7 +185,7 @@ public void testEvaluateTripleAndBNode() { } @Test - public void testEvaluateTripleAndLiteral() { + void testEvaluateTripleAndLiteral() { IRI pred = f.createIRI("urn:b"); Literal obj = f.createLiteral(1); Triple subj = f.createTriple(pred, pred, pred); @@ -198,7 +198,7 @@ public void testEvaluateTripleAndLiteral() { } @Test - public void testEvaluateTripleAndTriple() { + void testEvaluateTripleAndTriple() { IRI pred = f.createIRI("urn:b"); Triple obj = f.createTriple(pred, pred, pred); Triple subj = f.createTriple(pred, pred, pred); @@ -211,7 +211,7 @@ public void testEvaluateTripleAndTriple() { } @Test - public void testNegariveWrongNumberOfArguments() { + void testNegariveWrongNumberOfArguments() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -220,7 +220,7 @@ public void testNegariveWrongNumberOfArguments() { } @Test - public void testNegativeLiteralAsSubject() { + void testNegativeLiteralAsSubject() { Literal subj = f.createLiteral(1); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -229,7 +229,7 @@ public void testNegativeLiteralAsSubject() { } @Test - public void testNegativeLiteralAsPredicate() { + void testNegativeLiteralAsPredicate() { Literal subj = f.createLiteral(1); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TripleObjectFunctionTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TripleObjectFunctionTest.java index 5debe44177f..0c6fa2d4599 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TripleObjectFunctionTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TripleObjectFunctionTest.java @@ -30,7 +30,7 @@ * * @author damyan.ognyanov */ -public class TripleObjectFunctionTest { +class TripleObjectFunctionTest { private TripleObjectFunction function; @@ -40,7 +40,7 @@ public class TripleObjectFunctionTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { function = new TripleObjectFunction(); } @@ -48,11 +48,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluateWithTriple() { + void testEvaluateWithTriple() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -65,7 +65,7 @@ public void testEvaluateWithTriple() { } @Test - public void testNegativeWrongArguments() { + void testNegativeWrongArguments() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -75,7 +75,7 @@ public void testNegativeWrongArguments() { } @Test - public void testWrongArguments() { + void testWrongArguments() { IRI subj = f.createIRI("urn:a"); assertThrows(ValueExprEvaluationException.class, () -> function.evaluate(f, subj)); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TriplePredicateFunctionTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TriplePredicateFunctionTest.java index 0f9d8f2d8d5..5b9cb7b06a0 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TriplePredicateFunctionTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TriplePredicateFunctionTest.java @@ -30,7 +30,7 @@ * * @author damyan.ognyanov */ -public class TriplePredicateFunctionTest { +class TriplePredicateFunctionTest { private TriplePredicateFunction function; @@ -40,7 +40,7 @@ public class TriplePredicateFunctionTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { function = new TriplePredicateFunction(); } @@ -48,11 +48,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluateWithTriple() { + void testEvaluateWithTriple() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -65,7 +65,7 @@ public void testEvaluateWithTriple() { } @Test - public void testNegativeWrongArguments() { + void testNegativeWrongArguments() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -75,7 +75,7 @@ public void testNegativeWrongArguments() { } @Test - public void testWrongArguments() { + void testWrongArguments() { IRI subj = f.createIRI("urn:a"); assertThrows(ValueExprEvaluationException.class, () -> function.evaluate(f, subj)); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TripleSubjectFunctionTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TripleSubjectFunctionTest.java index 2e82add1961..bfc270a5af6 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TripleSubjectFunctionTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/triple/TripleSubjectFunctionTest.java @@ -30,7 +30,7 @@ * * @author damyan.ognyanov */ -public class TripleSubjectFunctionTest { +class TripleSubjectFunctionTest { private TripleSubjectFunction function; @@ -40,7 +40,7 @@ public class TripleSubjectFunctionTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { function = new TripleSubjectFunction(); } @@ -48,11 +48,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testEvaluateWithTriple() { + void testEvaluateWithTriple() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -65,7 +65,7 @@ public void testEvaluateWithTriple() { } @Test - public void testNegativeWrongArguments() { + void testNegativeWrongArguments() { IRI subj = f.createIRI("urn:a"); IRI pred = f.createIRI("urn:b"); IRI obj = f.createIRI("urn:c"); @@ -75,7 +75,7 @@ public void testNegativeWrongArguments() { } @Test - public void testWrongArguments() { + void testWrongArguments() { IRI subj = f.createIRI("urn:a"); assertThrows(ValueExprEvaluationException.class, () -> function.evaluate(f, subj)); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestDateCast.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestDateCast.java index 6f711f6ec3e..8f127d3398a 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestDateCast.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestDateCast.java @@ -24,28 +24,28 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -public class TestDateCast { +class TestDateCast { private static final DateCast dateCast = new DateCast(); private final ValueFactory vf = SimpleValueFactory.getInstance(); @Test - public void testCastPlainLiteral_date() { + void testCastPlainLiteral_date() { testDateCast(vf.createLiteral("1999-09-09"), "1999-09-09"); } @Test - public void testCastPlainLiteral_date_withTimeZone_utc() { + void testCastPlainLiteral_date_withTimeZone_utc() { testDateCast(vf.createLiteral("1999-09-09Z"), "1999-09-09Z"); } @Test - public void testCastPlainLiteral_date_withTimeZone_offset() { + void testCastPlainLiteral_date_withTimeZone_offset() { testDateCast(vf.createLiteral("1999-09-09-06:00"), "1999-09-09-06:00"); } @Test - public void testCastPlainLiteral_date_invalid() { + void testCastPlainLiteral_date_invalid() { // Arrange Literal plainLit = vf.createLiteral("1999-09-xx"); @@ -54,22 +54,22 @@ public void testCastPlainLiteral_date_invalid() { } @Test - public void testCastPlainLiteral_dateTime() { + void testCastPlainLiteral_dateTime() { testDateCast(vf.createLiteral("1999-09-09T14:45:13"), "1999-09-09"); } @Test - public void testCastPlainLiteral_dateTime_withTimeZone_utc() { + void testCastPlainLiteral_dateTime_withTimeZone_utc() { testDateCast(vf.createLiteral("1999-09-09T14:45:13Z"), "1999-09-09-00:00"); } @Test - public void testCastPlainLiteral_dateTime_withTimeZone_offset() { + void testCastPlainLiteral_dateTime_withTimeZone_offset() { testDateCast(vf.createLiteral("1999-09-09T14:45:13-06:00"), "1999-09-09-06:00"); } @Test - public void testCastPlainLiteral_dateTime_invalid() { + void testCastPlainLiteral_dateTime_invalid() { // Arrange Literal plainLit = vf.createLiteral("1999-09-09T14:45:xx"); @@ -78,22 +78,22 @@ public void testCastPlainLiteral_dateTime_invalid() { } @Test - public void testCastDateLiteral() { + void testCastDateLiteral() { testDateCast(vf.createLiteral("2022-11-01Z", DATE), "2022-11-01Z"); } @Test - public void testCastDateTimeLiteral() { + void testCastDateTimeLiteral() { testDateCast(vf.createLiteral(parseCalendar("1999-09-09T14:45:13")), "1999-09-09"); } @Test - public void testCastDateTimeLiteral_withTimeZone_utc() { + void testCastDateTimeLiteral_withTimeZone_utc() { testDateCast(vf.createLiteral(parseCalendar("1999-09-09T14:45:13Z")), "1999-09-09-00:00"); } @Test - public void testCastDateTimeLiteral_withTimeZone_offset() { + void testCastDateTimeLiteral_withTimeZone_offset() { testDateCast(vf.createLiteral(parseCalendar("1999-09-09T14:45:13+03:00")), "1999-09-09+03:00"); } diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestDateTimeCast.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestDateTimeCast.java index 81622f40b04..a536e0eeb33 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestDateTimeCast.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestDateTimeCast.java @@ -28,7 +28,7 @@ /** * @author jeen */ -public class TestDateTimeCast { +class TestDateTimeCast { private DateTimeCast dtCast; @@ -38,7 +38,7 @@ public class TestDateTimeCast { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { dtCast = new DateTimeCast(); } @@ -46,11 +46,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testCastPlainLiteral() { + void testCastPlainLiteral() { Literal plainLit = f.createLiteral("1999-09-09T00:00:01"); try { Literal result = dtCast.evaluate(f, plainLit); @@ -62,7 +62,7 @@ public void testCastPlainLiteral() { } @Test - public void testCastDateLiteral() { + void testCastDateLiteral() { Literal dateLit = f.createLiteral("1999-09-09", XSD.DATE); try { Literal result = dtCast.evaluate(f, dateLit); @@ -75,7 +75,7 @@ public void testCastDateLiteral() { } @Test - public void testCastDateTimeLiteral() { + void testCastDateTimeLiteral() { String lexVal = "2000-01-01T00:00:00"; Literal dtLit = f.createLiteral(XMLDatatypeUtil.parseCalendar(lexVal)); try { diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestStringCast.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestStringCast.java index 94a1cfd7453..4b323a7d46e 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestStringCast.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/xsd/TestStringCast.java @@ -28,7 +28,7 @@ /** * @author jeen */ -public class TestStringCast { +class TestStringCast { private StringCast stringCast; @@ -38,7 +38,7 @@ public class TestStringCast { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { stringCast = new StringCast(); } @@ -46,11 +46,11 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } @Test - public void testCastPlainLiteral() { + void testCastPlainLiteral() { Literal plainLit = f.createLiteral("foo"); try { Literal result = stringCast.evaluate(f, plainLit); @@ -62,7 +62,7 @@ public void testCastPlainLiteral() { } @Test - public void testCastLangtagLiteral() { + void testCastLangtagLiteral() { Literal langLit = f.createLiteral("foo", "en"); try { Literal result = stringCast.evaluate(f, langLit); @@ -73,7 +73,7 @@ public void testCastLangtagLiteral() { } @Test - public void testCastIntegerLiteral() { + void testCastIntegerLiteral() { Literal intLit = f.createLiteral(10); try { Literal result = stringCast.evaluate(f, intLit); @@ -87,7 +87,7 @@ public void testCastIntegerLiteral() { } @Test - public void testCastDateTimeLiteral() { + void testCastDateTimeLiteral() { String lexVal = "2000-01-01T00:00:00"; Literal dtLit = f.createLiteral(XMLDatatypeUtil.parseCalendar(lexVal)); try { @@ -102,7 +102,7 @@ public void testCastDateTimeLiteral() { } @Test - public void testCastUnknownDatatypedLiteral() { + void testCastUnknownDatatypedLiteral() { String lexVal = "foobar"; Literal dtLit = f.createLiteral(lexVal, f.createIRI("foo:unknownDt")); try { diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/BindingSetAssignmentInlinerTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/BindingSetAssignmentInlinerTest.java index d2de3db28d1..60a0b5f54d5 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/BindingSetAssignmentInlinerTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/BindingSetAssignmentInlinerTest.java @@ -45,7 +45,7 @@ public class BindingSetAssignmentInlinerTest extends QueryOptimizerTest { @Test - public void testOptimizeAssignsVars() { + void testOptimizeAssignsVars() { String query = "select * \n" + "where { values ?z { } \n" + " ?x ?y ; \n" @@ -74,7 +74,7 @@ public void testOptimizeAssignsVars() { } @Test - public void testEmptyValues() { + void testEmptyValues() { String query = "select * \n" + "where { values ?z { } \n" + " ?x ?y ; \n" @@ -101,7 +101,7 @@ public void testEmptyValues() { } @Test - public void testOptimize_MultipleValues() { + void testOptimize_MultipleValues() { String query = "select * \n" + "where { values ?z { } \n" + " ?x ?y ; \n" @@ -128,7 +128,7 @@ public void testOptimize_MultipleValues() { } @Test - public void testOptimize_leftJoin() { + void testOptimize_leftJoin() { String query = "PREFIX : \n" + "PREFIX foaf: \n" + "SELECT ?s ?o1 ?o2\n" @@ -163,7 +163,7 @@ public void testOptimize_leftJoin() { * @see GH-3091 */ @Test - public void testOptimize_LeftJoinWithValuesInScope() { + void testOptimize_LeftJoinWithValuesInScope() { String query = "SELECT ?datasetBound {\n" + " OPTIONAL {\n" + " VALUES(?dataset ?uriSpace) {\n" @@ -197,7 +197,7 @@ public void testOptimize_LeftJoinWithValuesInScope() { } @Test - public void testOptimize_Union_OutOfScope() { + void testOptimize_Union_OutOfScope() { String query = "SELECT * WHERE { VALUES ?s1 { } { ?s1 ?p1 ?o1 } UNION { ?s1 ?p1 ?o2 } }"; ParsedTupleQuery parsedQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, query, null); @@ -225,7 +225,7 @@ public void testOptimize_Union_OutOfScope() { } @Test - public void testOptimize_Union_InScope() { + void testOptimize_Union_InScope() { String query = "SELECT * WHERE { { VALUES ?s1 { } ?s1 ?p1 ?o1 } UNION { ?s1 ?p1 ?o2 } }"; ParsedTupleQuery parsedQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, query, null); @@ -253,7 +253,7 @@ public void testOptimize_Union_InScope() { } @Test - public void testOptimize_FilterNotExists() { + void testOptimize_FilterNotExists() { String query = "SELECT * WHERE { VALUES ?s1 { } ?s1 ?p1 ?o1 . FILTER NOT EXISTS { ?s1 ?p2 ?o2 } }"; ParsedTupleQuery parsedQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, query, null); @@ -284,7 +284,7 @@ public void testOptimize_FilterNotExists() { } @Test - public void testOptimize_Minus() { + void testOptimize_Minus() { String query = "SELECT * WHERE { VALUES ?s1 { } ?s1 ?p1 ?o1 MINUS { ?s1 ?p2 ?o2 } }"; ParsedTupleQuery parsedQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, query, null); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ConstantOptimizerTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ConstantOptimizerTest.java index d23ad0ecf88..9a0c8ddcbbc 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ConstantOptimizerTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ConstantOptimizerTest.java @@ -43,7 +43,7 @@ public class ConstantOptimizerTest extends QueryOptimizerTest { @Test - public void testAndOptimization() throws RDF4JException { + void testAndOptimization() throws RDF4JException { String query = "prefix ex: " + "select ?a ?b ?c\n" + "where {\n" + " bind((?a && ?b) as ?c) \n" + "}"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); @@ -78,7 +78,7 @@ public void testAndOptimization() throws RDF4JException { } @Test - public void testFunctionOptimization() throws RDF4JException { + void testFunctionOptimization() throws RDF4JException { String query = "prefix ex: " + "select ?a ?b ?c \n " + "where {\n" + " bind(concat(?a, ?b) as ?c) \n" + "}"; diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/EvaluationStatisticsTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/EvaluationStatisticsTest.java index 168c4b6c196..2f9d6963e76 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/EvaluationStatisticsTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/EvaluationStatisticsTest.java @@ -11,6 +11,9 @@ package org.eclipse.rdf4j.query.algebra.evaluation.impl; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayDeque; import java.util.ArrayList; @@ -26,13 +29,12 @@ import org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor; import org.eclipse.rdf4j.query.parser.ParsedTupleQuery; import org.eclipse.rdf4j.query.parser.QueryParserUtil; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class EvaluationStatisticsTest { +class EvaluationStatisticsTest { @Test - public void testGetCardinality_ParentReferences() throws Exception { + void testGetCardinality_ParentReferences() throws Exception { ParsedTupleQuery query = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, "select * where {?a ?b ?c. ?c * ?d}", null); @@ -52,33 +54,33 @@ public void testGetCardinality_ParentReferences() throws Exception { } @Test - public void testCacheCardinalityStatementPattern() { + void testCacheCardinalityStatementPattern() { StatementPattern tupleExpr = new StatementPattern(new Var("a"), new Var("b"), new Var("c")); - Assertions.assertFalse(tupleExpr.isCardinalitySet()); + assertFalse(tupleExpr.isCardinalitySet()); double cardinality = new EvaluationStatistics().getCardinality(tupleExpr); - Assertions.assertTrue(tupleExpr.isCardinalitySet()); - Assertions.assertEquals(cardinality, tupleExpr.getCardinality()); + assertTrue(tupleExpr.isCardinalitySet()); + assertEquals(cardinality, tupleExpr.getCardinality()); } @Test - public void testCacheCardinalityTripleRef() { + void testCacheCardinalityTripleRef() { TripleRef tupleExpr = new TripleRef(new Var("a"), new Var("b"), new Var("c"), new Var("expr")); - Assertions.assertFalse(tupleExpr.isCardinalitySet()); + assertFalse(tupleExpr.isCardinalitySet()); double cardinality = new EvaluationStatistics().getCardinality(tupleExpr); - Assertions.assertTrue(tupleExpr.isCardinalitySet()); - Assertions.assertEquals(cardinality, tupleExpr.getCardinality()); + assertTrue(tupleExpr.isCardinalitySet()); + assertEquals(cardinality, tupleExpr.getCardinality()); } @Test - public void testCacheCardinalityBindingSetAssignment() { + void testCacheCardinalityBindingSetAssignment() { BindingSetAssignment tupleExpr = new BindingSetAssignment(); - Assertions.assertFalse(tupleExpr.isCardinalitySet()); + assertFalse(tupleExpr.isCardinalitySet()); double cardinality = new EvaluationStatistics().getCardinality(tupleExpr); - Assertions.assertTrue(tupleExpr.isCardinalitySet()); - Assertions.assertEquals(cardinality, tupleExpr.getCardinality()); + assertTrue(tupleExpr.isCardinalitySet()); + assertEquals(cardinality, tupleExpr.getCardinality()); } private class ParentCheckingVisitor extends AbstractQueryModelVisitor { diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/EvaluationStrategyWithRDFStarTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/EvaluationStrategyWithRDFStarTest.java index 65108a2f69a..ec4210c5df5 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/EvaluationStrategyWithRDFStarTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/EvaluationStrategyWithRDFStarTest.java @@ -46,7 +46,7 @@ * * @author damyan.ognyanov */ -public class EvaluationStrategyWithRDFStarTest { +class EvaluationStrategyWithRDFStarTest { // the triples over which the evaluations is carried private final ArrayList triples = new ArrayList<>(); @@ -143,7 +143,7 @@ protected Statement convert(Triple sourceObject) } @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { // prepare data triples.clear(); triples.add(vf.createTriple(vf.createIRI("urn:a"), vf.createIRI("urn:p"), vf.createIRI("urn:b"))); @@ -203,7 +203,7 @@ public CloseableIteration getStat @ParameterizedTest(name = "RDF-star={0}") @ValueSource(booleans = { false, true }) - public void testMatchAllUnbound(boolean bRDFStarData) { + void testMatchAllUnbound(boolean bRDFStarData) { EvaluationStrategy strategy = new StrictEvaluationStrategy(createSource(bRDFStarData), null); // case check all unbound try (CloseableIteration iter = strategy.evaluate(tripleRefNode, @@ -223,7 +223,7 @@ public void testMatchAllUnbound(boolean bRDFStarData) { @ParameterizedTest(name = "RDF-star={0}") @ValueSource(booleans = { false, true }) - public void testSubjVarBound(boolean bRDFStarData) { + void testSubjVarBound(boolean bRDFStarData) { EvaluationStrategy strategy = new StrictEvaluationStrategy(createSource(bRDFStarData), null); try (CloseableIteration iter = strategy.evaluate(tripleRefNode, createWithVarValue(tripleRefNode.getSubjectVar(), vf.createIRI("urn:a")))) { @@ -244,7 +244,7 @@ public void testSubjVarBound(boolean bRDFStarData) { @ParameterizedTest(name = "RDF-star={0}") @ValueSource(booleans = { false, true }) - public void testPredVarBound(boolean bRDFStarData) { + void testPredVarBound(boolean bRDFStarData) { EvaluationStrategy strategy = new StrictEvaluationStrategy(createSource(bRDFStarData), null); try (CloseableIteration iter = strategy.evaluate(tripleRefNode, createWithVarValue(tripleRefNode.getPredicateVar(), vf.createIRI("urn:p")))) { @@ -266,7 +266,7 @@ public void testPredVarBound(boolean bRDFStarData) { @ParameterizedTest(name = "RDF-star={0}") @ValueSource(booleans = { false, true }) - public void testObjVarBound(boolean bRDFStarData) { + void testObjVarBound(boolean bRDFStarData) { EvaluationStrategy strategy = new StrictEvaluationStrategy(createSource(bRDFStarData), null); try (CloseableIteration iter = strategy.evaluate(tripleRefNode, createWithVarValue(tripleRefNode.getObjectVar(), vf.createIRI("urn:b")))) { @@ -288,7 +288,7 @@ public void testObjVarBound(boolean bRDFStarData) { @ParameterizedTest(name = "RDF-star={0}") @ValueSource(booleans = { false, true }) - public void testSubjAndObjVarBound(boolean bRDFStarData) { + void testSubjAndObjVarBound(boolean bRDFStarData) { QueryBindingSet set = (QueryBindingSet) createWithVarValue(tripleRefNode.getObjectVar(), vf.createIRI("urn:c")); set.addBinding(tripleRefNode.getSubjectVar().getName(), vf.createIRI("urn:a:2")); @@ -312,7 +312,7 @@ public void testSubjAndObjVarBound(boolean bRDFStarData) { @ParameterizedTest(name = "RDF-star={0}") @ValueSource(booleans = { false, true }) - public void testExtVarBound(boolean bRDFStarData) { + void testExtVarBound(boolean bRDFStarData) { Triple triple = triples.get(0); QueryBindingSet set = (QueryBindingSet) createWithVarValue(tripleRefNode.getExprVar(), triple); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/FilterOptimizerTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/FilterOptimizerTest.java index ca40354b365..dcfdeeb10dc 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/FilterOptimizerTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/FilterOptimizerTest.java @@ -43,7 +43,7 @@ public FilterOptimizer getOptimizer() { } @Test - public void merge() { + void merge() { String expectedQuery = "SELECT * WHERE {?s ?p ?o . FILTER( ?o <4 && ?o > 2) }"; String query = "SELECT * WHERE {?s ?p ?o . FILTER(?o > 2) . FILTER(?o <4) }"; @@ -51,7 +51,7 @@ public void merge() { } @Test - public void dontMerge() { + void dontMerge() { Var s = new Var("s"); Var p = new Var("p"); Var o = new Var("o"); @@ -71,7 +71,7 @@ public void dontMerge() { } @Test - public void deMerge() { + void deMerge() { Var s = new Var("s"); Var p = new Var("p"); Var o = new Var("o"); @@ -99,7 +99,7 @@ public void deMerge() { } @Test - public void testNestedFilter() { + void testNestedFilter() { String expectedQuery = "SELECT * WHERE {?s ?p ?o . ?o ?r ?z. ?z ?k ?m. FILTER( NOT EXISTS {{?o ?p2 ?v1. FILTER(?v1 < 4) }\n {?o ?p2 ?v2. FILTER(?v2 > 0 && ?v2 < 4)}\n ?o ?p2 ?v3.} && NOT EXISTS {?o ?p2 []}) }"; String query = "SELECT * WHERE {?s ?p ?o . ?o ?r ?z. FILTER NOT EXISTS {?o ?p2 []}\n ?z ?k ?m. FILTER NOT EXISTS {?o ?p2 ?v1, ?v2, ?v3. FILTER(?v2 < 4) FILTER(?v1 < 4) FILTER(?v2 > 0)} }"; diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/MinimalContextNowTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/MinimalContextNowTest.java index a4d5af4ebb5..aee55a9245f 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/MinimalContextNowTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/MinimalContextNowTest.java @@ -10,6 +10,11 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.algebra.evaluation.impl; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; @@ -24,28 +29,27 @@ import org.eclipse.rdf4j.model.base.CoreDatatype; import org.eclipse.rdf4j.query.algebra.evaluation.QueryValueEvaluationStep; import org.eclipse.rdf4j.query.impl.EmptyBindingSet; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class MinimalContextNowTest { +class MinimalContextNowTest { @Test - public void testNow() { + void testNow() { // Tests that the now value is correctly initialized. QueryEvaluationContext.Minimal context = new QueryEvaluationContext.Minimal(null); QueryValueEvaluationStep prepared = new QueryValueEvaluationStep.ConstantQueryValueEvaluationStep( context.getNow()); - Assertions.assertNotNull(prepared); + assertNotNull(prepared); Value nowValue = prepared.evaluate(EmptyBindingSet.getInstance()); - Assertions.assertTrue(nowValue.isLiteral()); - Assertions.assertEquals(CoreDatatype.XSD.DATETIME, ((Literal) nowValue).getCoreDatatype()); + assertTrue(nowValue.isLiteral()); + assertEquals(CoreDatatype.XSD.DATETIME, ((Literal) nowValue).getCoreDatatype()); } @Test - public void testConcurrentAccessToNow() throws ExecutionException, InterruptedException { + void testConcurrentAccessToNow() throws ExecutionException, InterruptedException { int numberOfIterations = 100; int numberOfThreads = 10; @@ -72,9 +76,9 @@ public void testConcurrentAccessToNow() throws ExecutionException, InterruptedEx Literal prev = null; for (Future future : futures) { Literal now = future.get(); - Assertions.assertNotNull(now); + assertNotNull(now); if (prev != null) { - Assertions.assertSame(prev, now); + assertSame(prev, now); } prev = now; } @@ -83,7 +87,7 @@ public void testConcurrentAccessToNow() throws ExecutionException, InterruptedEx } finally { List runnables = executorService.shutdownNow(); - Assertions.assertTrue(runnables.isEmpty()); + assertTrue(runnables.isEmpty()); } } diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ParentReferenceCleanerTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ParentReferenceCleanerTest.java index 6e0ca7d7fbc..689c156ecbf 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ParentReferenceCleanerTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ParentReferenceCleanerTest.java @@ -30,10 +30,10 @@ import org.eclipse.rdf4j.query.parser.QueryParserUtil; import org.junit.jupiter.api.Test; -public class ParentReferenceCleanerTest { +class ParentReferenceCleanerTest { @Test - public void testStandardOptimizerPipeline() { + void testStandardOptimizerPipeline() { ParsedTupleQuery query = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, "select * where {?a ?b ?c. ?c * ?d}", null); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ProjectionRemovalOptimizerTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ProjectionRemovalOptimizerTest.java index e9f2957f34c..e364cd16ec2 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ProjectionRemovalOptimizerTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ProjectionRemovalOptimizerTest.java @@ -26,10 +26,10 @@ import org.eclipse.rdf4j.query.parser.QueryParserUtil; import org.junit.jupiter.api.Test; -public class ProjectionRemovalOptimizerTest { +class ProjectionRemovalOptimizerTest { @Test - public void testRemovingOptimization() throws RDF4JException { + void testRemovingOptimization() throws RDF4JException { String query = "SELECT ?s ?p ?o WHERE { ?s ?p ?o }"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); @@ -43,7 +43,7 @@ public void testRemovingOptimization() throws RDF4JException { } @Test - public void testRemovingOptimizationSubselect() throws RDF4JException { + void testRemovingOptimizationSubselect() throws RDF4JException { String query = "SELECT ?s ?p ?o WHERE { SELECT * WHERE { ?s ?p ?o }}"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); @@ -60,7 +60,7 @@ public void testRemovingOptimizationSubselect() throws RDF4JException { } @Test - public void testRemovingHalfOptimizationSubselect() throws RDF4JException { + void testRemovingHalfOptimizationSubselect() throws RDF4JException { String query = "SELECT ?s ?p WHERE { SELECT * WHERE { ?s ?p ?o , ?o2 }}"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); @@ -79,7 +79,7 @@ public void testRemovingHalfOptimizationSubselect() throws RDF4JException { } @Test - public void testNotRemovingOptimizationTooFew() throws RDF4JException { + void testNotRemovingOptimizationTooFew() throws RDF4JException { String query = "SELECT ?s ?p WHERE { ?s ?p ?o }"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); @@ -93,7 +93,7 @@ public void testNotRemovingOptimizationTooFew() throws RDF4JException { } @Test - public void testNotRemovingOptimizationTooMany() throws RDF4JException { + void testNotRemovingOptimizationTooMany() throws RDF4JException { String query = "SELECT ?s ?p ?o ?o2 WHERE { ?s ?p ?o }"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); @@ -107,7 +107,7 @@ public void testNotRemovingOptimizationTooMany() throws RDF4JException { } @Test - public void testNotRemovingOptimization2() throws RDF4JException { + void testNotRemovingOptimization2() throws RDF4JException { String query = "SELECT (?s as ?o2) (?p as ?s1) ?o WHERE { ?s ?p ?o }"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryCostEstimatesTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryCostEstimatesTest.java index f030c2a6f2e..f0d1cc03b9d 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryCostEstimatesTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryCostEstimatesTest.java @@ -21,12 +21,12 @@ /** * Tests that cost estimates are printed as part of the plan */ -public class QueryCostEstimatesTest { +class QueryCostEstimatesTest { private final String LINE_SEP = System.lineSeparator(); @Test - public void testBindingSetAssignmentOptimization() throws RDF4JException { + void testBindingSetAssignmentOptimization() throws RDF4JException { String query = "prefix ex: " + "select ?s ?p ?o ?x where {" + " ex:s1 ex:pred ?v. " + " ex:s2 ex:pred 'bah'. {" + " ?s ?p ?o. " + " optional {" + " values ?x {ex:a ex:b ex:c ex:d ex:e ex:f ex:g}. " + " }" + " }" + "}"; diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryJoinOptimizerTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryJoinOptimizerTest.java index 92c0ea69678..125c0775d98 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryJoinOptimizerTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryJoinOptimizerTest.java @@ -13,6 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -47,7 +48,7 @@ public class QueryJoinOptimizerTest extends QueryOptimizerTest { @Test - public void testBindingSetAssignmentOptimization() throws RDF4JException { + void testBindingSetAssignmentOptimization() throws RDF4JException { String query = "prefix ex: " + "select ?s ?p ?o ?x where {" + " ex:s1 ex:pred ?v. " + " ex:s2 ex:pred 'bah'. {" + " ?s ?p ?o. " + " optional {" + " values ?x {ex:a ex:b ex:c ex:d ex:e ex:f ex:g}. " + " }" + " }" + "}"; @@ -61,7 +62,7 @@ public void testBindingSetAssignmentOptimization() throws RDF4JException { } @Test - public void testContextOptimization() throws RDF4JException { + void testContextOptimization() throws RDF4JException { String query = "prefix ex: " + "select ?x ?y ?z ?g ?p ?o where {" + " graph ?g {" + " ex:s ?sp ?so. " + " ?ps ex:p ?po. " + " ?os ?op 'ex:o'. " + " }" + " ?x ?y ?z. " + "}"; // optimal order should be ?g graph first @@ -76,7 +77,7 @@ public void testContextOptimization() throws RDF4JException { } @Test - public void testSES2306AggregateOrderBy() throws Exception { + void testSES2306AggregateOrderBy() throws Exception { String select = "PREFIX ex: \n" + "SELECT ((MIN(?x+1) + MAX(?y-1))/2 AS ?r) {\n" + " ?this ex:name ?n . ?this ex:id ?id . ?this ex:prop1 ?x . ?this ex:prop2 ?y .\n" + "} GROUP BY concat(?n, ?id) HAVING (SUM(?x) + SUM(?y) < 5) ORDER BY (COUNT(?x) + COUNT(?y))"; @@ -94,7 +95,7 @@ protected void meetUnaryTupleOperator(UnaryTupleOperator node) throws Exception } @Test - public void testSES2116JoinBind() throws Exception { + void testSES2116JoinBind() throws Exception { StringBuilder qb = new StringBuilder(); qb.append("SELECT ?subject ?name ?row {\n" + " ?subject ?uri .\n" @@ -112,7 +113,7 @@ public void testSES2116JoinBind() throws Exception { } @Test - public void bindSubselectJoinOrder() throws Exception { + void bindSubselectJoinOrder() throws Exception { String query = "SELECT * WHERE {\n" + " BIND (bnode() as ?ct01) \n" + " { SELECT ?s WHERE {\n" + " ?s ?p ?o .\n" + " }\n" + " LIMIT 10\n" + " }\n" + "}"; @@ -131,7 +132,7 @@ public void bindSubselectJoinOrder() throws Exception { } @Test - public void testValues() throws RDF4JException { + void testValues() throws RDF4JException { String query = String.join("\n", "", "prefix ex: ", "select * where {", @@ -154,7 +155,7 @@ public void testValues() throws RDF4JException { } @Test - public void testOptionalWithSubSelect() throws RDF4JException { + void testOptionalWithSubSelect() throws RDF4JException { String query = String.join("\n", "", "prefix ex: ", "select * where {", @@ -182,13 +183,13 @@ public void testOptionalWithSubSelect() throws RDF4JException { optRoot.visit(stmtFinder); List stmts = stmtFinder.getStatements(); - assertEquals(stmts.size(), 3); - assertEquals(stmts.get(0).getSubjectVar().getValue().stringValue(), "ex:b"); - assertEquals(stmts.get(0).getPredicateVar().getValue().stringValue(), "ex:a"); - assertEquals(stmts.get(0).getObjectVar().getValue(), null); - assertEquals(stmts.get(1).getSubjectVar().getValue().stringValue(), "ex:b"); - assertEquals(stmts.get(1).getPredicateVar().getValue(), null); - assertEquals(stmts.get(1).getObjectVar().getValue(), null); + assertEquals(3, stmts.size()); + assertEquals("ex:b", stmts.get(0).getSubjectVar().getValue().stringValue()); + assertEquals("ex:a", stmts.get(0).getPredicateVar().getValue().stringValue()); + assertNull(stmts.get(0).getObjectVar().getValue()); + assertEquals("ex:b", stmts.get(1).getSubjectVar().getValue().stringValue()); + assertNull(stmts.get(1).getPredicateVar().getValue()); + assertNull(stmts.get(1).getObjectVar().getValue()); } diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryModelNormalizerTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryModelNormalizerTest.java index 72f123fd1fe..49caf38a856 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryModelNormalizerTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/QueryModelNormalizerTest.java @@ -26,12 +26,12 @@ public class QueryModelNormalizerTest extends QueryOptimizerTest { private QueryModelNormalizerOptimizer subject; @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { subject = getOptimizer(); } @Test - public void testNormalizeUnionWithEmptyLeft() { + void testNormalizeUnionWithEmptyLeft() { Projection p = new Projection(); Union union = new Union(); SingletonSet s = new SingletonSet(); @@ -45,7 +45,7 @@ public void testNormalizeUnionWithEmptyLeft() { } @Test - public void testNormalizeUnionWithEmptyRight() { + void testNormalizeUnionWithEmptyRight() { Projection p = new Projection(); Union union = new Union(); SingletonSet s = new SingletonSet(); @@ -62,7 +62,7 @@ public void testNormalizeUnionWithEmptyRight() { * @see GH-1404 */ @Test - public void testNormalizeUnionWithTwoSingletons() { + void testNormalizeUnionWithTwoSingletons() { Projection p = new Projection(); Union union = new Union(); union.setRightArg(new SingletonSet()); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/RegexAsStringFunctionOptimizierTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/RegexAsStringFunctionOptimizierTest.java index 767d3103f5f..d0e308f4da2 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/RegexAsStringFunctionOptimizierTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/RegexAsStringFunctionOptimizierTest.java @@ -30,17 +30,17 @@ * * @author Jerven Bolleman */ -public class RegexAsStringFunctionOptimizierTest { +class RegexAsStringFunctionOptimizierTest { @Test - public void testEqualsTerm() throws MalformedQueryException { + void testEqualsTerm() throws MalformedQueryException { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REGEX(?o, '^a$'))}"; String optimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(?o = 'a')}"; testOptimizer(optimizedQuery, unoptimizedQuery); } @Test - public void testStrStartsTerm() throws MalformedQueryException { + void testStrStartsTerm() throws MalformedQueryException { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REGEX(?o, '^a'))}"; String optimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(strStarts(?o, 'a'))}"; @@ -48,7 +48,7 @@ public void testStrStartsTerm() throws MalformedQueryException { } @Test - public void testStrEndsTerm() throws MalformedQueryException { + void testStrEndsTerm() throws MalformedQueryException { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REGEX(?o, 'a$'))}"; String optimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(strEnds(?o, 'a'))}"; @@ -56,35 +56,35 @@ public void testStrEndsTerm() throws MalformedQueryException { } @Test - public void testContains() throws MalformedQueryException { + void testContains() throws MalformedQueryException { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REGEX(?o, 'a'))}"; String optimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(contains(?o, 'a'))}"; testOptimizer(optimizedQuery, unoptimizedQuery); } @Test - public void testContainsWithDollar() throws MalformedQueryException { + void testContainsWithDollar() throws MalformedQueryException { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REGEX($o, 'a'))}"; String optimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(contains(?o, 'a'))}"; testOptimizer(optimizedQuery, unoptimizedQuery); } @Test - public void testContainsWithStrangeSpacingAndCaptials() throws MalformedQueryException { + void testContainsWithStrangeSpacingAndCaptials() throws MalformedQueryException { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REgeX( $o , \"a\" ))}"; String optimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(contains(?o, 'a'))}"; testOptimizer(optimizedQuery, unoptimizedQuery); } @Test - public void testNotContains() throws MalformedQueryException { + void testNotContains() throws MalformedQueryException { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REGEX(?o, 'a', 'i'))}"; testOptimizer(unoptimizedQuery, unoptimizedQuery); } @Test - public void testContainsFunction() throws MalformedQueryException { + void testContainsFunction() throws MalformedQueryException { String optimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(CONTAINS(STR(?o), 'a'))}"; String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REGEX(STR(?o), 'a'))}"; @@ -92,7 +92,7 @@ public void testContainsFunction() throws MalformedQueryException { } @Test - public void testRealRegexDoesNotRedirect() { + void testRealRegexDoesNotRedirect() { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(REGEX(?o, 'a*'))}"; @@ -109,7 +109,7 @@ public void testRealRegexDoesNotRedirect() { } @Test - public void testContainsAsIs() throws MalformedQueryException { + void testContainsAsIs() throws MalformedQueryException { String unoptimizedQuery = "SELECT ?o WHERE {?s ?p ?o . FILTER(contains(?o, 'a*'))}"; testOptimizer(unoptimizedQuery, unoptimizedQuery); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/StrictEvaluationStrategyTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/StrictEvaluationStrategyTest.java index e79d869f5b6..00c5d3dfd33 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/StrictEvaluationStrategyTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/StrictEvaluationStrategyTest.java @@ -48,12 +48,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class StrictEvaluationStrategyTest { +class StrictEvaluationStrategyTest { private EvaluationStrategy strategy; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { strategy = new StrictEvaluationStrategy(new EmptyTripleSource(), null); } @@ -61,7 +61,7 @@ public void setUp() throws Exception { * Verifies if only those input bindings that actually occur in the query are returned in the result. See SES-2373. */ @Test - public void testBindings() throws Exception { + void testBindings() throws Exception { String query = "SELECT ?a ?b WHERE {}"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); @@ -84,7 +84,7 @@ public void testBindings() throws Exception { } @Test - public void testOptimize() throws Exception { + void testOptimize() throws Exception { QueryOptimizer optimizer1 = mock(QueryOptimizer.class); QueryOptimizer optimizer2 = mock(QueryOptimizer.class); @@ -101,7 +101,7 @@ public void testOptimize() throws Exception { } @Test - public void testEvaluateRegexFlags() throws Exception { + void testEvaluateRegexFlags() throws Exception { String query = "SELECT ?a WHERE { " + "VALUES ?a { \"foo.bar\" \"foo bar\" } \n" @@ -147,7 +147,7 @@ public void testEvaluateRegexFlags() throws Exception { } @Test - public void testComplex() { + void testComplex() { String query = "PREFIX dcat: \n" + "PREFIX foaf: \n" + "PREFIX dct: \n" + @@ -167,7 +167,7 @@ public void testComplex() { } @Test - public void testNow() { + void testNow() { String query = "SELECT ?now WHERE {BIND(NOW() AS ?now)}"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); QueryEvaluationStep prepared = strategy.precompile(pq.getTupleExpr()); @@ -188,7 +188,7 @@ public void testNow() { } @Test - public void testDatetimeCast() { + void testDatetimeCast() { String query = "PREFIX xsd: SELECT (xsd:date(\"2022-09-xx\") AS ?date) { }"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); QueryEvaluationStep prepared = strategy.precompile(pq.getTupleExpr()); @@ -205,7 +205,7 @@ public void testDatetimeCast() { } @Test - public void testSES1991NOWEvaluation() throws Exception { + void testSES1991NOWEvaluation() throws Exception { String query = "PREFIX ex: SELECT ?d WHERE {VALUES(?s ?p ?o) {(ex:type rdf:type ex:type)(ex:type ex:type ex:type)} . BIND(NOW() as ?d) } LIMIT 2"; ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, null); QueryEvaluationStep prepared = strategy.precompile(pq.getTupleExpr()); @@ -229,7 +229,7 @@ public void testSES1991NOWEvaluation() throws Exception { } @Test - public void testSES869ValueOfNow() { + void testSES869ValueOfNow() { ParsedQuery pq = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, "SELECT ?p ( NOW() as ?n ) { BIND (NOW() as ?p ) }", null); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/UnionScopeChangeOptimizerTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/UnionScopeChangeOptimizerTest.java index c839d6ab8b6..a96880f9d69 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/UnionScopeChangeOptimizerTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/UnionScopeChangeOptimizerTest.java @@ -28,7 +28,7 @@ public class UnionScopeChangeOptimizerTest extends QueryOptimizerTest { private Union union; @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { subject = getOptimizer(); union = new Union(); union.setVariableScopeChange(true); @@ -36,7 +36,7 @@ public void setup() throws Exception { } @Test - public void fixesScopeChange() { + void fixesScopeChange() { union.setRightArg(new SingletonSet()); union.setLeftArg(new SingletonSet()); @@ -45,7 +45,7 @@ public void fixesScopeChange() { } @Test - public void keepsScopeChangeOnBindClauseArg() { + void keepsScopeChangeOnBindClauseArg() { { union.setLeftArg(new Extension(new SingletonSet())); union.setRightArg(new SingletonSet()); @@ -64,7 +64,7 @@ public void keepsScopeChangeOnBindClauseArg() { } @Test - public void fixesScopeChangeOnSubselect1() { + void fixesScopeChangeOnSubselect1() { union.setLeftArg(new Projection(new Extension(new SingletonSet()))); union.setRightArg(new SingletonSet()); @@ -73,7 +73,7 @@ public void fixesScopeChangeOnSubselect1() { } @Test - public void fixesScopeChangeOnSubselect2() { + void fixesScopeChangeOnSubselect2() { union.setLeftArg(new SingletonSet()); union.setRightArg(new Projection(new Extension(new SingletonSet()))); @@ -82,7 +82,7 @@ public void fixesScopeChangeOnSubselect2() { } @Test - public void fixesScopeChangeOnNestedUnion() { + void fixesScopeChangeOnNestedUnion() { Union nestedUnion = new Union(); nestedUnion.setVariableScopeChange(true); nestedUnion.setLeftArg(new Extension(new SingletonSet())); @@ -119,7 +119,7 @@ public void keepsScopeChangeOnNestedPathAlternative() { } @Test - public void keepsScopeChangeOnValuesClauseArg() { + void keepsScopeChangeOnValuesClauseArg() { { union.setLeftArg(new BindingSetAssignment()); union.setRightArg(new SingletonSet()); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/GroupIteratorTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/GroupIteratorTest.java index affe4bf209a..7f63d760e02 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/GroupIteratorTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/GroupIteratorTest.java @@ -60,7 +60,7 @@ /** * @author Bart Hanssens */ -public class GroupIteratorTest { +class GroupIteratorTest { private final static ValueFactory vf = SimpleValueFactory.getInstance(); private static final EvaluationStrategy evaluator = new StrictEvaluationStrategy(null, null); private static final QueryEvaluationContext context = new QueryEvaluationContext.Minimal( @@ -70,7 +70,7 @@ public class GroupIteratorTest { private static AggregateFunctionFactory aggregateFunctionFactory; @BeforeAll - public static void init() { + static void init() { EMPTY_ASSIGNMENT = new BindingSetAssignment(); EMPTY_ASSIGNMENT.setBindingSets(Collections.emptyList()); NONEMPTY_ASSIGNMENT = new BindingSetAssignment(); @@ -127,12 +127,12 @@ public SumCollector getCollector() { } @AfterAll - public static void cleanUp() { + static void cleanUp() { CustomAggregateFunctionRegistry.getInstance().remove(aggregateFunctionFactory); } @Test - public void testAvgEmptySet() throws QueryEvaluationException { + void testAvgEmptySet() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("avg", new Avg(new Var("a")))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { @@ -144,7 +144,7 @@ public void testAvgEmptySet() throws QueryEvaluationException { } @Test - public void testMaxEmptySet_DefaultGroup() throws QueryEvaluationException { + void testMaxEmptySet_DefaultGroup() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("max", new Max(new Var("a")))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { @@ -155,7 +155,7 @@ public void testMaxEmptySet_DefaultGroup() throws QueryEvaluationException { } @Test - public void testMaxEmptySet_Grouped() throws QueryEvaluationException { + void testMaxEmptySet_Grouped() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("max", new Max(new Var("a")))); group.addGroupBindingName("x"); // we are grouping by variable x @@ -167,7 +167,7 @@ public void testMaxEmptySet_Grouped() throws QueryEvaluationException { } @Test - public void testMinEmptySet() throws QueryEvaluationException { + void testMinEmptySet() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("min", new Min(new Var("a")))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { @@ -178,7 +178,7 @@ public void testMinEmptySet() throws QueryEvaluationException { } @Test - public void testSampleEmptySet() throws QueryEvaluationException { + void testSampleEmptySet() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("sample", new Sample(new Var("a")))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { @@ -189,7 +189,7 @@ public void testSampleEmptySet() throws QueryEvaluationException { } @Test - public void testGroupConcatEmptySet() throws QueryEvaluationException { + void testGroupConcatEmptySet() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("groupconcat", new GroupConcat(new Var("a")))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { @@ -201,7 +201,7 @@ public void testGroupConcatEmptySet() throws QueryEvaluationException { } @Test - public void testAvgNotZero() throws QueryEvaluationException { + void testAvgNotZero() throws QueryEvaluationException { Group group = new Group(NONEMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("avg", new Avg(new Var("a")))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { @@ -211,7 +211,7 @@ public void testAvgNotZero() throws QueryEvaluationException { } @Test - public void testCountNotZero() throws QueryEvaluationException { + void testCountNotZero() throws QueryEvaluationException { Group group = new Group(NONEMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("count", new Count(new Var("a")))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { @@ -221,7 +221,7 @@ public void testCountNotZero() throws QueryEvaluationException { } @Test - public void testSumNotZero() throws QueryEvaluationException { + void testSumNotZero() throws QueryEvaluationException { Group group = new Group(NONEMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("sum", new Sum(new Var("a")))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { @@ -231,7 +231,7 @@ public void testSumNotZero() throws QueryEvaluationException { } @Test - public void testCustomAggregateFunction_Nonempty() throws QueryEvaluationException { + void testCustomAggregateFunction_Nonempty() throws QueryEvaluationException { Group group = new Group(NONEMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("customSum", new AggregateFunctionCall(new Var("a"), aggregateFunctionFactory.getIri(), false))); @@ -241,7 +241,7 @@ public void testCustomAggregateFunction_Nonempty() throws QueryEvaluationExcepti } @Test - public void testCustomAggregateFunction_Empty() throws QueryEvaluationException { + void testCustomAggregateFunction_Empty() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("customSum", new AggregateFunctionCall(new Var("a"), aggregateFunctionFactory.getIri(), false))); @@ -251,7 +251,7 @@ public void testCustomAggregateFunction_Empty() throws QueryEvaluationException } @Test - public void testCustomAggregateFunction_WrongIri() throws QueryEvaluationException { + void testCustomAggregateFunction_WrongIri() throws QueryEvaluationException { Group group = new Group(EMPTY_ASSIGNMENT); group.addGroupElement(new GroupElem("customSum", new AggregateFunctionCall(new Var("a"), "urn:i", false))); try (GroupIterator gi = new GroupIterator(evaluator, group, EmptyBindingSet.getInstance(), context)) { diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/HashJoinIterationTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/HashJoinIterationTest.java index 4d42951b1e8..1ad583b2a0f 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/HashJoinIterationTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/HashJoinIterationTest.java @@ -35,7 +35,7 @@ /** * @author MJAHale */ -public class HashJoinIterationTest { +class HashJoinIterationTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @@ -55,7 +55,7 @@ public CloseableIteration getStat }, null); @Test - public void testCartesianJoin() throws QueryEvaluationException { + void testCartesianJoin() throws QueryEvaluationException { BindingSetAssignment left = new BindingSetAssignment(); { QueryBindingSet leftb = new QueryBindingSet(); @@ -78,7 +78,7 @@ public void testCartesianJoin() throws QueryEvaluationException { } @Test - public void testInnerJoin() throws QueryEvaluationException { + void testInnerJoin() throws QueryEvaluationException { BindingSetAssignment left = new BindingSetAssignment(); { QueryBindingSet leftb = new QueryBindingSet(); @@ -104,7 +104,7 @@ public void testInnerJoin() throws QueryEvaluationException { } @Test - public void testLeftJoin() throws QueryEvaluationException { + void testLeftJoin() throws QueryEvaluationException { BindingSetAssignment left = new BindingSetAssignment(); { QueryBindingSet leftb = new QueryBindingSet(); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/JoinIteratorTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/JoinIteratorTest.java index d28e4f609ec..0fee037415b 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/JoinIteratorTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/JoinIteratorTest.java @@ -41,7 +41,7 @@ /** * @author MJAHale */ -public class JoinIteratorTest { +class JoinIteratorTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @@ -66,7 +66,7 @@ public CloseableIteration getStat * Tests joins between two different BindingSetAssignments with the same BindingSets but ordered differently. */ @Test - public void testBindingSetAssignmentJoin() throws QueryEvaluationException { + void testBindingSetAssignmentJoin() throws QueryEvaluationException { testBindingSetAssignmentJoin(5, 5, EmptyBindingSet.getInstance()); { diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/OrderIteratorTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/OrderIteratorTest.java index 8b7cbd5bd17..d2324f7d669 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/OrderIteratorTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/OrderIteratorTest.java @@ -33,7 +33,7 @@ /** * @author james */ -public class OrderIteratorTest { +class OrderIteratorTest { class IterationStub extends CloseableIteratorIteration { @@ -139,7 +139,7 @@ public String toString() { private SizeComparator cmp; @Test - public void testFirstHasNext() throws Exception { + void testFirstHasNext() throws Exception { order.hasNext(); assertEquals(list.size() + 1, iteration.hasNextCount); assertEquals(list.size(), iteration.nextCount); @@ -147,7 +147,7 @@ public void testFirstHasNext() throws Exception { } @Test - public void testHasNext() throws Exception { + void testHasNext() throws Exception { order.hasNext(); order.next(); order.hasNext(); @@ -157,7 +157,7 @@ public void testHasNext() throws Exception { } @Test - public void testFirstNext() throws Exception { + void testFirstNext() throws Exception { order.next(); assertEquals(list.size() + 1, iteration.hasNextCount); assertEquals(list.size(), iteration.nextCount); @@ -165,7 +165,7 @@ public void testFirstNext() throws Exception { } @Test - public void testNext() throws Exception { + void testNext() throws Exception { order.next(); order.next(); assertEquals(list.size() + 1, iteration.hasNextCount); @@ -174,7 +174,7 @@ public void testNext() throws Exception { } @Test - public void testRemove() throws Exception { + void testRemove() throws Exception { try { order.remove(); fail(); @@ -184,7 +184,7 @@ public void testRemove() throws Exception { } @Test - public void testSorting() throws Exception { + void testSorting() throws Exception { List sorted = new ArrayList<>(list); Collections.sort(sorted, cmp); for (BindingSet b : sorted) { diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/ZeroLengthPathIterationTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/ZeroLengthPathIterationTest.java index 082a1c5edec..a2217f3c8cd 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/ZeroLengthPathIterationTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/ZeroLengthPathIterationTest.java @@ -38,14 +38,14 @@ /** * @author jeen */ -public class ZeroLengthPathIterationTest { +class ZeroLengthPathIterationTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); private EvaluationStrategy evaluator; @BeforeEach - public void setUp() { + void setUp() { Model m = new LinkedHashModel(); m.add(RDF.ALT, RDF.TYPE, RDFS.CLASS); m.add(RDF.BAG, RDF.TYPE, RDFS.CLASS); @@ -72,7 +72,7 @@ public ValueFactory getValueFactory() { * @see GH-689 */ @Test - public void testRetainInputBindings() { + void testRetainInputBindings() { MapBindingSet bindings = new MapBindingSet(); bindings.addBinding("a", RDF.FIRST); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/LiteralComparatorTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/LiteralComparatorTest.java index 97dc0063dc5..090f1ade18d 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/LiteralComparatorTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/LiteralComparatorTest.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.algebra.evaluation.util; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; @@ -29,7 +30,7 @@ /** * @author james */ -public class LiteralComparatorTest { +class LiteralComparatorTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @@ -64,70 +65,70 @@ public class LiteralComparatorTest { private final ValueComparator cmp = new ValueComparator(); @Test - public void testNumeric() throws Exception { - assertTrue(cmp.compare(one, one) == 0); + void testNumeric() throws Exception { + assertEquals(0, cmp.compare(one, one)); assertTrue(cmp.compare(one, ten) < 0); assertTrue(cmp.compare(ten, one) > 0); - assertTrue(cmp.compare(ten, ten) == 0); + assertEquals(0, cmp.compare(ten, ten)); } @Test - public void testString() throws Exception { - assertTrue(cmp.compare(a, a) == 0); + void testString() throws Exception { + assertEquals(0, cmp.compare(a, a)); assertTrue(cmp.compare(a, b) < 0); assertTrue(cmp.compare(b, a) > 0); - assertTrue(cmp.compare(b, b) == 0); + assertEquals(0, cmp.compare(b, b)); } @Test - public void testSameLanguage() throws Exception { - assertTrue(cmp.compare(la, la) == 0); + void testSameLanguage() throws Exception { + assertEquals(0, cmp.compare(la, la)); assertTrue(cmp.compare(la, lb) < 0); assertTrue(cmp.compare(lb, la) > 0); - assertTrue(cmp.compare(lb, lb) == 0); + assertEquals(0, cmp.compare(lb, lb)); } @Test - public void testDifferentLanguage() throws Exception { + void testDifferentLanguage() throws Exception { cmp.compare(la, lf); } @Test - public void testBoolean() throws Exception { - assertTrue(cmp.compare(f, f) == 0); + void testBoolean() throws Exception { + assertEquals(0, cmp.compare(f, f)); assertTrue(cmp.compare(f, t) < 0); assertTrue(cmp.compare(t, f) > 0); - assertTrue(cmp.compare(t, t) == 0); + assertEquals(0, cmp.compare(t, t)); } @Test - public void testDateTime() throws Exception { - assertTrue(cmp.compare(date1, date1) == 0); + void testDateTime() throws Exception { + assertEquals(0, cmp.compare(date1, date1)); assertTrue(cmp.compare(date1, date2) < 0); assertTrue(cmp.compare(date2, date1) > 0); - assertTrue(cmp.compare(date2, date2) == 0); + assertEquals(0, cmp.compare(date2, date2)); } @Test - public void testBothSimple() throws Exception { - assertTrue(cmp.compare(simple1, simple1) == 0); + void testBothSimple() throws Exception { + assertEquals(0, cmp.compare(simple1, simple1)); assertTrue(cmp.compare(simple1, simple2) < 0); assertTrue(cmp.compare(simple2, simple1) > 0); - assertTrue(cmp.compare(simple2, simple2) == 0); + assertEquals(0, cmp.compare(simple2, simple2)); } @Test - public void testLeftSimple() throws Exception { - assertTrue(cmp.compare(simple1, typed1) == 0); + void testLeftSimple() throws Exception { + assertEquals(0, cmp.compare(simple1, typed1)); } @Test - public void testRightSimple() throws Exception { - assertTrue(cmp.compare(typed1, simple1) == 0); + void testRightSimple() throws Exception { + assertEquals(0, cmp.compare(typed1, simple1)); } @Test - public void testOrder() throws Exception { + void testOrder() throws Exception { Literal en4 = vf.createLiteral("4", "en"); Literal nine = vf.createLiteral(9); List list = new ArrayList<>(); @@ -139,7 +140,7 @@ public void testOrder() throws Exception { } @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { DatatypeFactory factory = DatatypeFactory.newInstance(); XMLGregorianCalendar mar = factory.newXMLGregorianCalendar("2000-03-04T20:00:00Z"); XMLGregorianCalendar oct = factory.newXMLGregorianCalendar("2002-10-10T12:00:00-05:00"); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/MathUtilTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/MathUtilTest.java index 9b776ef7878..c38eda75df4 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/MathUtilTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/MathUtilTest.java @@ -26,12 +26,12 @@ /** * @author Jerven Bolleman */ -public class MathUtilTest { +class MathUtilTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @Test - public void testCompute() { + void testCompute() { Literal float1 = vf.createLiteral("12", XSD.INTEGER); Literal float2 = vf.createLiteral("2", CoreDatatype.XSD.INTEGER); @@ -45,7 +45,7 @@ public void testCompute() { * @link https://www.w3.org/TR/xpath-functions/#func-numeric-divide */ @Test - public void testDivideByZero() { + void testDivideByZero() { Literal in1 = vf.createLiteral("12", XSD.INTEGER); divideByZero(in1, CoreDatatype.XSD.INTEGER); @@ -61,7 +61,7 @@ public void testDivideByZero() { assertTrue(Double.isInfinite(divideByZeroFloat(double1, CoreDatatype.XSD.DOUBLE).doubleValue())); Literal double1neg = vf.createLiteral("-12", XSD.DOUBLE); - assertTrue(divideByZeroFloat(double1neg, CoreDatatype.XSD.DOUBLE).doubleValue() == Double.NEGATIVE_INFINITY); + assertEquals(Double.NEGATIVE_INFINITY, divideByZeroFloat(double1neg, CoreDatatype.XSD.DOUBLE).doubleValue()); assertTrue(Double .isNaN(divideByZeroFloat(vf.createLiteral("0", XSD.DOUBLE), CoreDatatype.XSD.DOUBLE).doubleValue())); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/OrderComparatorTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/OrderComparatorTest.java index 53b1999234e..96618103489 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/OrderComparatorTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/OrderComparatorTest.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.algebra.evaluation.util; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import java.time.Instant; @@ -44,7 +45,7 @@ /** * @author james */ -public class OrderComparatorTest { +class OrderComparatorTest { private static final ValueFactory vf = SimpleValueFactory.getInstance(); private final QueryEvaluationContext context = new QueryEvaluationContext.Minimal( vf.createLiteral(Date.from(Instant.now())), null); @@ -140,15 +141,15 @@ public int compare(Value o1, Value o2) { private final int NEG = -7349; @Test - public void testEquals() throws Exception { + void testEquals() throws Exception { order.addElement(asc); cmp.setIterator(List.of(ZERO).iterator()); OrderComparator sud = new OrderComparator(strategy, order, cmp, context); - assertTrue(sud.compare(null, null) == 0); + assertEquals(0, sud.compare(null, null)); } @Test - public void testZero() throws Exception { + void testZero() throws Exception { order.addElement(asc); order.addElement(asc); cmp.setIterator(Arrays.asList(ZERO, POS).iterator()); @@ -157,7 +158,7 @@ public void testZero() throws Exception { } @Test - public void testTerm() throws Exception { + void testTerm() throws Exception { order.addElement(asc); order.addElement(asc); cmp.setIterator(Arrays.asList(POS, NEG).iterator()); @@ -166,7 +167,7 @@ public void testTerm() throws Exception { } @Test - public void testAscLessThan() throws Exception { + void testAscLessThan() throws Exception { order.addElement(asc); cmp.setIterator(List.of(NEG).iterator()); OrderComparator sud = new OrderComparator(strategy, order, cmp, context); @@ -174,7 +175,7 @@ public void testAscLessThan() throws Exception { } @Test - public void testAscGreaterThan() throws Exception { + void testAscGreaterThan() throws Exception { order.addElement(asc); cmp.setIterator(List.of(POS).iterator()); OrderComparator sud = new OrderComparator(strategy, order, cmp, context); @@ -182,7 +183,7 @@ public void testAscGreaterThan() throws Exception { } @Test - public void testDescLessThan() throws Exception { + void testDescLessThan() throws Exception { order.addElement(desc); cmp.setIterator(List.of(NEG).iterator()); OrderComparator sud = new OrderComparator(strategy, order, cmp, context); @@ -190,7 +191,7 @@ public void testDescLessThan() throws Exception { } @Test - public void testDescGreaterThan() throws Exception { + void testDescGreaterThan() throws Exception { order.addElement(desc); cmp.setIterator(List.of(POS).iterator()); OrderComparator sud = new OrderComparator(strategy, order, cmp, context); @@ -198,7 +199,7 @@ public void testDescGreaterThan() throws Exception { } @Test - public void testDisjunctBindingNames() throws Exception { + void testDisjunctBindingNames() throws Exception { OrderComparator sud = new OrderComparator(strategy, order, cmp, context); QueryBindingSet a = new QueryBindingSet(); QueryBindingSet b = new QueryBindingSet(); @@ -209,7 +210,7 @@ public void testDisjunctBindingNames() throws Exception { } @Test - public void testEqualBindingNamesUnequalValues() { + void testEqualBindingNamesUnequalValues() { OrderComparator sud = new OrderComparator(strategy, order, new ValueComparator(), context); QueryBindingSet a = new QueryBindingSet(); QueryBindingSet b = new QueryBindingSet(); @@ -222,7 +223,7 @@ public void testEqualBindingNamesUnequalValues() { } @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { asc.setAscending(true); desc.setAscending(false); } diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/QueryEvaluationUtilTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/QueryEvaluationUtilTest.java index 25a8876c9b0..e6cb59fe32a 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/QueryEvaluationUtilTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/QueryEvaluationUtilTest.java @@ -39,7 +39,7 @@ /** * @author Jeen Broekstra */ -public class QueryEvaluationUtilTest { +class QueryEvaluationUtilTest { private final ValueFactory f = SimpleValueFactory.getInstance(); @@ -84,7 +84,7 @@ public class QueryEvaluationUtilTest { private Literal arg2unknown; @BeforeEach - public void setUp() { + void setUp() { arg1simple = f.createLiteral("abc"); arg2simple = f.createLiteral("b"); @@ -117,7 +117,7 @@ public void setUp() { } @Test - public void testCompatibleArguments() { + void testCompatibleArguments() { assertTrue(QueryEvaluationUtil.compatibleArguments(arg1simple, arg2simple)); assertFalse(QueryEvaluationUtil.compatibleArguments(arg1simple, arg2en)); @@ -154,7 +154,7 @@ public void testCompatibleArguments() { } @Test - public void testCompareEQ() { + void testCompareEQ() { assertCompareTrue(arg1simple, arg1simple, EQ); assertCompareTrue(arg1en, arg1en, EQ); assertCompareTrue(arg2cy, arg2cy, EQ); @@ -236,7 +236,7 @@ public void testCompareEQ() { } @Test - public void testCompareNE() { + void testCompareNE() { assertCompareFalse(arg1simple, arg1simple, NE); assertCompareFalse(arg1en, arg1en, NE); assertCompareFalse(arg1cy, arg1cy, NE); @@ -316,7 +316,7 @@ public void testCompareNE() { } @Test - public void testCompareLT() { + void testCompareLT() { assertCompareFalse(arg1simple, arg1simple, LT); assertCompareException(arg1en, arg1en, LT); assertCompareFalse(arg1string, arg1string, LT); @@ -468,7 +468,7 @@ private void assertCompareTrue(Literal lit1, Literal lit2, CompareOp op, boolean * Reporoduces GH-2760: an NPE has been thrown when comparing custom literal implementations */ @Test - public void testCompareWithCustomLiterals() { + void testCompareWithCustomLiterals() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = vf.createLiteral(5); @@ -485,7 +485,7 @@ public void testCompareWithCustomLiterals() { * Reporoduces GH-2760: an NPE has been thrown when comparing custom literal implementations */ @Test - public void testCompareWithCustomLiteralsIncompatible() { + void testCompareWithCustomLiteralsIncompatible() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = vf.createLiteral("abc"); @@ -506,7 +506,7 @@ public void testCompareWithCustomLiteralsIncompatible() { } @Test - public void testCompareWithCustomLiteralsInditerminate() { + void testCompareWithCustomLiteralsInditerminate() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = vf.createLiteral("2000-01-01T12:00:00", XSD.DATETIME); @@ -527,7 +527,7 @@ public void testCompareWithCustomLiteralsInditerminate() { } @Test - public void testCompareCustomDatatypes() { + void testCompareCustomDatatypes() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = vf.createLiteral(1); @@ -551,7 +551,7 @@ public void testCompareCustomDatatypes() { * Reporoduces GH-2760: an NPE has been thrown when comparing custom literal implementations */ @Test - public void testCompareWithOnlyCustomLiterals() { + void testCompareWithOnlyCustomLiterals() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = getCustomLiteral(vf.createLiteral(1)); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/QueryEvaluationUtilityTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/QueryEvaluationUtilityTest.java index c73b4772129..17f0b7baeb7 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/QueryEvaluationUtilityTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/QueryEvaluationUtilityTest.java @@ -39,7 +39,7 @@ * @author Jeen Broekstra * @author Håvard M. Ottestad */ -public class QueryEvaluationUtilityTest { +class QueryEvaluationUtilityTest { private final ValueFactory f = SimpleValueFactory.getInstance(); @@ -88,7 +88,7 @@ public class QueryEvaluationUtilityTest { private Literal arg2unknown; @BeforeEach - public void setUp() { + void setUp() { arg1simple = f.createLiteral("abc"); arg2simple = f.createLiteral("b"); @@ -124,7 +124,7 @@ public void setUp() { } @Test - public void testCompatibleArguments() { + void testCompatibleArguments() { assertTrue(QueryEvaluationUtility.compatibleArguments(arg1simple, arg2simple)); assertFalse(QueryEvaluationUtility.compatibleArguments(arg1simple, arg2en)); @@ -161,7 +161,7 @@ public void testCompatibleArguments() { } @Test - public void testCompareEQ() { + void testCompareEQ() { assertCompareTrue(arg1simple, arg1simple, EQ); assertCompareTrue(arg1en, arg1en, EQ); assertCompareTrue(arg2cy, arg2cy, EQ); @@ -255,7 +255,7 @@ public void testCompareEQ() { } @Test - public void testCompareNE() { + void testCompareNE() { assertCompareFalse(arg1simple, arg1simple, NE); assertCompareFalse(arg1en, arg1en, NE); assertCompareFalse(arg1cy, arg1cy, NE); @@ -347,7 +347,7 @@ public void testCompareNE() { } @Test - public void testCompareLT() { + void testCompareLT() { assertCompareFalse(arg1simple, arg1simple, LT); // The arguments are equal, so they one can not be less than the other. @@ -514,7 +514,7 @@ private void assertCompareTrue(Literal lit1, Literal lit2, CompareOp op, boolean * Reporoduces GH-2760: an NPE has been thrown when comparing custom literal implementations */ @Test - public void testCompareWithCustomLiterals() { + void testCompareWithCustomLiterals() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = vf.createLiteral(5); @@ -531,7 +531,7 @@ public void testCompareWithCustomLiterals() { * Reporoduces GH-2760: an NPE has been thrown when comparing custom literal implementations */ @Test - public void testCompareWithCustomLiteralsIncompatible() { + void testCompareWithCustomLiteralsIncompatible() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = vf.createLiteral("abc"); @@ -552,7 +552,7 @@ public void testCompareWithCustomLiteralsIncompatible() { } @Test - public void testCompareWithCustomLiteralsInditerminate() { + void testCompareWithCustomLiteralsInditerminate() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = vf.createLiteral("2000-01-01T12:00:00", XSD.DATETIME); @@ -573,7 +573,7 @@ public void testCompareWithCustomLiteralsInditerminate() { } @Test - public void testCompareCustomDatatypes() { + void testCompareCustomDatatypes() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = vf.createLiteral(1); @@ -597,7 +597,7 @@ public void testCompareCustomDatatypes() { * Reporoduces GH-2760: an NPE has been thrown when comparing custom literal implementations */ @Test - public void testCompareWithOnlyCustomLiterals() { + void testCompareWithOnlyCustomLiterals() { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Literal left = getCustomLiteral(vf.createLiteral(1)); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/ValueComparatorTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/ValueComparatorTest.java index 0beacdf15c8..16236e4619d 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/ValueComparatorTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/ValueComparatorTest.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.algebra.evaluation.util; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; @@ -27,7 +28,7 @@ /** * @author james */ -public class ValueComparatorTest { +class ValueComparatorTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @@ -46,58 +47,58 @@ public class ValueComparatorTest { private final ValueComparator cmp = new ValueComparator(); @Test - public void testBothNull() throws Exception { - assertTrue(cmp.compare(null, null) == 0); + void testBothNull() throws Exception { + assertEquals(0, cmp.compare(null, null)); } @Test - public void testLeftNull() throws Exception { + void testLeftNull() throws Exception { assertTrue(cmp.compare(null, typed1) < 0); } @Test - public void testRightNull() throws Exception { + void testRightNull() throws Exception { assertTrue(cmp.compare(typed1, null) > 0); } @Test - public void testBothBnode() throws Exception { - assertTrue(cmp.compare(bnode1, bnode1) == 0); - assertTrue(cmp.compare(bnode2, bnode2) == 0); + void testBothBnode() throws Exception { + assertEquals(0, cmp.compare(bnode1, bnode1)); + assertEquals(0, cmp.compare(bnode2, bnode2)); assertTrue(cmp.compare(bnode1, bnode2) != cmp.compare(bnode2, bnode1)); - assertTrue(cmp.compare(bnode1, bnode2) == -1 * cmp.compare(bnode2, bnode1)); + assertEquals(cmp.compare(bnode1, bnode2), -1 * cmp.compare(bnode2, bnode1)); } @Test - public void testLeftBnode() throws Exception { + void testLeftBnode() throws Exception { assertTrue(cmp.compare(bnode1, typed1) < 0); } @Test - public void testRightBnode() throws Exception { + void testRightBnode() throws Exception { assertTrue(cmp.compare(typed1, bnode1) > 0); } @Test - public void testBothURI() throws Exception { - assertTrue(cmp.compare(uri1, uri1) == 0); + void testBothURI() throws Exception { + assertEquals(0, cmp.compare(uri1, uri1)); assertTrue(cmp.compare(uri1, uri2) < 0); assertTrue(cmp.compare(uri1, uri3) < 0); assertTrue(cmp.compare(uri2, uri1) > 0); - assertTrue(cmp.compare(uri2, uri2) == 0); + assertEquals(0, cmp.compare(uri2, uri2)); assertTrue(cmp.compare(uri2, uri3) < 0); assertTrue(cmp.compare(uri3, uri1) > 0); assertTrue(cmp.compare(uri3, uri2) > 0); - assertTrue(cmp.compare(uri3, uri3) == 0); + assertEquals(0, cmp.compare(uri3, uri3)); } @Test - public void testLeftURI() throws Exception { + void testLeftURI() throws Exception { assertTrue(cmp.compare(uri1, typed1) < 0); } @Test - public void testRightURI() throws Exception { + void testRightURI() throws Exception { assertTrue(cmp.compare(typed1, uri1) > 0); } @@ -105,7 +106,7 @@ public void testRightURI() throws Exception { * Tests whether xsd:int's are properly sorted in a list with mixed value types. */ @Test - public void testOrder1() throws Exception { + void testOrder1() throws Exception { Literal en4 = vf.createLiteral("4", "en"); Literal int10 = vf.createLiteral(10); Literal int9 = vf.createLiteral(9); @@ -120,7 +121,7 @@ public void testOrder1() throws Exception { * Tests whether various numerics are properly sorted in a list with mixed value types. */ @Test - public void testOrder2() throws Exception { + void testOrder2() throws Exception { Literal en4 = vf.createLiteral("4", "en"); Literal int10 = vf.createLiteral(10); Literal int9 = vf.createLiteral(9); @@ -146,7 +147,7 @@ public void testOrder2() throws Exception { * sorted between the numerics if the datatypes were to be sorted alphabetically. */ @Test - public void testOrder3() throws Exception { + void testOrder3() throws Exception { Literal year1234 = vf.createLiteral("1234", XSD.GYEAR); Literal float2000 = vf.createLiteral(2000f); Literal int1000 = vf.createLiteral(1000); @@ -157,18 +158,18 @@ public void testOrder3() throws Exception { } @Test - public void testNonStrictComparisons() throws Exception { + void testNonStrictComparisons() throws Exception { cmp.setStrict(false); - assertTrue(cmp.isStrict() == false); + assertEquals(false, cmp.isStrict()); Literal date1 = vf.createLiteral("2019-09-02", XSD.DATE); Literal date2 = vf.createLiteral("2018", XSD.GYEAR); assertTrue(cmp.compare(date1, date2) > 0); } @Test - public void testStrictComparisons() throws Exception { + void testStrictComparisons() throws Exception { cmp.setStrict(true); - assertTrue(cmp.isStrict() == true); + assertEquals(true, cmp.isStrict()); Literal date1 = vf.createLiteral("2019-09-02", XSD.DATE); Literal date2 = vf.createLiteral("2018", XSD.GYEAR); assertTrue(cmp.compare(date1, date2) < 0); diff --git a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/XMLDatatypeMathUtilTest.java b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/XMLDatatypeMathUtilTest.java index 04942e7ab6d..5a6d93199f5 100644 --- a/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/XMLDatatypeMathUtilTest.java +++ b/core/queryalgebra/evaluation/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/util/XMLDatatypeMathUtilTest.java @@ -23,12 +23,12 @@ /** * @author Thomas Pellissier Tanon */ -public class XMLDatatypeMathUtilTest { +class XMLDatatypeMathUtilTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @Test - public void testCompute() throws Exception { + void testCompute() throws Exception { Literal float1 = vf.createLiteral("12", XSD.INTEGER); Literal float2 = vf.createLiteral("2", CoreDatatype.XSD.INTEGER); Literal duration1 = vf.createLiteral("P1Y1M", XSD.YEARMONTHDURATION); diff --git a/core/queryalgebra/geosparql/pom.xml b/core/queryalgebra/geosparql/pom.xml index e9ea3eab62f..e0b5871f77d 100644 --- a/core/queryalgebra/geosparql/pom.xml +++ b/core/queryalgebra/geosparql/pom.xml @@ -35,6 +35,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + org.mockito mockito-junit-jupiter diff --git a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/BufferTest.java b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/BufferTest.java index 9af7b834f0a..53a55f92914 100644 --- a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/BufferTest.java +++ b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/BufferTest.java @@ -28,7 +28,7 @@ /** * @author jeen */ -public class BufferTest { +class BufferTest { private final Buffer buffer = new Buffer(); @@ -39,25 +39,25 @@ public class BufferTest { private final IRI unit = f.createIRI("http://www.opengis.net/def/uom/OGC/1.0/metre"); @Test - public void testEvaluateWithIntRadius() { + void testEvaluateWithIntRadius() { Value result = buffer.evaluate(f, point, f.createLiteral(1), unit); assertNotNull(result); } @Test - public void testEvaluateWithDoubleRadius() { + void testEvaluateWithDoubleRadius() { Value result = buffer.evaluate(f, point, f.createLiteral(1.0), unit); assertNotNull(result); } @Test - public void testEvaluateWithDecimalRadius() { + void testEvaluateWithDecimalRadius() { Value result = buffer.evaluate(f, point, f.createLiteral("1.0", XSD.DECIMAL), unit); assertNotNull(result); } @Test - public void resultIsPolygonWKT() { + void resultIsPolygonWKT() { Literal result = (Literal) buffer.evaluate(f, point, f.createLiteral(1), unit); assertNotNull(result); assertThat(result.getDatatype()).isEqualTo(GEO.WKT_LITERAL); @@ -65,13 +65,13 @@ public void resultIsPolygonWKT() { } @Test - public void testEvaluateWithInvalidRadius() { + void testEvaluateWithInvalidRadius() { assertThrows(ValueExprEvaluationException.class, () -> buffer.evaluate(f, point, f.createLiteral("foobar", XSD.DECIMAL), unit)); } @Test - public void testEvaluateWithInvalidUnit() { + void testEvaluateWithInvalidUnit() { assertThrows(ValueExprEvaluationException.class, () -> buffer.evaluate(f, point, f.createLiteral(1.0), FOAF.PERSON)); } diff --git a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/DistanceTest.java b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/DistanceTest.java index 5cd78defc06..32a05530d32 100644 --- a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/DistanceTest.java +++ b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/DistanceTest.java @@ -25,7 +25,7 @@ /** * @author Bart Hanssens */ -public class DistanceTest { +class DistanceTest { /** * Test distance between two cities, in meters. @@ -33,7 +33,7 @@ public class DistanceTest { * @throws IOException */ @Test - public void testDistanceAmBxl() throws IOException { + void testDistanceAmBxl() throws IOException { BindingSet bs = GeoSPARQLTests.getBindingSet("distance.rq"); assertNotNull(bs, "Bindingset is null"); @@ -43,7 +43,7 @@ public void testDistanceAmBxl() throws IOException { assertTrue(value instanceof Literal, "Value is not a literal"); Literal l = (Literal) value; - assertTrue(l.getDatatype().equals(XSD.DOUBLE), "Literal not of type double"); + assertEquals(XSD.DOUBLE, l.getDatatype(), "Literal not of type double"); assertEquals(173, l.doubleValue() / 1000, 0.5, "Distance Amsterdam-Brussels not correct"); } @@ -54,7 +54,7 @@ public void testDistanceAmBxl() throws IOException { * @throws IOException */ @Test - public void testDistanceSame() throws IOException { + void testDistanceSame() throws IOException { BindingSet bs = GeoSPARQLTests.getBindingSet("distance_same.rq"); assertNotNull(bs, "Bindingset is null"); diff --git a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/EhContainsTest.java b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/EhContainsTest.java index a3cd23d379b..b7ae059c03d 100644 --- a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/EhContainsTest.java +++ b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/EhContainsTest.java @@ -25,7 +25,7 @@ /** * @author Bart Hanssens */ -public class EhContainsTest extends GeometricRelationFunctionTest { +class EhContainsTest extends GeometricRelationFunctionTest { /** * Test ehContains. @@ -33,7 +33,7 @@ public class EhContainsTest extends GeometricRelationFunctionTest { * @throws IOException */ @Test - public void testEhContainsDenver() throws IOException { + void testEhContainsDenver() throws IOException { List list = GeoSPARQLTests.getResults("ehcontains.rq"); assertNotNull(list, "Resultset is null"); diff --git a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfContainsTest.java b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfContainsTest.java index 6866469c790..cd920cc0486 100644 --- a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfContainsTest.java +++ b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfContainsTest.java @@ -25,7 +25,7 @@ /** * @author Bart Hanssens */ -public class SfContainsTest extends GeometricRelationFunctionTest { +class SfContainsTest extends GeometricRelationFunctionTest { /** * Test sfContains. @@ -33,7 +33,7 @@ public class SfContainsTest extends GeometricRelationFunctionTest { * @throws IOException */ @Test - public void testSfContainsDenver() throws IOException { + void testSfContainsDenver() throws IOException { List list = GeoSPARQLTests.getResults("sfcontains.rq"); assertNotNull(list, "Resultset is null"); diff --git a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfEqualsTest.java b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfEqualsTest.java index 182d9344c7f..4ef6277844b 100644 --- a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfEqualsTest.java +++ b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfEqualsTest.java @@ -24,7 +24,7 @@ import org.eclipse.rdf4j.model.vocabulary.GEO; import org.junit.jupiter.api.Test; -public class SfEqualsTest extends GeometricRelationFunctionTest { +class SfEqualsTest extends GeometricRelationFunctionTest { private final ValueFactory f = SimpleValueFactory.getInstance(); @@ -34,7 +34,7 @@ protected GeometricRelationFunction testedFunction() { } @Test - public void matchesMultiPolygonWKT() throws IOException { + void matchesMultiPolygonWKT() throws IOException { String polygon = IOUtils.toString( getClass().getResourceAsStream( diff --git a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfWithinTest.java b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfWithinTest.java index 46394fd293b..42757f770c9 100644 --- a/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfWithinTest.java +++ b/core/queryalgebra/geosparql/src/test/java/org/eclipse/rdf4j/query/algebra/evaluation/function/geosparql/SfWithinTest.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.algebra.evaluation.function.geosparql; +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.assertTrue; @@ -25,7 +26,7 @@ /** * @author Bart Hanssens */ -public class SfWithinTest extends GeometricRelationFunctionTest { +class SfWithinTest extends GeometricRelationFunctionTest { /** * Test sfWithin @@ -33,7 +34,7 @@ public class SfWithinTest extends GeometricRelationFunctionTest { * @throws IOException */ @Test - public void testDenverSfWithinColorado() throws IOException { + void testDenverSfWithinColorado() throws IOException { BindingSet bs = GeoSPARQLTests.getBindingSet("sfwithin_denver.rq"); assertNotNull(bs, "Bindingset is null"); @@ -43,7 +44,7 @@ public void testDenverSfWithinColorado() throws IOException { assertTrue(value instanceof Literal, "Value is not a literal"); Literal l = (Literal) value; - assertTrue(l.getDatatype().equals(XSD.BOOLEAN), "Literal not of type double"); + assertEquals(XSD.BOOLEAN, l.getDatatype(), "Literal not of type double"); assertTrue(l.booleanValue(), "Denver not within Colorado"); } @@ -54,7 +55,7 @@ public void testDenverSfWithinColorado() throws IOException { * @throws java.io.IOException */ @Test - public void testBrusselsSfWithinColorado() throws IOException { + void testBrusselsSfWithinColorado() throws IOException { BindingSet bs = GeoSPARQLTests.getBindingSet("sfwithin_brussels.rq"); assertNotNull(bs, "Bindingset is null"); @@ -64,7 +65,7 @@ public void testBrusselsSfWithinColorado() throws IOException { assertTrue(value instanceof Literal, "Value is not a literal"); Literal l = (Literal) value; - assertTrue(l.getDatatype().equals(XSD.BOOLEAN), "Literal not of type double"); + assertEquals(XSD.BOOLEAN, l.getDatatype(), "Literal not of type double"); assertFalse(l.booleanValue(), "Brussels within Colorado"); } diff --git a/core/queryalgebra/model/pom.xml b/core/queryalgebra/model/pom.xml index 2f092512127..1e03a0fb595 100644 --- a/core/queryalgebra/model/pom.xml +++ b/core/queryalgebra/model/pom.xml @@ -20,6 +20,11 @@ rdf4j-query ${project.version} + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/AbstractQueryModelNodeTest.java b/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/AbstractQueryModelNodeTest.java index c3b08b851f6..5a374c72fcc 100644 --- a/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/AbstractQueryModelNodeTest.java +++ b/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/AbstractQueryModelNodeTest.java @@ -14,10 +14,10 @@ import org.junit.jupiter.api.Test; -public class AbstractQueryModelNodeTest { +class AbstractQueryModelNodeTest { @Test - public void getCardinalityString() { + void getCardinalityString() { { StatementPattern statementPattern = new StatementPattern(); diff --git a/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/ProjectionElemListTest.java b/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/ProjectionElemListTest.java index 821890756d0..17a1831c4a2 100644 --- a/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/ProjectionElemListTest.java +++ b/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/ProjectionElemListTest.java @@ -22,7 +22,7 @@ /** * @author Jeen Broekstra */ -public class ProjectionElemListTest { +class ProjectionElemListTest { private ProjectionElem elem_a = new ProjectionElem("a"); private ProjectionElem elem_b = new ProjectionElem("b"); @@ -32,12 +32,12 @@ public class ProjectionElemListTest { private ProjectionElemList subject = new ProjectionElemList(elem_a, elem_b, elem_ac, elem_de); @Test - public void testGetProjectedNames() { + void testGetProjectedNames() { assertThat(subject.getProjectedNames()).containsExactly("a", "b", "c", "e"); } @Test - public void testGetProjectedNamesFor() { + void testGetProjectedNamesFor() { Set sourceNames = new HashSet<>(Arrays.asList("a", "d")); assertThat(subject.getProjectedNamesFor(sourceNames)).containsExactly("a", "c", "e"); diff --git a/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/ProjectionElemTest.java b/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/ProjectionElemTest.java index a27cde2ebe4..70bdfc6124c 100644 --- a/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/ProjectionElemTest.java +++ b/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/ProjectionElemTest.java @@ -18,7 +18,7 @@ /** * @author Jeen Broekstra */ -public class ProjectionElemTest { +class ProjectionElemTest { private ProjectionElem elem_a = new ProjectionElem("a"); private ProjectionElem elem_b = new ProjectionElem("b"); @@ -30,7 +30,7 @@ public class ProjectionElemTest { private ProjectionElem elem_ab2 = new ProjectionElem("a", "b"); @Test - public void testEquals() { + void testEquals() { assertThat(elem_a).isEqualTo(elem_a2); assertThat(elem_a).isNotEqualTo(elem_aa).isNotEqualTo(elem_b).isNotEqualTo(elem_ab).isNotEqualTo(elem_ba); assertThat(elem_ab).isNotEqualTo(elem_aa).isNotEqualTo(elem_ba); @@ -38,7 +38,7 @@ public void testEquals() { } @Test - public void testSignature() { + void testSignature() { assertThat(elem_a.getSignature()).isEqualTo("ProjectionElem \"a\""); assertThat(elem_aa.getSignature()).isEqualTo("ProjectionElem \"a\" AS \"a\""); assertThat(elem_ab.getSignature()).isEqualTo("ProjectionElem \"a\" AS \"b\""); diff --git a/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/helpers/TupleExprsTest.java b/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/helpers/TupleExprsTest.java index d2c3f59d1e0..35918a9f449 100644 --- a/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/helpers/TupleExprsTest.java +++ b/core/queryalgebra/model/src/test/java/org/eclipse/rdf4j/query/algebra/helpers/TupleExprsTest.java @@ -24,19 +24,19 @@ import org.eclipse.rdf4j.query.algebra.Var; import org.junit.jupiter.api.Test; -public class TupleExprsTest { +class TupleExprsTest { private final ValueFactory f = SimpleValueFactory.getInstance(); @Test - public void isFilterExistsFunctionOnEmptyFilter() { + void isFilterExistsFunctionOnEmptyFilter() { TupleExpr expr = new Filter(); assertThat(isFilterExistsFunction(expr)).isFalse(); } @Test - public void isFilterExistsFunctionOnNormalFilter() { + void isFilterExistsFunctionOnNormalFilter() { Filter expr = new Filter(); expr.setArg(new StatementPattern()); expr.setCondition(new Compare(new Var("x", f.createBNode()), new Var("y", f.createBNode()))); @@ -45,7 +45,7 @@ public void isFilterExistsFunctionOnNormalFilter() { } @Test - public void isFilterExistsFunctionOnNormalNot() { + void isFilterExistsFunctionOnNormalNot() { Filter expr = new Filter(); expr.setArg(new StatementPattern()); expr.setCondition(new Not(new Compare(new Var("x", f.createBNode()), new Var("y", f.createBNode())))); @@ -54,7 +54,7 @@ public void isFilterExistsFunctionOnNormalNot() { } @Test - public void isFilterExistsFunctionOnExists() { + void isFilterExistsFunctionOnExists() { Filter expr = new Filter(); expr.setArg(new StatementPattern()); expr.setCondition(new Exists(new StatementPattern())); @@ -64,7 +64,7 @@ public void isFilterExistsFunctionOnExists() { } @Test - public void isFilterExistsFunctionOnNotExist() { + void isFilterExistsFunctionOnNotExist() { Filter expr = new Filter(); expr.setArg(new StatementPattern()); expr.setCondition(new Not(new Exists(new StatementPattern()))); diff --git a/core/queryparser/api/pom.xml b/core/queryparser/api/pom.xml index 329c2603470..905c9a20ee0 100644 --- a/core/queryparser/api/pom.xml +++ b/core/queryparser/api/pom.xml @@ -20,6 +20,11 @@ rdf4j-queryalgebra-model ${project.version} + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/queryparser/api/src/test/java/org/eclipse/rdf4j/query/parser/QueryParserUtilTest.java b/core/queryparser/api/src/test/java/org/eclipse/rdf4j/query/parser/QueryParserUtilTest.java index d910e6db148..79e3a33721f 100644 --- a/core/queryparser/api/src/test/java/org/eclipse/rdf4j/query/parser/QueryParserUtilTest.java +++ b/core/queryparser/api/src/test/java/org/eclipse/rdf4j/query/parser/QueryParserUtilTest.java @@ -17,10 +17,10 @@ /** * @author Andreas Schwarte */ -public class QueryParserUtilTest { +class QueryParserUtilTest { @Test - public void testGetRestOfQueryString() throws Exception { + void testGetRestOfQueryString() throws Exception { String queryString = "# this is a comment\n" + "PREFIX : \n" + "# one more comment\r\n" + "SELECT * WHERE { ?s ?p ?o }"; diff --git a/core/queryparser/api/src/test/java/org/eclipse/rdf4j/query/parser/QueryPrologLexerTest.java b/core/queryparser/api/src/test/java/org/eclipse/rdf4j/query/parser/QueryPrologLexerTest.java index 08e03efa72c..e656373fcd0 100644 --- a/core/queryparser/api/src/test/java/org/eclipse/rdf4j/query/parser/QueryPrologLexerTest.java +++ b/core/queryparser/api/src/test/java/org/eclipse/rdf4j/query/parser/QueryPrologLexerTest.java @@ -12,7 +12,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import java.util.List; @@ -24,10 +23,10 @@ /** * @author jeen */ -public class QueryPrologLexerTest { +class QueryPrologLexerTest { @Test - public void testLexEmptyString() { + void testLexEmptyString() { List tokens = QueryPrologLexer.lex(""); assertNotNull(tokens); assertEquals(0, tokens.size()); @@ -35,7 +34,7 @@ public void testLexEmptyString() { } @Test - public void testFinalTokenEmptyString() { + void testFinalTokenEmptyString() { try { Token t = QueryPrologLexer.getRestOfQueryToken(""); } catch (Exception e) { @@ -44,99 +43,99 @@ public void testFinalTokenEmptyString() { } @Test - public void testLexNoProlog1() { + void testLexNoProlog1() { List tokens = QueryPrologLexer.lex("SELECT * WHERE {?s ?p ?o} "); assertNotNull(tokens); assertEquals(1, tokens.size()); Token t = tokens.get(0); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); } @Test - public void testFinalTokenNoProlog1() { + void testFinalTokenNoProlog1() { Token t = QueryPrologLexer.getRestOfQueryToken("SELECT * WHERE {?s ?p ?o} "); assertNotNull(t); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); } @Test - public void testLexWithComment() { + void testLexWithComment() { List tokens = QueryPrologLexer.lex("# COMMENT \nSELECT * WHERE {?s ?p ?o} "); assertNotNull(tokens); assertEquals(3, tokens.size()); assertEquals(" COMMENT \n", tokens.get(1).s); Token t = tokens.get(tokens.size() - 1); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); assertEquals("SELECT * WHERE {?s ?p ?o} ", t.s); } @Test - public void testLexWithComment_WindowsLinebreak() { + void testLexWithComment_WindowsLinebreak() { List tokens = QueryPrologLexer.lex("# COMMENT \r\nSELECT * WHERE {?s ?p ?o} "); assertNotNull(tokens); Token t = tokens.get(tokens.size() - 1); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); assertEquals("SELECT * WHERE {?s ?p ?o} ", t.s); } @Test - public void testLexWithComment_NoSpaceBeforeQuery() { + void testLexWithComment_NoSpaceBeforeQuery() { List tokens = QueryPrologLexer.lex("# COMMENT \nSELECT * WHERE {?s ?p ?o} "); assertNotNull(tokens); Token t = tokens.get(tokens.size() - 1); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); assertEquals("SELECT * WHERE {?s ?p ?o} ", t.s); } @Test - public void testFinalTokenWithComment() { + void testFinalTokenWithComment() { Token t = QueryPrologLexer.getRestOfQueryToken("# COMMENT \n SELECT * WHERE {?s ?p ?o} "); assertNotNull(t); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); assertEquals("SELECT * WHERE {?s ?p ?o} ", t.s); } @Test - public void testFinalTokenWithMultilineComment() { + void testFinalTokenWithMultilineComment() { Token t = QueryPrologLexer .getRestOfQueryToken("# COMMENT \n# COMMENT (continued) \nSELECT * WHERE {?s ?p ?o} "); assertNotNull(t); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); assertEquals("SELECT * WHERE {?s ?p ?o} ", t.s); } @Test - public void testFinalTokenWithMultilineComment2() { + void testFinalTokenWithMultilineComment2() { Token t = QueryPrologLexer .getRestOfQueryToken("#comment1\n#another comment\n" + "SELECT * WHERE { ?s ?p ?o } LIMIT 1"); assertNotNull(t); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); assertEquals("SELECT * WHERE { ?s ?p ?o } LIMIT 1", t.s); } @Test - public void testLexWithBaseAndComment() { + void testLexWithBaseAndComment() { List tokens = QueryPrologLexer.lex("BASE # COMMENT \nSELECT * WHERE {?s ?p ?o} "); assertNotNull(tokens); Token t = tokens.get(tokens.size() - 1); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); assertEquals("SELECT * WHERE {?s ?p ?o} ", t.s); } @Test - public void testFinalTokenWithBaseAndComment() { + void testFinalTokenWithBaseAndComment() { Token t = QueryPrologLexer.getRestOfQueryToken("BASE # COMMENT \nSELECT * WHERE {?s ?p ?o} "); assertNotNull(t); - assertTrue(t.getType().equals(TokenType.REST_OF_QUERY)); + assertEquals(TokenType.REST_OF_QUERY, t.getType()); } @Test - public void testLexSyntaxError() { + void testLexSyntaxError() { // all that is guaranteed in queries with syntax errors is that the lexer // returns. there are no guarantees that the // last token is the rest of the query in this case. Any syntax errors in @@ -152,7 +151,7 @@ public void testLexSyntaxError() { } @Test - public void testFinalTokenSyntaxError() { + void testFinalTokenSyntaxError() { // all that is guaranteed in queries with syntax errors is that the lexer // returns. there are no guarantees that the // token returned is the rest of the query in this case. Any syntax errors @@ -167,7 +166,7 @@ public void testFinalTokenSyntaxError() { } @Test - public void testFinalTokenSyntaxErrorPrefix() { + void testFinalTokenSyntaxErrorPrefix() { try { Token t = QueryPrologLexer.getRestOfQueryToken("PREFIX"); } catch (Exception e) { diff --git a/core/queryparser/sparql/pom.xml b/core/queryparser/sparql/pom.xml index 84f76d99eca..8e840acfbec 100644 --- a/core/queryparser/sparql/pom.xml +++ b/core/queryparser/sparql/pom.xml @@ -20,6 +20,11 @@ rdf4j-rio-trig ${project.version} + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-query diff --git a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLParserTest.java b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLParserTest.java index 7179ffe30f6..88514198bc3 100644 --- a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLParserTest.java +++ b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLParserTest.java @@ -77,17 +77,17 @@ /** * @author jeen */ -public class SPARQLParserTest { +class SPARQLParserTest { private SPARQLParser parser; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parser = new SPARQLParser(); } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { parser = null; } @@ -96,7 +96,7 @@ public void tearDown() throws Exception { * {@link org.eclipse.rdf4j.query.parser.sparql.SPARQLParser#parseQuery(java.lang.String, java.lang.String)} . */ @Test - public void testSourceStringAssignment() throws Exception { + void testSourceStringAssignment() throws Exception { String simpleSparqlQuery = "SELECT * WHERE {?X ?P ?Y }"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -105,7 +105,7 @@ public void testSourceStringAssignment() throws Exception { } @Test - public void testInsertDataLineNumberReporting() throws Exception { + void testInsertDataLineNumberReporting() throws Exception { String insertDataString = "INSERT DATA {\n incorrect reference }"; try { @@ -118,7 +118,7 @@ public void testInsertDataLineNumberReporting() throws Exception { } @Test - public void testDeleteDataLineNumberReporting() throws Exception { + void testDeleteDataLineNumberReporting() throws Exception { String deleteDataString = "DELETE DATA {\n incorrect reference }"; try { @@ -130,7 +130,7 @@ public void testDeleteDataLineNumberReporting() throws Exception { } @Test - public void testSES1922PathSequenceWithValueConstant() throws Exception { + void testSES1922PathSequenceWithValueConstant() throws Exception { StringBuilder qb = new StringBuilder(); qb.append("ASK {?A ()/ } "); @@ -151,12 +151,12 @@ public void testSES1922PathSequenceWithValueConstant() throws Exception { StatementPattern leftArg = (StatementPattern) j.getLeftArg(); StatementPattern rightArg = (StatementPattern) j.getRightArg(); - assertTrue(leftArg.getObjectVar().equals(rightArg.getSubjectVar())); + assertEquals(leftArg.getObjectVar(), rightArg.getSubjectVar()); assertEquals(leftArg.getObjectVar().getName(), rightArg.getSubjectVar().getName()); } @Test - public void testParsedBooleanQueryRootNode() throws Exception { + void testParsedBooleanQueryRootNode() throws Exception { StringBuilder qb = new StringBuilder(); qb.append("ASK {?a \"test\"}"); @@ -175,7 +175,7 @@ public void testParsedBooleanQueryRootNode() throws Exception { * @see #686 */ @Test - public void testParseWildcardSubselectInUpdate() throws Exception { + void testParseWildcardSubselectInUpdate() throws Exception { StringBuilder update = new StringBuilder(); update.append("INSERT { . } WHERE { SELECT * {?s ?p ?o } }"); @@ -197,7 +197,7 @@ public void testParseWildcardSubselectInUpdate() throws Exception { } @Test - public void testParseIntegerObjectValue() throws Exception { + void testParseIntegerObjectValue() throws Exception { // test that the parser correctly parses the object value as an integer, instead of as a decimal. String query = "select ?Concept where { ?Concept a 1. ?Concept2 a 1. } "; ParsedTupleQuery q = (ParsedTupleQuery) parser.parseQuery(query, null); @@ -209,7 +209,7 @@ public void testParseIntegerObjectValue() throws Exception { } @Test - public void testParsedTupleQueryRootNode() throws Exception { + void testParsedTupleQueryRootNode() throws Exception { StringBuilder qb = new StringBuilder(); qb.append("SELECT * {?a \"test\"}"); @@ -223,7 +223,7 @@ public void testParsedTupleQueryRootNode() throws Exception { } @Test - public void testParsedGraphQueryRootNode() throws Exception { + void testParsedGraphQueryRootNode() throws Exception { StringBuilder qb = new StringBuilder(); qb.append("CONSTRUCT WHERE {?a \"test\"}"); @@ -238,7 +238,7 @@ public void testParsedGraphQueryRootNode() throws Exception { } @Test - public void testOrderByWithAliases1() throws Exception { + void testOrderByWithAliases1() throws Exception { String queryString = " SELECT ?x (SUM(?v1)/COUNT(?v1) as ?r) WHERE { ?x ?v1 } GROUP BY ?x ORDER BY ?r"; ParsedQuery query = parser.parseQuery(queryString, null); @@ -259,7 +259,7 @@ public void testOrderByWithAliases1() throws Exception { } @Test - public void testOrderByWithAliases2() throws Exception { + void testOrderByWithAliases2() throws Exception { String queryString = "SELECT (?l AS ?v)\n" + "WHERE { ?s rdfs:label ?l. }\n" + "ORDER BY ?v"; @@ -280,7 +280,7 @@ public void testOrderByWithAliases2() throws Exception { } @Test - public void testSES1927UnequalLiteralValueConstants1() throws Exception { + void testSES1927UnequalLiteralValueConstants1() throws Exception { StringBuilder qb = new StringBuilder(); qb.append("ASK {?a \"test\". ?a \"test\"@en .} "); @@ -301,12 +301,12 @@ public void testSES1927UnequalLiteralValueConstants1() throws Exception { StatementPattern leftArg = (StatementPattern) j.getLeftArg(); StatementPattern rightArg = (StatementPattern) j.getRightArg(); - assertFalse(leftArg.getObjectVar().equals(rightArg.getObjectVar())); + assertNotEquals(leftArg.getObjectVar(), rightArg.getObjectVar()); assertNotEquals(leftArg.getObjectVar().getName(), rightArg.getObjectVar().getName()); } @Test - public void testSES1927UnequalLiteralValueConstants2() throws Exception { + void testSES1927UnequalLiteralValueConstants2() throws Exception { StringBuilder qb = new StringBuilder(); qb.append("ASK {?a \"test\". ?a \"test\"^^ .} "); @@ -327,12 +327,12 @@ public void testSES1927UnequalLiteralValueConstants2() throws Exception { StatementPattern leftArg = (StatementPattern) j.getLeftArg(); StatementPattern rightArg = (StatementPattern) j.getRightArg(); - assertFalse(leftArg.getObjectVar().equals(rightArg.getObjectVar())); + assertNotEquals(leftArg.getObjectVar(), rightArg.getObjectVar()); assertNotEquals(leftArg.getObjectVar().getName(), rightArg.getObjectVar().getName()); } @Test - public void testLongUnicode() throws Exception { + void testLongUnicode() throws Exception { ParsedUpdate ru = parser.parseUpdate("insert data { \"\\U0001F61F\" .}", "urn:test"); InsertData insertData = (InsertData) ru.getUpdateExprs().get(0); @@ -341,7 +341,7 @@ public void testLongUnicode() throws Exception { } @Test - public void testAdditionalWhitespace_Not_In() throws Exception { + void testAdditionalWhitespace_Not_In() throws Exception { String query = "SELECT * WHERE { ?s ?p ?o. FILTER(?o NOT IN (1, 2, 3)) }"; ParsedQuery parsedQuery = parser.parseQuery(query, null); @@ -352,7 +352,7 @@ public void testAdditionalWhitespace_Not_In() throws Exception { } @Test - public void testAdditionalWhitespace_Not_Exists() throws Exception { + void testAdditionalWhitespace_Not_Exists() throws Exception { String query = "SELECT * WHERE { ?s ?p ?o. FILTER NOT EXISTS { ?s ?p ?o } }"; ParsedQuery parsedQuery = parser.parseQuery(query, null); @@ -363,7 +363,7 @@ public void testAdditionalWhitespace_Not_Exists() throws Exception { } @Test - public void testWildCardPathFixedEnd() { + void testWildCardPathFixedEnd() { String query = "PREFIX : \n ASK {:IBM ((:|!:)|(^:|!^:))* :Jane.} "; @@ -375,7 +375,7 @@ public void testWildCardPathFixedEnd() { } @Test - public void testWildCardPathPushNegation() { + void testWildCardPathPushNegation() { String query = "PREFIX : \n ASK {:IBM ^(:|!:) ?jane.} "; @@ -395,7 +395,7 @@ public void testWildCardPathPushNegation() { } @Test - public void testWildCardPathPushNegation2() { + void testWildCardPathPushNegation2() { String query = "PREFIX : \n ASK {:IBM ^(:|!:) :Jane.} "; @@ -416,7 +416,7 @@ public void testWildCardPathPushNegation2() { } @Test - public void testWildCardPathComplexSubjectHandling() { + void testWildCardPathComplexSubjectHandling() { String query = "PREFIX : \n ASK { ?a (:comment/^(:subClassOf|(:type/:label))/:type)* ?b } "; @@ -448,7 +448,7 @@ public void testWildCardPathComplexSubjectHandling() { } @Test - public void testGroupByProjectionHandling_NoAggregate() { + void testGroupByProjectionHandling_NoAggregate() { String query = "SELECT DISTINCT ?s (?o AS ?o1) \n" + "WHERE {\n" + " ?s ?p ?o \n" @@ -459,7 +459,7 @@ public void testGroupByProjectionHandling_NoAggregate() { } @Test - public void testProjectionHandling_CustomAggregateFunction() { + void testProjectionHandling_CustomAggregateFunction() { var factory = buildDummyFactory(); try { CustomAggregateFunctionRegistry.getInstance().add(factory); @@ -490,7 +490,7 @@ public void testProjectionHandling_CustomAggregateFunction() { } @Test - public void testProjectionHandling_HavingCustomAggregateFunction() { + void testProjectionHandling_HavingCustomAggregateFunction() { var factory = buildDummyFactory(); try { CustomAggregateFunctionRegistry.getInstance().add(factory); @@ -527,7 +527,7 @@ public void testProjectionHandling_HavingCustomAggregateFunction() { } @Test - public void testProjectionHandling_MultipleAggregateFunction() { + void testProjectionHandling_MultipleAggregateFunction() { var factory = buildDummyFactory(); try { CustomAggregateFunctionRegistry.getInstance().add(factory); @@ -559,7 +559,7 @@ public void testProjectionHandling_MultipleAggregateFunction() { } @Test - public void testProjectionHandling_UnknownFunctionCallWithDistinct() { + void testProjectionHandling_UnknownFunctionCallWithDistinct() { String query = "prefix rj: " + "SELECT (rj:x(distinct ?o) AS ?o1) \n" + "WHERE {\n" @@ -569,7 +569,7 @@ public void testProjectionHandling_UnknownFunctionCallWithDistinct() { } @Test - public void testProjectionHandling_FunctionCallWithArgsFails() { + void testProjectionHandling_FunctionCallWithArgsFails() { var factory = buildDummyFactory(); String query = "prefix rj: " + "SELECT (rj:x(?o, ?p) AS ?o1) \n" @@ -588,7 +588,7 @@ public void testProjectionHandling_FunctionCallWithArgsFails() { } @Test - public void testGroupByProjectionHandling_Aggregate_NonSimpleExpr() { + void testGroupByProjectionHandling_Aggregate_NonSimpleExpr() { String query = "SELECT (COUNT(?s) as ?count) (?o + ?s AS ?o1) \n" + "WHERE {\n" + " ?s ?p ?o \n" @@ -600,7 +600,7 @@ public void testGroupByProjectionHandling_Aggregate_NonSimpleExpr() { } @Test - public void testGroupByProjectionHandling_Aggregate_Alias() { + void testGroupByProjectionHandling_Aggregate_Alias() { String query = "SELECT (COUNT(?s) as ?count) (?o AS ?o1) \n" + "WHERE {\n" + " ?s ?p ?o \n" @@ -611,7 +611,7 @@ public void testGroupByProjectionHandling_Aggregate_Alias() { } @Test - public void testGroupByProjectionHandling_Aggregate_Alias2() { + void testGroupByProjectionHandling_Aggregate_Alias2() { String query = "SELECT (COUNT(?s) as ?count) (?o AS ?o1) \n" + "WHERE {\n" + " ?s ?p ?o \n" @@ -622,7 +622,7 @@ public void testGroupByProjectionHandling_Aggregate_Alias2() { } @Test - public void testGroupByProjectionHandling_Aggregate_SimpleExpr() { + void testGroupByProjectionHandling_Aggregate_SimpleExpr() { String query = "SELECT (COUNT(?s) as ?count) ?o \n" + "WHERE {\n" + " ?s ?p ?o \n" @@ -634,7 +634,7 @@ public void testGroupByProjectionHandling_Aggregate_SimpleExpr() { } @Test - public void testGroupByProjectionHandling_Aggregate_SimpleExpr2() { + void testGroupByProjectionHandling_Aggregate_SimpleExpr2() { String query = "SELECT (COUNT(?s) as ?count) ?o \n" + "WHERE {\n" + " ?s ?p ?o \n" @@ -645,7 +645,7 @@ public void testGroupByProjectionHandling_Aggregate_SimpleExpr2() { } @Test - public void testGroupByProjectionHandling_Aggregate_Constant() { + void testGroupByProjectionHandling_Aggregate_Constant() { String query = "SELECT (COUNT(?s) as ?count) ( as ?constant) \n" + "WHERE {\n" + " ?s ?p ?o \n" @@ -656,7 +656,7 @@ public void testGroupByProjectionHandling_Aggregate_Constant() { } @Test - public void testGroupByProjectionHandling_variableEffectivelyAggregationResult() { + void testGroupByProjectionHandling_variableEffectivelyAggregationResult() { String query = "SELECT (COUNT (*) AS ?count) (?count / ?count AS ?result) (?result AS ?temp) (?temp / 2 AS ?temp2) {\n" + " ?s a ?o .\n" + @@ -667,7 +667,7 @@ public void testGroupByProjectionHandling_variableEffectivelyAggregationResult() } @Test - public void testGroupByProjectionHandling_effectivelyConstant() { + void testGroupByProjectionHandling_effectivelyConstant() { String query = "SELECT (2 AS ?constant1) (?constant1 AS ?constant2) (?constant2/2 AS ?constant3){\n" + " ?o ?p ?o .\n" + "} GROUP BY ?o"; @@ -677,7 +677,7 @@ public void testGroupByProjectionHandling_effectivelyConstant() { } @Test - public void testGroupByProjectionHandling_renameVariable() { + void testGroupByProjectionHandling_renameVariable() { String query = "SELECT ?o (?o AS ?o2) (?o2 AS ?o3) (?o3/2 AS ?o4){\n" + " ?o ?p ?o .\n" + "} GROUP BY ?o"; @@ -687,7 +687,7 @@ public void testGroupByProjectionHandling_renameVariable() { } @Test - public void testGroupByProjectionHandling_renameVariableWithAggregation() { + void testGroupByProjectionHandling_renameVariableWithAggregation() { String query = "SELECT ?o (?o AS ?o2) (COUNT (*) AS ?count) (?o2/?count AS ?newCount){\n" + " ?o ?p ?o .\n" + "} GROUP BY ?o"; @@ -697,7 +697,7 @@ public void testGroupByProjectionHandling_renameVariableWithAggregation() { } @Test - public void testDefaultPrefixes() { + void testDefaultPrefixes() { String queryTuple = "SELECT ?s {?s ex:aaa ex:ooo}"; Set defaultPrefixes = new HashSet<>(); @@ -708,7 +708,7 @@ public void testDefaultPrefixes() { } @Test - public void testDefaultPrefixesOverride() { + void testDefaultPrefixesOverride() { final String namespaceEx1 = "http://example1.org/"; final String namespaceEx2 = "http://example2.org/"; @@ -729,7 +729,7 @@ public void testDefaultPrefixesOverride() { } @Test - public void testDefaultPrefixesNoOverride() { + void testDefaultPrefixesNoOverride() { final String namespaceEx1 = "http://example1.org/"; String query = "CONSTRUCT {?s ex:bbb ex:ccc} WHERE {?s ex:aaa ex:ooo}"; @@ -747,7 +747,7 @@ public void testDefaultPrefixesNoOverride() { } @Test - public void testNoDefaultPrefixes() { + void testNoDefaultPrefixes() { assertThrows(MalformedQueryException.class, () -> { String query = "SELECT ?s {?s ex:aaa ex:ooo}"; @@ -759,7 +759,7 @@ public void testNoDefaultPrefixes() { } @Test - public void testDefaultPrefixesInsertDataOverride() throws IOException { + void testDefaultPrefixesInsertDataOverride() throws IOException { final String namespaceEx1 = "http://example1.org/"; final String namespaceEx2 = "http://example2.org/"; String query = "PREFIX ex: <" + namespaceEx2 + "> INSERT DATA { ex:A ex:P ex:B . }"; @@ -785,7 +785,7 @@ public void testDefaultPrefixesInsertDataOverride() throws IOException { } @Test - public void testDefaultPrefixesInsertDataInsideOverride() throws IOException { + void testDefaultPrefixesInsertDataInsideOverride() throws IOException { final String namespaceEx1 = "http://example1.org/"; final String namespaceEx2 = "http://example2.org/"; String query = "INSERT DATA { PREFIX ex: <" + namespaceEx2 + "> ex:A ex:P ex:B . }"; @@ -811,7 +811,7 @@ public void testDefaultPrefixesInsertDataInsideOverride() throws IOException { } @Test - public void testDefaultPrefixesInsertDataNoOverride() throws IOException { + void testDefaultPrefixesInsertDataNoOverride() throws IOException { final String namespaceEx1 = "http://example1.org/"; String query = "INSERT DATA { ex:A ex:P ex:B . }"; @@ -836,7 +836,7 @@ public void testDefaultPrefixesInsertDataNoOverride() throws IOException { } @Test - public void testDefaultPrefixesDeleteDataOverride() throws IOException { + void testDefaultPrefixesDeleteDataOverride() throws IOException { final String namespaceEx1 = "http://example1.org/"; final String namespaceEx2 = "http://example2.org/"; String query = "PREFIX ex: <" + namespaceEx2 + "> DELETE DATA { ex:A ex:P ex:B . }"; @@ -862,7 +862,7 @@ public void testDefaultPrefixesDeleteDataOverride() throws IOException { } @Test - public void testDefaultPrefixesDeleteDataInsideOverride() throws IOException { + void testDefaultPrefixesDeleteDataInsideOverride() throws IOException { final String namespaceEx1 = "http://example1.org/"; final String namespaceEx2 = "http://example2.org/"; String query = "DELETE DATA { PREFIX ex: <" + namespaceEx2 + "> ex:A ex:P ex:B . }"; @@ -888,7 +888,7 @@ public void testDefaultPrefixesDeleteDataInsideOverride() throws IOException { } @Test - public void testDefaultPrefixesDeleteDataNoOverride() throws IOException { + void testDefaultPrefixesDeleteDataNoOverride() throws IOException { final String namespaceEx1 = "http://example1.org/"; String query = "DELETE DATA { ex:A ex:P ex:B . }"; @@ -913,7 +913,7 @@ public void testDefaultPrefixesDeleteDataNoOverride() throws IOException { } @Test - public void testGroupByProjectionHandling_function() { + void testGroupByProjectionHandling_function() { String query = "select (strlen(concat(strlen(?s)+2, \"abc\", count(?o))) as ?len) where { \n" + "?s ?p ?o .\n" + "} group by ?s"; diff --git a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLQueriesTest.java b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLQueriesTest.java index 2f361417d61..bd999e61600 100644 --- a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLQueriesTest.java +++ b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLQueriesTest.java @@ -19,10 +19,10 @@ import org.eclipse.rdf4j.model.vocabulary.RDF; import org.junit.jupiter.api.Test; -public class SPARQLQueriesTest { +class SPARQLQueriesTest { @Test - public void testGetPrefixClauses() { + void testGetPrefixClauses() { String result = SPARQLQueries.getPrefixClauses(Arrays.asList(RDF.NS, namespace("ex", "http://example.org/"))); assertThat(result).isEqualTo("PREFIX rdf: \n" @@ -31,7 +31,7 @@ public void testGetPrefixClauses() { } @Test - public void testUnescape() { + void testUnescape() { String escaped = "foo\\nbar\\twith\\\\most of the \\\"actual\\\" chars that need \\'escaping\\'"; assertThat(SPARQLQueries.unescape(escaped)) @@ -39,7 +39,7 @@ public void testUnescape() { } @Test - public void testUnescape_invalid() { + void testUnescape_invalid() { String escaped = "foo\\ bar"; assertThatThrownBy(() -> SPARQLQueries.unescape(escaped)).isInstanceOf(IllegalArgumentException.class) @@ -47,7 +47,7 @@ public void testUnescape_invalid() { } @Test - public void testEscape() { + void testEscape() { String unescaped = "foo\nbar\twith\\most of the \"actual\" chars that need 'escaping'"; String escaped = "foo\\nbar\\twith\\\\most of the \\\"actual\\\" chars that need \\'escaping\\'"; diff --git a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLUpdateDataBlockParserTest.java b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLUpdateDataBlockParserTest.java index 87cb15e3283..a7d72ff214a 100644 --- a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLUpdateDataBlockParserTest.java +++ b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/SPARQLUpdateDataBlockParserTest.java @@ -20,14 +20,14 @@ /** * @author Damyan Ognyanov */ -public class SPARQLUpdateDataBlockParserTest { +class SPARQLUpdateDataBlockParserTest { /** * A case reproducing SES-2258 using two cases with optional 'dot'. If not handled properly by * SPARQLUpdateDataBlockParser.parseGraph(), an Exception is throws and test fails. */ @Test - public void testParseGraph() throws RDFParseException, RDFHandlerException, IOException { + void testParseGraph() throws RDFParseException, RDFHandlerException, IOException { SPARQLUpdateDataBlockParser parser = new SPARQLUpdateDataBlockParser(); String[] blocksToCheck = new String[] { "graph { 1 } . 2.", "graph { 1 .} . 2." }; @@ -37,7 +37,7 @@ public void testParseGraph() throws RDFParseException, RDFHandlerException, IOEx } @Test - public void testParseRDFStar() throws IOException { + void testParseRDFStar() throws IOException { SPARQLUpdateDataBlockParser parser = new SPARQLUpdateDataBlockParser(); String[] blocksToCheck = new String[] { diff --git a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestPropPathMisbehaviour.java b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestPropPathMisbehaviour.java index bcd8f708814..ca83d12b975 100644 --- a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestPropPathMisbehaviour.java +++ b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestPropPathMisbehaviour.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.query.parser.sparql; +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.assertTrue; @@ -27,14 +29,14 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class TestPropPathMisbehaviour { +class TestPropPathMisbehaviour { private SPARQLParser parser; /** * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parser = new SPARQLParser(); } @@ -42,7 +44,7 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { parser = null; } @@ -51,7 +53,7 @@ public void tearDown() throws Exception { * that is using the PE */ @Test - public void testGH2343() { + void testGH2343() { String query1 = "select ?iri ?value where { \n" + " ?iri (+) / ?value .\n" + "}"; @@ -72,14 +74,14 @@ public void testGH2343() { StatementPattern sp = (StatementPattern) alp.getPathExpression(); assertNotNull(sp.getSubjectVar()); - assertTrue("iri".equals(sp.getSubjectVar().getName()), "expect subj var to be iri"); + assertEquals("iri", sp.getSubjectVar().getName(), "expect subj var to be iri"); - assertTrue(alp.getObjectVar().equals(sp.getObjectVar()), + assertEquals(alp.getObjectVar(), sp.getObjectVar(), "expect obj var of the pattern to be same as the objVar of ALP"); } @Test - public void testGH3053() { + void testGH3053() { String query1 = "select ?value where { \n" + " ^(*) / ? ?value .\n" + "}"; @@ -109,6 +111,6 @@ public void testGH3053() { "expect Union Left arg to be ZeroPath"); assertTrue(((Union) proj2.getArg()).getRightArg() instanceof StatementPattern, "expect Union Right arg to be StatementPattern"); - assertTrue(!proj2.isSubquery(), "expect projection to do NOT be a subQuery"); + assertFalse(proj2.isSubquery(), "expect projection to do NOT be a subQuery"); } } diff --git a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestServiceUpdateExprBuilder.java b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestServiceUpdateExprBuilder.java index 1835b127768..aa538f1144d 100644 --- a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestServiceUpdateExprBuilder.java +++ b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestServiceUpdateExprBuilder.java @@ -13,7 +13,7 @@ import org.eclipse.rdf4j.query.algebra.Service; import org.junit.jupiter.api.Test; -public class TestServiceUpdateExprBuilder { +class TestServiceUpdateExprBuilder { /** * The test reproduces a {@link NullPointerException} that is thrown when parsing an update with several update @@ -21,7 +21,7 @@ public class TestServiceUpdateExprBuilder { * to the outermost operation container */ @Test - public void testServiceWithMultipleUpdateExpr() { + void testServiceWithMultipleUpdateExpr() { SPARQLParser parser = new SPARQLParser(); String updateStr = "PREFIX family: \n" + "DROP ALL ;\n" + diff --git a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestSparqlStarParser.java b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestSparqlStarParser.java index 43d2a5b0bfe..e2dd131417b 100644 --- a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestSparqlStarParser.java +++ b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TestSparqlStarParser.java @@ -53,7 +53,7 @@ /** * @author damyan.ognyanov */ -public class TestSparqlStarParser { +class TestSparqlStarParser { private SPARQLParser parser; @@ -61,7 +61,7 @@ public class TestSparqlStarParser { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parser = new SPARQLParser(); } @@ -69,7 +69,7 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { parser = null; } @@ -89,7 +89,7 @@ public void tearDown() throws Exception { * @throws Exception */ @Test - public void testUseInProjection() throws Exception { + void testUseInProjection() throws Exception { String simpleSparqlQuery = "SELECT (<< 1>> as ?ref) WHERE {}"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -105,7 +105,7 @@ public void testUseInProjection() throws Exception { assertTrue(proj.getArg() instanceof Extension, "expect extension"); Extension ext = (Extension) proj.getArg(); - assertTrue(ext.getElements().size() == 1, "single extention elemrnt"); + assertEquals(1, ext.getElements().size(), "single extention elemrnt"); ExtensionElem elem = ext.getElements().get(0); assertEquals("ref", elem.getName(), "name should match"); @@ -134,7 +134,7 @@ public void testUseInProjection() throws Exception { * @throws Exception */ @Test - public void testUseInValues() throws Exception { + void testUseInValues() throws Exception { String simpleSparqlQuery = "SELECT ?ref WHERE { values ?ref {<< 1>>} }"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -163,7 +163,7 @@ public void testUseInValues() throws Exception { assertTrue(triple.getObject() instanceof Literal, "object should be Literal"); assertEquals(1, ((Literal) triple.getObject()).intValue(), "object should match"); - assertTrue(oneValue[0] == false, "expect one value"); + assertEquals(false, oneValue[0], "expect one value"); oneValue[0] = true; }); assertTrue(oneValue[0], "expect one value"); @@ -185,7 +185,7 @@ public void testUseInValues() throws Exception { * @throws Exception */ @Test - public void testUseInBind() throws Exception { + void testUseInBind() throws Exception { String simpleSparqlQuery = "SELECT ?ref WHERE { bind(<< 1>> as ?ref)}"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -199,7 +199,7 @@ public void testUseInBind() throws Exception { assertTrue(proj.getArg() instanceof Extension, "expect extension"); Extension ext = (Extension) proj.getArg(); - assertTrue(ext.getElements().size() == 1, "single extension element"); + assertEquals(1, ext.getElements().size(), "single extension element"); ExtensionElem elem = ext.getElements().get(0); assertEquals("ref", elem.getName(), "name should match"); @@ -236,7 +236,7 @@ public void testUseInBind() throws Exception { * @throws Exception */ @Test - public void testUseInBindWithVars() throws Exception { + void testUseInBindWithVars() throws Exception { String simpleSparqlQuery = "SELECT * WHERE { bind(<> as ?ref)}"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -259,7 +259,7 @@ public void testUseInBindWithVars() throws Exception { assertTrue(proj.getArg() instanceof Extension, "expect extension"); Extension ext = (Extension) proj.getArg(); - assertTrue(ext.getElements().size() == 1, "single extention elemrnt"); + assertEquals(1, ext.getElements().size(), "single extention elemrnt"); ExtensionElem elem = ext.getElements().get(0); assertEquals("ref", elem.getName(), "name should match"); @@ -298,7 +298,7 @@ public void testUseInBindWithVars() throws Exception { * @throws Exception */ @Test - public void testUseInStatementPatternWithVars() throws Exception { + void testUseInStatementPatternWithVars() throws Exception { String simpleSparqlQuery = "SELECT * WHERE { <> ?val}"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -367,7 +367,7 @@ public void testUseInStatementPatternWithVars() throws Exception { * @throws Exception */ @Test - public void testUseNestedInStatementPatternWithVars() throws Exception { + void testUseNestedInStatementPatternWithVars() throws Exception { String simpleSparqlQuery = "SELECT * WHERE { <<<> ?q ?r>> ?val}"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -443,7 +443,7 @@ public void testUseNestedInStatementPatternWithVars() throws Exception { * @throws Exception */ @Test - public void testUseInConstructFromStatementPattern() throws Exception { + void testUseInConstructFromStatementPattern() throws Exception { String simpleSparqlQuery = "CONSTRUCT {<> } WHERE {?s ?p ?o}"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -473,7 +473,7 @@ public void testUseInConstructFromStatementPattern() throws Exception { assertTrue(proj.getArg() instanceof Extension, "expect extension"); Extension ext = (Extension) proj.getArg(); - assertTrue(ext.getElements().size() == 3, "three extention elements"); + assertEquals(3, ext.getElements().size(), "three extention elements"); ExtensionElem elem = ext.getElements().get(0); assertEquals(elem.getName(), listSourceNames.get(0), "anon name should match first"); @@ -526,13 +526,13 @@ public void testUseInConstructFromStatementPattern() throws Exception { * @throws Exception */ @Test - public void testUseInInsertFromStatementPattern() throws Exception { + void testUseInInsertFromStatementPattern() throws Exception { String simpleSparqlQuery = "Insert {<> } WHERE {?s ?p ?o}"; ParsedUpdate q = parser.parseUpdate(simpleSparqlQuery, null); assertNotNull(q); - assertTrue(q.getUpdateExprs().size() == 1, "expect single UpdateExpr"); + assertEquals(1, q.getUpdateExprs().size(), "expect single UpdateExpr"); UpdateExpr updateExpr = q.getUpdateExprs().get(0); assertTrue(updateExpr instanceof Modify, "expect Modify UpdateExpr"); Modify modify = (Modify) updateExpr; @@ -551,7 +551,7 @@ public void testUseInInsertFromStatementPattern() throws Exception { Extension where = (Extension) modify.getWhereExpr(); Extension ext = (Extension) where; - assertTrue(ext.getElements().size() == 1, "one extention element"); + assertEquals(1, ext.getElements().size(), "one extention element"); ExtensionElem elem = ext.getElements().get(0); assertEquals(elem.getName(), anonVar, "anon name should match first"); @@ -596,13 +596,13 @@ public void testUseInInsertFromStatementPattern() throws Exception { * @throws Exception */ @Test - public void testUseInDeleteFromStatementPattern() throws Exception { + void testUseInDeleteFromStatementPattern() throws Exception { String simpleSparqlQuery = "DELETE {<> } WHERE {?s ?p ?o}"; ParsedUpdate q = parser.parseUpdate(simpleSparqlQuery, null); assertNotNull(q); - assertTrue(q.getUpdateExprs().size() == 1, "expect single UpdateExpr"); + assertEquals(1, q.getUpdateExprs().size(), "expect single UpdateExpr"); UpdateExpr updateExpr = q.getUpdateExprs().get(0); assertTrue(updateExpr instanceof Modify, "expect Modify UpdateExpr"); Modify modify = (Modify) updateExpr; @@ -621,7 +621,7 @@ public void testUseInDeleteFromStatementPattern() throws Exception { Extension where = (Extension) modify.getWhereExpr(); Extension ext = (Extension) where; - assertTrue(ext.getElements().size() == 1, "one extention element"); + assertEquals(1, ext.getElements().size(), "one extention element"); ExtensionElem elem = ext.getElements().get(0); assertEquals(elem.getName(), anonVar, "anon name should match first"); @@ -666,7 +666,7 @@ public void testUseInDeleteFromStatementPattern() throws Exception { * @throws Exception */ @Test - public void testUseInGroupByFromBindWithVars() throws Exception { + void testUseInGroupByFromBindWithVars() throws Exception { String simpleSparqlQuery = "SELECT ?ref (count( distinct ?p) as ?count) WHERE { bind(<> as ?ref)} group by ?ref"; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -689,7 +689,7 @@ public void testUseInGroupByFromBindWithVars() throws Exception { assertTrue(proj.getArg() instanceof Extension, "expect extension"); Extension ext = (Extension) proj.getArg(); - assertTrue(ext.getElements().size() == 1, "one extension element"); + assertEquals(1, ext.getElements().size(), "one extension element"); ExtensionElem elem = ext.getElements().get(0); assertEquals("count", elem.getName(), "name should match"); @@ -707,7 +707,7 @@ public void testUseInGroupByFromBindWithVars() throws Exception { assertTrue(group.getArg() instanceof Extension, "expect Extension"); ext = (Extension) group.getArg(); - assertTrue(ext.getElements().size() == 1, "single extention elemrnt"); + assertEquals(1, ext.getElements().size(), "single extention elemrnt"); elem = ext.getElements().get(0); assertEquals("ref", elem.getName(), "name should match"); @@ -750,7 +750,7 @@ public void testUseInGroupByFromBindWithVars() throws Exception { * @throws Exception */ @Test - public void testUseInExists() throws Exception { + void testUseInExists() throws Exception { String simpleSparqlQuery = "SELECT * WHERE { ?s ?p ?o . filter exists {<>> ?q}} "; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -816,7 +816,7 @@ public void testUseInExists() throws Exception { * @throws Exception */ @Test - public void testUseInSTR() throws Exception { + void testUseInSTR() throws Exception { String simpleSparqlQuery = "SELECT (str(<< >>) as ?str) WHERE { } "; ParsedQuery q = parser.parseQuery(simpleSparqlQuery, null); @@ -840,7 +840,7 @@ public void testUseInSTR() throws Exception { assertTrue(proj.getArg() instanceof Extension, "expect Extension"); Extension ext = (Extension) proj.getArg(); - assertTrue(ext.getElements().size() == 1, "one extention element"); + assertEquals(1, ext.getElements().size(), "one extention element"); ExtensionElem elem = ext.getElements().get(0); assertEquals("str", elem.getName(), "name should match"); @@ -857,21 +857,21 @@ public void testUseInSTR() throws Exception { /*- * Expected UpdateExpr: * Modify - SingletonSet - Join - TripleRef - Var (name=_const_6a63498_uri, value=urn:a, anonymous) - Var (name=_const_6a63499_uri, value=urn:b, anonymous) - Var (name=_const_6a6349a_uri, value=urn:c, anonymous) - Var (name=_anon_ec2f43ed_6a93_44ff_ad7d_e1f403b4a5e9, anonymous) - StatementPattern - Var (name=_anon_ec2f43ed_6a93_44ff_ad7d_e1f403b4a5e9, anonymous) - Var (name=_const_6a634a7_uri, value=urn:p, anonymous) - Var (name=_const_31_lit_5fc8fb17_0, value="1"^^, anonymous) + SingletonSet + Join + TripleRef + Var (name=_const_6a63498_uri, value=urn:a, anonymous) + Var (name=_const_6a63499_uri, value=urn:b, anonymous) + Var (name=_const_6a6349a_uri, value=urn:c, anonymous) + Var (name=_anon_ec2f43ed_6a93_44ff_ad7d_e1f403b4a5e9, anonymous) + StatementPattern + Var (name=_anon_ec2f43ed_6a93_44ff_ad7d_e1f403b4a5e9, anonymous) + Var (name=_const_6a634a7_uri, value=urn:p, anonymous) + Var (name=_const_31_lit_5fc8fb17_0, value="1"^^, anonymous) * @throws Exception */ @Test - public void testUpdateWithTripleRefEmptyHead() throws Exception { + void testUpdateWithTripleRefEmptyHead() throws Exception { String simpleSparqlUpdate = "insert {} where {<< >> 1}"; ParsedUpdate q = parser.parseUpdate(simpleSparqlUpdate, null); @@ -879,7 +879,7 @@ public void testUpdateWithTripleRefEmptyHead() throws Exception { assertNotNull(q); List list = q.getUpdateExprs(); assertNotNull(list); - assertEquals(list.size(), 1, "expect single update expr"); + assertEquals(1, list.size(), "expect single update expr"); assertTrue(list.get(0) instanceof Modify, "expect modify op"); Modify op = (Modify) list.get(0); assertTrue(null == op.getDeleteExpr(), "do not expect delete"); @@ -898,39 +898,39 @@ public void testUpdateWithTripleRefEmptyHead() throws Exception { /*- * Expected UpdateExpr: - Modify - StatementPattern - Var (name=_anon_24e6f014_3e16_49f9_ad0f_ef6d8045bbe9, anonymous) - Var (name=_const_6a634a7_uri, value=urn:p, anonymous) - Var (name=_const_31_lit_5fc8fb17_0, value="1"^^, anonymous) - - Extension - ExtensionElem (_anon_24e6f014_3e16_49f9_ad0f_ef6d8045bbe9) - ValueExprTripleRef - Var (name=_const_6a63498_uri, value=urn:a, anonymous) - Var (name=_const_6a63499_uri, value=urn:b, anonymous) - Var (name=_const_6a6349a_uri, value=urn:c, anonymous) - Join - TripleRef - Var (name=_const_6a63498_uri, value=urn:a, anonymous) - Var (name=_const_6a63499_uri, value=urn:b, anonymous) - Var (name=_const_6a6349a_uri, value=urn:c, anonymous) - Var (name=_anon_9e07cd00_0c02_4754_89ad_0ce4a5264d6e, anonymous) - StatementPattern - Var (name=_anon_9e07cd00_0c02_4754_89ad_0ce4a5264d6e, anonymous) - Var (name=_const_6a634a7_uri, value=urn:p, anonymous) - Var (name=_const_31_lit_5fc8fb17_0, value="1"^^, anonymous) + dify + atementPattern + r (name=_anon_24e6f014_3e16_49f9_ad0f_ef6d8045bbe9, anonymous) + r (name=_const_6a634a7_uri, value=urn:p, anonymous) + r (name=_const_31_lit_5fc8fb17_0, value="1"^^, anonymous) + + tension + tensionElem (_anon_24e6f014_3e16_49f9_ad0f_ef6d8045bbe9) + lueExprTripleRef + r (name=_const_6a63498_uri, value=urn:a, anonymous) + r (name=_const_6a63499_uri, value=urn:b, anonymous) + r (name=_const_6a6349a_uri, value=urn:c, anonymous) + in + ipleRef + r (name=_const_6a63498_uri, value=urn:a, anonymous) + r (name=_const_6a63499_uri, value=urn:b, anonymous) + r (name=_const_6a6349a_uri, value=urn:c, anonymous) + r (name=_anon_9e07cd00_0c02_4754_89ad_0ce4a5264d6e, anonymous) + atementPattern + r (name=_anon_9e07cd00_0c02_4754_89ad_0ce4a5264d6e, anonymous) + r (name=_const_6a634a7_uri, value=urn:p, anonymous) + r (name=_const_31_lit_5fc8fb17_0, value="1"^^, anonymous) * @throws Exception */ @Test - public void testUpdateWithTripleRefNonEmptyHead() throws Exception { + void testUpdateWithTripleRefNonEmptyHead() throws Exception { String simpleSparqlUpdate = "insert {<< >> 1} where {<< >> 1}"; ParsedUpdate q = parser.parseUpdate(simpleSparqlUpdate, null); assertNotNull(q); List list = q.getUpdateExprs(); assertNotNull(list); - assertEquals(list.size(), 1, "expect single update expr"); + assertEquals(1, list.size(), "expect single update expr"); assertTrue(list.get(0) instanceof Modify, "expect modify op"); Modify op = (Modify) list.get(0); assertTrue(null == op.getDeleteExpr(), "do not expect delete"); @@ -955,18 +955,18 @@ public void testUpdateWithTripleRefNonEmptyHead() throws Exception { /*- * Expected UpdateExpr: - Modify + dify * @throws Exception */ @Test - public void testUpdateExample() { + void testUpdateExample() { String update = "INSERT {?s ?p ?o} \r\n" + "WHERE { <> 0.9 }"; ParsedUpdate q = parser.parseUpdate(update, null); assertNotNull(q); List list = q.getUpdateExprs(); assertNotNull(list); - assertEquals(list.size(), 1, "expect single update expr"); + assertEquals(1, list.size(), "expect single update expr"); assertTrue(list.get(0) instanceof Modify, "expect modify op"); Modify op = (Modify) list.get(0); assertTrue(null == op.getDeleteExpr(), "do not expect delete"); @@ -989,7 +989,7 @@ public void testUpdateExample() { * @throws Exception */ @Test - public void testDeleteWhereRDFStar() { + void testDeleteWhereRDFStar() { String update = "DELETE\r\n" + "WHERE { << >> ?p ?o }"; ParsedUpdate q = parser.parseUpdate(update, null); diff --git a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TupleExprBuilderTest.java b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TupleExprBuilderTest.java index afaca7d955e..4994fc1b130 100644 --- a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TupleExprBuilderTest.java +++ b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/TupleExprBuilderTest.java @@ -42,17 +42,17 @@ /** * @author jeen */ -public class TupleExprBuilderTest { +class TupleExprBuilderTest { private TupleExprBuilder builder; @BeforeEach - public void setupBuilder() { + void setupBuilder() { builder = new TupleExprBuilder(SimpleValueFactory.getInstance()); } @Test - public void testSimpleAliasHandling() { + void testSimpleAliasHandling() { String query = "SELECT (?a as ?b) WHERE { ?a ?x ?z }"; try { @@ -75,7 +75,7 @@ public void testSimpleAliasHandling() { } @Test - public void testBindVarReuseHandling() { + void testBindVarReuseHandling() { String query = "SELECT * WHERE { ?s ?p ?o. BIND( as ?o) }"; assertThatExceptionOfType(VisitorException.class).isThrownBy(() -> { @@ -85,7 +85,7 @@ public void testBindVarReuseHandling() { } @Test - public void testBindVarReuseHandling2() { + void testBindVarReuseHandling2() { String query = "SELECT * WHERE { { ?s ?p ?o } BIND( as ?o) }"; assertThatExceptionOfType(VisitorException.class).isThrownBy(() -> { @@ -95,7 +95,7 @@ public void testBindVarReuseHandling2() { } @Test - public void testBindVarReuseHandling3() { + void testBindVarReuseHandling3() { String query = "SELECT * WHERE { BIND( as ?o) ?s ?p ?o. }"; ASTQueryContainer qc; @@ -108,7 +108,7 @@ public void testBindVarReuseHandling3() { } @Test - public void testAskQuerySolutionModifiers() { + void testAskQuerySolutionModifiers() { String query = "ASK WHERE { ?foo ?bar ?baz . } ORDER BY ?foo LIMIT 1"; try { @@ -123,7 +123,7 @@ public void testAskQuerySolutionModifiers() { } @Test - public void testNegatedPathWithFixedObject() { + void testNegatedPathWithFixedObject() { String query = "ASK WHERE { ?s ! . }"; try { @@ -143,7 +143,7 @@ public void testNegatedPathWithFixedObject() { */ @Test @Timeout(10) - public void testMissingCloseBrace() { + void testMissingCloseBrace() { String query = "INSERT DATA { ."; try { final ASTUpdateSequence us = SyntaxTreeBuilder.parseUpdateSequence(query); @@ -154,7 +154,7 @@ public void testMissingCloseBrace() { } @Test - public void testServiceGraphPatternStringDetection1() throws TokenMgrError, ParseException, VisitorException { + void testServiceGraphPatternStringDetection1() throws TokenMgrError, ParseException, VisitorException { String servicePattern = "SERVICE { ?x ?y }"; @@ -174,12 +174,12 @@ public void testServiceGraphPatternStringDetection1() throws TokenMgrError, Pars ServiceNodeFinder f = new ServiceNodeFinder(); f.visit(qc, null); - assertTrue(f.getGraphPatterns().size() == 1); - assertTrue(servicePattern.equals(f.getGraphPatterns().get(0))); + assertEquals(1, f.getGraphPatterns().size()); + assertEquals(servicePattern, f.getGraphPatterns().get(0)); } @Test - public void testServiceGraphPatternStringDetection2() throws TokenMgrError, ParseException, VisitorException { + void testServiceGraphPatternStringDetection2() throws TokenMgrError, ParseException, VisitorException { String servicePattern = "SERVICE \r\n { ?x ?y. \r\n \r\n }"; @@ -199,12 +199,12 @@ public void testServiceGraphPatternStringDetection2() throws TokenMgrError, Pars ServiceNodeFinder f = new ServiceNodeFinder(); f.visit(qc, null); - assertTrue(f.getGraphPatterns().size() == 1); - assertTrue(servicePattern.equals(f.getGraphPatterns().get(0))); + assertEquals(1, f.getGraphPatterns().size()); + assertEquals(servicePattern, f.getGraphPatterns().get(0)); } @Test - public void testServiceGraphPatternStringDetection3() throws TokenMgrError, ParseException, VisitorException { + void testServiceGraphPatternStringDetection3() throws TokenMgrError, ParseException, VisitorException { String servicePattern1 = "SERVICE \n { ?x ?y. }"; String servicePattern2 = "SERVICE \n { ?x ?y. }"; @@ -223,13 +223,13 @@ public void testServiceGraphPatternStringDetection3() throws TokenMgrError, Pars ServiceNodeFinder f = new ServiceNodeFinder(); f.visit(qc, null); - assertTrue(f.getGraphPatterns().size() == 2); - assertTrue(servicePattern1.equals(f.getGraphPatterns().get(0))); - assertTrue(servicePattern2.equals(f.getGraphPatterns().get(1))); + assertEquals(2, f.getGraphPatterns().size()); + assertEquals(servicePattern1, f.getGraphPatterns().get(0)); + assertEquals(servicePattern2, f.getGraphPatterns().get(1)); } @Test - public void testServiceGraphPatternStringDetection4() throws TokenMgrError, ParseException, VisitorException { + void testServiceGraphPatternStringDetection4() throws TokenMgrError, ParseException, VisitorException { String servicePattern1 = "SERVICE { ?s ?p ?o1 . " + "OPTIONAL { SERVICE SILENT { ?s ?p2 ?o2 } } }"; @@ -247,13 +247,13 @@ public void testServiceGraphPatternStringDetection4() throws TokenMgrError, Pars ServiceNodeFinder f = new ServiceNodeFinder(); f.visit(qc, null); - assertTrue(f.getGraphPatterns().size() == 2); - assertTrue(servicePattern1.equals(f.getGraphPatterns().get(0))); - assertTrue(servicePattern2.equals(f.getGraphPatterns().get(1))); + assertEquals(2, f.getGraphPatterns().size()); + assertEquals(servicePattern1, f.getGraphPatterns().get(0)); + assertEquals(servicePattern2, f.getGraphPatterns().get(1)); } @Test - public void testServiceGraphPatternChopping() throws Exception { + void testServiceGraphPatternChopping() throws Exception { // just for construction Service service = new Service(new Var(null, null, false, false), new SingletonSet(), "", null, null, false); diff --git a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/WildcardProjectionProcessorTest.java b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/WildcardProjectionProcessorTest.java index d68fd9e51e9..91199d4b565 100644 --- a/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/WildcardProjectionProcessorTest.java +++ b/core/queryparser/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/WildcardProjectionProcessorTest.java @@ -21,10 +21,10 @@ import org.eclipse.rdf4j.query.parser.sparql.ast.SyntaxTreeBuilder; import org.junit.jupiter.api.Test; -public class WildcardProjectionProcessorTest { +class WildcardProjectionProcessorTest { @Test - public void testVarInFilter() throws Exception { + void testVarInFilter() throws Exception { String queryStr = "SELECT * {\n" + " FILTER (!bound(?a))\n" + "}"; ASTQueryContainer qc = SyntaxTreeBuilder.parseQuery(queryStr); WildcardProjectionProcessor.process(qc); @@ -35,7 +35,7 @@ public void testVarInFilter() throws Exception { } @Test - public void testVarInBGP() throws Exception { + void testVarInBGP() throws Exception { String queryStr = "SELECT * {\n" + " ?a . \n" + " FILTER (!bound(?a))\n" + "}"; ASTQueryContainer qc = SyntaxTreeBuilder.parseQuery(queryStr); WildcardProjectionProcessor.process(qc); @@ -47,7 +47,7 @@ public void testVarInBGP() throws Exception { } @Test - public void testVarInBind() throws Exception { + void testVarInBind() throws Exception { String queryStr = "SELECT * {\n" + " BIND (?a AS ?b)\n" + "}"; ASTQueryContainer qc = SyntaxTreeBuilder.parseQuery(queryStr); WildcardProjectionProcessor.process(qc); @@ -59,7 +59,7 @@ public void testVarInBind() throws Exception { } @Test - public void testVarInSubselect() throws Exception { + void testVarInSubselect() throws Exception { String queryStr = "SELECT * {\n" + " { SELECT ?a { ?a ?p ?o } }\n" + "}"; ASTQueryContainer qc = SyntaxTreeBuilder.parseQuery(queryStr); WildcardProjectionProcessor.process(qc); diff --git a/core/queryrender/pom.xml b/core/queryrender/pom.xml index 9f94b6a5dcf..58cc3b6903a 100644 --- a/core/queryrender/pom.xml +++ b/core/queryrender/pom.xml @@ -31,6 +31,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-queryalgebra-evaluation diff --git a/core/queryrender/src/test/java/org/eclipse/rdf4j/queryrender/RenderUtilsTest.java b/core/queryrender/src/test/java/org/eclipse/rdf4j/queryrender/RenderUtilsTest.java index be4ab174140..0f03b61f709 100644 --- a/core/queryrender/src/test/java/org/eclipse/rdf4j/queryrender/RenderUtilsTest.java +++ b/core/queryrender/src/test/java/org/eclipse/rdf4j/queryrender/RenderUtilsTest.java @@ -17,9 +17,9 @@ import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.junit.jupiter.api.Test; -public class RenderUtilsTest { +class RenderUtilsTest { @Test - public void toSparqlWithLiteralSerialisesLanguageTag() { + void toSparqlWithLiteralSerialisesLanguageTag() { Value val = SimpleValueFactory.getInstance().createLiteral("test", "en"); assertEquals("\"\"\"test\"\"\"@en", RenderUtils.toSPARQL(val)); diff --git a/core/queryrender/src/test/java/org/eclipse/rdf4j/queryrender/SPARQLQueryRenderTest.java b/core/queryrender/src/test/java/org/eclipse/rdf4j/queryrender/SPARQLQueryRenderTest.java index 2fd13e030ed..b67f84fc7de 100644 --- a/core/queryrender/src/test/java/org/eclipse/rdf4j/queryrender/SPARQLQueryRenderTest.java +++ b/core/queryrender/src/test/java/org/eclipse/rdf4j/queryrender/SPARQLQueryRenderTest.java @@ -26,7 +26,7 @@ public class SPARQLQueryRenderTest { private static SPARQLQueryRenderer renderer; @BeforeAll - public static void beforeAll() { + static void beforeAll() { base = "http://example.org/base/"; lineSeparator = System.lineSeparator(); parser = new SPARQLParser(); @@ -34,13 +34,13 @@ public static void beforeAll() { } @AfterAll - public static void afterAll() { + static void afterAll() { parser = null; renderer = null; } @Test - public void renderArbitraryLengthPathTest() throws Exception { + void renderArbitraryLengthPathTest() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?s ?o").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -59,7 +59,7 @@ public void renderArbitraryLengthPathTest() throws Exception { } @Test - public void renderBindTest1() throws Exception { + void renderBindTest1() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -78,7 +78,7 @@ public void renderBindTest1() throws Exception { } @Test - public void renderBindTest2() throws Exception { + void renderBindTest2() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -99,7 +99,7 @@ public void renderBindTest2() throws Exception { } @Test - public void renderBindTest3() throws Exception { + void renderBindTest3() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b1 ?b2").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -122,7 +122,7 @@ public void renderBindTest3() throws Exception { } @Test - public void renderBindTest4() throws Exception { + void renderBindTest4() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b1 ?b2").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -146,7 +146,7 @@ public void renderBindTest4() throws Exception { } @Test - public void renderBindTest5() throws Exception { + void renderBindTest5() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b1 ?b2").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -170,7 +170,7 @@ public void renderBindTest5() throws Exception { } @Test - public void renderFunctionalFormsTest() throws Exception { + void renderFunctionalFormsTest() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b1").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -234,7 +234,7 @@ public void renderFunctionalFormsTest() throws Exception { } @Test - public void renderConstruct() throws Exception { + void renderConstruct() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("construct {").append(lineSeparator); sb.append(" ?s ?p ?o.").append(lineSeparator); @@ -247,7 +247,7 @@ public void renderConstruct() throws Exception { } @Test - public void renderFunctionsOnRdfTermsTest() throws Exception { + void renderFunctionsOnRdfTermsTest() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b2").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -306,7 +306,7 @@ public void renderFunctionsOnRdfTermsTest() throws Exception { } @Test - public void renderFunctionsOnStringsTest() throws Exception { + void renderFunctionsOnStringsTest() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b1").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -435,7 +435,7 @@ public void renderFunctionsOnStringsTest() throws Exception { } @Test - public void renderFunctionsOnNumericsTest() throws Exception { + void renderFunctionsOnNumericsTest() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b1").append(lineSeparator); sb.append("where {").append(lineSeparator); @@ -478,7 +478,7 @@ public void renderFunctionsOnNumericsTest() throws Exception { } @Test - public void renderFunctionsOnDatesAndTimesTest() throws Exception { + void renderFunctionsOnDatesAndTimesTest() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("prefix xsd: ").append(lineSeparator); sb.append("select ?b1").append(lineSeparator); @@ -572,7 +572,7 @@ public void renderFunctionsOnDatesAndTimesTest() throws Exception { } @Test - public void renderHashFunctionsTest() throws Exception { + void renderHashFunctionsTest() throws Exception { StringBuffer sb = new StringBuffer(); sb.append("select ?b1").append(lineSeparator); sb.append("where {").append(lineSeparator); diff --git a/core/queryresultio/sparqljson/pom.xml b/core/queryresultio/sparqljson/pom.xml index 6cf2b6513e7..6666c0062b7 100644 --- a/core/queryresultio/sparqljson/pom.xml +++ b/core/queryresultio/sparqljson/pom.xml @@ -35,5 +35,10 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONBooleanTest.java b/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONBooleanTest.java index b77bc0d84eb..054e33d1e24 100644 --- a/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONBooleanTest.java +++ b/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONBooleanTest.java @@ -24,7 +24,7 @@ * @author Peter Ansell * @author Sebastian Schaffert */ -public class SPARQLJSONBooleanTest extends AbstractQueryResultIOBooleanTest { +class SPARQLJSONBooleanTest extends AbstractQueryResultIOBooleanTest { @Override protected String getFileName() { @@ -42,7 +42,7 @@ protected TupleQueryResultFormat getMatchingTupleFormatOrNull() { } @Test - public void testBoolean1() throws Exception { + void testBoolean1() throws Exception { SPARQLBooleanJSONParser parser = new SPARQLBooleanJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -53,7 +53,7 @@ public void testBoolean1() throws Exception { } @Test - public void testBoolean2() throws Exception { + void testBoolean2() throws Exception { SPARQLBooleanJSONParser parser = new SPARQLBooleanJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -64,7 +64,7 @@ public void testBoolean2() throws Exception { } @Test - public void testBoolean3() throws Exception { + void testBoolean3() throws Exception { SPARQLBooleanJSONParser parser = new SPARQLBooleanJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -75,7 +75,7 @@ public void testBoolean3() throws Exception { } @Test - public void testBoolean4() throws Exception { + void testBoolean4() throws Exception { SPARQLBooleanJSONParser parser = new SPARQLBooleanJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); diff --git a/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONParserCustomTest.java b/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONParserCustomTest.java index 89c972f9dc0..7509b2ee5ce 100644 --- a/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONParserCustomTest.java +++ b/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONParserCustomTest.java @@ -46,7 +46,7 @@ * * @author Peter Ansell */ -public class SPARQLJSONParserCustomTest { +class SPARQLJSONParserCustomTest { /** * Backslash escaped "h" in "http" @@ -118,7 +118,7 @@ public class SPARQLJSONParserCustomTest { .createLiteral("42\u0009", XSD.STRING); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parser = QueryResultIO.createTupleParser(TupleQueryResultFormat.JSON); errors = new ParseErrorCollector(); results = new QueryResultCollector(); @@ -142,27 +142,27 @@ private InputStream stringToInputStream(String input) { } @Test - public void testSupportedSettings() throws Exception { + void testSupportedSettings() throws Exception { // 11 supported in AbstractSPARQLJSONParser + 0 from AbstractQueryResultParser assertEquals(11, parser.getSupportedSettings().size()); } @Test - public void testAllowBackslashEscapingAnyCharacterDefault() throws Exception { + void testAllowBackslashEscapingAnyCharacterDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(BACKSLASH_ESCAPED_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowBackslashEscapingAnyCharacterEnabled() throws Exception { + void testAllowBackslashEscapingAnyCharacterEnabled() throws Exception { parser.set(JSONSettings.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, true); parser.parseQueryResult(stringToInputStream(BACKSLASH_ESCAPED_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueIRI); } @Test - public void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { + void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { parser.set(JSONSettings.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(BACKSLASH_ESCAPED_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -170,21 +170,21 @@ public void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { } @Test - public void testAllowCommentsDefault() throws Exception { + void testAllowCommentsDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(COMMENTS_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowCommentsEnabled() throws Exception { + void testAllowCommentsEnabled() throws Exception { parser.set(JSONSettings.ALLOW_COMMENTS, true); parser.parseQueryResult(stringToInputStream(COMMENTS_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueIRI); } @Test - public void testAllowCommentsDisabled() throws Exception { + void testAllowCommentsDisabled() throws Exception { parser.set(JSONSettings.ALLOW_COMMENTS, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(COMMENTS_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -192,21 +192,21 @@ public void testAllowCommentsDisabled() throws Exception { } @Test - public void testAllowNonNumericNumbersDefault() throws Exception { + void testAllowNonNumericNumbersDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(NON_NUMERIC_NUMBERS_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowNonNumericNumbersEnabled() throws Exception { + void testAllowNonNumericNumbersEnabled() throws Exception { parser.set(JSONSettings.ALLOW_NON_NUMERIC_NUMBERS, true); parser.parseQueryResult(stringToInputStream(NON_NUMERIC_NUMBERS_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueNotANumber); } @Test - public void testAllowNonNumericNumbersDisabled() throws Exception { + void testAllowNonNumericNumbersDisabled() throws Exception { parser.set(JSONSettings.ALLOW_NON_NUMERIC_NUMBERS, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(NON_NUMERIC_NUMBERS_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -214,21 +214,21 @@ public void testAllowNonNumericNumbersDisabled() throws Exception { } @Test - public void testAllowNumericLeadingZeroesDefault() throws Exception { + void testAllowNumericLeadingZeroesDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(NUMERIC_LEADING_ZEROES_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowNumericLeadingZeroesEnabled() throws Exception { + void testAllowNumericLeadingZeroesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_NUMERIC_LEADING_ZEROS, true); parser.parseQueryResult(stringToInputStream(NUMERIC_LEADING_ZEROES_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueLiteralNumber); } @Test - public void testAllowNumericLeadingZeroesDisabled() throws Exception { + void testAllowNumericLeadingZeroesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_NUMERIC_LEADING_ZEROS, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(NUMERIC_LEADING_ZEROES_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -236,21 +236,21 @@ public void testAllowNumericLeadingZeroesDisabled() throws Exception { } @Test - public void testAllowSingleQuotesDefault() throws Exception { + void testAllowSingleQuotesDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(SINGLE_QUOTES_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowSingleQuotesEnabled() throws Exception { + void testAllowSingleQuotesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_SINGLE_QUOTES, true); parser.parseQueryResult(stringToInputStream(SINGLE_QUOTES_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueLiteralNumber); } @Test - public void testAllowSingleQuotesDisabled() throws Exception { + void testAllowSingleQuotesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_SINGLE_QUOTES, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(SINGLE_QUOTES_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -258,21 +258,21 @@ public void testAllowSingleQuotesDisabled() throws Exception { } @Test - public void testAllowUnquotedControlCharactersDefault() throws Exception { + void testAllowUnquotedControlCharactersDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(UNQUOTED_CONTROL_CHARS_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowUnquotedControlCharactersEnabled() throws Exception { + void testAllowUnquotedControlCharactersEnabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_CONTROL_CHARS, true); parser.parseQueryResult(stringToInputStream(UNQUOTED_CONTROL_CHARS_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueLiteralUnquotedControlChar); } @Test - public void testAllowUnquotedControlCharactersDisabled() throws Exception { + void testAllowUnquotedControlCharactersDisabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_CONTROL_CHARS, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(UNQUOTED_CONTROL_CHARS_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -280,21 +280,21 @@ public void testAllowUnquotedControlCharactersDisabled() throws Exception { } @Test - public void testAllowUnquotedFieldNamesDefault() throws Exception { + void testAllowUnquotedFieldNamesDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(UNQUOTED_FIELD_NAMES_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowUnquotedFieldNamesEnabled() throws Exception { + void testAllowUnquotedFieldNamesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_FIELD_NAMES, true); parser.parseQueryResult(stringToInputStream(UNQUOTED_FIELD_NAMES_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueLiteralNumber); } @Test - public void testAllowUnquotedFieldNamesDisabled() throws Exception { + void testAllowUnquotedFieldNamesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_FIELD_NAMES, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(UNQUOTED_FIELD_NAMES_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -302,21 +302,21 @@ public void testAllowUnquotedFieldNamesDisabled() throws Exception { } @Test - public void testAllowYamlCommentsDefault() throws Exception { + void testAllowYamlCommentsDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(YAML_COMMENTS_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowYamlCommentsEnabled() throws Exception { + void testAllowYamlCommentsEnabled() throws Exception { parser.set(JSONSettings.ALLOW_YAML_COMMENTS, true); parser.parseQueryResult(stringToInputStream(YAML_COMMENTS_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueIRI); } @Test - public void testAllowYamlCommentsDisabled() throws Exception { + void testAllowYamlCommentsDisabled() throws Exception { parser.set(JSONSettings.ALLOW_YAML_COMMENTS, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(YAML_COMMENTS_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -324,21 +324,21 @@ public void testAllowYamlCommentsDisabled() throws Exception { } @Test - public void testAllowTrailingCommaDefault() throws Exception { + void testAllowTrailingCommaDefault() throws Exception { assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(TRAILING_COMMA_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) .hasMessage("Could not parse SPARQL/JSON"); } @Test - public void testAllowTrailingCommaEnabled() throws Exception { + void testAllowTrailingCommaEnabled() throws Exception { parser.set(JSONSettings.ALLOW_TRAILING_COMMA, true); parser.parseQueryResult(stringToInputStream(TRAILING_COMMA_TEST_STRING)); verifyParseResults(testBindingName, testBindingValueIRI); } @Test - public void testAllowTrailingCommaDisabled() throws Exception { + void testAllowTrailingCommaDisabled() throws Exception { parser.set(JSONSettings.ALLOW_TRAILING_COMMA, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(TRAILING_COMMA_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -346,7 +346,7 @@ public void testAllowTrailingCommaDisabled() throws Exception { } @Test - public void testIncludeSourceLocationDefault() throws Exception { + void testIncludeSourceLocationDefault() throws Exception { final InputStream source = stringToInputStream(YAML_COMMENTS_TEST_STRING); try { parser.parseQueryResult(source); @@ -363,7 +363,7 @@ public void testIncludeSourceLocationDefault() throws Exception { } @Test - public void testIncludeSourceLocationEnabled() throws Exception { + void testIncludeSourceLocationEnabled() throws Exception { final InputStream source = stringToInputStream(YAML_COMMENTS_TEST_STRING); try { parser.set(JSONSettings.INCLUDE_SOURCE_IN_LOCATION, true); @@ -381,7 +381,7 @@ public void testIncludeSourceLocationEnabled() throws Exception { } @Test - public void testIncludeSourceLocationDisabled() throws Exception { + void testIncludeSourceLocationDisabled() throws Exception { try { parser.set(JSONSettings.INCLUDE_SOURCE_IN_LOCATION, false); parser.parseQueryResult(stringToInputStream(YAML_COMMENTS_TEST_STRING)); @@ -397,7 +397,7 @@ public void testIncludeSourceLocationDisabled() throws Exception { } @Test - public void testStrictDuplicateDetectionDefault() throws Exception { + void testStrictDuplicateDetectionDefault() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(STRICT_DUPLICATE_DETECTION_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -405,7 +405,7 @@ public void testStrictDuplicateDetectionDefault() throws Exception { } @Test - public void testStrictDuplicateDetectionEnabled() throws Exception { + void testStrictDuplicateDetectionEnabled() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, true); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(STRICT_DUPLICATE_DETECTION_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -413,7 +413,7 @@ public void testStrictDuplicateDetectionEnabled() throws Exception { } @Test - public void testStrictDuplicateDetectionDisabled() throws Exception { + void testStrictDuplicateDetectionDisabled() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, false); assertThatThrownBy(() -> parser.parseQueryResult(stringToInputStream(STRICT_DUPLICATE_DETECTION_TEST_STRING))) .isInstanceOf(QueryResultParseException.class) @@ -421,7 +421,7 @@ public void testStrictDuplicateDetectionDisabled() throws Exception { } @Test - public void testLangMissingOnStringLang() throws Exception { + void testLangMissingOnStringLang() throws Exception { ParserConfig config = new ParserConfig(); QueryResultCollector handler = new QueryResultCollector(); ParseErrorCollector errorCollector = new ParseErrorCollector(); diff --git a/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONTupleBackgroundTest.java b/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONTupleBackgroundTest.java index fcbbc9ab9ac..efc21fadd89 100644 --- a/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONTupleBackgroundTest.java +++ b/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONTupleBackgroundTest.java @@ -42,7 +42,7 @@ * @author Peter Ansell * @author Sebastian Schaffert */ -public class SPARQLJSONTupleBackgroundTest extends AbstractQueryResultIOTupleTest { +class SPARQLJSONTupleBackgroundTest extends AbstractQueryResultIOTupleTest { @Override protected String getFileName() { @@ -66,7 +66,7 @@ protected TupleQueryResult parseTupleInternal(TupleQueryResultFormat format, Inp } @Test - public void testBindings1() throws Exception { + void testBindings1() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -117,7 +117,7 @@ public void testBindings1() throws Exception { } @Test - public void testBindings2() throws Exception { + void testBindings2() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -207,7 +207,7 @@ public void testBindings2() throws Exception { } @Test - public void testNonStandardDistinct() throws Exception { + void testNonStandardDistinct() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -227,7 +227,7 @@ public void testNonStandardDistinct() throws Exception { } @Test - public void testNonStandardOrdered() throws Exception { + void testNonStandardOrdered() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -247,7 +247,7 @@ public void testNonStandardOrdered() throws Exception { } @Test - public void testNonStandardDistinctOrdered() throws Exception { + void testNonStandardDistinctOrdered() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); diff --git a/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONTupleTest.java b/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONTupleTest.java index 03926b7c2c4..653830190b6 100644 --- a/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONTupleTest.java +++ b/core/queryresultio/sparqljson/src/test/java/org/eclipse/rdf4j/query/resultio/sparqljson/SPARQLJSONTupleTest.java @@ -40,7 +40,7 @@ * @author Peter Ansell * @author Sebastian Schaffert */ -public class SPARQLJSONTupleTest extends AbstractQueryResultIOTupleTest { +class SPARQLJSONTupleTest extends AbstractQueryResultIOTupleTest { @Override protected String getFileName() { @@ -58,7 +58,7 @@ protected BooleanQueryResultFormat getMatchingBooleanFormatOrNull() { } @Test - public void testBindings1() throws Exception { + void testBindings1() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -109,7 +109,7 @@ public void testBindings1() throws Exception { } @Test - public void testBindings2() throws Exception { + void testBindings2() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -199,7 +199,7 @@ public void testBindings2() throws Exception { } @Test - public void testNonStandardDistinct() throws Exception { + void testNonStandardDistinct() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -219,7 +219,7 @@ public void testNonStandardDistinct() throws Exception { } @Test - public void testNonStandardOrdered() throws Exception { + void testNonStandardOrdered() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -239,7 +239,7 @@ public void testNonStandardOrdered() throws Exception { } @Test - public void testNonStandardDistinctOrdered() throws Exception { + void testNonStandardDistinctOrdered() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -259,7 +259,7 @@ public void testNonStandardDistinctOrdered() throws Exception { } @Test - public void testOtherKeys() throws Exception { + void testOtherKeys() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -291,7 +291,7 @@ public void testOtherKeys() throws Exception { } @Test - public void testRDFStar_extendedFormatRDF4J() throws Exception { + void testRDFStar_extendedFormatRDF4J() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -309,7 +309,7 @@ public void testRDFStar_extendedFormatRDF4J() throws Exception { } @Test - public void testRDFStar_extendedFormatRDF4J_incompleteTriple() throws Exception { + void testRDFStar_extendedFormatRDF4J_incompleteTriple() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -322,7 +322,7 @@ public void testRDFStar_extendedFormatRDF4J_incompleteTriple() throws Exception } @Test - public void testRDFStar_extendedFormatRDF4J_doubleSubject() throws Exception { + void testRDFStar_extendedFormatRDF4J_doubleSubject() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -335,7 +335,7 @@ public void testRDFStar_extendedFormatRDF4J_doubleSubject() throws Exception { } @Test - public void testRDFStar_extendedFormatStardog() throws Exception { + void testRDFStar_extendedFormatStardog() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -353,7 +353,7 @@ public void testRDFStar_extendedFormatStardog() throws Exception { } @Test - public void testRDFStar_extendedFormatStardog_NamedGraph() throws Exception { + void testRDFStar_extendedFormatStardog_NamedGraph() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -372,7 +372,7 @@ public void testRDFStar_extendedFormatStardog_NamedGraph() throws Exception { } @Test - public void testRDFStar_extendedFormatJena() throws Exception { + void testRDFStar_extendedFormatJena() throws Exception { SPARQLResultsJSONParser parser = new SPARQLResultsJSONParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); diff --git a/core/queryresultio/sparqlxml/pom.xml b/core/queryresultio/sparqlxml/pom.xml index f6a2e5d6ad6..01ff2fab794 100644 --- a/core/queryresultio/sparqlxml/pom.xml +++ b/core/queryresultio/sparqlxml/pom.xml @@ -36,5 +36,10 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/queryresultio/sparqlxml/src/test/java/org/eclipse/rdf4j/query/resultio/sparqlxml/SPARQLXMLParserCustomTest.java b/core/queryresultio/sparqlxml/src/test/java/org/eclipse/rdf4j/query/resultio/sparqlxml/SPARQLXMLParserCustomTest.java index 277be3b33ca..7894a40d229 100644 --- a/core/queryresultio/sparqlxml/src/test/java/org/eclipse/rdf4j/query/resultio/sparqlxml/SPARQLXMLParserCustomTest.java +++ b/core/queryresultio/sparqlxml/src/test/java/org/eclipse/rdf4j/query/resultio/sparqlxml/SPARQLXMLParserCustomTest.java @@ -32,7 +32,7 @@ * @author Michael Grove * @author Peter Ansell */ -public class SPARQLXMLParserCustomTest { +class SPARQLXMLParserCustomTest { /** * Test with the default ParserConfig settings. Ie, setParserConfig is not called. @@ -40,7 +40,7 @@ public class SPARQLXMLParserCustomTest { * @throws Exception */ @Test - public void testEntityExpansionDefaultSettings() throws Exception { + void testEntityExpansionDefaultSettings() throws Exception { QueryResultCollector handler = new QueryResultCollector(); ParseErrorCollector errorCollector = new ParseErrorCollector(); QueryResultParser aParser = QueryResultIO.createTupleParser(TupleQueryResultFormat.SPARQL) @@ -69,7 +69,7 @@ public void testEntityExpansionDefaultSettings() throws Exception { * @throws Exception */ @Test - public void testEntityExpansionUnrelatedSettings() throws Exception { + void testEntityExpansionUnrelatedSettings() throws Exception { ParserConfig config = new ParserConfig(); QueryResultCollector handler = new QueryResultCollector(); ParseErrorCollector errorCollector = new ParseErrorCollector(); @@ -95,7 +95,7 @@ public void testEntityExpansionUnrelatedSettings() throws Exception { } @Test - public void testLangMissingOnStringLang() throws Exception { + void testLangMissingOnStringLang() throws Exception { ParserConfig config = new ParserConfig(); QueryResultCollector handler = new QueryResultCollector(); ParseErrorCollector errorCollector = new ParseErrorCollector(); @@ -122,7 +122,7 @@ public void testLangMissingOnStringLang() throws Exception { * @throws Exception */ @Test - public void testEntityExpansionSecureProcessing() throws Exception { + void testEntityExpansionSecureProcessing() throws Exception { QueryResultCollector handler = new QueryResultCollector(); ParseErrorCollector errorCollector = new ParseErrorCollector(); QueryResultParser aParser = QueryResultIO.createTupleParser(TupleQueryResultFormat.SPARQL) @@ -158,7 +158,7 @@ public void testEntityExpansionSecureProcessing() throws Exception { @Disabled @Test @Timeout(10) - public void testEntityExpansionNoSecureProcessing() throws Exception { + void testEntityExpansionNoSecureProcessing() throws Exception { QueryResultCollector handler = new QueryResultCollector(); ParseErrorCollector errorCollector = new ParseErrorCollector(); QueryResultParser aParser = QueryResultIO.createTupleParser(TupleQueryResultFormat.SPARQL) @@ -181,7 +181,7 @@ public void testEntityExpansionNoSecureProcessing() throws Exception { } @Test - public void testSupportedSettings() throws Exception { + void testSupportedSettings() throws Exception { assertTrue(QueryResultIO.createTupleParser(TupleQueryResultFormat.SPARQL).getSupportedSettings().size() > 0); } } diff --git a/core/queryresultio/sparqlxml/src/test/java/org/eclipse/rdf4j/query/resultio/sparqlxml/SPARQLXMLTupleTest.java b/core/queryresultio/sparqlxml/src/test/java/org/eclipse/rdf4j/query/resultio/sparqlxml/SPARQLXMLTupleTest.java index 685656d4c46..89b9a5ef2f8 100644 --- a/core/queryresultio/sparqlxml/src/test/java/org/eclipse/rdf4j/query/resultio/sparqlxml/SPARQLXMLTupleTest.java +++ b/core/queryresultio/sparqlxml/src/test/java/org/eclipse/rdf4j/query/resultio/sparqlxml/SPARQLXMLTupleTest.java @@ -26,7 +26,7 @@ /** * @author Peter Ansell */ -public class SPARQLXMLTupleTest extends AbstractQueryResultIOTupleTest { +class SPARQLXMLTupleTest extends AbstractQueryResultIOTupleTest { @Override protected String getFileName() { @@ -44,7 +44,7 @@ protected BooleanQueryResultFormat getMatchingBooleanFormatOrNull() { } @Test - public void testRDFStar_extendedFormatRDF4J() throws Exception { + void testRDFStar_extendedFormatRDF4J() throws Exception { SPARQLResultsXMLParser parser = new SPARQLResultsXMLParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); @@ -62,7 +62,7 @@ public void testRDFStar_extendedFormatRDF4J() throws Exception { } @Test - public void testRDFStar_extendedFormatStardog() throws Exception { + void testRDFStar_extendedFormatStardog() throws Exception { SPARQLResultsXMLParser parser = new SPARQLResultsXMLParser(SimpleValueFactory.getInstance()); QueryResultCollector handler = new QueryResultCollector(); parser.setQueryResultHandler(handler); diff --git a/core/queryresultio/text/pom.xml b/core/queryresultio/text/pom.xml index a6dda80681c..a527834bd30 100644 --- a/core/queryresultio/text/pom.xml +++ b/core/queryresultio/text/pom.xml @@ -35,5 +35,10 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleBackgroundTest.java b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleBackgroundTest.java index ec8e0f2a8d8..e8b61da068f 100644 --- a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleBackgroundTest.java +++ b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleBackgroundTest.java @@ -41,7 +41,7 @@ * @author Peter Ansell * @author James Leigh */ -public class SPARQLCSVTupleBackgroundTest extends AbstractQueryResultIOTupleTest { +class SPARQLCSVTupleBackgroundTest extends AbstractQueryResultIOTupleTest { @Override protected String getFileName() { @@ -59,7 +59,7 @@ protected BooleanQueryResultFormat getMatchingBooleanFormatOrNull() { } @Test - public void testEndOfLine() throws Exception { + void testEndOfLine() throws Exception { TupleQueryResultFormat format = getTupleFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); @@ -72,7 +72,7 @@ public void testEndOfLine() throws Exception { } @Test - public void testEmptyResults() throws Exception { + void testEmptyResults() throws Exception { TupleQueryResultFormat format = getTupleFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); @@ -85,7 +85,7 @@ public void testEmptyResults() throws Exception { } @Test - public void testSingleVarResults() throws Exception { + void testSingleVarResults() throws Exception { TupleQueryResultFormat format = getTupleFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); @@ -104,7 +104,7 @@ public void testSingleVarResults() throws Exception { } @Test - public void testmultipleVarResults() throws Exception { + void testmultipleVarResults() throws Exception { TupleQueryResultFormat format = getTupleFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); diff --git a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleQueryResultWriterTest.java b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleQueryResultWriterTest.java index 3cb1ba73870..d9bc0829319 100644 --- a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleQueryResultWriterTest.java +++ b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleQueryResultWriterTest.java @@ -21,7 +21,7 @@ /** * @author Jeen Broekstra */ -public class SPARQLCSVTupleQueryResultWriterTest extends AbstractTupleQueryResultWriterTest { +class SPARQLCSVTupleQueryResultWriterTest extends AbstractTupleQueryResultWriterTest { @Override protected TupleQueryResultParserFactory getParserFactory() { diff --git a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleTest.java b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleTest.java index fa9db139c7b..1cb5f8c8a61 100644 --- a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleTest.java +++ b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/csv/SPARQLCSVTupleTest.java @@ -41,7 +41,7 @@ * @author Peter Ansell * @author James Leigh */ -public class SPARQLCSVTupleTest extends AbstractQueryResultIOTupleTest { +class SPARQLCSVTupleTest extends AbstractQueryResultIOTupleTest { @Override protected String getFileName() { @@ -59,7 +59,7 @@ protected BooleanQueryResultFormat getMatchingBooleanFormatOrNull() { } @Test - public void testEndOfLine() throws Exception { + void testEndOfLine() throws Exception { TupleQueryResultFormat format = getTupleFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); @@ -72,7 +72,7 @@ public void testEndOfLine() throws Exception { } @Test - public void testEmptyResults() throws Exception { + void testEmptyResults() throws Exception { TupleQueryResultFormat format = getTupleFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); @@ -85,7 +85,7 @@ public void testEmptyResults() throws Exception { } @Test - public void testSingleVarResults() throws Exception { + void testSingleVarResults() throws Exception { TupleQueryResultFormat format = getTupleFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); @@ -104,7 +104,7 @@ public void testSingleVarResults() throws Exception { } @Test - public void testmultipleVarResults() throws Exception { + void testmultipleVarResults() throws Exception { TupleQueryResultFormat format = getTupleFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(4096); TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out); diff --git a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVCustomTest.java b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVCustomTest.java index 2dcfc8d3131..3010ec60775 100644 --- a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVCustomTest.java +++ b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVCustomTest.java @@ -34,7 +34,7 @@ * * @author Peter Ansell */ -public class SPARQLTSVCustomTest { +class SPARQLTSVCustomTest { /** * Only Literals with the XML Schema numeric types should be simplified. @@ -46,7 +46,7 @@ public class SPARQLTSVCustomTest { */ @Disabled("This test does not work with RDF-1.1") @Test - public void testSES2126QuotedLiteralIntegerAsStringExplicitType() throws Exception { + void testSES2126QuotedLiteralIntegerAsStringExplicitType() throws Exception { List bindingNames = List.of("test"); TupleQueryResult tqr = new IteratingTupleQueryResult(bindingNames, List.of(new ListBindingSet(bindingNames, @@ -61,7 +61,7 @@ public void testSES2126QuotedLiteralIntegerAsStringExplicitType() throws Excepti * @throws Exception */ @Test - public void testSES2126QuotedLiteralIntegerAsStringImplicitType() throws Exception { + void testSES2126QuotedLiteralIntegerAsStringImplicitType() throws Exception { List bindingNames = List.of("test"); TupleQueryResult tqr = new IteratingTupleQueryResult(bindingNames, List.of(new ListBindingSet(bindingNames, SimpleValueFactory.getInstance().createLiteral("1")))); diff --git a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleBackgroundTest.java b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleBackgroundTest.java index ad737292c76..66d5be17f49 100644 --- a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleBackgroundTest.java +++ b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleBackgroundTest.java @@ -40,7 +40,7 @@ * @author Peter Ansell * @author James Leigh */ -public class SPARQLTSVTupleBackgroundTest extends AbstractQueryResultIOTupleTest { +class SPARQLTSVTupleBackgroundTest extends AbstractQueryResultIOTupleTest { @Override protected String getFileName() { @@ -64,17 +64,17 @@ protected TupleQueryResult parseTupleInternal(TupleQueryResultFormat format, Inp } @Test - public void testEndOfLine() throws Exception { + void testEndOfLine() throws Exception { assertEquals("\n", toString(createTupleNoBindingSets()).replaceAll("\\S+|\t", "")); } @Test - public void testEmptyResults() throws Exception { + void testEmptyResults() throws Exception { assertRegex("\\?a\t\\?b\t\\?c\n?", toString(createTupleNoBindingSets())); } @Test - public void testSingleVarResults() throws Exception { + void testSingleVarResults() throws Exception { assertRegex("\\?a\n" + "\n" + "(2.0(E0)?|\"2.0\"\\^\\^)\n" + "_:bnode3\n" + "\"?''single-quoted string(\"(\\^\\^)?)?\n" + "\"\\\\\"\\\\\"double-quoted string\"(\\^\\^)?\n" @@ -87,7 +87,7 @@ public void testSingleVarResults() throws Exception { } @Test - public void testmultipleVarResults() throws Exception { + void testmultipleVarResults() throws Exception { assertRegex("\\?a\t\\?b\t\\?c\n" + "\t_:bnode\t(baz|\"baz\"(\\^\\^)?)\n" + "(1|\"1\"\\^\\^)\t\t\"Hello World!\"@en\n" diff --git a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleTest.java b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleTest.java index ad857047503..c1a034784bc 100644 --- a/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleTest.java +++ b/core/queryresultio/text/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleTest.java @@ -36,7 +36,7 @@ * @author Peter Ansell * @author James Leigh */ -public class SPARQLTSVTupleTest extends AbstractQueryResultIOTupleTest { +class SPARQLTSVTupleTest extends AbstractQueryResultIOTupleTest { @Override protected String getFileName() { @@ -54,17 +54,17 @@ protected BooleanQueryResultFormat getMatchingBooleanFormatOrNull() { } @Test - public void testEndOfLine() throws Exception { + void testEndOfLine() throws Exception { assertEquals("\n", toString(createTupleNoBindingSets()).replaceAll("\\S+|\t", "")); } @Test - public void testEmptyResults() throws Exception { + void testEmptyResults() throws Exception { assertRegex("\\?a\t\\?b\t\\?c\n?", toString(createTupleNoBindingSets())); } @Test - public void testSingleVarResults() throws Exception { + void testSingleVarResults() throws Exception { assertRegex("\\?a\n" + "\n" + "(2.0(E0)?|\"2.0\"\\^\\^)\n" + "_:bnode3\n" + "\"?''single-quoted string(\"(\\^\\^)?)?\n" + "\"\\\\\"\\\\\"double-quoted string\"(\\^\\^)?\n" @@ -77,7 +77,7 @@ public void testSingleVarResults() throws Exception { } @Test - public void testmultipleVarResults() throws Exception { + void testmultipleVarResults() throws Exception { assertRegex("\\?a\t\\?b\t\\?c\n" + "\t_:bnode\t(baz|\"baz\"(\\^\\^)?)\n" + "(1|\"1\"\\^\\^)\t\t\"Hello World!\"@en\n" diff --git a/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/config/RepositoryConfigTest.java b/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/config/RepositoryConfigTest.java index 5b2332a77da..80d59cc191e 100644 --- a/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/config/RepositoryConfigTest.java +++ b/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/config/RepositoryConfigTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.repository.config; -import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.rdf4j.model.util.Values.iri; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.eclipse.rdf4j.model.Model; import org.eclipse.rdf4j.model.util.ModelBuilder; @@ -23,7 +23,7 @@ public class RepositoryConfigTest { public static final String ID = "test"; @Test - public void testParse_newVocabulary() { + void testParse_newVocabulary() { var repoNode = iri("urn:repo1"); Model m = new ModelBuilder() @@ -35,11 +35,11 @@ public void testParse_newVocabulary() { config.parse(m, repoNode); - assertThat(config.getID()).isEqualTo(ID); + assertEquals(config.getID(), ID); } @Test - public void testParse_oldVocabulary() { + void testParse_oldVocabulary() { var repoNode = iri("urn:repo1"); Model m = new ModelBuilder() .subject(repoNode) @@ -50,7 +50,7 @@ public void testParse_oldVocabulary() { config.parse(m, repoNode); - assertThat(config.getID()).isEqualTo(ID); + assertEquals(config.getID(), ID); } } diff --git a/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/config/TestConfigTemplate.java b/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/config/TestConfigTemplate.java index 68d376d778b..9a0441ecb3d 100644 --- a/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/config/TestConfigTemplate.java +++ b/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/config/TestConfigTemplate.java @@ -24,7 +24,7 @@ public class TestConfigTemplate { @Test - public final void testNonEscapeOfAlternateMultilineDelimiter() { + final void testNonEscapeOfAlternateMultilineDelimiter() { String value = "I contain a '''multiline\nstring''' that shouldn't be escaped."; assertEquals(ConfigTemplate.escapeMultilineQuotes("\"\"\"", value), value); value = "I contain a \"\"\"multiline\nstring\"\"\" that shouldn't be escaped."; @@ -32,30 +32,32 @@ public final void testNonEscapeOfAlternateMultilineDelimiter() { } @Test - public final void testEscapeOfSpecifiedMultilineDelimiter() { + final void testEscapeOfSpecifiedMultilineDelimiter() { String value = "I contain a '''multiline\nstring''' that should be escaped."; - assertEquals(ConfigTemplate.escapeMultilineQuotes("'''", value), - "I contain a \\'\\'\\'multiline\nstring\\'\\'\\' that should be escaped."); + assertEquals( + "I contain a \\'\\'\\'multiline\nstring\\'\\'\\' that should be escaped.", + ConfigTemplate.escapeMultilineQuotes("'''", value)); value = "I contain a \"\"\"multiline\nstring\"\"\" that should be escaped."; - assertEquals(ConfigTemplate.escapeMultilineQuotes("\"\"\"", value), - "I contain a \\\"\\\"\\\"multiline\nstring\\\"\\\"\\\" that should be escaped."); + assertEquals( + "I contain a \\\"\\\"\\\"multiline\nstring\\\"\\\"\\\" that should be escaped.", + ConfigTemplate.escapeMultilineQuotes("\"\"\"", value)); } @Test - public final void testNonEscapeOfShorterSequences() { + final void testNonEscapeOfShorterSequences() { String value = "' '' ''' ''''"; - assertEquals(ConfigTemplate.escapeMultilineQuotes("'''", value), "' '' \\'\\'\\' \\'\\'\\''"); + assertEquals("' '' \\'\\'\\' \\'\\'\\''", ConfigTemplate.escapeMultilineQuotes("'''", value)); value = "\" \"\" \"\"\" \"\"\"\""; - assertEquals(ConfigTemplate.escapeMultilineQuotes("\"\"\"", value), "\" \"\" \\\"\\\"\\\" \\\"\\\"\\\"\""); + assertEquals("\" \"\" \\\"\\\"\\\" \\\"\\\"\\\"\"", ConfigTemplate.escapeMultilineQuotes("\"\"\"", value)); } @Test - public final void testInvalidDelimiterThrowsException() { + final void testInvalidDelimiterThrowsException() { assertThrows(IllegalArgumentException.class, () -> ConfigTemplate.escapeMultilineQuotes("'", "any value")); } @Test - public final void testSimpleCharacters() { + final void testSimpleCharacters() { ConfigTemplate temp = new ConfigTemplate("{%value%}"); Map map = new LinkedHashMap<>(); map.put("value", "sob"); @@ -63,7 +65,7 @@ public final void testSimpleCharacters() { } @Test - public final void testSpecialCharacters() { + final void testSpecialCharacters() { ConfigTemplate temp = new ConfigTemplate("{%value%}"); Map map = new LinkedHashMap<>(); map.put("value", "$0b"); diff --git a/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/util/RDFLoaderTest.java b/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/util/RDFLoaderTest.java index ab9e4600bdd..03068e7a9aa 100644 --- a/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/util/RDFLoaderTest.java +++ b/core/repository/api/src/test/java/org/eclipse/rdf4j/repository/util/RDFLoaderTest.java @@ -52,7 +52,7 @@ * @author Manuel Fiorelli */ @ExtendWith(MockServerExtension.class) -public class RDFLoaderTest { +class RDFLoaderTest { @BeforeAll static void defineMockServerBehavior(MockServerClient client) { client.when( @@ -102,7 +102,7 @@ static void defineMockServerBehavior(MockServerClient client) { } @Test - public void testTurtleJavaResource() throws Exception { + void testTurtleJavaResource() throws Exception { RDFLoader rdfLoader = new RDFLoader(new ParserConfig(), getValueFactory()); RDFHandler rdfHandler = mock(RDFHandler.class); @@ -118,7 +118,7 @@ public void testTurtleJavaResource() throws Exception { } @Test - public void testTurtleDocument(MockServerClient client) throws Exception { + void testTurtleDocument(MockServerClient client) throws Exception { RDFLoader rdfLoader = new RDFLoader(new ParserConfig(), getValueFactory()); RDFHandler rdfHandler = mock(RDFHandler.class); @@ -135,7 +135,7 @@ public void testTurtleDocument(MockServerClient client) throws Exception { } @Test - public void testMultipleRedirects(MockServerClient client) throws Exception { + void testMultipleRedirects(MockServerClient client) throws Exception { RDFLoader rdfLoader = new RDFLoader(new ParserConfig(), getValueFactory()); RDFHandler rdfHandler = mock(RDFHandler.class); @@ -152,7 +152,7 @@ public void testMultipleRedirects(MockServerClient client) throws Exception { } @Test - public void testAbortOverMaxRedirects(MockServerClient client) throws Exception { + void testAbortOverMaxRedirects(MockServerClient client) throws Exception { /* nullable */ String oldMaxRedirects = System.getProperty("http.maxRedirects"); try { @@ -182,7 +182,7 @@ public void testAbortOverMaxRedirects(MockServerClient client) throws Exception } @Test - public void testNonInformationResource(MockServerClient client) throws Exception { + void testNonInformationResource(MockServerClient client) throws Exception { final SSLSocketFactory toRestoreSocketFactory = disableSSLCertificatCheck(); try { final HostnameVerifier toRestoreHostnameVerifier = disableHostnameVerifier(); diff --git a/core/repository/contextaware/pom.xml b/core/repository/contextaware/pom.xml index 4c8abf4e80e..b85d83cb16e 100644 --- a/core/repository/contextaware/pom.xml +++ b/core/repository/contextaware/pom.xml @@ -25,6 +25,11 @@ rdf4j-rio-api ${project.version} + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-model diff --git a/core/repository/contextaware/src/test/java/org/eclipse/rdf4j/repository/contextaware/ContextAwareConnectionTest.java b/core/repository/contextaware/src/test/java/org/eclipse/rdf4j/repository/contextaware/ContextAwareConnectionTest.java index 58e5019cc7e..da988c8021a 100644 --- a/core/repository/contextaware/src/test/java/org/eclipse/rdf4j/repository/contextaware/ContextAwareConnectionTest.java +++ b/core/repository/contextaware/src/test/java/org/eclipse/rdf4j/repository/contextaware/ContextAwareConnectionTest.java @@ -41,7 +41,7 @@ import org.eclipse.rdf4j.rio.RDFHandler; import org.junit.jupiter.api.Test; -public class ContextAwareConnectionTest { +class ContextAwareConnectionTest { static class GraphQueryStub extends AbstractQuery implements GraphQuery { @@ -116,7 +116,7 @@ public RepositoryConnectionStub() { String queryString = "SELECT ?o WHERE { ?s ?p ?o}"; @Test - public void testGraphQuery() throws Exception { + void testGraphQuery() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub() { @Override @@ -142,7 +142,7 @@ public void setDataset(Dataset dataset) { } @Test - public void testQuery() throws Exception { + void testQuery() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub() { @Override @@ -168,7 +168,7 @@ public void setDataset(Dataset dataset) { } @Test - public void testTupleQuery() throws Exception { + void testTupleQuery() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub() { @Override @@ -194,7 +194,7 @@ public void setDataset(Dataset dataset) { } @Test - public void testIncludeInferred() throws Exception { + void testIncludeInferred() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); @@ -205,7 +205,7 @@ public void testIncludeInferred() throws Exception { } @Test - public void testMaxQueryTime() throws Exception { + void testMaxQueryTime() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); @@ -216,7 +216,7 @@ public void testMaxQueryTime() throws Exception { } @Test - public void testQueryLanguage() throws Exception { + void testQueryLanguage() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); @@ -227,7 +227,7 @@ public void testQueryLanguage() throws Exception { } @Test - public void testBaseURI() throws Exception { + void testBaseURI() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); @@ -238,7 +238,7 @@ public void testBaseURI() throws Exception { } @Test - public void testReadContexts() throws Exception { + void testReadContexts() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); @@ -249,7 +249,7 @@ public void testReadContexts() throws Exception { } @Test - public void testRemoveContexts() throws Exception { + void testRemoveContexts() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); @@ -260,7 +260,7 @@ public void testRemoveContexts() throws Exception { } @Test - public void testAddContexts() throws Exception { + void testAddContexts() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); @@ -271,7 +271,7 @@ public void testAddContexts() throws Exception { } @Test - public void testArchiveContexts() throws Exception { + void testArchiveContexts() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); @@ -282,7 +282,7 @@ public void testArchiveContexts() throws Exception { } @Test - public void testInsertContexts() throws Exception { + void testInsertContexts() throws Exception { RepositoryConnection stub = new RepositoryConnectionStub(); Repository repo = stub.getRepository(); ContextAwareConnection a = new ContextAwareConnection(repo, stub); diff --git a/core/repository/event/pom.xml b/core/repository/event/pom.xml index ec478113fff..6b19e77ed75 100644 --- a/core/repository/event/pom.xml +++ b/core/repository/event/pom.xml @@ -15,6 +15,11 @@ rdf4j-repository-api ${project.version} + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-model diff --git a/core/repository/event/src/test/java/org/eclipse/rdf4j/repository/event/InterceptorTest.java b/core/repository/event/src/test/java/org/eclipse/rdf4j/repository/event/InterceptorTest.java index 9e5f72d828c..d257b064368 100644 --- a/core/repository/event/src/test/java/org/eclipse/rdf4j/repository/event/InterceptorTest.java +++ b/core/repository/event/src/test/java/org/eclipse/rdf4j/repository/event/InterceptorTest.java @@ -40,7 +40,7 @@ /** * @author James Leigh */ -public class InterceptorTest { +class InterceptorTest { static class InvocationHandlerStub implements InvocationHandler { @@ -101,7 +101,7 @@ public void execute() throws UpdateExecutionException { } @Test - public void testUpdate() throws Exception { + void testUpdate() throws Exception { final Update updateStub = new UpdateStub() { @Override @@ -137,7 +137,7 @@ public boolean execute(RepositoryConnection conn, QueryLanguage ql, String updat } @Test - public void testRemove() throws Exception { + void testRemove() throws Exception { ValueFactory vf = SimpleValueFactory.getInstance(); final IRI uri = vf.createIRI("http://example.com/"); final RepositoryConnection stub = new RepositoryConnectionStub() { diff --git a/core/repository/event/src/test/java/org/eclipse/rdf4j/repository/event/NotifyingTest.java b/core/repository/event/src/test/java/org/eclipse/rdf4j/repository/event/NotifyingTest.java index 953f13dd312..75881d7ad57 100644 --- a/core/repository/event/src/test/java/org/eclipse/rdf4j/repository/event/NotifyingTest.java +++ b/core/repository/event/src/test/java/org/eclipse/rdf4j/repository/event/NotifyingTest.java @@ -39,7 +39,7 @@ /** * @author James Leigh */ -public class NotifyingTest { +class NotifyingTest { static class InvocationHandlerStub implements InvocationHandler { @@ -100,7 +100,7 @@ public void execute() throws UpdateExecutionException { } @Test - public void testUpdate() throws Exception { + void testUpdate() throws Exception { final Update updateStub = new UpdateStub(); final RepositoryConnection stub = new RepositoryConnectionStub() { @@ -129,7 +129,7 @@ public void execute(RepositoryConnection conn, QueryLanguage ql, String update, } @Test - public void testRemove() throws Exception { + void testRemove() throws Exception { ValueFactory vf = SimpleValueFactory.getInstance(); final IRI uri = vf.createIRI("http://example.com/"); final RepositoryConnection stub = new RepositoryConnectionStub() { diff --git a/core/repository/http/src/test/java/org/eclipse/rdf4j/repository/http/HTTPRepositoryConnectionTest.java b/core/repository/http/src/test/java/org/eclipse/rdf4j/repository/http/HTTPRepositoryConnectionTest.java index 649809cb4b4..d73ab35bc24 100644 --- a/core/repository/http/src/test/java/org/eclipse/rdf4j/repository/http/HTTPRepositoryConnectionTest.java +++ b/core/repository/http/src/test/java/org/eclipse/rdf4j/repository/http/HTTPRepositoryConnectionTest.java @@ -33,7 +33,7 @@ import org.mockserver.model.MediaType; @ExtendWith(MockServerExtension.class) -public class HTTPRepositoryConnectionTest { +class HTTPRepositoryConnectionTest { static HTTPRepository testRepository; static RDF4JProtocolSession session; @@ -84,7 +84,7 @@ static void configureHTTPRepository(MockServerClient client) { } @Test - public void testAddFromURL_FormatFromMimetype(MockServerClient client) throws Exception { + void testAddFromURL_FormatFromMimetype(MockServerClient client) throws Exception { URL url = new URL("http://localhost:" + client.getPort() + "/Socrates"); try (HTTPRepositoryConnection repoConn = new HTTPRepositoryConnection(testRepository, session)) { repoConn.add(url); @@ -94,7 +94,7 @@ public void testAddFromURL_FormatFromMimetype(MockServerClient client) throws Ex } @Test - public void testAddFromURL_FormatFromFilename(MockServerClient client) throws Exception { + void testAddFromURL_FormatFromFilename(MockServerClient client) throws Exception { URL url = new URL("http://localhost:" + client.getPort() + "/Socrates.ttl"); try (HTTPRepositoryConnection repoConn = new HTTPRepositoryConnection(testRepository, session)) { repoConn.add(url); @@ -104,7 +104,7 @@ public void testAddFromURL_FormatFromFilename(MockServerClient client) throws Ex } @Test - public void testAddFromURL_FormatUndetermined(MockServerClient client) throws Exception { + void testAddFromURL_FormatUndetermined(MockServerClient client) throws Exception { URL url = new URL("http://localhost:" + client.getPort() + "/Plato"); try (HTTPRepositoryConnection repoConn = new HTTPRepositoryConnection(testRepository, session)) { assertThatExceptionOfType(UnsupportedRDFormatException.class).isThrownBy(() -> { diff --git a/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManagerTest.java b/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManagerTest.java index 1f585108af7..6151993335f 100644 --- a/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManagerTest.java +++ b/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/LocalRepositoryManagerTest.java @@ -33,13 +33,13 @@ * * @author Jeen Broekstra */ -public class LocalRepositoryManagerTest extends RepositoryManagerTest { +class LocalRepositoryManagerTest extends RepositoryManagerTest { /** * @throws java.lang.Exception */ @BeforeEach - public void setUp(@TempDir File datadir) throws Exception { + void setUp(@TempDir File datadir) throws Exception { subject = new LocalRepositoryManager(datadir); subject.init(); } @@ -48,12 +48,12 @@ public void setUp(@TempDir File datadir) throws Exception { * @throws IOException if a problem occurs deleting temporary resources */ @AfterEach - public void tearDown() throws IOException { + void tearDown() throws IOException { subject.shutDown(); } @Test - public void testAddRepositoryConfig_validation() { + void testAddRepositoryConfig_validation() { RepositoryConfig config = mock(RepositoryConfig.class); doThrow(RepositoryConfigException.class).when(config).validate(); diff --git a/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/RemoteRepositoryManagerTest.java b/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/RemoteRepositoryManagerTest.java index 759e743a2bc..edfc84045fc 100644 --- a/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/RemoteRepositoryManagerTest.java +++ b/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/RemoteRepositoryManagerTest.java @@ -41,15 +41,15 @@ * @author Jeen Broekstra */ @ExtendWith(MockServerExtension.class) -public class RemoteRepositoryManagerTest extends RepositoryManagerTest { +class RemoteRepositoryManagerTest extends RepositoryManagerTest { @BeforeEach - public void setUp(MockServerClient client) { + void setUp(MockServerClient client) { subject = new RemoteRepositoryManager("http://localhost:" + client.getPort() + "/rdf4j-server"); } @Test - public void testAddRepositoryConfig(MockServerClient client) throws Exception { + void testAddRepositoryConfig(MockServerClient client) throws Exception { client.when( request() .withMethod("GET") @@ -97,7 +97,7 @@ public void testAddRepositoryConfig(MockServerClient client) throws Exception { } @Test - public void testAddRepositoryConfigExisting(MockServerClient client) throws Exception { + void testAddRepositoryConfigExisting(MockServerClient client) throws Exception { client.when( request() .withMethod("GET") @@ -145,7 +145,7 @@ public void testAddRepositoryConfigExisting(MockServerClient client) throws Exce } @Test - public void testGetRepositoryConfig(MockServerClient client) throws Exception { + void testGetRepositoryConfig(MockServerClient client) throws Exception { client.when( request() .withMethod("GET") @@ -178,7 +178,7 @@ public void testGetRepositoryConfig(MockServerClient client) throws Exception { } @Test - public void testAddRepositoryConfigLegacy(MockServerClient client) throws Exception { + void testAddRepositoryConfigLegacy(MockServerClient client) throws Exception { client.when( request() .withMethod("GET") diff --git a/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/RepositoryManagerTest.java b/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/RepositoryManagerTest.java index 4d50b727794..46653d87b01 100644 --- a/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/RepositoryManagerTest.java +++ b/core/repository/manager/src/test/java/org/eclipse/rdf4j/repository/manager/RepositoryManagerTest.java @@ -32,12 +32,12 @@ * * @author Jeen Broekstra */ -public class RepositoryManagerTest { +class RepositoryManagerTest { protected RepositoryManager subject; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { subject = new RepositoryManager() { @Override @@ -80,14 +80,14 @@ public void addRepositoryConfig(RepositoryConfig config) } @Test - public void testSetModelFactory() { + void testSetModelFactory() { ModelFactory f = new LinkedHashModelFactory(); subject.setModelFactory(f); assertThat(subject.getModelFactory()).isEqualTo(f); } @Test - public void testSetModelFactoryWithNull() { + void testSetModelFactoryWithNull() { assertThrows(NullPointerException.class, () -> subject.setModelFactory(null)); } } diff --git a/core/repository/sail/pom.xml b/core/repository/sail/pom.xml index 310a8521086..79283e9d164 100644 --- a/core/repository/sail/pom.xml +++ b/core/repository/sail/pom.xml @@ -67,6 +67,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/SailRepositoryConnectionTest.java b/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/SailRepositoryConnectionTest.java index d0af7a12dd2..91caf0b5e83 100644 --- a/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/SailRepositoryConnectionTest.java +++ b/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/SailRepositoryConnectionTest.java @@ -34,14 +34,14 @@ * * @author Jeen Broekstra */ -public class SailRepositoryConnectionTest { +class SailRepositoryConnectionTest { private SailRepositoryConnection subject; private SailConnection sailConnection; private SailRepository sailRepository; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { sailConnection = mock(SailConnection.class); sailRepository = mock(SailRepository.class); @@ -49,7 +49,7 @@ public void setUp() throws Exception { } @Test - public void testPrepareQuery_not_bypassed() throws Exception { + void testPrepareQuery_not_bypassed() throws Exception { Optional response = Optional.empty(); when(sailConnection.prepareQuery(any(), eq(Query.QueryType.TUPLE), any(), any())).thenReturn(response); when(sailConnection.evaluate(any(), any(), any(), anyBoolean())).thenReturn(new EmptyIteration<>()); @@ -61,7 +61,7 @@ public void testPrepareQuery_not_bypassed() throws Exception { } @Test - public void testPrepareQuery_bypassed() throws Exception { + void testPrepareQuery_bypassed() throws Exception { TupleExpr expr = mock(TupleExpr.class); Optional response = Optional.of(expr); when(sailConnection.prepareQuery(any(), eq(Query.QueryType.GRAPH), any(), any())).thenReturn(response); @@ -74,7 +74,7 @@ public void testPrepareQuery_bypassed() throws Exception { } @Test - public void testPrepareTupleQuery_not_bypassed() throws Exception { + void testPrepareTupleQuery_not_bypassed() throws Exception { Optional response = Optional.empty(); when(sailConnection.prepareQuery(any(), eq(Query.QueryType.TUPLE), any(), any())).thenReturn(response); when(sailConnection.evaluate(any(), any(), any(), anyBoolean())).thenReturn(new EmptyIteration<>()); @@ -86,7 +86,7 @@ public void testPrepareTupleQuery_not_bypassed() throws Exception { } @Test - public void testPrepareTupleQuery_bypassed() throws Exception { + void testPrepareTupleQuery_bypassed() throws Exception { TupleExpr expr = mock(TupleExpr.class); Optional response = Optional.of(expr); when(sailConnection.prepareQuery(any(), eq(Query.QueryType.TUPLE), any(), any())).thenReturn(response); @@ -99,7 +99,7 @@ public void testPrepareTupleQuery_bypassed() throws Exception { } @Test - public void testPrepareGraphQuery_not_bypassed() throws Exception { + void testPrepareGraphQuery_not_bypassed() throws Exception { Optional response = Optional.empty(); when(sailConnection.prepareQuery(any(), eq(Query.QueryType.GRAPH), any(), any())).thenReturn(response); when(sailConnection.evaluate(any(), any(), any(), anyBoolean())).thenReturn(new EmptyIteration<>()); @@ -111,7 +111,7 @@ public void testPrepareGraphQuery_not_bypassed() throws Exception { } @Test - public void testPrepareGraphQuery_bypassed() throws Exception { + void testPrepareGraphQuery_bypassed() throws Exception { TupleExpr expr = mock(TupleExpr.class); Optional response = Optional.of(expr); when(sailConnection.prepareQuery(any(), eq(Query.QueryType.GRAPH), any(), any())).thenReturn(response); @@ -124,7 +124,7 @@ public void testPrepareGraphQuery_bypassed() throws Exception { } @Test - public void testPrepareBooleanQuery_not_bypassed() throws Exception { + void testPrepareBooleanQuery_not_bypassed() throws Exception { Optional response = Optional.empty(); when(sailConnection.prepareQuery(any(), eq(Query.QueryType.BOOLEAN), any(), any())).thenReturn(response); when(sailConnection.evaluate(any(), any(), any(), anyBoolean())).thenReturn(new EmptyIteration<>()); @@ -136,7 +136,7 @@ public void testPrepareBooleanQuery_not_bypassed() throws Exception { } @Test - public void testPrepareBooleanQuery_bypassed() throws Exception { + void testPrepareBooleanQuery_bypassed() throws Exception { TupleExpr expr = mock(TupleExpr.class); Optional response = Optional.of(expr); when(sailConnection.prepareQuery(any(), eq(Query.QueryType.BOOLEAN), any(), any())).thenReturn(response); diff --git a/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/config/TestProxyRepositoryFactory.java b/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/config/TestProxyRepositoryFactory.java index a584851738c..bdeaa481dec 100644 --- a/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/config/TestProxyRepositoryFactory.java +++ b/core/repository/sail/src/test/java/org/eclipse/rdf4j/repository/sail/config/TestProxyRepositoryFactory.java @@ -11,7 +11,7 @@ package org.eclipse.rdf4j.repository.sail.config; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; import java.io.IOException; @@ -29,24 +29,24 @@ import org.eclipse.rdf4j.rio.Rio; import org.junit.jupiter.api.Test; -public class TestProxyRepositoryFactory { +class TestProxyRepositoryFactory { private final ProxyRepositoryFactory factory = new ProxyRepositoryFactory(); @Test - public final void testGetRepositoryType() { + final void testGetRepositoryType() { assertThat(factory.getRepositoryType()).isEqualTo("openrdf:ProxyRepository"); } @Test - public final void testGetConfig() throws RepositoryConfigException { + final void testGetConfig() throws RepositoryConfigException { RepositoryImplConfig factoryConfig = factory.getConfig(); assertThat(factoryConfig).isInstanceOf(ProxyRepositoryConfig.class); assertThrows(RepositoryConfigException.class, () -> factoryConfig.validate()); } @Test - public final void testGetRepository() throws RDF4JException, IOException { + final void testGetRepository() throws RDF4JException, IOException { Model graph = Rio.parse(this.getClass().getResourceAsStream("/proxy.ttl"), RepositoryConfigSchema.NAMESPACE, RDFFormat.TURTLE); RepositoryConfig config = RepositoryConfig.create(graph, diff --git a/core/repository/sparql/pom.xml b/core/repository/sparql/pom.xml index 64dd98e029c..88b8a062151 100644 --- a/core/repository/sparql/pom.xml +++ b/core/repository/sparql/pom.xml @@ -17,6 +17,11 @@ rdf4j-repository-api ${project.version} + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-http-client diff --git a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/SPARQLConnectionTest.java b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/SPARQLConnectionTest.java index e799ffb264a..788d9861d5a 100644 --- a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/SPARQLConnectionTest.java +++ b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/SPARQLConnectionTest.java @@ -32,20 +32,20 @@ import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -public class SPARQLConnectionTest { +class SPARQLConnectionTest { private SPARQLConnection subject; private SPARQLProtocolSession client; private final ValueFactory vf = SimpleValueFactory.getInstance(); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { client = mock(SPARQLProtocolSession.class); subject = new SPARQLConnection(null, client); } @Test - public void setParserConfigPassesToProtocolSession() throws Exception { + void setParserConfigPassesToProtocolSession() throws Exception { ParserConfig config = new ParserConfig(); subject.setParserConfig(config); @@ -53,7 +53,7 @@ public void setParserConfigPassesToProtocolSession() throws Exception { } @Test - public void commitOnEmptyTxnDoesNothing() throws Exception { + void commitOnEmptyTxnDoesNothing() throws Exception { subject.begin(); subject.commit(); @@ -63,7 +63,7 @@ public void commitOnEmptyTxnDoesNothing() throws Exception { } @Test - public void testGroupingAddsInInsert() throws Exception { + void testGroupingAddsInInsert() throws Exception { ArgumentCaptor sparqlUpdateCaptor = ArgumentCaptor.forClass(String.class); subject.begin(); @@ -81,7 +81,7 @@ public void testGroupingAddsInInsert() throws Exception { } @Test - public void testAddSingleContextHandling() throws Exception { + void testAddSingleContextHandling() throws Exception { ArgumentCaptor sparqlUpdateCaptor = ArgumentCaptor.forClass(String.class); IRI g1 = vf.createIRI("urn:g1"); @@ -101,7 +101,7 @@ public void testAddSingleContextHandling() throws Exception { } @Test - public void testAddMultipleContextHandling() throws Exception { + void testAddMultipleContextHandling() throws Exception { ArgumentCaptor sparqlUpdateCaptor = ArgumentCaptor.forClass(String.class); IRI g1 = vf.createIRI("urn:g1"); @@ -125,7 +125,7 @@ public void testAddMultipleContextHandling() throws Exception { } @Test - public void testHandlingAddsRemoves() throws Exception { + void testHandlingAddsRemoves() throws Exception { ArgumentCaptor sparqlUpdateCaptor = ArgumentCaptor.forClass(String.class); subject.begin(); @@ -155,7 +155,7 @@ public void testHandlingAddsRemoves() throws Exception { } @Test - public void testSilentClear() throws Exception { + void testSilentClear() throws Exception { subject.setSilentClear(true); assertThat(subject.isSilentClear()); @@ -171,7 +171,7 @@ public void testSilentClear() throws Exception { } @Test - public void testSilentClear_NamedGraph() throws Exception { + void testSilentClear_NamedGraph() throws Exception { subject.setSilentClear(true); assertThat(subject.isSilentClear()); diff --git a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/SPARQLRepositoryTest.java b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/SPARQLRepositoryTest.java index e00b5c217c1..ce8cf12971d 100644 --- a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/SPARQLRepositoryTest.java +++ b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/SPARQLRepositoryTest.java @@ -28,11 +28,11 @@ public class SPARQLRepositoryTest { TupleQueryResultFormat customPreferred = TupleQueryResultFormat.CSV; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { } @Test - public void testCustomPreferredTupleQueryResultFormat() { + void testCustomPreferredTupleQueryResultFormat() { SPARQLRepository rep = new SPARQLRepository(endpointUrl); rep.setHttpClientSessionManager(new HttpClientSessionManager() { diff --git a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryConfigTest.java b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryConfigTest.java index 7f8bd600759..fa0298aa7bb 100644 --- a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryConfigTest.java +++ b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryConfigTest.java @@ -27,14 +27,14 @@ * * @author infgeoax */ -public class SPARQLRepositoryConfigTest { +class SPARQLRepositoryConfigTest { private static final String QUERY_ENDPOINT_URL = "http://example.com/sparql"; private static final String UPDATE_ENDPOINT_URL = "http://example.com/update"; @Test - public void testConstructorWithSPARQLEndpoint() { + void testConstructorWithSPARQLEndpoint() { SPARQLRepositoryConfig config = new SPARQLRepositoryConfig(QUERY_ENDPOINT_URL); assertThat(config.getQueryEndpointUrl()).isEqualTo(QUERY_ENDPOINT_URL); assertThat(config.getUpdateEndpointUrl()).isNull(); @@ -42,7 +42,7 @@ public void testConstructorWithSPARQLEndpoint() { } @Test - public void testConstructorWithQueryAndUpdateEndpoints() { + void testConstructorWithQueryAndUpdateEndpoints() { SPARQLRepositoryConfig config = new SPARQLRepositoryConfig(QUERY_ENDPOINT_URL, UPDATE_ENDPOINT_URL); assertThat(config.getQueryEndpointUrl()).isEqualTo(QUERY_ENDPOINT_URL); @@ -51,7 +51,7 @@ public void testConstructorWithQueryAndUpdateEndpoints() { } @Test - public void testPassThroughEnabled() { + void testPassThroughEnabled() { SPARQLRepositoryConfig config = new SPARQLRepositoryConfig(QUERY_ENDPOINT_URL); assertThat(config.getPassThroughEnabled()).isNull(); @@ -62,7 +62,7 @@ public void testPassThroughEnabled() { } @Test - public void testParse() { + void testParse() { Model m = new LinkedHashModel(); BNode implNode = bnode(); m.add(implNode, RepositoryConfigSchema.REPOSITORYTYPE, literal(SPARQLRepositoryFactory.REPOSITORY_TYPE)); diff --git a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryFactoryTest.java b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryFactoryTest.java index 766ae33e705..22551522481 100644 --- a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryFactoryTest.java +++ b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/config/SPARQLRepositoryFactoryTest.java @@ -15,14 +15,14 @@ import org.eclipse.rdf4j.repository.sparql.SPARQLRepository; import org.junit.jupiter.api.Test; -public class SPARQLRepositoryFactoryTest { +class SPARQLRepositoryFactoryTest { private final String queryEndpointUrl = "http://example.org/sparql"; private final SPARQLRepositoryFactory factory = new SPARQLRepositoryFactory(); @Test - public void testGetRepository() { + void testGetRepository() { SPARQLRepositoryConfig config = new SPARQLRepositoryConfig(queryEndpointUrl); SPARQLRepository rep = factory.getRepository(config); diff --git a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/federation/RepositoryFederatedServiceTest.java b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/federation/RepositoryFederatedServiceTest.java index 564d5e64078..a38c89ee50d 100644 --- a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/federation/RepositoryFederatedServiceTest.java +++ b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/federation/RepositoryFederatedServiceTest.java @@ -14,10 +14,10 @@ import org.junit.jupiter.api.Test; -public class RepositoryFederatedServiceTest { +class RepositoryFederatedServiceTest { @Test - public void testInsertValuesClause() throws Exception { + void testInsertValuesClause() throws Exception { // dummy instance for test RepositoryFederatedService inst = new RepositoryFederatedService(null); diff --git a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/query/QueryStringUtilTest.java b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/query/QueryStringUtilTest.java index 1acd09f0d6a..200faeffb81 100644 --- a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/query/QueryStringUtilTest.java +++ b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/query/QueryStringUtilTest.java @@ -23,12 +23,12 @@ /** * Verifies that QueryStringUtil converts values to their SPARQL string representations. */ -public class QueryStringUtilTest { +class QueryStringUtilTest { private static final ValueFactory VF = SimpleValueFactory.getInstance(); @Test - public void testIRI() { + void testIRI() { IRI iri = VF.createIRI("http://example.com/test"); assertEquals("", QueryStringUtil.valueToString(iri)); @@ -36,7 +36,7 @@ public void testIRI() { } @Test - public void testSimpleLiteral() { + void testSimpleLiteral() { Literal literal = VF.createLiteral("simple \"literal\""); assertEquals("\"simple \\\"literal\\\"\"", QueryStringUtil.valueToString(literal)); @@ -44,7 +44,7 @@ public void testSimpleLiteral() { } @Test - public void testLanguageLiteral() { + void testLanguageLiteral() { Literal literal = VF.createLiteral("lang \"literal\"", "en"); assertEquals("\"lang \\\"literal\\\"\"@en", QueryStringUtil.valueToString(literal)); @@ -52,7 +52,7 @@ public void testLanguageLiteral() { } @Test - public void testTypedLiteral() { + void testTypedLiteral() { Literal literal = VF.createLiteral("typed \"literal\"", VF.createIRI("http://example.com/test")); assertEquals("\"typed \\\"literal\\\"\"^^", QueryStringUtil.valueToString(literal)); @@ -60,13 +60,13 @@ public void testTypedLiteral() { } @Test - public void testNullValue() { + void testNullValue() { assertEquals("UNDEF", QueryStringUtil.valueToString(null)); assertEquals("UNDEF", valueToStringWithStringBuilder(null)); } @Test - public void testBNode() { + void testBNode() { try { QueryStringUtil.valueToString(VF.createBNode()); fail("Must throw exception"); diff --git a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/query/SPARQLQueryBindingSetTest.java b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/query/SPARQLQueryBindingSetTest.java index 2149432c0c0..5bab542c94c 100644 --- a/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/query/SPARQLQueryBindingSetTest.java +++ b/core/repository/sparql/src/test/java/org/eclipse/rdf4j/repository/sparql/query/SPARQLQueryBindingSetTest.java @@ -19,14 +19,14 @@ /** * @author jeen */ -public class SPARQLQueryBindingSetTest { +class SPARQLQueryBindingSetTest { /** * Verifies that the BindingSet implementation honors the API spec for {@link BindingSet#equals(Object)} and * {@link BindingSet#hashCode()}. */ @Test - public void testEqualsHashcode() { + void testEqualsHashcode() { SPARQLQueryBindingSet bs1 = new SPARQLQueryBindingSet(); SPARQLQueryBindingSet bs2 = new SPARQLQueryBindingSet(); diff --git a/core/rio/api/pom.xml b/core/rio/api/pom.xml index bfc650dacdf..223ee77efed 100644 --- a/core/rio/api/pom.xml +++ b/core/rio/api/pom.xml @@ -47,6 +47,11 @@ commons-io test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/ParserConfigTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/ParserConfigTest.java index f11c0e1880a..c0001821c03 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/ParserConfigTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/ParserConfigTest.java @@ -27,13 +27,13 @@ * * @author Peter Ansell */ -public class ParserConfigTest { +class ParserConfigTest { /** * Test the default constructor does not set any settings, but still returns the default values for basic settings. */ @Test - public final void testParserConfig() { + final void testParserConfig() { ParserConfig testConfig = new ParserConfig(); // check that the basic settings are not set @@ -69,7 +69,7 @@ public final void testParserConfig() { */ @Disabled("TODO: Implement me") @Test - public final void testParserConfigBooleanBooleanBooleanDatatypeHandling() { + final void testParserConfigBooleanBooleanBooleanDatatypeHandling() { fail("Not yet implemented"); } @@ -77,7 +77,7 @@ public final void testParserConfigBooleanBooleanBooleanDatatypeHandling() { * Test method for {@link org.eclipse.rdf4j.rio.ParserConfig#useDefaults()}. */ @Test - public final void testUseDefaults() { + final void testUseDefaults() { ParserConfig testConfig = new ParserConfig(); // Test the initial state and add a non-fatal error first @@ -99,7 +99,7 @@ public final void testUseDefaults() { * Test method for {@link org.eclipse.rdf4j.rio.ParserConfig#setNonFatalErrors(java.util.Set)}. */ @Test - public final void testSetNonFatalErrors() { + final void testSetNonFatalErrors() { ParserConfig testConfig = new ParserConfig(); // Test that the defaults exist and are empty @@ -130,7 +130,7 @@ public final void testSetNonFatalErrors() { * Test method for {@link org.eclipse.rdf4j.rio.ParserConfig#addNonFatalError(org.eclipse.rdf4j.rio.RioSetting)} . */ @Test - public final void testAddNonFatalError() { + final void testAddNonFatalError() { ParserConfig testConfig = new ParserConfig(); assertTrue(testConfig.getNonFatalErrors().isEmpty()); @@ -142,7 +142,7 @@ public final void testAddNonFatalError() { * Test method for {@link org.eclipse.rdf4j.rio.ParserConfig#isNonFatalError(org.eclipse.rdf4j.rio.RioSetting)} . */ @Test - public final void testIsNonFatalError() { + final void testIsNonFatalError() { ParserConfig testConfig = new ParserConfig(); assertTrue(testConfig.getNonFatalErrors().isEmpty()); @@ -158,7 +158,7 @@ public final void testIsNonFatalError() { * Test method for {@link org.eclipse.rdf4j.rio.ParserConfig#getNonFatalErrors()}. */ @Test - public final void testGetNonFatalErrors() { + final void testGetNonFatalErrors() { ParserConfig testConfig = new ParserConfig(); assertTrue(testConfig.getNonFatalErrors().isEmpty()); @@ -172,7 +172,7 @@ public final void testGetNonFatalErrors() { * Test method for {@link org.eclipse.rdf4j.rio.ParserConfig#isPreserveBNodeIDs()}. */ @Test - public final void testIsPreserveBNodeIDs() { + final void testIsPreserveBNodeIDs() { ParserConfig testConfig = new ParserConfig(); assertFalse(testConfig.isPreserveBNodeIDs()); @@ -186,7 +186,7 @@ public final void testIsPreserveBNodeIDs() { * Test method for {@link org.eclipse.rdf4j.rio.ParserConfig#get(org.eclipse.rdf4j.rio.RioSetting)}. */ @Test - public final void testGet() { + final void testGet() { ParserConfig testConfig = new ParserConfig(); assertTrue(testConfig.get(BasicParserSettings.VERIFY_RELATIVE_URIS)); @@ -201,7 +201,7 @@ public final void testGet() { * {@link org.eclipse.rdf4j.rio.ParserConfig#set(org.eclipse.rdf4j.rio.RioSetting, java.lang.Object)} . */ @Test - public final void testSet() { + final void testSet() { ParserConfig testConfig = new ParserConfig(); assertFalse(testConfig.isSet(BasicParserSettings.VERIFY_RELATIVE_URIS)); @@ -215,7 +215,7 @@ public final void testSet() { * Test method for {@link org.eclipse.rdf4j.rio.ParserConfig#isSet(org.eclipse.rdf4j.rio.RioSetting)}. */ @Test - public final void testIsSet() { + final void testIsSet() { ParserConfig testConfig = new ParserConfig(); assertFalse(testConfig.isSet(BasicParserSettings.PRESERVE_BNODE_IDS)); diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/RioConfigTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/RioConfigTest.java index d9cd230eda1..052e80b957f 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/RioConfigTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/RioConfigTest.java @@ -18,7 +18,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class RioConfigTest { +class RioConfigTest { private RioConfig config; @@ -27,48 +27,48 @@ public class RioConfigTest { private final BooleanRioSetting testSetting = new BooleanRioSetting(key, "test setting", true); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { config = new RioConfig(); } @AfterEach - public void cleanup() { + void cleanup() { System.clearProperty(key); } @Test - public void testIsSetDefault() throws Exception { + void testIsSetDefault() throws Exception { assertThat(config.isSet(testSetting)).isFalse(); } @Test - public void testIsSetWithSystemPropertyOverride() throws Exception { + void testIsSetWithSystemPropertyOverride() throws Exception { System.setProperty(key, "false"); assertThat(config.isSet(testSetting)).isTrue(); } @Test - public void testIsSetWithExplicitSet() throws Exception { + void testIsSetWithExplicitSet() throws Exception { config.set(testSetting, false); assertThat(config.isSet(testSetting)).isTrue(); } @Test - public void testUseDefaultsNoOverride() throws Exception { + void testUseDefaultsNoOverride() throws Exception { config.set(testSetting, false); config.useDefaults(); assertThat(config.isSet(testSetting)).isFalse(); } @Test - public void testUseDefaultsWithOverride() throws Exception { + void testUseDefaultsWithOverride() throws Exception { System.setProperty(key, "false"); config.useDefaults(); assertThat(config.isSet(testSetting)).isTrue(); } @Test - public void testGetWithSystemPropertyOverride() throws Exception { + void testGetWithSystemPropertyOverride() throws Exception { System.setProperty(key, "false"); assertThat(config.get(testSetting)).as("default setting overridden by system prop").isFalse(); @@ -86,7 +86,7 @@ public void testGetWithSystemPropertyOverride() throws Exception { } @Test - public void testGetWithUnsupportedConversionType() throws Exception { + void testGetWithUnsupportedConversionType() throws Exception { // we deliberately do not use StringRioSetting as that supports conversion of system property values AbstractRioSetting nonConvertableSetting = new AbstractRioSetting<>(key, "test setting", "default value") { diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/RioTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/RioTest.java index abe12332309..3265d9b8e2b 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/RioTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/RioTest.java @@ -39,7 +39,7 @@ public class RioTest { private RDFParser mockParser; @BeforeEach - public void setUp() { + void setUp() { mockParser = mock(RDFParser.class); RDFParserRegistry.getInstance().add(new RDFParserFactory() { @Override @@ -55,7 +55,7 @@ public RDFParser getParser() { } @Test - public void parseInputStream_DefaultSettings() throws Exception { + void parseInputStream_DefaultSettings() throws Exception { Rio.parse(testInputStream, TEST_FORMAT); verify(mockParser).setRDFHandler(any(ContextStatementCollector.class)); @@ -63,7 +63,7 @@ public void parseInputStream_DefaultSettings() throws Exception { } @Test - public void parseInputStream_BaseURI() throws Exception { + void parseInputStream_BaseURI() throws Exception { String baseURI = "test:baseURI"; Rio.parse(testInputStream, baseURI, TEST_FORMAT); @@ -71,7 +71,7 @@ public void parseInputStream_BaseURI() throws Exception { } @Test - public void parseInputStream_CustomConfig() throws Exception { + void parseInputStream_CustomConfig() throws Exception { ParserConfig config = new ParserConfig(); Rio.parse(testInputStream, TEST_FORMAT, config); @@ -80,7 +80,7 @@ public void parseInputStream_CustomConfig() throws Exception { } @Test - public void parseReader_DefaultSettings() throws Exception { + void parseReader_DefaultSettings() throws Exception { Rio.parse(testReader, TEST_FORMAT); verify(mockParser).setRDFHandler(any(ContextStatementCollector.class)); @@ -88,7 +88,7 @@ public void parseReader_DefaultSettings() throws Exception { } @Test - public void parseReader_CustomConfig() throws Exception { + void parseReader_CustomConfig() throws Exception { ParserConfig config = new ParserConfig(); Rio.parse(testReader, TEST_FORMAT, config); @@ -97,7 +97,7 @@ public void parseReader_CustomConfig() throws Exception { } @Test - public void createParser_existing() throws Exception { + void createParser_existing() throws Exception { RDFParser parser = Rio.createParser(TEST_FORMAT); assertThat(parser).isEqualTo(mockParser); } diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/AbstractRDFParserTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/AbstractRDFParserTest.java index 43a7b489160..9e0cf7437a2 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/AbstractRDFParserTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/AbstractRDFParserTest.java @@ -28,7 +28,7 @@ /** * @author Bart Hanssens */ -public class AbstractRDFParserTest { +class AbstractRDFParserTest { private MyRDFParser parser; private class MyRDFParser extends AbstractRDFParser { @@ -57,12 +57,12 @@ public Resource getBNode(String id) { } @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parser = new MyRDFParser(); } @Test - public void testSkolemOrigin() throws Exception { + void testSkolemOrigin() throws Exception { parser.getParserConfig().set(BasicParserSettings.SKOLEMIZE_ORIGIN, "http://www.example.com"); assertTrue(parser.getBNode().toString().startsWith("http://www.example.com")); @@ -70,7 +70,7 @@ public void testSkolemOrigin() throws Exception { } @Test - public void testSkolemOriginReset() throws Exception { + void testSkolemOriginReset() throws Exception { parser.getParserConfig().set(BasicParserSettings.SKOLEMIZE_ORIGIN, "http://www.example.com"); parser.getParserConfig().set(BasicParserSettings.SKOLEMIZE_ORIGIN, ""); @@ -80,7 +80,7 @@ public void testSkolemOriginReset() throws Exception { } @Test - public void testNodeIdHashing() throws Exception { + void testNodeIdHashing() throws Exception { // node ids look like "genid_.*-suffix assertThat(parser.createNode("someid").stringValue()) .endsWith("-someid"); diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/BasicParserSettingsTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/BasicParserSettingsTest.java index 26f00a26c76..ba9474100a7 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/BasicParserSettingsTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/BasicParserSettingsTest.java @@ -17,15 +17,15 @@ import org.eclipse.rdf4j.model.util.Namespaces; import org.junit.jupiter.api.Test; -public class BasicParserSettingsTest { +class BasicParserSettingsTest { @Test - public void testAdditionalPrefixes() { + void testAdditionalPrefixes() { assertTrue(Namespaces.DEFAULT_RDF4J.size() > Namespaces.DEFAULT_RDFA11.size(), "No additional prefixes"); } @Test - public void testImmutable() { + void testImmutable() { assertThatThrownBy(() -> Namespaces.DEFAULT_RDF4J.add(new SimpleNamespace("ex", "http://www.example.com"))) .isInstanceOf(UnsupportedOperationException.class) .withFailMessage("Not immutable"); diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/BooleanRioSettingTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/BooleanRioSettingTest.java index 779347aab02..ef605560ee1 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/BooleanRioSettingTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/BooleanRioSettingTest.java @@ -16,7 +16,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -public class BooleanRioSettingTest extends RioSettingTest { +class BooleanRioSettingTest extends RioSettingTest { @Test @Override @@ -25,7 +25,7 @@ public void testConvertIllegal() throws Exception { } @Test - public void testConvertLegalStringVariants() throws Exception { + void testConvertLegalStringVariants() throws Exception { assertThat(subject.convert("True")).isTrue(); assertThat(subject.convert("Foo")).isFalse(); assertThat(subject.convert("false")).isFalse(); diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/NTriplesUtilTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/NTriplesUtilTest.java index e61f509c257..541d093d0a4 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/NTriplesUtilTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/NTriplesUtilTest.java @@ -33,32 +33,32 @@ * * @author Jeen Broekstra */ -public class NTriplesUtilTest { +class NTriplesUtilTest { private StringBuilder appendable; private final ValueFactory f = SimpleValueFactory.getInstance(); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { appendable = new StringBuilder(); } @Test - public void testAppendWithoutEncoding() throws Exception { + void testAppendWithoutEncoding() throws Exception { Literal l = f.createLiteral("Äbc"); NTriplesUtil.append(l, appendable, true, false); assertThat(appendable.toString()).isEqualTo("\"Äbc\""); } @Test - public void testAppendWithEncoding() throws Exception { + void testAppendWithEncoding() throws Exception { Literal l = f.createLiteral("Äbc"); NTriplesUtil.append(l, appendable, true, true); assertThat(appendable.toString()).isEqualTo("\"\\u00C4bc\""); } @Test - public void testSerializeTriple() throws IOException { + void testSerializeTriple() throws IOException { Object[] triples = new Object[] { f.createTriple(f.createIRI("urn:a"), f.createIRI("urn:b"), f.createIRI("urn:c")), "<< >>", @@ -89,7 +89,7 @@ public void testSerializeTriple() throws IOException { } @Test - public void testParseTriple() { + void testParseTriple() { String[] triples = new String[] { "<<<<\"täst\"@de-DE>>>>", "<>>>", @@ -148,12 +148,12 @@ private void parseTriple(String triple, String expected, Function NTriplesUtil.parseURI("<<>>", f)); } @Test - public void testGH3323Stackoverflow() { + void testGH3323Stackoverflow() { String badLiteral = "<< \"Ko te kamupene S.L., he kamupene i whakapumautia i te tau 2009 a i whakatapua ki nga kaupapa korero mo etahi atu kamupene, mai i te 2012 i tiimata te hanga i ona ake hangarau a kua poipoihia e te mahi tahi me nga hinonga a iwi. Ina koa, ko te mahi tahi me te Manatū o te Roto o Spain te mea nui, i runga i te ngana ki te whakawhanake i nga otinga hangarau motuhake e haangai ana ki nga hiahia o nga Hoia Haumaru o te Kawanatanga o Paniora i nga waahi o nga drones me nga anti-drones. te hononga i waenga i te trga me te Manatu o roto i te mana i roto i nga tau e 8 kua hipa kua kitea i roto i nga waahanga nui e rua: i tetahi taha, ko te tautoko a te Minita ki te maha o nga kaupapa R&D i hangaia e AEORUM me te tahua tahua me te iwi whanui. moni; a, i tetahi atu, ko te mahi tahi nui a te Hekeretari o te Whenua mo te Haumarutanga i te wa e whanakehia ana te punaha me . He kamupene hangarau-hangarau e whakarato ana i nga otinga aunoa mo nga pokapu whakahaere me nga waka kaore he tangata, he nui te utu ki nga waahi e hiahia ana kia mamao te whakahaere me te mohio. Mo tenei, ka whakamahia e ia tana ake R&D i roto i nga waahanga o te tirohanga matakite (kitenga / mohio / taatari i nga taiao me nga tauira), te whakahaere waka (whakahaere aunoa me te mohio o nga waka rererangi robotic me nga tauira) me te mohio mohio. Ko te kaupapa uara o te , SL, e whaaia ana mo te hunga e ahuru ana i te ahuru, ko te whakarato i nga taputapu tirotiro hou kia aukati, kia tere, kia tika hoki te whakatau i nga ahuatanga uaua, kia pai ake ai te whakahaere i te ahuru me te karo i nga ahuatanga ohorere. Ko nga punaha i whakawhanakehia i roto i nga whare taiwhanga o , S.L., ka taea te whakamahi i enei waahanga e whai ake nei: · Te Tiakitanga me te Whakahaumaru i nga Hanganga Hanga. · Haumarutanga: he rongoa mo te whakahaere, tirotiro me te tirotiro aunoa i nga whakahaerenga ture, hei awhina i te whanuitanga o nga ahuatanga. · Whakahaerenga ohorere, mo nga rongoa taangata me nga hoia: nga taputapu hei tirotiro mo te waa-tuuturu o nga rohe e pa ana me nga punaha mohio hei awhina i nga mahi whakatau. · Nga Taone Tino me etahi atu whakauru: otinga aunoa hei whakapai ake i te whakahaerenga o te taiao i nga taone, nga tuawhenua me nga rohe takutai (te whakahaere waka, te taiao, nga whare, te whakahaere ururua, te tiaki ...) SL, he ake hangarau hei whirihora i te maha o nga rongoa, ka taea te urutau ki nga hiahia motuhake o ona kaihoko: te rapu me te waahi o nga taangata, te tiaki me nga hanganga whakahirahira, te aukati ahi, te tirotiro i nga taiao taone, te waahi o nga mahi koretake i nga whare / umanga, me era atu. Ko nga hangarau e whai ake nei me whakanui: · : Te Whakawhanake i tetahi Punaha Korero Maatauranga mo te Whakahaere me te Whakahaumaru i nga Hanganga Critical. · : Te Whakawhanake i te punaha Paanui mo te Kimi me te Whakakore i nga tuma me nga . · : , me te mahi tahi me te tari Irirangi o te Awhina. · : Te Whakawhanake i te Punaha Whakatutukitanga Arā Atu Anō mo te Whakaaetanga i nga Whakanui Taone me nga Hanga Tino, me te mahi tahi me nga pirihimana pirihimana e ono. I te taumata o te ao (kei waho o te fg), kei te tuu a S.L. ki etahi kaupapa rereke me nga hoa hangarau, whakaaweawe i nga roopu me nga roopu whanui i nga whenua penei i te , ko nga \">>"; NTriplesUtil.parseTriple(badLiteral, SimpleValueFactory.getInstance()); } diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RDFParserHelperTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RDFParserHelperTest.java index dd526345f31..f7683cd6905 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RDFParserHelperTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RDFParserHelperTest.java @@ -39,7 +39,7 @@ * * @author Peter Ansell */ -public class RDFParserHelperTest { +class RDFParserHelperTest { private static final String TEST_MESSAGE_FOR_FAILURE = "Test message for failure."; @@ -57,7 +57,7 @@ public class RDFParserHelperTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parserConfig = new ParserConfig(); // By default we wipe out the SPI loaded datatype and language handlers parserConfig.set(BasicParserSettings.DATATYPE_HANDLERS, Collections.emptyList()); @@ -72,7 +72,7 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } /** @@ -81,7 +81,7 @@ public void tearDown() throws Exception { * . */ @Test - public final void testCreateLiteralLabelNull() throws Exception { + final void testCreateLiteralLabelNull() throws Exception { assertThatThrownBy( () -> RDFParserHelper.createLiteral(null, null, null, parserConfig, errListener, valueFactory)) .isInstanceOf(NullPointerException.class) @@ -94,7 +94,7 @@ public final void testCreateLiteralLabelNull() throws Exception { * . */ @Test - public final void testCreateLiteralLabelOnly() throws Exception { + final void testCreateLiteralLabelOnly() throws Exception { Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, null, null, parserConfig, errListener, valueFactory); @@ -109,7 +109,7 @@ public final void testCreateLiteralLabelOnly() throws Exception { * . */ @Test - public final void testCreateLiteralLabelAndLanguage() throws Exception { + final void testCreateLiteralLabelAndLanguage() throws Exception { Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, LANG_EN, null, parserConfig, errListener, valueFactory); @@ -124,7 +124,7 @@ public final void testCreateLiteralLabelAndLanguage() throws Exception { * . */ @Test - public final void testCreateLiteralLabelAndDatatype() throws Exception { + final void testCreateLiteralLabelAndDatatype() throws Exception { Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, null, XSD.STRING, parserConfig, errListener, valueFactory); @@ -142,7 +142,7 @@ public final void testCreateLiteralLabelAndDatatype() throws Exception { * cases where {@link RDF#LANGSTRING} is given and there is a language. */ @Test - public final void testCreateLiteralLabelAndLanguageWithRDFLangString() throws Exception { + final void testCreateLiteralLabelAndLanguageWithRDFLangString() throws Exception { Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, LANG_EN, RDF.LANGSTRING, parserConfig, errListener, valueFactory); @@ -165,7 +165,7 @@ public final void testCreateLiteralLabelAndLanguageWithRDFLangString() throws Ex * and there is NO given language. */ @Test - public final void testCreateLiteralLabelNoLanguageWithRDFLangStringWithVerify() throws Exception { + final void testCreateLiteralLabelNoLanguageWithRDFLangStringWithVerify() throws Exception { parserConfig.set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true); assertTrue(parserConfig.get(BasicParserSettings.VERIFY_DATATYPE_VALUES)); assertThatThrownBy(() -> RDFParserHelper.createLiteral(LABEL_TESTA, null, RDF.LANGSTRING, parserConfig, @@ -174,7 +174,7 @@ public final void testCreateLiteralLabelNoLanguageWithRDFLangStringWithVerify() } @Test - public final void testCreateLiteralLabelNoLanguageWithRDFLangStringWithNoVerify() throws Exception { + final void testCreateLiteralLabelNoLanguageWithRDFLangStringWithNoVerify() throws Exception { parserConfig.set(BasicParserSettings.VERIFY_DATATYPE_VALUES, false); Literal literal = RDFParserHelper.createLiteral(LABEL_TESTA, null, RDF.LANGSTRING, parserConfig, errListener, valueFactory); @@ -183,7 +183,7 @@ public final void testCreateLiteralLabelNoLanguageWithRDFLangStringWithNoVerify( } @Test - public final void testReportErrorStringFatalActive() throws Exception { + final void testReportErrorStringFatalActive() throws Exception { parserConfig.set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true); assertTrue(parserConfig.get(BasicParserSettings.VERIFY_DATATYPE_VALUES)); assertThatThrownBy( @@ -195,7 +195,7 @@ public final void testReportErrorStringFatalActive() throws Exception { } @Test - public final void testReportErrorStringNonFatalActive() throws Exception { + final void testReportErrorStringNonFatalActive() throws Exception { parserConfig.set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true); assertTrue(parserConfig.get(BasicParserSettings.VERIFY_DATATYPE_VALUES)); parserConfig.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES); @@ -205,7 +205,7 @@ public final void testReportErrorStringNonFatalActive() throws Exception { } @Test - public final void testReportErrorStringFatalInactive() throws Exception { + final void testReportErrorStringFatalInactive() throws Exception { assertFalse(parserConfig.get(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES)); RDFParserHelper.reportError(TEST_MESSAGE_FOR_FAILURE, BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, parserConfig, errListener); @@ -213,7 +213,7 @@ public final void testReportErrorStringFatalInactive() throws Exception { } @Test - public final void testReportErrorStringNonFatalInactive() throws Exception { + final void testReportErrorStringNonFatalInactive() throws Exception { assertFalse(parserConfig.get(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES)); parserConfig.addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES); RDFParserHelper.reportError(TEST_MESSAGE_FOR_FAILURE, BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, @@ -222,7 +222,7 @@ public final void testReportErrorStringNonFatalInactive() throws Exception { } @Test - public final void testReportErrorStringIntIntFatalActive() throws Exception { + final void testReportErrorStringIntIntFatalActive() throws Exception { parserConfig.set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true); assertTrue(parserConfig.get(BasicParserSettings.VERIFY_DATATYPE_VALUES)); assertThatThrownBy( @@ -236,7 +236,7 @@ public final void testReportErrorStringIntIntFatalActive() throws Exception { } @Test - public final void testReportErrorStringIntIntNonFatalActive() throws Exception { + final void testReportErrorStringIntIntNonFatalActive() throws Exception { parserConfig.set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true); assertTrue(parserConfig.get(BasicParserSettings.VERIFY_DATATYPE_VALUES)); parserConfig.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES); @@ -246,7 +246,7 @@ public final void testReportErrorStringIntIntNonFatalActive() throws Exception { } @Test - public final void testReportErrorStringIntIntFatalInactive() throws Exception { + final void testReportErrorStringIntIntFatalInactive() throws Exception { assertFalse(parserConfig.get(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES)); RDFParserHelper.reportError(TEST_MESSAGE_FOR_FAILURE, 1, 1, BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, parserConfig, errListener); @@ -254,7 +254,7 @@ public final void testReportErrorStringIntIntFatalInactive() throws Exception { } @Test - public final void testReportErrorStringIntIntNonFatalInactive() throws Exception { + final void testReportErrorStringIntIntNonFatalInactive() throws Exception { assertFalse(parserConfig.get(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES)); parserConfig.addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES); RDFParserHelper.reportError(TEST_MESSAGE_FOR_FAILURE, 1, 1, BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES, @@ -269,7 +269,7 @@ public final void testReportErrorStringIntIntNonFatalInactive() throws Exception */ @Disabled @Test - public final void testReportErrorExceptionIntInt() throws Exception { + final void testReportErrorExceptionIntInt() throws Exception { fail("Not yet implemented"); // TODO } @@ -280,7 +280,7 @@ public final void testReportErrorExceptionIntInt() throws Exception { */ @Disabled @Test - public final void testReportFatalErrorString() throws Exception { + final void testReportFatalErrorString() throws Exception { fail("Not yet implemented"); // TODO } @@ -291,7 +291,7 @@ public final void testReportFatalErrorString() throws Exception { */ @Disabled @Test - public final void testReportFatalErrorStringIntInt() throws Exception { + final void testReportFatalErrorStringIntInt() throws Exception { fail("Not yet implemented"); // TODO } @@ -302,7 +302,7 @@ public final void testReportFatalErrorStringIntInt() throws Exception { */ @Disabled @Test - public final void testReportFatalErrorException() throws Exception { + final void testReportFatalErrorException() throws Exception { fail("Not yet implemented"); // TODO } @@ -313,7 +313,7 @@ public final void testReportFatalErrorException() throws Exception { */ @Disabled @Test - public final void testReportFatalErrorExceptionIntInt() throws Exception { + final void testReportFatalErrorExceptionIntInt() throws Exception { fail("Not yet implemented"); // TODO } diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RDFStarUtilTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RDFStarUtilTest.java index 3497d0cc6e5..42f32cf995c 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RDFStarUtilTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RDFStarUtilTest.java @@ -29,11 +29,11 @@ /** * @author Pavel Mihaylov */ -public class RDFStarUtilTest { +class RDFStarUtilTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @Test - public void testEncoding() { + void testEncoding() { IRI iri = vf.createIRI("urn:a"); assertSame(iri, RDFStarUtil.toRDFEncodedValue(iri)); assertFalse(RDFStarUtil.isEncodedTriple(iri)); @@ -63,7 +63,7 @@ public void testEncoding() { } @Test - public void testDecoding() { + void testDecoding() { IRI iri = vf.createIRI("urn:a"); assertSame(iri, RDFStarUtil.fromRDFEncodedValue(iri)); @@ -91,7 +91,7 @@ public void testDecoding() { } @Test - public void testInvalidEncodedValue() { + void testInvalidEncodedValue() { IRI[] invalidValues = { vf.createIRI("urn:rdf4j:triple:"), vf.createIRI("urn:rdf4j:triple:foo"), diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RioFileTypeDetectorTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RioFileTypeDetectorTest.java index ad1581920a3..944ca4d295b 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RioFileTypeDetectorTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/RioFileTypeDetectorTest.java @@ -17,9 +17,9 @@ import org.junit.jupiter.api.Test; -public class RioFileTypeDetectorTest { +class RioFileTypeDetectorTest { @Test - public void correctClassIsRegisteredInServices() { + void correctClassIsRegisteredInServices() { assertThat(ServiceLoader.load(FileTypeDetector.class)).anyMatch(ftd -> ftd instanceof RioFileTypeDetector); } } diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/StatementCollectorTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/StatementCollectorTest.java index 8068f1ed29b..984442a494b 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/StatementCollectorTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/StatementCollectorTest.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.rio.helpers; +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.assertTrue; @@ -32,27 +33,27 @@ /** * @author Peter Ansell */ -public class StatementCollectorTest { +class StatementCollectorTest { /** * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { } /** * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } /** * Test method for {@link org.eclipse.rdf4j.rio.helpers.StatementCollector#StatementCollector()}. */ @Test - public final void testStatementCollector() throws Exception { + final void testStatementCollector() throws Exception { StatementCollector collector = new StatementCollector(); assertNotNull(collector.getStatements()); @@ -64,7 +65,7 @@ public final void testStatementCollector() throws Exception { * . */ @Test - public final void testStatementCollectorList() throws Exception { + final void testStatementCollectorList() throws Exception { List testList = new ArrayList<>(); StatementCollector collector = new StatementCollector(testList); @@ -79,7 +80,7 @@ public final void testStatementCollectorList() throws Exception { * . */ @Test - public final void testStatementCollectorSet() throws Exception { + final void testStatementCollectorSet() throws Exception { Set testList = new LinkedHashSet<>(); StatementCollector collector = new StatementCollector(testList); @@ -94,7 +95,7 @@ public final void testStatementCollectorSet() throws Exception { * . */ @Test - public final void testStatementCollectorCollectionModel() throws Exception { + final void testStatementCollectorCollectionModel() throws Exception { Model testList = new LinkedHashModel(); StatementCollector collector = new StatementCollector(testList); @@ -112,8 +113,8 @@ public final void testStatementCollectorCollectionModel() throws Exception { assertFalse(collector.getNamespaces().isEmpty()); assertTrue(collector.getNamespaces().containsKey("ns1")); assertTrue(collector.getNamespaces().containsValue("http://example.org/ns1#")); - assertTrue(testList.getNamespaces().iterator().next().getPrefix().equals("ns1")); - assertTrue(testList.getNamespaces().iterator().next().getName().equals("http://example.org/ns1#")); + assertEquals("ns1", testList.getNamespaces().iterator().next().getPrefix()); + assertEquals("http://example.org/ns1#", testList.getNamespaces().iterator().next().getName()); } /** @@ -122,7 +123,7 @@ public final void testStatementCollectorCollectionModel() throws Exception { * . */ @Test - public final void testStatementCollectorCollectionModelMapIndependent() throws Exception { + final void testStatementCollectorCollectionModelMapIndependent() throws Exception { Model testList = new LinkedHashModel(); Map testNamespaces = new LinkedHashMap<>(); StatementCollector collector = new StatementCollector(testList, testNamespaces); @@ -140,7 +141,7 @@ public final void testStatementCollectorCollectionModelMapIndependent() throws E * . */ @Test - public final void testStatementCollectorCollectionMapModel() throws Exception { + final void testStatementCollectorCollectionMapModel() throws Exception { Collection testList = new LinkedHashModel(); Map testNamespaces = new LinkedHashMap<>(); StatementCollector collector = new StatementCollector(testList, testNamespaces); @@ -155,7 +156,7 @@ public final void testStatementCollectorCollectionMapModel() throws Exception { * Test method for {@link org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler#startRDF()}. */ @Test - public final void testStartRDF() throws Exception { + final void testStartRDF() throws Exception { StatementCollector testCollector = new StatementCollector(); testCollector.startRDF(); } @@ -164,7 +165,7 @@ public final void testStartRDF() throws Exception { * Test method for {@link org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler#endRDF()}. */ @Test - public final void testEndRDF() throws Exception { + final void testEndRDF() throws Exception { StatementCollector testCollector = new StatementCollector(); testCollector.startRDF(); testCollector.endRDF(); @@ -176,7 +177,7 @@ public final void testEndRDF() throws Exception { * @throws Exception */ @Test - public final void testHandleComment() throws Exception { + final void testHandleComment() throws Exception { StatementCollector testCollector = new StatementCollector(); // StatementCollector must be able to handle comments, but does not // preserve them diff --git a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/StringRioSettingTest.java b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/StringRioSettingTest.java index 23897ada686..d48765c2068 100644 --- a/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/StringRioSettingTest.java +++ b/core/rio/api/src/test/java/org/eclipse/rdf4j/rio/helpers/StringRioSettingTest.java @@ -14,7 +14,7 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -public class StringRioSettingTest extends RioSettingTest { +class StringRioSettingTest extends RioSettingTest { @Test @Override diff --git a/core/rio/datatypes/pom.xml b/core/rio/datatypes/pom.xml index 112edd1c01b..295863d701d 100644 --- a/core/rio/datatypes/pom.xml +++ b/core/rio/datatypes/pom.xml @@ -20,5 +20,10 @@ rdf4j-rio-api ${project.version} + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/rio/datatypes/src/test/java/org/eclipse/rdf4j/rio/datatypes/DBPediaCelsiusDatatypeHandlerTest.java b/core/rio/datatypes/src/test/java/org/eclipse/rdf4j/rio/datatypes/DBPediaCelsiusDatatypeHandlerTest.java index 324f21422fb..e22ece41d7a 100644 --- a/core/rio/datatypes/src/test/java/org/eclipse/rdf4j/rio/datatypes/DBPediaCelsiusDatatypeHandlerTest.java +++ b/core/rio/datatypes/src/test/java/org/eclipse/rdf4j/rio/datatypes/DBPediaCelsiusDatatypeHandlerTest.java @@ -24,7 +24,7 @@ * * @author Peter Ansell */ -public class DBPediaCelsiusDatatypeHandlerTest extends AbstractDatatypeHandlerTest { +class DBPediaCelsiusDatatypeHandlerTest extends AbstractDatatypeHandlerTest { @Disabled("DBPedia datatypes are not currently verified") @Test diff --git a/core/rio/datatypes/src/test/java/org/eclipse/rdf4j/rio/datatypes/RDFLangStringDatatypeHandlerTest.java b/core/rio/datatypes/src/test/java/org/eclipse/rdf4j/rio/datatypes/RDFLangStringDatatypeHandlerTest.java index 1e149463ab4..d7157d494af 100644 --- a/core/rio/datatypes/src/test/java/org/eclipse/rdf4j/rio/datatypes/RDFLangStringDatatypeHandlerTest.java +++ b/core/rio/datatypes/src/test/java/org/eclipse/rdf4j/rio/datatypes/RDFLangStringDatatypeHandlerTest.java @@ -25,7 +25,7 @@ * * @author Peter Ansell */ -public class RDFLangStringDatatypeHandlerTest extends AbstractDatatypeHandlerTest { +class RDFLangStringDatatypeHandlerTest extends AbstractDatatypeHandlerTest { @Disabled("There are no invalid values for RDF LangString other than null, which is tested seperately") @Test diff --git a/core/rio/hdt/pom.xml b/core/rio/hdt/pom.xml index 9c3a364c5ca..6075f6628fe 100644 --- a/core/rio/hdt/pom.xml +++ b/core/rio/hdt/pom.xml @@ -27,5 +27,10 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC16Test.java b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC16Test.java index dee1afc83a7..6138d3d960f 100644 --- a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC16Test.java +++ b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC16Test.java @@ -19,16 +19,16 @@ /** * @author Bart Hanssens */ -public class CRC16Test { +class CRC16Test { @Test - public void testHello() { + void testHello() { CRC16 crc = new CRC16(); crc.update("Hello world".getBytes(StandardCharsets.US_ASCII), 0, "Hello world".length()); assertEquals(0xF96A, crc.getValue(), "CRC hello world not correct"); } @Test - public void testHelloPerByte() { + void testHelloPerByte() { CRC16 crc = new CRC16(); for (byte b : "Hello world".getBytes(StandardCharsets.US_ASCII)) { crc.update(b); diff --git a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC32Test.java b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC32Test.java index bb4cd0de11a..d558f831815 100644 --- a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC32Test.java +++ b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC32Test.java @@ -19,16 +19,16 @@ /** * @author Bart Hanssens */ -public class CRC32Test { +class CRC32Test { @Test - public void testHello() { + void testHello() { CRC32 crc = new CRC32(); crc.update("Hello world".getBytes(StandardCharsets.US_ASCII), 0, "Hello world".length()); assertEquals(0x72B51F78, crc.getValue(), "CRC hello world not correct"); } @Test - public void testHelloPerByte() { + void testHelloPerByte() { CRC32 crc = new CRC32(); for (byte b : "Hello world".getBytes(StandardCharsets.US_ASCII)) { crc.update(b); diff --git a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC8Test.java b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC8Test.java index 845b054dc1b..6ccfa049378 100644 --- a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC8Test.java +++ b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/CRC8Test.java @@ -19,16 +19,16 @@ /** * @author Bart.Hanssens */ -public class CRC8Test { +class CRC8Test { @Test - public void testHello() { + void testHello() { CRC8 crc = new CRC8(); crc.update("Hello world".getBytes(StandardCharsets.US_ASCII), 0, "Hello world".length()); assertEquals(0x41, crc.getValue(), "CRC hello world not correct"); } @Test - public void testHelloPerByte() { + void testHelloPerByte() { CRC8 crc = new CRC8(); for (byte b : "Hello world".getBytes(StandardCharsets.US_ASCII)) { crc.update(b); diff --git a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/HDTParserTest.java b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/HDTParserTest.java index 6d2eaa6f2e2..db7fdd35873 100644 --- a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/HDTParserTest.java +++ b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/HDTParserTest.java @@ -27,17 +27,17 @@ /** * @author Bart Hanssens */ -public class HDTParserTest { +class HDTParserTest { private RDFParser parser; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parser = Rio.createParser(RDFFormat.HDT); parser.setParseLocationListener((line, col) -> System.err.println("byte " + line)); } @Test - public void parseSimpleSPO() { + void parseSimpleSPO() { // load original N-Triples file Model orig = new LinkedHashModel(); try (InputStream is = HDTParserTest.class.getResourceAsStream("/test-orig.nt")) { @@ -62,7 +62,7 @@ public void parseSimpleSPO() { } @Test - public void parseSimplePOS() { + void parseSimplePOS() { Model m = new LinkedHashModel(); try (InputStream is = HDTParserTest.class.getResourceAsStream("/test-pos.hdt")) { @@ -71,7 +71,7 @@ public void parseSimplePOS() { assertEquals(43, m.size(), "Number of statements does not match"); fail("Unsupported not caught"); } catch (Exception e) { - assertEquals(e.getMessage(), "Triples section: order 4, but only SPO order is supported"); + assertEquals("Triples section: order 4, but only SPO order is supported", e.getMessage()); } } } diff --git a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/VByteTest.java b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/VByteTest.java index 8f70e8da175..47644175c27 100644 --- a/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/VByteTest.java +++ b/core/rio/hdt/src/test/java/org/eclipse/rdf4j/rio/hdt/VByteTest.java @@ -21,19 +21,19 @@ /** * @author Bart.Hanssens */ -public class VByteTest { +class VByteTest { @Test - public void test127() { + void test127() { assertEquals(127, VByte.decode(new byte[] { (byte) 0xff }, 1), "127 not correctly decoded"); } @Test - public void test128() { + void test128() { assertEquals(128, VByte.decode(new byte[] { (byte) 0x00, (byte) 0x81 }, 2), "128 not correctly decoded"); } @Test - public void test128Input() { + void test128Input() { byte b[] = new byte[] { (byte) 0x00, (byte) 0x81 }; try (ByteArrayInputStream bis = new ByteArrayInputStream(b)) { diff --git a/core/rio/jsonld/pom.xml b/core/rio/jsonld/pom.xml index 1d150df94f9..61b6c671b71 100644 --- a/core/rio/jsonld/pom.xml +++ b/core/rio/jsonld/pom.xml @@ -72,6 +72,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-query diff --git a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDHierarchicalWriterTest.java b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDHierarchicalWriterTest.java index 482aa877306..fedfcd895e1 100644 --- a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDHierarchicalWriterTest.java +++ b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDHierarchicalWriterTest.java @@ -40,21 +40,21 @@ /** * @author Yasen Marinov */ -public class JSONLDHierarchicalWriterTest { +class JSONLDHierarchicalWriterTest { private static final SimpleValueFactory vf = SimpleValueFactory.getInstance(); private Model model; private WriterConfig writerConfig; @BeforeEach - public void setup() { + void setup() { model = new LinkedHashModel(); writerConfig = new WriterConfig(); writerConfig.set(JSONLDSettings.HIERARCHICAL_VIEW, true); } @Test - public void testSingleSubnode() throws IOException { + void testSingleSubnode() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3")); @@ -62,7 +62,7 @@ public void testSingleSubnode() throws IOException { } @Test - public void testMultipleSubnodesSamePredicate() throws IOException { + void testMultipleSubnodesSamePredicate() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred"), vf.createIRI("sch:node3")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred"), vf.createIRI("sch:node4")); @@ -72,7 +72,7 @@ public void testMultipleSubnodesSamePredicate() throws IOException { } @Test - public void testSingleSubnodeInContext() throws IOException { + void testSingleSubnodeInContext() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred"), vf.createIRI("sch:node2"), vf.createIRI("sch:node3")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3"), @@ -82,7 +82,7 @@ public void testSingleSubnodeInContext() throws IOException { } @Test - public void testRootIsNotTheParentNode() throws IOException { + void testRootIsNotTheParentNode() throws IOException { addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred3"), vf.createLiteral("literal1")); addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node2")); @@ -91,7 +91,7 @@ public void testRootIsNotTheParentNode() throws IOException { } @Test - public void testRootIsNotTheParentNodeInContext() throws IOException { + void testRootIsNotTheParentNodeInContext() throws IOException { addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3"), vf.createIRI("sch:context1")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred3"), vf.createLiteral("literal1"), @@ -103,7 +103,7 @@ public void testRootIsNotTheParentNodeInContext() throws IOException { } @Test - public void testNextRootIsSelectedBasedOnNumberOfPredicates() throws IOException { + void testNextRootIsSelectedBasedOnNumberOfPredicates() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createLiteral("literal1")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createLiteral("literal1")); addStatement(vf.createIRI("sch:node3"), vf.createIRI("sch:pred3"), vf.createLiteral("literal1")); @@ -116,7 +116,7 @@ public void testNextRootIsSelectedBasedOnNumberOfPredicates() throws IOException } @Test - public void testDeeperHierarchy() throws IOException { + void testDeeperHierarchy() throws IOException { int depth = 256; for (int i = 0; i++ < depth;) { addStatement(vf.createIRI("sch:node" + i), vf.createIRI("sch:pred"), vf.createIRI("sch:node" + (i + 1))); @@ -126,7 +126,7 @@ public void testDeeperHierarchy() throws IOException { } @Test - public void testExpandMultipleTimesSingleNode() throws IOException { + void testExpandMultipleTimesSingleNode() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred3"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3")); @@ -135,7 +135,7 @@ public void testExpandMultipleTimesSingleNode() throws IOException { } @Test - public void testExpandMultipleTimesSingleNodeDifferentLevel() throws IOException { + void testExpandMultipleTimesSingleNodeDifferentLevel() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred3"), vf.createIRI("sch:node4")); addStatement(vf.createIRI("sch:node4"), vf.createIRI("sch:pred4"), vf.createIRI("sch:node2")); @@ -145,7 +145,7 @@ public void testExpandMultipleTimesSingleNodeDifferentLevel() throws IOException } @Test - public void testExpandMultipleTimesSingleNodeDifferentLevel2() throws IOException { + void testExpandMultipleTimesSingleNodeDifferentLevel2() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred3"), vf.createIRI("sch:node4")); addStatement(vf.createIRI("sch:node4"), vf.createIRI("sch:pred4"), vf.createIRI("sch:node5")); addStatement(vf.createIRI("sch:node5"), vf.createIRI("sch:pred4"), vf.createIRI("sch:node2")); @@ -156,7 +156,7 @@ public void testExpandMultipleTimesSingleNodeDifferentLevel2() throws IOExceptio } @Test - public void testExpandMultipleTimesSingleNodeDifferentLevel3() throws IOException { + void testExpandMultipleTimesSingleNodeDifferentLevel3() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node4")); addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node3")); @@ -169,7 +169,7 @@ public void testExpandMultipleTimesSingleNodeDifferentLevel3() throws IOExceptio } @Test - public void testLoop() throws IOException { + void testLoop() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3")); addStatement(vf.createIRI("sch:node3"), vf.createIRI("sch:pred3"), vf.createIRI("sch:node1")); @@ -178,7 +178,7 @@ public void testLoop() throws IOException { } @Test - public void testLoop2() throws IOException { + void testLoop2() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node4")); @@ -189,7 +189,7 @@ public void testLoop2() throws IOException { } @Test - public void testBlankNode() throws IOException { + void testBlankNode() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createBNode("bnode1")); addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred2"), vf.createLiteral("literal1")); addStatement(vf.createBNode("bnode1"), vf.createIRI("sch:pred2"), vf.createBNode("bnode2")); @@ -198,7 +198,7 @@ public void testBlankNode() throws IOException { } @Test - public void testDifferentBlankNodes() throws IOException { + void testDifferentBlankNodes() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createBNode("bnode1")); addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred2"), vf.createLiteral("literal1")); addStatement(vf.createBNode("bnode2"), vf.createIRI("sch:pred2"), vf.createBNode("bnode2")); @@ -207,7 +207,7 @@ public void testDifferentBlankNodes() throws IOException { } @Test - public void testIndependentRoots() throws IOException { + void testIndependentRoots() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createLiteral("literal1")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createLiteral("literal2")); @@ -215,7 +215,7 @@ public void testIndependentRoots() throws IOException { } @Test - public void testLiteralsAreNotConfusedWithIRIs() throws IOException { + void testLiteralsAreNotConfusedWithIRIs() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createLiteral("sch:node2")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createLiteral("literal2")); @@ -223,7 +223,7 @@ public void testLiteralsAreNotConfusedWithIRIs() throws IOException { } @Test - public void testPredicatesDoNotExpand() throws IOException { + void testPredicatesDoNotExpand() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:pred1"), vf.createIRI("sch:pred2"), vf.createLiteral("literal")); @@ -231,12 +231,12 @@ public void testPredicatesDoNotExpand() throws IOException { } @Test - public void testEmptyModel() throws IOException { + void testEmptyModel() throws IOException { verifyOutput(); } @Test - public void testDifferentContexts() throws IOException { + void testDifferentContexts() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node1")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node2"), vf.createIRI("sch:context1")); @@ -246,7 +246,7 @@ public void testDifferentContexts() throws IOException { } @Test - public void testNodesInDifferentContextsAreNotMixed() throws IOException { + void testNodesInDifferentContextsAreNotMixed() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred1"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3"), vf.createIRI("sch:context1")); @@ -256,7 +256,7 @@ public void testNodesInDifferentContextsAreNotMixed() throws IOException { } @Test - public void testTreeModeSetting() throws IOException { + void testTreeModeSetting() throws IOException { addStatement(vf.createIRI("sch:node1"), vf.createIRI("sch:pred"), vf.createIRI("sch:node2")); addStatement(vf.createIRI("sch:node2"), vf.createIRI("sch:pred2"), vf.createIRI("sch:node3")); @@ -271,7 +271,7 @@ public void testTreeModeSetting() throws IOException { * @see GH-1283 */ @Test - public void testOrder() throws IOException { + void testOrder() throws IOException { IRI child = vf.createIRI("urn:child"); IRI b = vf.createIRI("urn:B"); IRI c = vf.createIRI("urn:C"); @@ -284,7 +284,7 @@ public void testOrder() throws IOException { } @Test - public void testOrderDuplicatedChild() throws IOException { + void testOrderDuplicatedChild() throws IOException { IRI child = vf.createIRI("urn:child"); IRI b = vf.createIRI("urn:B"); IRI c = vf.createIRI("urn:C"); @@ -362,7 +362,7 @@ public void write(int b) throws IOException { @Override public void close() throws IOException { - assertTrue(is.read() == -1, "Streams match"); + assertEquals(-1, is.read(), "Streams match"); super.close(); } } diff --git a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDInternalTripleCallbackTest.java b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDInternalTripleCallbackTest.java index 85aa717d594..3504d42f32e 100644 --- a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDInternalTripleCallbackTest.java +++ b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDInternalTripleCallbackTest.java @@ -31,10 +31,10 @@ /** * @author Peter Ansell */ -public class JSONLDInternalTripleCallbackTest { +class JSONLDInternalTripleCallbackTest { @Test - public void triplesTest() throws JsonLdError, IOException { + void triplesTest() throws JsonLdError, IOException { // String inputstring = // "{\"@id\":{\"@id\":\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/machine/DVC-1_8\"},\"http://igreen-projekt.de/ontologies/isoxml#deviceElement\":\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceelement/DET-1_8\",\"http://igreen-projekt.de/ontologies/isoxml#deviceID\":{\"@datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"@literal\":\"DVC-1\"},\"http://igreen-projekt.de/ontologies/isoxml#deviceLocalizationLabel\":{\"@datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"@literal\":\"FF000000406564\"},\"http://igreen-projekt.de/ontologies/isoxml#deviceProcessData\":[\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/13_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/6_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/14_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/11_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/8_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/4_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/5_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/10_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/2_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/21_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/15_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/16_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/19_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/17_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/3_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/12_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/7_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/18_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/9_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/22_8\",\"http://pc-4107.kl.dfki.de:38080/onlinebox/resource/deviceprocessdata/20_8\"],\"http://igreen-projekt.de/ontologies/isoxml#deviceSerialNumber\":{\"@datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"@literal\":\"12345\"},\"http://igreen-projekt.de/ontologies/isoxml#deviceSoftwareVersion\":{\"@datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"@literal\":\"01.009\"},\"http://igreen-projekt.de/ontologies/isoxml#deviceStructureLabel\":{\"@datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"@literal\":\"31303030303030\"},\"http://igreen-projekt.de/ontologies/isoxml#workingSetMasterNAME\":{\"@datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"@literal\":\"A000860020800001\"},\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\":{\"@iri\":\"http://www.agroxml.de/rdfs#Machine\"},\"http://www.w3.org/2000/01/rdf-schema#label\":{\"@datatype\":\"http://www.w3.org/2001/XMLSchema#string\",\"@literal\":\"Krone // Device\"}}"; diff --git a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDParserCustomTest.java b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDParserCustomTest.java index d18ebbe626d..6e2379b9726 100644 --- a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDParserCustomTest.java +++ b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDParserCustomTest.java @@ -48,7 +48,7 @@ * * @author Peter Ansell */ -public class JSONLDParserCustomTest { +class JSONLDParserCustomTest { /** * Backslash escaped "h" in "http" @@ -123,7 +123,7 @@ public class JSONLDParserCustomTest { private final Literal testObjectLiteralUnquotedControlChar = F.createLiteral("42\u0009", XSD.STRING); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parser = Rio.createParser(RDFFormat.JSONLD); errors = new ParseErrorCollector(); model = new LinkedHashModel(); @@ -142,27 +142,27 @@ private void verifyParseResults(Resource nextSubject, IRI nextPredicate, Value n } @Test - public void testSupportedSettings() throws Exception { + void testSupportedSettings() throws Exception { // 13 supported in JSONLDParser + 12 from AbstractRDFParser assertEquals(25, parser.getSupportedSettings().size()); } @Test - public void testAllowBackslashEscapingAnyCharacterDefault() throws Exception { + void testAllowBackslashEscapingAnyCharacterDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(BACKSLASH_ESCAPED_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); } @Test - public void testAllowBackslashEscapingAnyCharacterEnabled() throws Exception { + void testAllowBackslashEscapingAnyCharacterEnabled() throws Exception { parser.set(JSONSettings.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, true); parser.parse(new StringReader(BACKSLASH_ESCAPED_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { + void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { parser.set(JSONSettings.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, false); assertThatThrownBy(() -> parser.parse(new StringReader(BACKSLASH_ESCAPED_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -171,21 +171,21 @@ public void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { } @Test - public void testAllowCommentsDefault() throws Exception { + void testAllowCommentsDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(COMMENTS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); } @Test - public void testAllowCommentsEnabled() throws Exception { + void testAllowCommentsEnabled() throws Exception { parser.set(JSONSettings.ALLOW_COMMENTS, true); parser.parse(new StringReader(COMMENTS_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testAllowCommentsDisabled() throws Exception { + void testAllowCommentsDisabled() throws Exception { parser.set(JSONSettings.ALLOW_COMMENTS, false); assertThatThrownBy(() -> parser.parse(new StringReader(COMMENTS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -193,7 +193,7 @@ public void testAllowCommentsDisabled() throws Exception { } @Test - public void testAllowNonNumericNumbersDefault() throws Exception { + void testAllowNonNumericNumbersDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(NON_NUMERIC_NUMBERS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); @@ -201,7 +201,7 @@ public void testAllowNonNumericNumbersDefault() throws Exception { @Test @Disabled("temporarily disabled due to breaking on command line but not in Eclipse") - public void testAllowNonNumericNumbersEnabled() throws Exception { + void testAllowNonNumericNumbersEnabled() throws Exception { parser.set(JSONSettings.ALLOW_NON_NUMERIC_NUMBERS, true); parser.parse(new StringReader(NON_NUMERIC_NUMBERS_TEST_STRING), ""); // FIXME: The literal being created has the replacement character as its label, @@ -210,7 +210,7 @@ public void testAllowNonNumericNumbersEnabled() throws Exception { } @Test - public void testAllowNonNumericNumbersDisabled() throws Exception { + void testAllowNonNumericNumbersDisabled() throws Exception { parser.set(JSONSettings.ALLOW_NON_NUMERIC_NUMBERS, false); assertThatThrownBy(() -> parser.parse(new StringReader(NON_NUMERIC_NUMBERS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -218,21 +218,21 @@ public void testAllowNonNumericNumbersDisabled() throws Exception { } @Test - public void testAllowNumericLeadingZeroesDefault() throws Exception { + void testAllowNumericLeadingZeroesDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(NUMERIC_LEADING_ZEROES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); } @Test - public void testAllowNumericLeadingZeroesEnabled() throws Exception { + void testAllowNumericLeadingZeroesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_NUMERIC_LEADING_ZEROS, true); parser.parse(new StringReader(NUMERIC_LEADING_ZEROES_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralNumber); } @Test - public void testAllowNumericLeadingZeroesDisabled() throws Exception { + void testAllowNumericLeadingZeroesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_NUMERIC_LEADING_ZEROS, false); assertThatThrownBy(() -> parser.parse(new StringReader(NUMERIC_LEADING_ZEROES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -240,21 +240,21 @@ public void testAllowNumericLeadingZeroesDisabled() throws Exception { } @Test - public void testAllowSingleQuotesDefault() throws Exception { + void testAllowSingleQuotesDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(SINGLE_QUOTES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); } @Test - public void testAllowSingleQuotesEnabled() throws Exception { + void testAllowSingleQuotesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_SINGLE_QUOTES, true); parser.parse(new StringReader(SINGLE_QUOTES_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralNumber); } @Test - public void testAllowSingleQuotesDisabled() throws Exception { + void testAllowSingleQuotesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_SINGLE_QUOTES, false); assertThatThrownBy(() -> parser.parse(new StringReader(SINGLE_QUOTES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -262,21 +262,21 @@ public void testAllowSingleQuotesDisabled() throws Exception { } @Test - public void testAllowUnquotedControlCharactersDefault() throws Exception { + void testAllowUnquotedControlCharactersDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(UNQUOTED_CONTROL_CHARS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); } @Test - public void testAllowUnquotedControlCharactersEnabled() throws Exception { + void testAllowUnquotedControlCharactersEnabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_CONTROL_CHARS, true); parser.parse(new StringReader(UNQUOTED_CONTROL_CHARS_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralUnquotedControlChar); } @Test - public void testAllowUnquotedControlCharactersDisabled() throws Exception { + void testAllowUnquotedControlCharactersDisabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_CONTROL_CHARS, false); assertThatThrownBy(() -> parser.parse(new StringReader(UNQUOTED_CONTROL_CHARS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -284,21 +284,21 @@ public void testAllowUnquotedControlCharactersDisabled() throws Exception { } @Test - public void testAllowUnquotedFieldNamesDefault() throws Exception { + void testAllowUnquotedFieldNamesDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(UNQUOTED_FIELD_NAMES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); } @Test - public void testAllowUnquotedFieldNamesEnabled() throws Exception { + void testAllowUnquotedFieldNamesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_FIELD_NAMES, true); parser.parse(new StringReader(UNQUOTED_FIELD_NAMES_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralNumber); } @Test - public void testAllowUnquotedFieldNamesDisabled() throws Exception { + void testAllowUnquotedFieldNamesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_FIELD_NAMES, false); assertThatThrownBy(() -> parser.parse(new StringReader(UNQUOTED_FIELD_NAMES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -306,21 +306,21 @@ public void testAllowUnquotedFieldNamesDisabled() throws Exception { } @Test - public void testAllowYamlCommentsDefault() throws Exception { + void testAllowYamlCommentsDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(YAML_COMMENTS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); } @Test - public void testAllowYamlCommentsEnabled() throws Exception { + void testAllowYamlCommentsEnabled() throws Exception { parser.set(JSONSettings.ALLOW_YAML_COMMENTS, true); parser.parse(new StringReader(YAML_COMMENTS_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testAllowYamlCommentsDisabled() throws Exception { + void testAllowYamlCommentsDisabled() throws Exception { parser.set(JSONSettings.ALLOW_YAML_COMMENTS, false); assertThatThrownBy(() -> parser.parse(new StringReader(YAML_COMMENTS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -328,21 +328,21 @@ public void testAllowYamlCommentsDisabled() throws Exception { } @Test - public void testAllowTrailingCommaDefault() throws Exception { + void testAllowTrailingCommaDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(TRAILING_COMMA_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessageContaining("Could not parse JSONLD"); } @Test - public void testAllowTrailingCommaEnabled() throws Exception { + void testAllowTrailingCommaEnabled() throws Exception { parser.set(JSONSettings.ALLOW_TRAILING_COMMA, true); parser.parse(new StringReader(TRAILING_COMMA_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testAllowTrailingCommaDisabled() throws Exception { + void testAllowTrailingCommaDisabled() throws Exception { parser.set(JSONSettings.ALLOW_TRAILING_COMMA, false); assertThatThrownBy(() -> parser.parse(new StringReader(TRAILING_COMMA_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -350,7 +350,7 @@ public void testAllowTrailingCommaDisabled() throws Exception { } @Test - public void testIncludeSourceLocationDefault() throws Exception { + void testIncludeSourceLocationDefault() throws Exception { final Reader source = new StringReader(YAML_COMMENTS_TEST_STRING); try { parser.parse(source, ""); @@ -367,7 +367,7 @@ public void testIncludeSourceLocationDefault() throws Exception { } @Test - public void testIncludeSourceLocationEnabled() throws Exception { + void testIncludeSourceLocationEnabled() throws Exception { final Reader source = new StringReader(YAML_COMMENTS_TEST_STRING); try { parser.set(JSONSettings.INCLUDE_SOURCE_IN_LOCATION, true); @@ -385,7 +385,7 @@ public void testIncludeSourceLocationEnabled() throws Exception { } @Test - public void testIncludeSourceLocationDisabled() throws Exception { + void testIncludeSourceLocationDisabled() throws Exception { try { parser.set(JSONSettings.INCLUDE_SOURCE_IN_LOCATION, false); parser.parse(new StringReader(YAML_COMMENTS_TEST_STRING), ""); @@ -401,14 +401,14 @@ public void testIncludeSourceLocationDisabled() throws Exception { } @Test - public void testStrictDuplicateDetectionDefault() throws Exception { + void testStrictDuplicateDetectionDefault() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, false); parser.parse(new StringReader(STRICT_DUPLICATE_DETECTION_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testStrictDuplicateDetectionEnabled() throws Exception { + void testStrictDuplicateDetectionEnabled() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, true); assertThatThrownBy(() -> parser.parse(new StringReader(STRICT_DUPLICATE_DETECTION_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -416,14 +416,14 @@ public void testStrictDuplicateDetectionEnabled() throws Exception { } @Test - public void testStrictDuplicateDetectionDisabled() throws Exception { + void testStrictDuplicateDetectionDisabled() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, false); parser.parse(new StringReader(STRICT_DUPLICATE_DETECTION_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testDocumentLoader() throws Exception { + void testDocumentLoader() throws Exception { DocumentLoader loader = new DocumentLoader(); loader.addInjectedDoc("http://example.com/context.jsonld", LOADER_CONTEXT); diff --git a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDWriterBackgroundTest.java b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDWriterBackgroundTest.java index e5bd1ad4274..c9bb0b78e7a 100644 --- a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDWriterBackgroundTest.java +++ b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDWriterBackgroundTest.java @@ -76,7 +76,7 @@ public void testIllegalPrefix() throws RDFHandlerException, RDFParseException, I } @Test - public void testRoundTripNamespaces() throws Exception { + void testRoundTripNamespaces() throws Exception { String exNs = "http://example.org/"; IRI uri1 = vf.createIRI(exNs, "uri1"); IRI uri2 = vf.createIRI(exNs, "uri2"); diff --git a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDWriterTest.java b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDWriterTest.java index 29b39974d0e..ccfcd14d066 100644 --- a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDWriterTest.java +++ b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/jsonld/JSONLDWriterTest.java @@ -11,6 +11,7 @@ package org.eclipse.rdf4j.rio.jsonld; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayInputStream; @@ -69,7 +70,7 @@ public void testIllegalPrefix() throws RDFHandlerException, RDFParseException, I } @Test - public void testEmptyNamespace() throws Exception { + void testEmptyNamespace() throws Exception { IRI uri1 = vf.createIRI(exNs, "uri1"); IRI uri2 = vf.createIRI(exNs, "uri2"); @@ -88,7 +89,7 @@ public void testEmptyNamespace() throws Exception { } @Test - public void testRoundTripNamespaces() throws Exception { + void testRoundTripNamespaces() throws Exception { IRI uri1 = vf.createIRI(exNs, "uri1"); IRI uri2 = vf.createIRI(exNs, "uri2"); Literal plainLit = vf.createLiteral("plain", XSD.STRING); @@ -130,7 +131,7 @@ public void testRoundTripNamespaces() throws Exception { * Test if the JSON-LD writer honors the "native RDF type" setting. */ @Test - public void testNativeRDFTypes() { + void testNativeRDFTypes() { IRI subject = vf.createIRI(exNs, "uri1"); IRI predicate = vf.createIRI(exNs, "uri2"); Literal object = vf.createLiteral(true); @@ -146,7 +147,7 @@ public void testNativeRDFTypes() { rdfWriter.handleStatement(stmt); rdfWriter.endRDF(); - assertTrue(!w.toString().contains("@type"), "Does contain @type"); + assertFalse(w.toString().contains("@type"), "Does contain @type"); } @Override diff --git a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/ndjsonld/NDJSONLDParserTest.java b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/ndjsonld/NDJSONLDParserTest.java index 1eafa3c09c1..b0d22a68b1c 100644 --- a/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/ndjsonld/NDJSONLDParserTest.java +++ b/core/rio/jsonld/src/test/java/org/eclipse/rdf4j/rio/ndjsonld/NDJSONLDParserTest.java @@ -24,12 +24,12 @@ import org.eclipse.rdf4j.rio.helpers.StatementCollector; import org.junit.jupiter.api.Test; -public class NDJSONLDParserTest { +class NDJSONLDParserTest { private final ValueFactory vf = SimpleValueFactory.getInstance(); @Test - public void testNDJSONLDWriter() throws IOException { + void testNDJSONLDWriter() throws IOException { NDJSONLDParser ndjsonldParser = new NDJSONLDParser(); ndjsonldParser.getParserConfig().set(BasicWriterSettings.BASE_DIRECTIVE, true); StatementCollector statementCollector = new StatementCollector(); @@ -47,7 +47,7 @@ public void testNDJSONLDWriter() throws IOException { } @Test - public void testNDJSONLDParser() throws IOException { + void testNDJSONLDParser() throws IOException { NDJSONLDParser ndjsonldParser = new NDJSONLDParser(); ndjsonldParser.getParserConfig().set(BasicWriterSettings.BASE_DIRECTIVE, true); StatementCollector statementCollector = new StatementCollector(); diff --git a/core/rio/n3/pom.xml b/core/rio/n3/pom.xml index 00da67dfb12..39f2e5bda6a 100644 --- a/core/rio/n3/pom.xml +++ b/core/rio/n3/pom.xml @@ -37,5 +37,10 @@ ${project.version} runtime + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/rio/n3/src/test/java/org/eclipse/rdf4j/rio/n3/N3ParserTest.java b/core/rio/n3/src/test/java/org/eclipse/rdf4j/rio/n3/N3ParserTest.java index 128f7329013..0368a2d26e7 100644 --- a/core/rio/n3/src/test/java/org/eclipse/rdf4j/rio/n3/N3ParserTest.java +++ b/core/rio/n3/src/test/java/org/eclipse/rdf4j/rio/n3/N3ParserTest.java @@ -28,7 +28,7 @@ /** * @author tanisha */ -public class N3ParserTest { +class N3ParserTest { private N3Parser parser; @@ -45,7 +45,7 @@ public class N3ParserTest { private final SimpleParseLocationListener locationListener = new SimpleParseLocationListener(); @BeforeEach - public void setUp() { + void setUp() { parser = new N3Parser(); parser.setParseErrorListener(errorCollector); parser.setRDFHandler(statementCollector); @@ -53,7 +53,7 @@ public void setUp() { } @Test - public void testParseEquals() throws IOException { + void testParseEquals() throws IOException { String data = prefixes + " ex:foo = ex:bar. "; parser.parse(new StringReader(data), baseURI); diff --git a/core/rio/nquads/pom.xml b/core/rio/nquads/pom.xml index 481da0c7c61..51c016527dd 100644 --- a/core/rio/nquads/pom.xml +++ b/core/rio/nquads/pom.xml @@ -49,6 +49,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-query diff --git a/core/rio/nquads/src/test/java/org/eclipse/rdf4j/rio/nquads/AbstractNQuadsParserUnitTest.java b/core/rio/nquads/src/test/java/org/eclipse/rdf4j/rio/nquads/AbstractNQuadsParserUnitTest.java index 544adb9a346..bfe857cd04b 100644 --- a/core/rio/nquads/src/test/java/org/eclipse/rdf4j/rio/nquads/AbstractNQuadsParserUnitTest.java +++ b/core/rio/nquads/src/test/java/org/eclipse/rdf4j/rio/nquads/AbstractNQuadsParserUnitTest.java @@ -189,7 +189,7 @@ public void testParseEmptyLinesAndComments() throws RDFHandlerException, IOExcep final TestRDFHandler rdfHandler = new TestRDFHandler(); parser.setRDFHandler(rdfHandler); parser.parse(bais, "http://test.base.uri"); - assertEquals(rdfHandler.getStatements().size(), 0); + assertEquals(0, rdfHandler.getStatements().size()); } /** diff --git a/core/rio/ntriples/pom.xml b/core/rio/ntriples/pom.xml index 99d45ea93d5..666b3a302d1 100644 --- a/core/rio/ntriples/pom.xml +++ b/core/rio/ntriples/pom.xml @@ -44,6 +44,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-query diff --git a/core/rio/ntriples/src/test/java/org/eclipse/rdf4j/rio/ntriples/AbstractNTriplesParserUnitTest.java b/core/rio/ntriples/src/test/java/org/eclipse/rdf4j/rio/ntriples/AbstractNTriplesParserUnitTest.java index be96419b1d2..3187fa55718 100644 --- a/core/rio/ntriples/src/test/java/org/eclipse/rdf4j/rio/ntriples/AbstractNTriplesParserUnitTest.java +++ b/core/rio/ntriples/src/test/java/org/eclipse/rdf4j/rio/ntriples/AbstractNTriplesParserUnitTest.java @@ -77,7 +77,7 @@ public void testExceptionHandlingWithDefaultSettings() throws Exception { ntriplesParser.parse(new StringReader(data), NTRIPLES_TEST_URL); fail("expected RDFParseException due to invalid data"); } catch (RDFParseException expected) { - assertEquals(expected.getLineNumber(), 1); + assertEquals(1, expected.getLineNumber()); } } @@ -95,7 +95,7 @@ public void testExceptionHandlingWithStopAtFirstError() throws Exception { ntriplesParser.parse(new StringReader(data), NTRIPLES_TEST_URL); fail("expected RDFParseException due to invalid data"); } catch (RDFParseException expected) { - assertEquals(expected.getLineNumber(), 1); + assertEquals(1, expected.getLineNumber()); } } diff --git a/core/rio/rdfjson/pom.xml b/core/rio/rdfjson/pom.xml index 7ca600bbd66..b2472711006 100644 --- a/core/rio/rdfjson/pom.xml +++ b/core/rio/rdfjson/pom.xml @@ -48,6 +48,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-query diff --git a/core/rio/rdfjson/src/test/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONMimeTypeTest.java b/core/rio/rdfjson/src/test/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONMimeTypeTest.java index 146bc5e9b0a..57cd0751bf8 100644 --- a/core/rio/rdfjson/src/test/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONMimeTypeTest.java +++ b/core/rio/rdfjson/src/test/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONMimeTypeTest.java @@ -19,16 +19,16 @@ /** * @author Peter Ansell */ -public class RDFJSONMimeTypeTest { +class RDFJSONMimeTypeTest { @Test - public void testApplicationRDFJSON() { + void testApplicationRDFJSON() { assertEquals(RDFFormat.RDFJSON, Rio.getParserFormatForMIMEType("application/rdf+json") .orElseThrow(Rio.unsupportedFormat(RDFFormat.RDFJSON))); } @Test - public void testApplicationRDFJSONUtf8() { + void testApplicationRDFJSONUtf8() { assertEquals(RDFFormat.RDFJSON, Rio.getParserFormatForMIMEType("application/rdf+json;charset=UTF-8") .orElseThrow(Rio.unsupportedFormat(RDFFormat.RDFJSON))); } diff --git a/core/rio/rdfjson/src/test/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONParserCustomTest.java b/core/rio/rdfjson/src/test/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONParserCustomTest.java index 343645cbf7c..7e331dd8af5 100644 --- a/core/rio/rdfjson/src/test/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONParserCustomTest.java +++ b/core/rio/rdfjson/src/test/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONParserCustomTest.java @@ -46,7 +46,7 @@ * * @author Peter Ansell */ -public class RDFJSONParserCustomTest { +class RDFJSONParserCustomTest { /** * Backslash escaped "h" in "http" @@ -120,7 +120,7 @@ public class RDFJSONParserCustomTest { .createLiteral("42\u0009", XSD.STRING); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { parser = Rio.createParser(RDFFormat.RDFJSON); errors = new ParseErrorCollector(); model = new LinkedHashModel(); @@ -139,27 +139,27 @@ private void verifyParseResults(Resource nextSubject, IRI nextPredicate, Value n } @Test - public void testSupportedSettings() throws Exception { + void testSupportedSettings() throws Exception { // 17 supported in RDFJSONParser + 13 from AbstractRDFParser assertEquals(30, parser.getSupportedSettings().size()); } @Test - public void testAllowBackslashEscapingAnyCharacterDefault() throws Exception { + void testAllowBackslashEscapingAnyCharacterDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(BACKSLASH_ESCAPED_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 1, column 5]"); } @Test - public void testAllowBackslashEscapingAnyCharacterEnabled() throws Exception { + void testAllowBackslashEscapingAnyCharacterEnabled() throws Exception { parser.set(JSONSettings.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, true); parser.parse(new StringReader(BACKSLASH_ESCAPED_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { + void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { parser.set(JSONSettings.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, false); assertThatThrownBy(() -> parser.parse(new StringReader(BACKSLASH_ESCAPED_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -167,21 +167,21 @@ public void testAllowBackslashEscapingAnyCharacterDisabled() throws Exception { } @Test - public void testAllowCommentsDefault() throws Exception { + void testAllowCommentsDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(COMMENTS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 1, column 3]"); } @Test - public void testAllowCommentsEnabled() throws Exception { + void testAllowCommentsEnabled() throws Exception { parser.set(JSONSettings.ALLOW_COMMENTS, true); parser.parse(new StringReader(COMMENTS_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testAllowCommentsDisabled() throws Exception { + void testAllowCommentsDisabled() throws Exception { parser.set(JSONSettings.ALLOW_COMMENTS, false); assertThatThrownBy(() -> parser.parse(new StringReader(COMMENTS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -189,21 +189,21 @@ public void testAllowCommentsDisabled() throws Exception { } @Test - public void testAllowNonNumericNumbersDefault() throws Exception { + void testAllowNonNumericNumbersDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(NON_NUMERIC_NUMBERS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 1, column 74]"); } @Test - public void testAllowNonNumericNumbersEnabled() throws Exception { + void testAllowNonNumericNumbersEnabled() throws Exception { parser.set(JSONSettings.ALLOW_NON_NUMERIC_NUMBERS, true); parser.parse(new StringReader(NON_NUMERIC_NUMBERS_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralNotANumber); } @Test - public void testAllowNonNumericNumbersDisabled() throws Exception { + void testAllowNonNumericNumbersDisabled() throws Exception { parser.set(JSONSettings.ALLOW_NON_NUMERIC_NUMBERS, false); assertThatThrownBy(() -> parser.parse(new StringReader(NON_NUMERIC_NUMBERS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -211,21 +211,21 @@ public void testAllowNonNumericNumbersDisabled() throws Exception { } @Test - public void testAllowNumericLeadingZeroesDefault() throws Exception { + void testAllowNumericLeadingZeroesDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(NUMERIC_LEADING_ZEROES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 1, column 72]"); } @Test - public void testAllowNumericLeadingZeroesEnabled() throws Exception { + void testAllowNumericLeadingZeroesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_NUMERIC_LEADING_ZEROS, true); parser.parse(new StringReader(NUMERIC_LEADING_ZEROES_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralNumber); } @Test - public void testAllowNumericLeadingZeroesDisabled() throws Exception { + void testAllowNumericLeadingZeroesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_NUMERIC_LEADING_ZEROS, false); assertThatThrownBy(() -> parser.parse(new StringReader(NUMERIC_LEADING_ZEROES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -233,21 +233,21 @@ public void testAllowNumericLeadingZeroesDisabled() throws Exception { } @Test - public void testAllowSingleQuotesDefault() throws Exception { + void testAllowSingleQuotesDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(SINGLE_QUOTES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 1, column 3]"); } @Test - public void testAllowSingleQuotesEnabled() throws Exception { + void testAllowSingleQuotesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_SINGLE_QUOTES, true); parser.parse(new StringReader(SINGLE_QUOTES_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralNumber); } @Test - public void testAllowSingleQuotesDisabled() throws Exception { + void testAllowSingleQuotesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_SINGLE_QUOTES, false); assertThatThrownBy(() -> parser.parse(new StringReader(SINGLE_QUOTES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -255,21 +255,21 @@ public void testAllowSingleQuotesDisabled() throws Exception { } @Test - public void testAllowUnquotedControlCharactersDefault() throws Exception { + void testAllowUnquotedControlCharactersDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(UNQUOTED_CONTROL_CHARS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 1, column 75]"); } @Test - public void testAllowUnquotedControlCharactersEnabled() throws Exception { + void testAllowUnquotedControlCharactersEnabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_CONTROL_CHARS, true); parser.parse(new StringReader(UNQUOTED_CONTROL_CHARS_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralUnquotedControlChar); } @Test - public void testAllowUnquotedControlCharactersDisabled() throws Exception { + void testAllowUnquotedControlCharactersDisabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_CONTROL_CHARS, false); assertThatThrownBy(() -> parser.parse(new StringReader(UNQUOTED_CONTROL_CHARS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -277,21 +277,21 @@ public void testAllowUnquotedControlCharactersDisabled() throws Exception { } @Test - public void testAllowUnquotedFieldNamesDefault() throws Exception { + void testAllowUnquotedFieldNamesDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(UNQUOTED_FIELD_NAMES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 1, column 63]"); } @Test - public void testAllowUnquotedFieldNamesEnabled() throws Exception { + void testAllowUnquotedFieldNamesEnabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_FIELD_NAMES, true); parser.parse(new StringReader(UNQUOTED_FIELD_NAMES_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectLiteralNumber); } @Test - public void testAllowUnquotedFieldNamesDisabled() throws Exception { + void testAllowUnquotedFieldNamesDisabled() throws Exception { parser.set(JSONSettings.ALLOW_UNQUOTED_FIELD_NAMES, false); assertThatThrownBy(() -> parser.parse(new StringReader(UNQUOTED_FIELD_NAMES_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -299,21 +299,21 @@ public void testAllowUnquotedFieldNamesDisabled() throws Exception { } @Test - public void testAllowYamlCommentsDefault() throws Exception { + void testAllowYamlCommentsDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(YAML_COMMENTS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 2, column 2]"); } @Test - public void testAllowYamlCommentsEnabled() throws Exception { + void testAllowYamlCommentsEnabled() throws Exception { parser.set(JSONSettings.ALLOW_YAML_COMMENTS, true); parser.parse(new StringReader(YAML_COMMENTS_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testAllowYamlCommentsDisabled() throws Exception { + void testAllowYamlCommentsDisabled() throws Exception { parser.set(JSONSettings.ALLOW_YAML_COMMENTS, false); assertThatThrownBy(() -> parser.parse(new StringReader(YAML_COMMENTS_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -321,21 +321,21 @@ public void testAllowYamlCommentsDisabled() throws Exception { } @Test - public void testAllowTrailingCommaDefault() throws Exception { + void testAllowTrailingCommaDefault() throws Exception { assertThatThrownBy(() -> parser.parse(new StringReader(TRAILING_COMMA_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) .hasMessage("Found IOException during parsing [line 1, column 113]"); } @Test - public void testAllowTrailingCommaEnabled() throws Exception { + void testAllowTrailingCommaEnabled() throws Exception { parser.set(JSONSettings.ALLOW_TRAILING_COMMA, true); parser.parse(new StringReader(TRAILING_COMMA_TEST_STRING), ""); verifyParseResults(testSubjectIRI, testPredicate, testObjectIRI); } @Test - public void testAllowTrailingCommaDisabled() throws Exception { + void testAllowTrailingCommaDisabled() throws Exception { parser.set(JSONSettings.ALLOW_TRAILING_COMMA, false); assertThatThrownBy(() -> parser.parse(new StringReader(TRAILING_COMMA_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -343,7 +343,7 @@ public void testAllowTrailingCommaDisabled() throws Exception { } @Test - public void testIncludeSourceLocationDefault() throws Exception { + void testIncludeSourceLocationDefault() throws Exception { final Reader source = new StringReader(YAML_COMMENTS_TEST_STRING); try { parser.parse(source, ""); @@ -360,7 +360,7 @@ public void testIncludeSourceLocationDefault() throws Exception { } @Test - public void testIncludeSourceLocationEnabled() throws Exception { + void testIncludeSourceLocationEnabled() throws Exception { final Reader source = new StringReader(YAML_COMMENTS_TEST_STRING); try { parser.set(JSONSettings.INCLUDE_SOURCE_IN_LOCATION, true); @@ -378,7 +378,7 @@ public void testIncludeSourceLocationEnabled() throws Exception { } @Test - public void testIncludeSourceLocationDisabled() throws Exception { + void testIncludeSourceLocationDisabled() throws Exception { try { parser.set(JSONSettings.INCLUDE_SOURCE_IN_LOCATION, false); parser.parse(new StringReader(YAML_COMMENTS_TEST_STRING), ""); @@ -394,7 +394,7 @@ public void testIncludeSourceLocationDisabled() throws Exception { } @Test - public void testStrictDuplicateDetectionDefault() throws Exception { + void testStrictDuplicateDetectionDefault() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, false); assertThatThrownBy(() -> parser.parse(new StringReader(STRICT_DUPLICATE_DETECTION_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -404,7 +404,7 @@ public void testStrictDuplicateDetectionDefault() throws Exception { } @Test - public void testStrictDuplicateDetectionEnabled() throws Exception { + void testStrictDuplicateDetectionEnabled() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, true); assertThatThrownBy(() -> parser.parse(new StringReader(STRICT_DUPLICATE_DETECTION_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) @@ -412,7 +412,7 @@ public void testStrictDuplicateDetectionEnabled() throws Exception { } @Test - public void testStrictDuplicateDetectionDisabled() throws Exception { + void testStrictDuplicateDetectionDisabled() throws Exception { parser.set(JSONSettings.STRICT_DUPLICATE_DETECTION, false); assertThatThrownBy(() -> parser.parse(new StringReader(STRICT_DUPLICATE_DETECTION_TEST_STRING), "")) .isInstanceOf(RDFParseException.class) diff --git a/core/rio/rdfxml/pom.xml b/core/rio/rdfxml/pom.xml index a7a45dafcb2..10d70e10a8a 100644 --- a/core/rio/rdfxml/pom.xml +++ b/core/rio/rdfxml/pom.xml @@ -56,5 +56,10 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserCustomTest.java b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserCustomTest.java index f194cd0077d..c2071b97051 100644 --- a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserCustomTest.java +++ b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserCustomTest.java @@ -41,7 +41,7 @@ * * @author Michael Grove */ -public class RDFXMLParserCustomTest { +class RDFXMLParserCustomTest { /** * Test with the default ParserConfig settings. Ie, setParserConfig is not called. @@ -49,7 +49,7 @@ public class RDFXMLParserCustomTest { * @throws Exception */ @Test - public void testEntityExpansionDefaultSettings() throws Exception { + void testEntityExpansionDefaultSettings() throws Exception { final Model aGraph = new LinkedHashModel(); ParseErrorCollector errorCollector = new ParseErrorCollector(); RDFParser aParser = Rio.createParser(RDFFormat.RDFXML) @@ -79,7 +79,7 @@ public void testEntityExpansionDefaultSettings() throws Exception { * @throws Exception */ @Test - public void testEntityExpansionUnrelatedSettings() throws Exception { + void testEntityExpansionUnrelatedSettings() throws Exception { final Model aGraph = new LinkedHashModel(); ParseErrorCollector errorCollector = new ParseErrorCollector(); ParserConfig config = new ParserConfig(); @@ -111,7 +111,7 @@ public void testEntityExpansionUnrelatedSettings() throws Exception { * @throws Exception */ @Test - public void testEntityExpansionSecureProcessing() throws Exception { + void testEntityExpansionSecureProcessing() throws Exception { final Model aGraph = new LinkedHashModel(); ParseErrorCollector errorCollector = new ParseErrorCollector(); RDFParser aParser = Rio.createParser(RDFFormat.RDFXML) @@ -148,7 +148,7 @@ public void testEntityExpansionSecureProcessing() throws Exception { @Disabled @Test @Timeout(10) - public void testEntityExpansionNoSecureProcessing() throws Exception { + void testEntityExpansionNoSecureProcessing() throws Exception { final Model aGraph = new LinkedHashModel(); ParseErrorCollector errorCollector = new ParseErrorCollector(); RDFParser aParser = Rio.createParser(RDFFormat.RDFXML) @@ -173,7 +173,7 @@ public void testEntityExpansionNoSecureProcessing() throws Exception { } @Test - public void testParseCollection() throws Exception { + void testParseCollection() throws Exception { // Example from: // http://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-parsetype-Collection StringBuilder string = new StringBuilder(); @@ -198,7 +198,7 @@ public void testParseCollection() throws Exception { } @Test - public void testParseCommentAtStart() throws Exception { + void testParseCommentAtStart() throws Exception { // Example from: // http://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-parsetype-Collection StringBuilder string = new StringBuilder(); @@ -218,12 +218,12 @@ public void testParseCommentAtStart() throws Exception { } @Test - public void testSupportedSettings() throws Exception { + void testSupportedSettings() throws Exception { assertEquals(26, Rio.createParser(RDFFormat.RDFXML).getSupportedSettings().size()); } @Test - public void tset() throws IOException { + void tset() throws IOException { ValueFactory vf = SimpleValueFactory.getInstance(); Model mm = new LinkedHashModel(); mm.add(vf.createStatement(vf.createIRI("urn:foo:момтен.т=2-"), RDF.TYPE, vf.createIRI("urn:foo:момтен"))); diff --git a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserTest.java b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserTest.java index 8419abd3da1..7d800bf34de 100644 --- a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserTest.java +++ b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLParserTest.java @@ -41,7 +41,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class RDFXMLParserTest { +class RDFXMLParserTest { private ValueFactory vf; @@ -54,7 +54,7 @@ public class RDFXMLParserTest { private Locale platformLocale; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { platformLocale = Locale.getDefault(); Locale.setDefault(Locale.ENGLISH); @@ -68,12 +68,12 @@ public void setUp() throws Exception { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { Locale.setDefault(platformLocale); } @Test - public void rdfXmlLoadedFromInsideAJarResolvesRelativeUris() throws Exception { + void rdfXmlLoadedFromInsideAJarResolvesRelativeUris() throws Exception { URL zipfileUrl = this.getClass().getResource("/org/eclipse/rdf4j/rio/rdfxml/sample-with-rdfxml-data.zip"); assertNotNull(zipfileUrl, "The sample-data.zip file must be present for this test"); @@ -116,7 +116,7 @@ public void rdfXmlLoadedFromInsideAJarResolvesRelativeUris() throws Exception { } @Test - public void testIgnoreExternalGeneralEntity() throws Exception { + void testIgnoreExternalGeneralEntity() throws Exception { try (final InputStream in = this.getClass() .getResourceAsStream("/org/eclipse/rdf4j/rio/rdfxml/rdfxml-external-general-entity.rdf")) { parser.parse(in, ""); @@ -137,7 +137,7 @@ public void testIgnoreExternalGeneralEntity() throws Exception { } @Test - public void testFatalErrorDoctypeDecl() throws Exception { + void testFatalErrorDoctypeDecl() throws Exception { // configure parser to disallow doctype declarations parser.getParserConfig().set(XMLParserSettings.DISALLOW_DOCTYPE_DECL, true); @@ -158,7 +158,7 @@ public void testFatalErrorDoctypeDecl() throws Exception { } @Test - public void testIgnoreExternalParamEntity() throws Exception { + void testIgnoreExternalParamEntity() throws Exception { // configure parser to allow doctype declarations parser.getParserConfig().set(XMLParserSettings.DISALLOW_DOCTYPE_DECL, false); @@ -174,7 +174,7 @@ public void testIgnoreExternalParamEntity() throws Exception { } @Test - public void testRDFXMLWhitespace() throws Exception { + void testRDFXMLWhitespace() throws Exception { try (final InputStream in = this.getClass() .getResourceAsStream("/org/eclipse/rdf4j/rio/rdfxml/rdfxml-whitespace-literal.rdf")) { parser.parse(in, ""); @@ -186,7 +186,7 @@ public void testRDFXMLWhitespace() throws Exception { } @Test - public void testFatalErrorPrologContent() throws Exception { + void testFatalErrorPrologContent() throws Exception { try (final InputStream in = this.getClass() .getResourceAsStream("/org/eclipse/rdf4j/rio/rdfxml/not-an-rdfxml-file.rdf")) { parser.parse(in, ""); @@ -200,7 +200,7 @@ public void testFatalErrorPrologContent() throws Exception { } @Test - public void testInsertUsedContextPrefixes() { + void testInsertUsedContextPrefixes() { Set inputCollection = new LinkedHashSet<>(); StatementCollector inputCollector = new StatementCollector(inputCollection); diff --git a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLPrettyWriterBackgroundTest.java b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLPrettyWriterBackgroundTest.java index 00192b433f4..994f398bce0 100644 --- a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLPrettyWriterBackgroundTest.java +++ b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLPrettyWriterBackgroundTest.java @@ -76,7 +76,7 @@ private static List rdfOpenTags(String s) throws IOException { } @Test - public void sequenceItemsAreAbbreviated() throws RDFHandlerException, IOException { + void sequenceItemsAreAbbreviated() throws RDFHandlerException, IOException { StringWriter writer = new StringWriter(); RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer); @@ -98,7 +98,7 @@ public void sequenceItemsAreAbbreviated() throws RDFHandlerException, IOExceptio } @Test - public void outOfSequenceItemsAreNotAbbreviated() throws RDFHandlerException, IOException { + void outOfSequenceItemsAreNotAbbreviated() throws RDFHandlerException, IOException { StringWriter writer = new StringWriter(); RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer); @@ -120,7 +120,7 @@ public void outOfSequenceItemsAreNotAbbreviated() throws RDFHandlerException, IO } @Test - public void inSequenceItemsMixedWithOtherElementsAreAbbreviated() throws RDFHandlerException, IOException { + void inSequenceItemsMixedWithOtherElementsAreAbbreviated() throws RDFHandlerException, IOException { StringWriter writer = new StringWriter(); RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer); diff --git a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLPrettyWriterTest.java b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLPrettyWriterTest.java index 88657bc1643..43a6fd92f3b 100644 --- a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLPrettyWriterTest.java +++ b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLPrettyWriterTest.java @@ -74,7 +74,7 @@ private static List rdfOpenTags(String s) throws IOException { } @Test - public void sequenceItemsAreAbbreviated() throws RDFHandlerException, IOException { + void sequenceItemsAreAbbreviated() throws RDFHandlerException, IOException { StringWriter writer = new StringWriter(); RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer); @@ -96,7 +96,7 @@ public void sequenceItemsAreAbbreviated() throws RDFHandlerException, IOExceptio } @Test - public void outOfSequenceItemsAreNotAbbreviated() throws RDFHandlerException, IOException { + void outOfSequenceItemsAreNotAbbreviated() throws RDFHandlerException, IOException { StringWriter writer = new StringWriter(); RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer); @@ -118,7 +118,7 @@ public void outOfSequenceItemsAreNotAbbreviated() throws RDFHandlerException, IO } @Test - public void compactXMLPrintTest() throws RDFHandlerException, IOException, ClassNotFoundException, + void compactXMLPrintTest() throws RDFHandlerException, IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { OutputStream outputStream = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(outputStream); @@ -158,7 +158,7 @@ public void compactXMLPrintTest() throws RDFHandlerException, IOException, Class } @Test - public void inSequenceItemsMixedWithOtherElementsAreAbbreviated() throws RDFHandlerException, IOException { + void inSequenceItemsMixedWithOtherElementsAreAbbreviated() throws RDFHandlerException, IOException { StringWriter writer = new StringWriter(); RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer); diff --git a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLWriterTest.java b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLWriterTest.java index 554ee085567..046b5d63eda 100644 --- a/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLWriterTest.java +++ b/core/rio/rdfxml/src/test/java/org/eclipse/rdf4j/rio/rdfxml/RDFXMLWriterTest.java @@ -34,27 +34,27 @@ protected void setupWriterConfig(WriterConfig config) { } @Test - public void singleQuotesAttributes() { + void singleQuotesAttributes() { String str = writeQuotable(true, false); assertTrue(str.startsWith(""), "No single quotes around attributes"); } @Test - public void singleQuotesAttributesText() { + void singleQuotesAttributesText() { String str = writeQuotable(true, true); assertTrue(str.contains("'"), "Quotes not replaced by entities"); } @Test - public void doubleQuotesAttributes() { + void doubleQuotesAttributes() { String str = writeQuotable(false, false); assertTrue(str.startsWith(""), "Not double quotes around attributes"); } @Test - public void doubleQuotesText() { + void doubleQuotesText() { String str = writeQuotable(false, true); System.err.println(str); diff --git a/core/rio/trig/pom.xml b/core/rio/trig/pom.xml index 06172c2ccd3..65ea9180f3c 100644 --- a/core/rio/trig/pom.xml +++ b/core/rio/trig/pom.xml @@ -56,5 +56,10 @@ assertj-core test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trig/TriGParserCustomTest.java b/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trig/TriGParserCustomTest.java index e2d3d43938b..d6c3c84cdaa 100644 --- a/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trig/TriGParserCustomTest.java +++ b/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trig/TriGParserCustomTest.java @@ -43,7 +43,7 @@ * @author Peter Ansell */ @Timeout(value = 10, unit = TimeUnit.MINUTES) -public class TriGParserCustomTest { +class TriGParserCustomTest { private ValueFactory vf; private ParserConfig settingsNoVerifyLangTag; @@ -58,7 +58,7 @@ public class TriGParserCustomTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { vf = SimpleValueFactory.getInstance(); settingsNoVerifyLangTag = new ParserConfig(); settingsNoVerifyLangTag.set(BasicParserSettings.VERIFY_LANGUAGE_TAGS, false); @@ -69,7 +69,7 @@ public void setUp() throws Exception { } @Test - public void testSPARQLGraphKeyword() throws Exception { + void testSPARQLGraphKeyword() throws Exception { Model model = Rio.parse(new StringReader("GRAPH { [] \"Foo\" }"), "", RDFFormat.TRIG); @@ -82,7 +82,7 @@ public void testSPARQLGraphKeyword() throws Exception { } @Test - public void testGraph() throws Exception { + void testGraph() throws Exception { Model model = Rio.parse(new StringReader(" { [] \"Foo\" }"), "", RDFFormat.TRIG); @@ -95,7 +95,7 @@ public void testGraph() throws Exception { } @Test - public void testGraphLocalNameGraph() throws Exception { + void testGraphLocalNameGraph() throws Exception { Model model = Rio.parse( new StringReader("@prefix graph: .\n graph:a { [] \"Foo\" }"), "", RDFFormat.TRIG); @@ -109,7 +109,7 @@ public void testGraphLocalNameGraph() throws Exception { } @Test - public void testGraphLocalNameIntegerGraph() throws Exception { + void testGraphLocalNameIntegerGraph() throws Exception { Model model = Rio.parse( new StringReader("@prefix graph: .\n graph:1 { [] \"Foo\" }"), "", RDFFormat.TRIG); @@ -123,7 +123,7 @@ public void testGraphLocalNameIntegerGraph() throws Exception { } @Test - public void testGraphLocalNameNotGraph() throws Exception { + void testGraphLocalNameNotGraph() throws Exception { Model model = Rio.parse( new StringReader("@prefix ex: .\n ex:a { [] \"Foo\" }"), "", RDFFormat.TRIG); @@ -137,7 +137,7 @@ public void testGraphLocalNameNotGraph() throws Exception { } @Test - public void testGraphLocalNameIntegerNotGraph() throws Exception { + void testGraphLocalNameIntegerNotGraph() throws Exception { Model model = Rio.parse( new StringReader("@prefix ex: .\n ex:1 { [] \"Foo\" }"), "", RDFFormat.TRIG); @@ -151,39 +151,39 @@ public void testGraphLocalNameIntegerNotGraph() throws Exception { } @Test - public void testTrailingSemicolon() throws Exception { + void testTrailingSemicolon() throws Exception { Rio.parse(new StringReader("{ ;}"), "", RDFFormat.TRIG); } @Test - public void testAnonymousGraph1() throws Exception { + void testAnonymousGraph1() throws Exception { Rio.parse(new StringReader("PREFIX : \n GRAPH [] { :s :p :o }"), "", RDFFormat.TRIG); } @Test - public void testAnonymousGraph2() throws Exception { + void testAnonymousGraph2() throws Exception { Rio.parse(new StringReader("PREFIX : \n [] { :s :p :o }"), "", RDFFormat.TRIG); } @Test - public void testTurtle() throws Exception { + void testTurtle() throws Exception { Rio.parse(new StringReader(" "), "", RDFFormat.TRIG); } @Test - public void testMinimalWhitespace() throws Exception { + void testMinimalWhitespace() throws Exception { Rio.parse(this.getClass().getResourceAsStream("/testcases/trig/trig-syntax-minimal-whitespace-01.trig"), "", RDFFormat.TRIG); } @Test - public void testMinimalWhitespaceLine12() throws Exception { + void testMinimalWhitespaceLine12() throws Exception { Rio.parse(new StringReader("@prefix : . {_:s:p :o ._:s:p\"Alice\". _:s:p _:o .}"), "", RDFFormat.TRIG); } @Test - public void testBadPname02() throws Exception { + void testBadPname02() throws Exception { try { Rio.parse(new StringReader("@prefix : . {:a%2 :p :o .}"), "", RDFFormat.TRIG); fail("Did not receive expected exception"); @@ -193,38 +193,38 @@ public void testBadPname02() throws Exception { } @Test - public void testSupportedSettings() throws Exception { + void testSupportedSettings() throws Exception { assertThat(Rio.createParser(RDFFormat.TRIG).getSupportedSettings()).hasSize(15); } @Test - public void testParseTruePrefix() throws Exception { + void testParseTruePrefix() throws Exception { Rio.parse(new StringReader("@prefix true: . {true:s true:p true:o .}"), "", RDFFormat.TRIG); } @Test - public void testParseTrig_booleanLiteral() throws Exception { + void testParseTrig_booleanLiteral() throws Exception { String trig = "{\n" + " true.\n" + "}"; Model m = Rio.parse(new StringReader(trig), "http://ex/", RDFFormat.TRIG); assertEquals(1, m.size()); } @Test - public void testParseTrig_booleanLiteral_space() throws Exception { + void testParseTrig_booleanLiteral_space() throws Exception { String trig = "{\n" + " true .\n" + "}"; Model m = Rio.parse(new StringReader(trig), "http://ex/", RDFFormat.TRIG); assertEquals(1, m.size()); } @Test - public void testParseTrig_intLiteral() throws Exception { + void testParseTrig_intLiteral() throws Exception { String trig = "{\n" + " 1.\n" + "}"; Model m = Rio.parse(new StringReader(trig), "http://ex/", RDFFormat.TRIG); assertEquals(1, Models.objectLiteral(m).get().intValue()); } @Test - public void testParseTrig_doubleLiteral() throws Exception { + void testParseTrig_doubleLiteral() throws Exception { String trig = "{\n" + " 1.2.\n" + "}"; Model m = Rio.parse(new StringReader(trig), "http://ex/", RDFFormat.TRIG); assertEquals(1.2d, Models.objectLiteral(m).get().doubleValue(), 0.01); diff --git a/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trigstar/TriGStarMimeTypeRDFFormatTest.java b/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trigstar/TriGStarMimeTypeRDFFormatTest.java index c1fe8659478..0bb64733de7 100644 --- a/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trigstar/TriGStarMimeTypeRDFFormatTest.java +++ b/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trigstar/TriGStarMimeTypeRDFFormatTest.java @@ -23,40 +23,40 @@ /** * @author Pavel Mihaylov */ -public class TriGStarMimeTypeRDFFormatTest { +class TriGStarMimeTypeRDFFormatTest { private final RDFFormat expectedRDFFormat = RDFFormat.TRIGSTAR; @Test - public void testApplicationXTrigStar() { + void testApplicationXTrigStar() { assertEquals(expectedRDFFormat, Rio.getParserFormatForMIMEType("application/x-trigstar") .orElseThrow(Rio.unsupportedFormat(expectedRDFFormat))); } @Test - public void testApplicationXTrigStarUtf8() { + void testApplicationXTrigStarUtf8() { assertEquals(RDFFormat.TRIGSTAR, Rio.getParserFormatForMIMEType("application/x-trigstar;charset=UTF-8") .orElseThrow(Rio.unsupportedFormat(expectedRDFFormat))); } @Test - public void testRDFFormatParser() { + void testRDFFormatParser() { assertEquals(expectedRDFFormat, new TriGStarParser().getRDFFormat()); } @Test - public void testRDFFormatWriter() throws IOException { + void testRDFFormatWriter() throws IOException { try (Writer w = new StringWriter()) { assertEquals(expectedRDFFormat, new TriGStarWriter(w).getRDFFormat()); } } @Test - public void testRDFFormatParserFactory() { + void testRDFFormatParserFactory() { assertEquals(expectedRDFFormat, new TriGStarParserFactory().getRDFFormat()); } @Test - public void testRDFFormatWriterFactory() { + void testRDFFormatWriterFactory() { assertEquals(expectedRDFFormat, new TriGStarWriterFactory().getRDFFormat()); } } diff --git a/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trigstar/TriGStarParserTest.java b/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trigstar/TriGStarParserTest.java index 038d37062ea..aa3e0bfa7cc 100644 --- a/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trigstar/TriGStarParserTest.java +++ b/core/rio/trig/src/test/java/org/eclipse/rdf4j/rio/trigstar/TriGStarParserTest.java @@ -39,7 +39,7 @@ /** * @author Pavel Mihaylov */ -public class TriGStarParserTest { +class TriGStarParserTest { private TriGStarParser parser; private final ValueFactory vf = SimpleValueFactory.getInstance(); @@ -53,7 +53,7 @@ public class TriGStarParserTest { private final SimpleParseLocationListener locationListener = new SimpleParseLocationListener(); @BeforeEach - public void setUp() { + void setUp() { parser = new TriGStarParser(); parser.setParseErrorListener(errorCollector); parser.setRDFHandler(statementCollector); @@ -61,7 +61,7 @@ public void setUp() { } @Test - public void testParseRDFStarData() throws IOException { + void testParseRDFStarData() throws IOException { IRI graph = vf.createIRI("http://example.com/rdfstar"); IRI bob = vf.createIRI("http://example.com/bob"); @@ -111,7 +111,7 @@ public void testParseRDFStarData() throws IOException { } @Test - public void testTripleInPredicate() throws IOException { + void testTripleInPredicate() throws IOException { String data = "@prefix ex: .\ngraph ex:G { ex:Example <<>> \"foo\"}"; try (Reader r = new StringReader(data)) { parser.parse(r, baseURI); @@ -122,7 +122,7 @@ public void testTripleInPredicate() throws IOException { } @Test - public void testTripleInGraph() throws IOException { + void testTripleInGraph() throws IOException { String data = "@prefix ex: .\ngraph << >> {ex:Example ex:p \"foo\" }"; try (Reader r = new StringReader(data)) { parser.parse(r, baseURI); @@ -133,7 +133,7 @@ public void testTripleInGraph() throws IOException { } @Test - public void testTripleInDatatype() throws IOException { + void testTripleInDatatype() throws IOException { String data = "@prefix ex: .\ngraph ex:g { ex:Example ex:p \"foo\"^^<<>> }"; try (Reader r = new StringReader(data)) { parser.parse(r, baseURI); diff --git a/core/rio/trix/pom.xml b/core/rio/trix/pom.xml index b524750f587..344a4427398 100644 --- a/core/rio/trix/pom.xml +++ b/core/rio/trix/pom.xml @@ -44,5 +44,10 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/rio/trix/src/test/java/org/eclipse/rdf4j/rio/trix/TriXParserTest.java b/core/rio/trix/src/test/java/org/eclipse/rdf4j/rio/trix/TriXParserTest.java index dfe20c8b5b2..6f01d8b171e 100644 --- a/core/rio/trix/src/test/java/org/eclipse/rdf4j/rio/trix/TriXParserTest.java +++ b/core/rio/trix/src/test/java/org/eclipse/rdf4j/rio/trix/TriXParserTest.java @@ -31,7 +31,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class TriXParserTest { +class TriXParserTest { private ValueFactory vf; @@ -44,7 +44,7 @@ public class TriXParserTest { private Locale platformLocale; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { platformLocale = Locale.getDefault(); Locale.setDefault(Locale.ENGLISH); @@ -57,12 +57,12 @@ public void setUp() throws Exception { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { Locale.setDefault(platformLocale); } @Test - public void testFatalErrorDoctypeDecl() throws Exception { + void testFatalErrorDoctypeDecl() throws Exception { // configure parser to disallow doctype declarations parser.getParserConfig().set(XMLParserSettings.DISALLOW_DOCTYPE_DECL, true); @@ -84,7 +84,7 @@ public void testFatalErrorDoctypeDecl() throws Exception { } @Test - public void testIgnoreExternalDTD_default() throws Exception { + void testIgnoreExternalDTD_default() throws Exception { try (final InputStream in = this.getClass() .getResourceAsStream("/org/eclipse/rdf4j/rio/trix/trix-xxe-external-dtd.trix")) { parser.parse(in, ""); @@ -105,7 +105,7 @@ public void testIgnoreExternalDTD_default() throws Exception { } @Test - public void testLoadExternalDTD_configured() throws Exception { + void testLoadExternalDTD_configured() throws Exception { parser.getParserConfig().set(XMLParserSettings.LOAD_EXTERNAL_DTD, true); try (final InputStream in = this.getClass() .getResourceAsStream("/org/eclipse/rdf4j/rio/trix/trix-xxe-external-dtd.trix")) { @@ -117,7 +117,7 @@ public void testLoadExternalDTD_configured() throws Exception { } @Test - public void testIgnoreExternalGeneralEntity() throws Exception { + void testIgnoreExternalGeneralEntity() throws Exception { try (final InputStream in = this.getClass() .getResourceAsStream("/org/eclipse/rdf4j/rio/trix/trix-xxe-external-entity.trix")) { parser.parse(in, ""); @@ -138,7 +138,7 @@ public void testIgnoreExternalGeneralEntity() throws Exception { } @Test - public void testIgnoreExternalParameterEntity() throws Exception { + void testIgnoreExternalParameterEntity() throws Exception { // configure parser to allow doctype declarations parser.getParserConfig().set(XMLParserSettings.DISALLOW_DOCTYPE_DECL, false); @@ -154,7 +154,7 @@ public void testIgnoreExternalParameterEntity() throws Exception { } @Test - public void testFatalErrorPrologContent() throws Exception { + void testFatalErrorPrologContent() throws Exception { try (final InputStream in = this.getClass() .getResourceAsStream("/org/eclipse/rdf4j/rio/trix/not-a-trix-file.trix")) { parser.parse(in, ""); diff --git a/core/rio/turtle/pom.xml b/core/rio/turtle/pom.xml index 2368f22761b..12ce71af4d4 100644 --- a/core/rio/turtle/pom.xml +++ b/core/rio/turtle/pom.xml @@ -61,5 +61,10 @@ assertj-core test + + org.junit.jupiter + junit-jupiter + test + diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/CustomTurtleParserTest.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/CustomTurtleParserTest.java index 9bbc137d313..99cc1090be7 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/CustomTurtleParserTest.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/CustomTurtleParserTest.java @@ -52,7 +52,7 @@ * @author Peter Ansell */ @Timeout(1000) -public class CustomTurtleParserTest { +class CustomTurtleParserTest { private ValueFactory vf; @@ -70,7 +70,7 @@ public class CustomTurtleParserTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { vf = SimpleValueFactory.getInstance(); settingsNoVerifyLangTag = new ParserConfig(); settingsNoVerifyLangTag.set(BasicParserSettings.VERIFY_LANGUAGE_TAGS, false); @@ -81,7 +81,7 @@ public void setUp() throws Exception { } @Test - public void testSES1887NoLangTagFailure() throws Exception { + void testSES1887NoLangTagFailure() throws Exception { try { Rio.parse(new StringReader(" \"Foo\"@."), "", RDFFormat.TURTLE); fail("Did not receive an exception"); @@ -91,7 +91,7 @@ public void testSES1887NoLangTagFailure() throws Exception { } @Test - public void testSES1887NoLangTagFailure2() throws Exception { + void testSES1887NoLangTagFailure2() throws Exception { try { // NOTE: Bad things may happen when VERIFY_LANGUAGE_TAGS is turned off // on a file of this structure @@ -104,7 +104,7 @@ public void testSES1887NoLangTagFailure2() throws Exception { } @Test - public void testSES1887Whitespace() throws Exception { + void testSES1887Whitespace() throws Exception { Model model = Rio.parse(new StringReader(" \"Foo\"@fr-FR ."), "", RDFFormat.TURTLE); @@ -113,7 +113,7 @@ public void testSES1887Whitespace() throws Exception { } @Test - public void testSES1887Period() throws Exception { + void testSES1887Period() throws Exception { Model model = Rio.parse(new StringReader(" \"Foo\"@fr-FR."), "", RDFFormat.TURTLE); @@ -122,7 +122,7 @@ public void testSES1887Period() throws Exception { } @Test - public void testSES1887Semicolon() throws Exception { + void testSES1887Semicolon() throws Exception { Model model = Rio.parse(new StringReader( " \"Foo\"@fr-FR;\"Blah\"@en-AU."), "", RDFFormat.TURTLE); @@ -133,7 +133,7 @@ public void testSES1887Semicolon() throws Exception { } @Test - public void testSES1887Comma() throws Exception { + void testSES1887Comma() throws Exception { Model model = Rio.parse(new StringReader(" \"Foo\"@fr-FR,\"Blah\"@en-AU."), "", RDFFormat.TURTLE); @@ -143,7 +143,7 @@ public void testSES1887Comma() throws Exception { } @Test - public void testSES1887CloseParentheses() throws Exception { + void testSES1887CloseParentheses() throws Exception { Model model = Rio.parse(new StringReader(" (\"Foo\"@fr-FR)."), "", RDFFormat.TURTLE); @@ -152,7 +152,7 @@ public void testSES1887CloseParentheses() throws Exception { } @Test - public void testSES1887CloseSquareBracket() throws Exception { + void testSES1887CloseSquareBracket() throws Exception { Model model = Rio.parse(new StringReader("[ \"Foo\"@fr-FR]."), "", RDFFormat.TURTLE); @@ -161,7 +161,7 @@ public void testSES1887CloseSquareBracket() throws Exception { } @Test - public void testLiteralWithNewlines() throws Exception { + void testLiteralWithNewlines() throws Exception { String namespace = "http://www.foo.com/bar#"; String okLiteralString = "Literal \n without \n new line at the beginning. \n "; String errLiteralString = "\n Literal \n with \n new line at the beginning. \n "; @@ -184,47 +184,47 @@ public void testLiteralWithNewlines() throws Exception { } @Test - public void testSupportedSettings() throws Exception { + void testSupportedSettings() throws Exception { assertThat(parser.getSupportedSettings()).hasSize(15); } @Test - public void testSES1988BlankNodePeriodEOF() throws Exception { + void testSES1988BlankNodePeriodEOF() throws Exception { Model model = Rio.parse(new StringReader(" _:blank."), "", RDFFormat.TURTLE); assertEquals(1, model.size()); } @Test - public void testSES1988BlankNodePeriodSpace() throws Exception { + void testSES1988BlankNodePeriodSpace() throws Exception { Model model = Rio.parse(new StringReader(" _:blank. "), "", RDFFormat.TURTLE); assertEquals(1, model.size()); } @Test - public void testSES1988BlankNodePeriodTab() throws Exception { + void testSES1988BlankNodePeriodTab() throws Exception { Model model = Rio.parse(new StringReader(" _:blank.\t"), "", RDFFormat.TURTLE); assertEquals(1, model.size()); } @Test - public void testSES1988BlankNodePeriodNewLine() throws Exception { + void testSES1988BlankNodePeriodNewLine() throws Exception { Model model = Rio.parse(new StringReader(" _:blank.\n"), "", RDFFormat.TURTLE); assertEquals(1, model.size()); } @Test - public void testSES1988BlankNodePeriodCarriageReturn() throws Exception { + void testSES1988BlankNodePeriodCarriageReturn() throws Exception { Model model = Rio.parse(new StringReader(" _:blank.\r"), "", RDFFormat.TURTLE); assertEquals(1, model.size()); } @Test - public void testSES1988BlankNodePeriodURI() throws Exception { + void testSES1988BlankNodePeriodURI() throws Exception { Model model = Rio.parse(new StringReader(" _:blank. ."), "", RDFFormat.TURTLE); @@ -232,7 +232,7 @@ public void testSES1988BlankNodePeriodURI() throws Exception { } @Test - public void testSES1988BlankNodePeriodBNode() throws Exception { + void testSES1988BlankNodePeriodBNode() throws Exception { Model model = Rio.parse(new StringReader(" _:blank._:blank ."), "", RDFFormat.TURTLE); @@ -240,7 +240,7 @@ public void testSES1988BlankNodePeriodBNode() throws Exception { } @Test - public void testSES2013BlankNodeSemiColonBNodeSpaceA() throws Exception { + void testSES2013BlankNodeSemiColonBNodeSpaceA() throws Exception { Model model = Rio.parse(new StringReader(" a _:c2; a ."), "", RDFFormat.TURTLE); assertEquals(2, model.size()); @@ -248,7 +248,7 @@ public void testSES2013BlankNodeSemiColonBNodeSpaceA() throws Exception { } @Test - public void testSES2013BlankNodeSemiColonBNodeA() throws Exception { + void testSES2013BlankNodeSemiColonBNodeA() throws Exception { Model model = Rio.parse(new StringReader(" a _:c2;a ."), "", RDFFormat.TURTLE); assertEquals(2, model.size()); @@ -256,7 +256,7 @@ public void testSES2013BlankNodeSemiColonBNodeA() throws Exception { } @Test - public void testSES2013BlankNodeSemiColonBNodeSpaceURI() throws Exception { + void testSES2013BlankNodeSemiColonBNodeSpaceURI() throws Exception { Model model = Rio.parse(new StringReader(" a _:c2; ."), "", RDFFormat.TURTLE); assertEquals(2, model.size()); @@ -264,7 +264,7 @@ public void testSES2013BlankNodeSemiColonBNodeSpaceURI() throws Exception { } @Test - public void testSES2013BlankNodeSemiColonBNodeURI() throws Exception { + void testSES2013BlankNodeSemiColonBNodeURI() throws Exception { Model model = Rio.parse(new StringReader(" a _:c2; ."), "", RDFFormat.TURTLE); assertEquals(2, model.size()); @@ -272,7 +272,7 @@ public void testSES2013BlankNodeSemiColonBNodeURI() throws Exception { } @Test - public void testSES2019ParseLongLiterals() throws Exception { + void testSES2019ParseLongLiterals() throws Exception { parser.parse(this.getClass().getResourceAsStream("/testcases/turtle/turtle-long-literals-test.ttl"), ""); assertTrue(errors.getWarnings().isEmpty()); @@ -288,7 +288,7 @@ public void testSES2019ParseLongLiterals() throws Exception { } @Test - public void testSES2086PeriodEndingLocalNamesFailure1() throws Exception { + void testSES2086PeriodEndingLocalNamesFailure1() throws Exception { try { Rio.parse( new StringReader( @@ -302,7 +302,7 @@ public void testSES2086PeriodEndingLocalNamesFailure1() throws Exception { } @Test - public void testSES2086PeriodEndingLocalNamesFailure2() throws Exception { + void testSES2086PeriodEndingLocalNamesFailure2() throws Exception { try { Rio.parse(new StringReader( "@prefix ns: . ns:uriWithDot. a ns:Product ; ns:title \"An example subject ending with a dot.\" . "), @@ -316,7 +316,7 @@ public void testSES2086PeriodEndingLocalNamesFailure2() throws Exception { } @Test - public void testSES2086PeriodEndingLocalNamesFailure3() throws Exception { + void testSES2086PeriodEndingLocalNamesFailure3() throws Exception { try { Rio.parse(new StringReader( "@prefix ns: . ns:1 a ns:Product ; ns:affects ns:4 , ns:16 , ns:uriWithDot. ; ns:title \"An example entity with uriWithDot as an object\" . "), @@ -329,7 +329,7 @@ public void testSES2086PeriodEndingLocalNamesFailure3() throws Exception { } @Test - public void testSES2086PeriodEndingLocalNamesFailure4() throws Exception { + void testSES2086PeriodEndingLocalNamesFailure4() throws Exception { try { Rio.parse(new StringReader( "@prefix ns: . ns:1 a ns:uriWithDot. ; ns:title \"An example entity with uriWithDot as an object\" . "), @@ -342,7 +342,7 @@ public void testSES2086PeriodEndingLocalNamesFailure4() throws Exception { } @Test - public void testSES2165LiteralSpaceDatatypeNewline() throws Exception { + void testSES2165LiteralSpaceDatatypeNewline() throws Exception { Model model = Rio.parse(new StringReader(" \"testliteral\"^^\n ."), "", RDFFormat.TURTLE); @@ -352,7 +352,7 @@ public void testSES2165LiteralSpaceDatatypeNewline() throws Exception { } @Test - public void testSES2165LiteralSpaceDatatypeTab() throws Exception { + void testSES2165LiteralSpaceDatatypeTab() throws Exception { Model model = Rio.parse(new StringReader(" \"testliteral\"^^\t ."), "", RDFFormat.TURTLE); @@ -362,7 +362,7 @@ public void testSES2165LiteralSpaceDatatypeTab() throws Exception { } @Test - public void testSES2165LiteralSpaceDatatypeCarriageReturn() throws Exception { + void testSES2165LiteralSpaceDatatypeCarriageReturn() throws Exception { Model model = Rio.parse(new StringReader(" \"testliteral\"^^\r ."), "", RDFFormat.TURTLE); @@ -372,7 +372,7 @@ public void testSES2165LiteralSpaceDatatypeCarriageReturn() throws Exception { } @Test - public void testSES2165LiteralSpaceDatatypeSpace() throws Exception { + void testSES2165LiteralSpaceDatatypeSpace() throws Exception { Model model = Rio.parse(new StringReader(" \"testliteral\"^^ ."), "", RDFFormat.TURTLE); @@ -382,7 +382,7 @@ public void testSES2165LiteralSpaceDatatypeSpace() throws Exception { } @Test - public void testSES2165LiteralSpaceDatatypeComment() throws Exception { + void testSES2165LiteralSpaceDatatypeComment() throws Exception { Model model = Rio.parse(new StringReader(" \"testliteral\"^^#comment\n ."), "", RDFFormat.TURTLE); @@ -392,7 +392,7 @@ public void testSES2165LiteralSpaceDatatypeComment() throws Exception { } @Test - public void testParsingDefaultNamespaces() throws Exception { + void testParsingDefaultNamespaces() throws Exception { Model model = Rio.parse(new StringReader(" skos:broader ."), "", RDFFormat.TURTLE); assertEquals(1, model.size()); @@ -400,7 +400,7 @@ public void testParsingDefaultNamespaces() throws Exception { } @Test - public void testParsingNamespacesWithOption() throws Exception { + void testParsingNamespacesWithOption() throws Exception { ParserConfig aConfig = new ParserConfig(); aConfig.set(BasicParserSettings.NAMESPACES, @@ -414,7 +414,7 @@ public void testParsingNamespacesWithOption() throws Exception { } @Test - public void testParsingNamespacesWithOverride() throws Exception { + void testParsingNamespacesWithOverride() throws Exception { ParserConfig aConfig = new ParserConfig(); aConfig.set(BasicParserSettings.NAMESPACES, @@ -428,7 +428,7 @@ public void testParsingNamespacesWithOverride() throws Exception { } @Test - public void test780IRISpace() throws Exception { + void test780IRISpace() throws Exception { String ttl = "_:b25978837 a ."; try { Rio.parse(new StringReader(ttl), "", RDFFormat.TURTLE); @@ -446,33 +446,33 @@ public void test780IRISpace() throws Exception { } @Test - public void testParseTruePrefix() throws Exception { + void testParseTruePrefix() throws Exception { Rio.parse(new StringReader("@prefix true: . true:s true:p true:o ."), "", RDFFormat.TURTLE); } @Test - public void testParseBooleanLiteral() throws Exception { + void testParseBooleanLiteral() throws Exception { String ttl = " true.\n"; Model m = Rio.parse(new StringReader(ttl), "http://ex/", RDFFormat.TURTLE); assertEquals(1, m.size()); } @Test - public void testParseBooleanLiteral_space() throws Exception { + void testParseBooleanLiteral_space() throws Exception { String ttl = " true .\n"; Model m = Rio.parse(new StringReader(ttl), "http://ex/", RDFFormat.TURTLE); assertEquals(1, m.size()); } @Test - public void testParseIntLiteral() throws Exception { + void testParseIntLiteral() throws Exception { String ttl = " 1.\n"; Model m = Rio.parse(new StringReader(ttl), "http://ex/", RDFFormat.TURTLE); assertEquals(1, Models.objectLiteral(m).get().intValue()); } @Test - public void testParseDoubleLiteral() throws Exception { + void testParseDoubleLiteral() throws Exception { String ttl = " 1.2.\n"; Model m = Rio.parse(new StringReader(ttl), "http://ex/", RDFFormat.TURTLE); assertEquals(1.2d, Models.objectLiteral(m).get().doubleValue(), 0.01); diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleMimeTypeTest.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleMimeTypeTest.java index 4729d08be93..bc7b55adf70 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleMimeTypeTest.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleMimeTypeTest.java @@ -19,22 +19,22 @@ /** * @author James Leigh */ -public class TurtleMimeTypeTest { +class TurtleMimeTypeTest { @Test - public void testTextTurtle() { + void testTextTurtle() { assertEquals(RDFFormat.TURTLE, Rio.getParserFormatForMIMEType("text/turtle").orElseThrow(Rio.unsupportedFormat(RDFFormat.TURTLE))); } @Test - public void testTextTurtleUtf8() { + void testTextTurtleUtf8() { assertEquals(RDFFormat.TURTLE, Rio.getParserFormatForMIMEType("text/turtle;charset=UTF-8") .orElseThrow(Rio.unsupportedFormat(RDFFormat.TURTLE))); } @Test - public void testApplicationXTurtle() { + void testApplicationXTurtle() { assertEquals(RDFFormat.TURTLE, Rio.getParserFormatForMIMEType("application/x-turtle") .orElseThrow(Rio.unsupportedFormat(RDFFormat.TURTLE))); } diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleParserTest.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleParserTest.java index 355ed0f7cde..c78641e77b1 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleParserTest.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleParserTest.java @@ -49,7 +49,7 @@ /** * @author jeen */ -public class TurtleParserTest { +class TurtleParserTest { private TurtleParser parser; @@ -66,7 +66,7 @@ public class TurtleParserTest { private final SimpleParseLocationListener locationListener = new SimpleParseLocationListener(); @BeforeEach - public void setUp() { + void setUp() { parser = new TurtleParser(); parser.setParseErrorListener(errorCollector); parser.setRDFHandler(statementCollector); @@ -74,7 +74,7 @@ public void setUp() { } @Test - public void testParseDots() throws IOException { + void testParseDots() throws IOException { String data = prefixes + " ex:foo.bar ex:\\~foo.bar ex:foobar. "; parser.parse(new StringReader(data), baseURI); @@ -89,7 +89,7 @@ public void testParseDots() throws IOException { } @Test - public void testParseIllegalURIFatal() throws IOException { + void testParseIllegalURIFatal() throws IOException { String data = " ; . . "; try { @@ -101,7 +101,7 @@ public void testParseIllegalURIFatal() throws IOException { } @Test - public void testParseIllegalURINonFatal() throws IOException { + void testParseIllegalURINonFatal() throws IOException { String data = " ; . . "; parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_URI_SYNTAX); @@ -114,7 +114,7 @@ public void testParseIllegalURINonFatal() throws IOException { } @Test - public void testParseIllegalURINoVerify() throws IOException { + void testParseIllegalURINoVerify() throws IOException { String data = " ; . . "; parser.getParserConfig().set(BasicParserSettings.VERIFY_URI_SYNTAX, false); @@ -128,7 +128,7 @@ public void testParseIllegalURINoVerify() throws IOException { } @Test - public void testParseIllegalDatatypeURIFatal() throws IOException { + void testParseIllegalDatatypeURIFatal() throws IOException { String data = " \"a\"^^ ; . . "; try { @@ -140,7 +140,7 @@ public void testParseIllegalDatatypeURIFatal() throws IOException { } @Test - public void testParseIllegalDatatypeValueFatalIRI() throws IOException { + void testParseIllegalDatatypeValueFatalIRI() throws IOException { String data = " \"a\"^^\"b\" ; . . "; try { @@ -152,7 +152,7 @@ public void testParseIllegalDatatypeValueFatalIRI() throws IOException { } @Test - public void testParseIllegalDatatypeURINonFatal() throws IOException { + void testParseIllegalDatatypeURINonFatal() throws IOException { String data = " \"a\"^^ ; . . "; parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_URI_SYNTAX); @@ -165,7 +165,7 @@ public void testParseIllegalDatatypeURINonFatal() throws IOException { } @Test - public void testParseIllegalDatatypValueINonFatalIRI() throws IOException { + void testParseIllegalDatatypValueINonFatalIRI() throws IOException { String data = " \"a\"^^\"b\" ; . . "; try { @@ -178,7 +178,7 @@ public void testParseIllegalDatatypValueINonFatalIRI() throws IOException { } @Test - public void testParseIllegalDatatypeURINoVerify() throws IOException { + void testParseIllegalDatatypeURINoVerify() throws IOException { String data = " \"a\"^^ ; . . "; parser.getParserConfig().set(BasicParserSettings.VERIFY_URI_SYNTAX, false); @@ -192,7 +192,7 @@ public void testParseIllegalDatatypeURINoVerify() throws IOException { } @Test - public void testParseIllegalDatatypValueINoVerify() throws IOException { + void testParseIllegalDatatypValueINoVerify() throws IOException { String data = " \"a\"^^\"b\" ; . . "; try { @@ -205,7 +205,7 @@ public void testParseIllegalDatatypValueINoVerify() throws IOException { } @Test - public void testUnparsableIRIFatal() throws IOException { + void testUnparsableIRIFatal() throws IOException { // subject IRI is not processable by ParsedIRI String data = " . "; @@ -219,7 +219,7 @@ public void testUnparsableIRIFatal() throws IOException { } @Test - public void testUnparsableIRINonFatal() throws IOException { + void testUnparsableIRINonFatal() throws IOException { // subject IRI is not processable by ParsedIRI String data = " . ."; parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_URI_SYNTAX); @@ -233,7 +233,7 @@ public void testUnparsableIRINonFatal() throws IOException { } @Test - public void testUnparsableIRINoVerify() throws IOException { + void testUnparsableIRINoVerify() throws IOException { // subject IRI is not processable by ParsedIRI String data = " . ."; parser.getParserConfig().set(BasicParserSettings.VERIFY_URI_SYNTAX, false); @@ -248,7 +248,7 @@ public void testUnparsableIRINoVerify() throws IOException { } @Test - public void testParseBNodes() throws IOException { + void testParseBNodes() throws IOException { String data = prefixes + " [ :p :o1,:2 ] . "; parser.parse(new StringReader(data), baseURI); @@ -263,7 +263,7 @@ public void testParseBNodes() throws IOException { } @Test - public void testLineNumberReporting() throws IOException { + void testLineNumberReporting() throws IOException { InputStream in = this.getClass().getResourceAsStream("/test-newlines.ttl"); try { parser.parse(in, baseURI); @@ -280,7 +280,7 @@ public void testLineNumberReporting() throws IOException { } @Test - public void testLineNumberReportingNoErrorsSingleLine() throws IOException { + void testLineNumberReportingNoErrorsSingleLine() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader(" ."); @@ -290,7 +290,7 @@ public void testLineNumberReportingNoErrorsSingleLine() throws IOException { } @Test - public void testLineNumberReportingNoErrorsSingleLineEndNewline() throws IOException { + void testLineNumberReportingNoErrorsSingleLineEndNewline() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader(" .\n"); @@ -300,7 +300,7 @@ public void testLineNumberReportingNoErrorsSingleLineEndNewline() throws IOExcep } @Test - public void testLineNumberReportingNoErrorsMultipleLinesNoEndNewline() throws IOException { + void testLineNumberReportingNoErrorsMultipleLinesNoEndNewline() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader(" .\n ."); @@ -310,7 +310,7 @@ public void testLineNumberReportingNoErrorsMultipleLinesNoEndNewline() throws IO } @Test - public void testLineNumberReportingNoErrorsMultipleLinesEndNewline() throws IOException { + void testLineNumberReportingNoErrorsMultipleLinesEndNewline() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader(" .\n .\n"); @@ -320,7 +320,7 @@ public void testLineNumberReportingNoErrorsMultipleLinesEndNewline() throws IOEx } @Test - public void testLineNumberReportingOnlySingleCommentNoEndline() throws IOException { + void testLineNumberReportingOnlySingleCommentNoEndline() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader("# This is just a comment"); @@ -330,7 +330,7 @@ public void testLineNumberReportingOnlySingleCommentNoEndline() throws IOExcepti } @Test - public void testLineNumberReportingOnlySingleCommentEndline() throws IOException { + void testLineNumberReportingOnlySingleCommentEndline() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader("# This is just a comment\n"); @@ -340,7 +340,7 @@ public void testLineNumberReportingOnlySingleCommentEndline() throws IOException } @Test - public void testLineNumberReportingOnlySingleCommentCarriageReturn() throws IOException { + void testLineNumberReportingOnlySingleCommentCarriageReturn() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader("# This is just a comment\r"); @@ -350,7 +350,7 @@ public void testLineNumberReportingOnlySingleCommentCarriageReturn() throws IOEx } @Test - public void testLineNumberReportingOnlySingleCommentCarriageReturnNewline() throws IOException { + void testLineNumberReportingOnlySingleCommentCarriageReturnNewline() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader("# This is just a comment\r\n"); @@ -360,7 +360,7 @@ public void testLineNumberReportingOnlySingleCommentCarriageReturnNewline() thro } @Test - public void testLineNumberReportingInLongStringLiterals() throws IOException { + void testLineNumberReportingInLongStringLiterals() throws IOException { assertEquals(0, locationListener.getLineNo()); assertEquals(0, locationListener.getColumnNo()); Reader in = new StringReader(" \"\"\"is\nallowed\nin\na very long string\"\"\" ."); @@ -370,59 +370,59 @@ public void testLineNumberReportingInLongStringLiterals() throws IOException { } @Test - public void testParseBooleanLiteralComma() throws IOException { + void testParseBooleanLiteralComma() throws IOException { String data = " true, false ."; Reader r = new StringReader(data); try { parser.parse(r, baseURI); - assertTrue(statementCollector.getStatements().size() == 2); + assertEquals(2, statementCollector.getStatements().size()); } catch (RDFParseException e) { fail("parse error on correct data: " + e.getMessage()); } } @Test - public void testParseBooleanLiteralWhitespaceComma() throws IOException { + void testParseBooleanLiteralWhitespaceComma() throws IOException { String data = " true , false ."; Reader r = new StringReader(data); try { parser.parse(r, baseURI); - assertTrue(statementCollector.getStatements().size() == 2); + assertEquals(2, statementCollector.getStatements().size()); } catch (RDFParseException e) { fail("parse error on correct data: " + e.getMessage()); } } @Test - public void testParseBooleanLiteralSemicolumn() throws IOException { + void testParseBooleanLiteralSemicolumn() throws IOException { String data = " true; false ."; Reader r = new StringReader(data); try { parser.parse(r, baseURI); - assertTrue(statementCollector.getStatements().size() == 2); + assertEquals(2, statementCollector.getStatements().size()); } catch (RDFParseException e) { fail("parse error on correct data: " + e.getMessage()); } } @Test - public void testParseBooleanLiteralWhitespaceSemicolumn() throws IOException { + void testParseBooleanLiteralWhitespaceSemicolumn() throws IOException { String data = " true ; false ."; Reader r = new StringReader(data); try { parser.parse(r, baseURI); - assertTrue(statementCollector.getStatements().size() == 2); + assertEquals(2, statementCollector.getStatements().size()); } catch (RDFParseException e) { fail("parse error on correct data: " + e.getMessage()); } } @Test - public void rdfXmlLoadedFromInsideAJarResolvesRelativeUris() throws IOException { + void rdfXmlLoadedFromInsideAJarResolvesRelativeUris() throws IOException { URL zipfileUrl = TurtleParserTest.class.getResource("sample-with-turtle-data.zip"); assertNotNull(zipfileUrl, "The sample-with-turtle-data.zip file must be present for this test"); @@ -468,7 +468,7 @@ public void rdfXmlLoadedFromInsideAJarResolvesRelativeUris() throws IOException } @Test - public void testIllegalNewlineInQuotedObjectLiteral() throws IOException { + void testIllegalNewlineInQuotedObjectLiteral() throws IOException { String data = " \"not\nallowed\" ."; Reader r = new StringReader(data); @@ -481,39 +481,39 @@ public void testIllegalNewlineInQuotedObjectLiteral() throws IOException { } @Test - public void testLegalNewlineInTripleQuotedObjectLiteral() throws IOException { + void testLegalNewlineInTripleQuotedObjectLiteral() throws IOException { String data = " \"\"\"is\nallowed\"\"\" ."; Reader r = new StringReader(data); try { parser.parse(r, baseURI); - assertTrue(statementCollector.getStatements().size() == 1); + assertEquals(1, statementCollector.getStatements().size()); } catch (RDFParseException e) { fail("New line is legal inside triple quoted literal"); } } @Test - public void testLegalUnicodeInTripleSubject() throws IOException { + void testLegalUnicodeInTripleSubject() throws IOException { String data = "@prefix xsd: .\n a xsd:string ."; Reader r = new StringReader(data); try { parser.parse(r, baseURI); - assertTrue(statementCollector.getStatements().size() == 1); + assertEquals(1, statementCollector.getStatements().size()); } catch (RDFParseException e) { fail("Complex unicode characters should be parsed correctly (" + e.getMessage() + ")"); } } @Test - public void testOverflowingUnicodeInTripleSubject() throws IOException { + void testOverflowingUnicodeInTripleSubject() throws IOException { String data = "@prefix xsd: .\n a xsd:string ."; Reader r = new StringReader(data); try { parser.parse(r, baseURI); - assertTrue(statementCollector.getStatements().size() == 1); + assertEquals(1, statementCollector.getStatements().size()); } catch (RDFParseException e) { fail("Complex unicode characters should be parsed correctly (" + e.getMessage() + ")"); } @@ -523,7 +523,7 @@ public void testOverflowingUnicodeInTripleSubject() throws IOException { * Extend standard Turtle parser to also accept RDF-star data (see GH-2511) */ @Test - public void testParseRDFStarData() throws IOException { + void testParseRDFStarData() throws IOException { IRI bob = vf.createIRI("http://example.com/bob"); IRI alice = vf.createIRI("http://example.com/alice"); IRI book = vf.createIRI("http://example.com/book"); @@ -571,7 +571,7 @@ public void testParseRDFStarData() throws IOException { } @Test - public void testParseRDFStar_TurtleStarDisabled() throws IOException { + void testParseRDFStar_TurtleStarDisabled() throws IOException { parser.getParserConfig().set(TurtleParserSettings.ACCEPT_TURTLESTAR, false); try (InputStream in = this.getClass().getResourceAsStream("/test-rdfstar.ttls")) { diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtlePrettyWriterTest.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtlePrettyWriterTest.java index 5fc191de626..b08d3cb1b34 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtlePrettyWriterTest.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtlePrettyWriterTest.java @@ -112,7 +112,7 @@ public void testRoundTripPreserveBNodeIds() throws Exception { } @Test - public void testAbbreviateNumbers() throws Exception { + void testAbbreviateNumbers() throws Exception { StringWriter sw = new StringWriter(); WriterConfig config = new WriterConfig(); @@ -127,7 +127,7 @@ public void testAbbreviateNumbers() throws Exception { } @Test - public void testDontAbbreviateNumbers() throws Exception { + void testDontAbbreviateNumbers() throws Exception { StringWriter sw = new StringWriter(); WriterConfig config = new WriterConfig(); diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleUtilTest.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleUtilTest.java index 41e451d18fd..927f51ec755 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleUtilTest.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleUtilTest.java @@ -23,20 +23,20 @@ * * @author Peter Ansell */ -public class TurtleUtilTest { +class TurtleUtilTest { /** * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { } /** * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { } /** @@ -44,7 +44,7 @@ public void tearDown() throws Exception { */ @Disabled("TODO: Implement me") @Test - public final void testFindURISplitIndex() { + final void testFindURISplitIndex() { } @@ -52,7 +52,7 @@ public final void testFindURISplitIndex() { * Test method for {@link org.eclipse.rdf4j.rio.turtle.TurtleUtil#isWhitespace(int)}. */ @Test - public final void testIsWhitespace() { + final void testIsWhitespace() { assertFalse(TurtleUtil.isWhitespace(';')); } @@ -61,7 +61,7 @@ public final void testIsWhitespace() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPN_CHARS_BASE() { + final void testIsPN_CHARS_BASE() { } @@ -70,7 +70,7 @@ public final void testIsPN_CHARS_BASE() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPN_CHARS_U() { + final void testIsPN_CHARS_U() { } @@ -79,7 +79,7 @@ public final void testIsPN_CHARS_U() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPN_CHARS() { + final void testIsPN_CHARS() { } @@ -88,7 +88,7 @@ public final void testIsPN_CHARS() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPrefixStartChar() { + final void testIsPrefixStartChar() { } @@ -97,7 +97,7 @@ public final void testIsPrefixStartChar() { */ @Disabled("TODO: Implement me") @Test - public final void testIsNameStartChar() { + final void testIsNameStartChar() { } @@ -105,7 +105,7 @@ public final void testIsNameStartChar() { * Test method for {@link org.eclipse.rdf4j.rio.turtle.TurtleUtil#isNameChar(int)}. */ @Test - public final void testIsNameChar() { + final void testIsNameChar() { assertFalse(TurtleUtil.isNameChar(';')); } @@ -114,7 +114,7 @@ public final void testIsNameChar() { */ @Disabled("TODO: Implement me") @Test - public final void testIsNameEndChar() { + final void testIsNameEndChar() { } @@ -123,7 +123,7 @@ public final void testIsNameEndChar() { */ @Disabled("TODO: Implement me") @Test - public final void testIsLocalEscapedChar() { + final void testIsLocalEscapedChar() { } @@ -132,7 +132,7 @@ public final void testIsLocalEscapedChar() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPrefixChar() { + final void testIsPrefixChar() { } @@ -141,7 +141,7 @@ public final void testIsPrefixChar() { */ @Disabled("TODO: Implement me") @Test - public final void testIsLanguageStartChar() { + final void testIsLanguageStartChar() { } @@ -150,7 +150,7 @@ public final void testIsLanguageStartChar() { */ @Disabled("TODO: Implement me") @Test - public final void testIsLanguageChar() { + final void testIsLanguageChar() { } @@ -159,7 +159,7 @@ public final void testIsLanguageChar() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPN_PREFIX() { + final void testIsPN_PREFIX() { } @@ -168,7 +168,7 @@ public final void testIsPN_PREFIX() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPLX_START() { + final void testIsPLX_START() { } @@ -177,7 +177,7 @@ public final void testIsPLX_START() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPERCENT() { + final void testIsPERCENT() { } @@ -186,7 +186,7 @@ public final void testIsPERCENT() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPLX_INTERNAL() { + final void testIsPLX_INTERNAL() { } @@ -195,7 +195,7 @@ public final void testIsPLX_INTERNAL() { */ @Disabled("TODO: Implement me") @Test - public final void testIsPN_LOCAL_ESC() { + final void testIsPN_LOCAL_ESC() { } @@ -203,7 +203,7 @@ public final void testIsPN_LOCAL_ESC() { * Test method for {@link org.eclipse.rdf4j.rio.turtle.TurtleUtil#isPN_LOCAL(java.lang.String)}. */ @Test - public final void testIsPN_LOCAL() { + final void testIsPN_LOCAL() { assertTrue(TurtleUtil.isPN_LOCAL("2bar")); assertTrue(TurtleUtil.isPN_LOCAL("foobar")); assertTrue(TurtleUtil.isPN_LOCAL("_foobar")); @@ -238,7 +238,7 @@ public final void testIsPN_LOCAL() { */ @Disabled("TODO: Implement me") @Test - public final void testEncodeString() { + final void testEncodeString() { } @@ -247,7 +247,7 @@ public final void testEncodeString() { */ @Disabled("TODO: Implement me") @Test - public final void testEncodeLongString() { + final void testEncodeLongString() { } @@ -256,7 +256,7 @@ public final void testEncodeLongString() { */ @Disabled("TODO: Implement me") @Test - public final void testEncodeURIString() { + final void testEncodeURIString() { } @@ -265,7 +265,7 @@ public final void testEncodeURIString() { */ @Disabled("TODO: Implement me") @Test - public final void testDecodeString() { + final void testDecodeString() { } diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleWriterTest.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleWriterTest.java index edfe25f7fe0..ef33bf437ab 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleWriterTest.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtle/TurtleWriterTest.java @@ -50,7 +50,7 @@ protected void setupWriterConfig(WriterConfig config) { } @Test - public void testBlankNodeInlining1() throws Exception { + void testBlankNodeInlining1() throws Exception { Model expected = Rio.parse( new StringReader( String.join("\n", "", @@ -98,7 +98,7 @@ public void testBlankNodeInlining1() throws Exception { } @Test - public void testBlankNodeInlining2() throws Exception { + void testBlankNodeInlining2() throws Exception { Model expected = Rio.parse( new StringReader( String.join("\n", "", @@ -125,7 +125,7 @@ public void testBlankNodeInlining2() throws Exception { * Test that blank node subjects are processed in correct order even when not supplied in order. */ @Test - public void testBlanknodeInlining_SubjectOrder() throws Exception { + void testBlanknodeInlining_SubjectOrder() throws Exception { String data = "@prefix rdfs: .\n" + "@prefix xsd: .\n" + @@ -160,7 +160,7 @@ public void testBlanknodeInlining_SubjectOrder() throws Exception { } @Test - public void testNoBuffering() throws Exception { + void testNoBuffering() throws Exception { String data = "@prefix rdfs: .\n" + "@prefix xsd: .\n" + "@prefix rep: .\n" + @@ -193,7 +193,7 @@ public void testNoBuffering() throws Exception { @Test @Disabled - public void anotherBnodeTest() throws Exception { + void anotherBnodeTest() throws Exception { String data = "@prefix ex: .\n" + "@prefix sh: .\n" + "@prefix rdf: .\n" + @@ -320,7 +320,7 @@ public void anotherBnodeTest() throws Exception { } @Test - public void testBNodeValuesInList() throws Exception { + void testBNodeValuesInList() throws Exception { String data = "" + "@prefix ex: .\n" + "\n" + @@ -338,7 +338,7 @@ public void testBNodeValuesInList() throws Exception { } @Test - public void testBNodeValuesInList2() throws Exception { + void testBNodeValuesInList2() throws Exception { String data = "" + "@prefix ex: .\n" + "\n" + @@ -355,7 +355,7 @@ public void testBNodeValuesInList2() throws Exception { } @Test - public void testBNodeValuesInList3() throws Exception { + void testBNodeValuesInList3() throws Exception { String data = "" + "@prefix ex: .\n" + "\n" + @@ -373,7 +373,7 @@ public void testBNodeValuesInList3() throws Exception { } @Test - public void testInvalidList_nonListPredicate() throws Exception { + void testInvalidList_nonListPredicate() throws Exception { String data = "@prefix ex: .\n" + "@prefix rdf: .\n" + "\n" + @@ -396,7 +396,7 @@ public void testInvalidList_nonListPredicate() throws Exception { } @Test - public void testInvalidList_multipleRdfRestPredicates() throws Exception { + void testInvalidList_multipleRdfRestPredicates() throws Exception { String data = "@prefix ex: .\n" + "@prefix foaf: .\n" + "@prefix xsd: .\n" + @@ -563,7 +563,7 @@ public void testInvalidList_multipleRdfRestPredicates() throws Exception { } @Test - public void testBlankNodeInlining_directCircularReference() throws Exception { + void testBlankNodeInlining_directCircularReference() throws Exception { String data = "@prefix dc: .\n" + "@prefix ns0: .\n" + "@prefix xsd: .\n" + @@ -599,7 +599,7 @@ public void testBlankNodeInlining_directCircularReference() throws Exception { } @Test - public void testBlankNodeInlining_indirectCircularReference() throws Exception { + void testBlankNodeInlining_indirectCircularReference() throws Exception { String data = "@prefix dc: .\n" + "@prefix ns0: .\n" + "@prefix xsd: .\n" + @@ -635,7 +635,7 @@ public void testBlankNodeInlining_indirectCircularReference() throws Exception { } @Test - public void testBlankNodeInlining_indirectCircularReferenceWithIRI() throws Exception { + void testBlankNodeInlining_indirectCircularReferenceWithIRI() throws Exception { String data = "@prefix dc: .\n" + "@prefix ns0: .\n" + "@prefix xsd: .\n" + @@ -672,7 +672,7 @@ public void testBlankNodeInlining_indirectCircularReferenceWithIRI() throws Exce } @Test - public void testIgnoreAbbreviateNumbers() throws Exception { + void testIgnoreAbbreviateNumbers() throws Exception { StringWriter sw = new StringWriter(); WriterConfig config = new WriterConfig(); diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TestGH3323StackoverflowRDFStar.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TestGH3323StackoverflowRDFStar.java index 2d7c66eb2d1..9aa55142beb 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TestGH3323StackoverflowRDFStar.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TestGH3323StackoverflowRDFStar.java @@ -20,10 +20,10 @@ import org.eclipse.rdf4j.rio.Rio; import org.junit.jupiter.api.Test; -public class TestGH3323StackoverflowRDFStar { +class TestGH3323StackoverflowRDFStar { @Test - public void testUsingParser() throws RDFParseException, RDFHandlerException, IOException { + void testUsingParser() throws RDFParseException, RDFHandlerException, IOException { String ntdata = " ."; RDFParser parser = Rio.createParser(RDFFormat.TURTLESTAR); parser.parse(new StringReader(ntdata)); diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TurtleStarMimeTypeRDFFormatTest.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TurtleStarMimeTypeRDFFormatTest.java index 4154daf44e1..19b476a47c7 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TurtleStarMimeTypeRDFFormatTest.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TurtleStarMimeTypeRDFFormatTest.java @@ -23,40 +23,40 @@ /** * @author Pavel Mihaylov */ -public class TurtleStarMimeTypeRDFFormatTest { +class TurtleStarMimeTypeRDFFormatTest { private final RDFFormat expectedRDFFormat = RDFFormat.TURTLESTAR; @Test - public void testApplicationXTurtleStarUtf8() { + void testApplicationXTurtleStarUtf8() { assertEquals(expectedRDFFormat, Rio.getParserFormatForMIMEType("application/x-turtlestar;charset=UTF-8") .orElseThrow(Rio.unsupportedFormat(expectedRDFFormat))); } @Test - public void testApplicationXTurtleStar() { + void testApplicationXTurtleStar() { assertEquals(expectedRDFFormat, Rio.getParserFormatForMIMEType("application/x-turtlestar") .orElseThrow(Rio.unsupportedFormat(expectedRDFFormat))); } @Test - public void testRDFFormatParser() { + void testRDFFormatParser() { assertEquals(expectedRDFFormat, new TurtleStarParser().getRDFFormat()); } @Test - public void testRDFFormatWriter() throws IOException { + void testRDFFormatWriter() throws IOException { try (Writer w = new StringWriter()) { assertEquals(expectedRDFFormat, new TurtleStarWriter(w).getRDFFormat()); } } @Test - public void testRDFFormatParserFactory() { + void testRDFFormatParserFactory() { assertEquals(expectedRDFFormat, new TurtleStarParserFactory().getRDFFormat()); } @Test - public void testRDFFormatWriterFactory() { + void testRDFFormatWriterFactory() { assertEquals(expectedRDFFormat, new TurtleStarWriterFactory().getRDFFormat()); } } diff --git a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TurtleStarParserTest.java b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TurtleStarParserTest.java index 06f6a8db890..43f9018134d 100644 --- a/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TurtleStarParserTest.java +++ b/core/rio/turtle/src/test/java/org/eclipse/rdf4j/rio/turtlestar/TurtleStarParserTest.java @@ -46,7 +46,7 @@ /** * @author Pavel Mihaylov */ -public class TurtleStarParserTest { +class TurtleStarParserTest { private TurtleStarParser parser; private final ValueFactory vf = SimpleValueFactory.getInstance(); @@ -60,7 +60,7 @@ public class TurtleStarParserTest { private final SimpleParseLocationListener locationListener = new SimpleParseLocationListener(); @BeforeEach - public void setUp() { + void setUp() { parser = new TurtleStarParser(); parser.setParseErrorListener(errorCollector); parser.setRDFHandler(statementCollector); @@ -68,7 +68,7 @@ public void setUp() { } @Test - public void testParseRDFStarData() throws IOException { + void testParseRDFStarData() throws IOException { IRI bob = vf.createIRI("http://example.com/bob"); IRI alice = vf.createIRI("http://example.com/alice"); IRI book = vf.createIRI("http://example.com/book"); @@ -116,7 +116,7 @@ public void testParseRDFStarData() throws IOException { } @Test - public void testParseRDFStar_TurtleStarDisabled() throws IOException { + void testParseRDFStar_TurtleStarDisabled() throws IOException { parser.getParserConfig().set(TurtleParserSettings.ACCEPT_TURTLESTAR, false); try (InputStream in = this.getClass().getResourceAsStream("/test-rdfstar.ttls")) { @@ -127,7 +127,7 @@ public void testParseRDFStar_TurtleStarDisabled() throws IOException { } @Test - public void testTripleInPredicate() throws IOException { + void testTripleInPredicate() throws IOException { String data = "@prefix ex: .\nex:Example << >> \"foo\" ."; try (Reader r = new StringReader(data)) { parser.parse(r, baseURI); @@ -138,7 +138,7 @@ public void testTripleInPredicate() throws IOException { } @Test - public void testTripleInDatatype() throws IOException { + void testTripleInDatatype() throws IOException { String data = "@prefix ex: .\nex:Example ex:p \"foo\"^^<< >> ."; try (Reader r = new StringReader(data)) { parser.parse(r, baseURI); @@ -149,7 +149,7 @@ public void testTripleInDatatype() throws IOException { } @Test - public void testTripleAnnotation() throws IOException { + void testTripleAnnotation() throws IOException { IRI example = iri("http://example.com/Example"); IRI a = iri("urn:a"), b = iri("urn:b"), c = iri("urn:c"); Literal foo = literal("foo"); @@ -165,7 +165,7 @@ public void testTripleAnnotation() throws IOException { } @Test - public void testTripleMultipleAnnotationSameObject() throws IOException { + void testTripleMultipleAnnotationSameObject() throws IOException { IRI example = iri("http://example.com/Example"); IRI a = iri("urn:a"), b = iri("urn:b"), c = iri("urn:c"), d = iri("urn:d"); Literal foo = literal("foo"), bar = literal("bar"); @@ -187,7 +187,7 @@ public void testTripleMultipleAnnotationSameObject() throws IOException { } @Test - public void testTripleMultipleAnnotationMultipleObjects() throws IOException { + void testTripleMultipleAnnotationMultipleObjects() throws IOException { IRI example = iri("http://example.com/Example"); IRI a = iri("urn:a"), b = iri("urn:b"), c = iri("urn:c"), d = iri("urn:d"); Literal foo = literal("foo"), bar = literal("bar"); @@ -210,7 +210,7 @@ public void testTripleMultipleAnnotationMultipleObjects() throws IOException { } @Test - public void testMalformedTripleAnnotation() throws IOException { + void testMalformedTripleAnnotation() throws IOException { String data = "@prefix ex: .\nex:Example {| \"foo\" }."; try (Reader r = new StringReader(data)) { assertThatThrownBy(() -> parser.parse(r, baseURI)) diff --git a/core/sail/api/pom.xml b/core/sail/api/pom.xml index da6ab454c92..f35f1cfe3f2 100644 --- a/core/sail/api/pom.xml +++ b/core/sail/api/pom.xml @@ -39,6 +39,11 @@ org.slf4j slf4j-api + + org.junit.jupiter + junit-jupiter + test + org.openjdk.jmh jmh-core diff --git a/core/sail/api/src/test/java/org/eclipse/rdf4j/sail/helpers/AbstractSailTest.java b/core/sail/api/src/test/java/org/eclipse/rdf4j/sail/helpers/AbstractSailTest.java index c77a36204c1..62dbe0b4778 100644 --- a/core/sail/api/src/test/java/org/eclipse/rdf4j/sail/helpers/AbstractSailTest.java +++ b/core/sail/api/src/test/java/org/eclipse/rdf4j/sail/helpers/AbstractSailTest.java @@ -31,14 +31,14 @@ * * @author Jeen Broekstra */ -public class AbstractSailTest { +class AbstractSailTest { AbstractSail subject; private final Random random = new Random(43252333); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { subject = new AbstractSail() { @@ -72,14 +72,14 @@ protected SailConnection getConnectionInternal() throws SailException { } @Test - public void testAutoInitOnConnection() { + void testAutoInitOnConnection() { assertThat(subject.isInitialized()).isFalse(); SailConnection conn = subject.getConnection(); assertThat(subject.isInitialized()).isTrue(); } @Test - public void testExplicitInitBeforeConnection() { + void testExplicitInitBeforeConnection() { assertThat(subject.isInitialized()).isFalse(); subject.init(); SailConnection conn = subject.getConnection(); @@ -87,7 +87,7 @@ public void testExplicitInitBeforeConnection() { } @Test - public void testExplicitInitTwice() { + void testExplicitInitTwice() { assertThat(subject.isInitialized()).isFalse(); subject.init(); subject.init(); @@ -96,7 +96,7 @@ public void testExplicitInitTwice() { } @Test - public void testConcurrentAutoInit() throws Exception { + void testConcurrentAutoInit() throws Exception { int count = 200; CountDownLatch latch = new CountDownLatch(count); diff --git a/core/sail/api/src/test/java/org/eclipse/rdf4j/sail/helpers/NotifyingSailConnectionWrapperTest.java b/core/sail/api/src/test/java/org/eclipse/rdf4j/sail/helpers/NotifyingSailConnectionWrapperTest.java index ba051e6e5a4..c865fa6e4e1 100644 --- a/core/sail/api/src/test/java/org/eclipse/rdf4j/sail/helpers/NotifyingSailConnectionWrapperTest.java +++ b/core/sail/api/src/test/java/org/eclipse/rdf4j/sail/helpers/NotifyingSailConnectionWrapperTest.java @@ -30,15 +30,15 @@ * * @author Dale Visser */ -public class NotifyingSailConnectionWrapperTest { +class NotifyingSailConnectionWrapperTest { @BeforeAll - public static void setUpClass() throws Exception { + static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } @AfterAll - public static void afterAll() throws Exception { + static void afterAll() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } @@ -73,13 +73,13 @@ public int getCount() { TestListener listener = new TestListener(); @BeforeEach - public void setUp() throws SailException { + void setUp() throws SailException { wrapper = new NotifyingSailConnectionWrapper(delegate); factory = SimpleValueFactory.getInstance(); } @AfterEach - public void tearDown() throws SailException { + void tearDown() throws SailException { wrapper.close(); } @@ -89,7 +89,7 @@ public void tearDown() throws SailException { * @throws SailException */ @Test - public void testAddThenRemoveListener() throws SailException { + void testAddThenRemoveListener() throws SailException { wrapper.addConnectionListener(listener); verify(delegate).addConnectionListener(listener); wrapper.removeConnectionListener(listener); diff --git a/core/sail/base/pom.xml b/core/sail/base/pom.xml index 14915c9b46e..33579bf01b4 100644 --- a/core/sail/base/pom.xml +++ b/core/sail/base/pom.xml @@ -45,6 +45,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-repository-manager diff --git a/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/ChangesetTest.java b/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/ChangesetTest.java index 85a2f9aab80..0dcf62b8e6c 100644 --- a/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/ChangesetTest.java +++ b/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/ChangesetTest.java @@ -28,13 +28,13 @@ import org.eclipse.rdf4j.sail.SailException; import org.junit.jupiter.api.Test; -public class ChangesetTest { +class ChangesetTest { SimpleValueFactory vf = SimpleValueFactory.getInstance(); Resource[] allGraph = {}; @Test - public void testConcurrency() throws InterruptedException, ExecutionException { + void testConcurrency() throws InterruptedException, ExecutionException { Changeset changeset = getChangeset(); diff --git a/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/SnapshotSailStoreTest.java b/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/SnapshotSailStoreTest.java index d9906aff675..6c228c24352 100644 --- a/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/SnapshotSailStoreTest.java +++ b/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/SnapshotSailStoreTest.java @@ -38,7 +38,7 @@ /** * Minimal tests for the functionality of {@link SnapshotSailStore} */ -public class SnapshotSailStoreTest { +class SnapshotSailStoreTest { /** * Base no-op sink as base for testing @@ -97,7 +97,7 @@ public void deprecate(Statement statement) throws SailException { } @Test - public void testRollbackExceptionDuringCommit() { + void testRollbackExceptionDuringCommit() { SnapshotSailStore sailStore = createSnapshotSailStore(level -> new TestSailSink() { @Override public void approve(Resource subj, IRI pred, Value obj, Resource ctx) throws SailException { diff --git a/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/config/BaseSailConfigTest.java b/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/config/BaseSailConfigTest.java index c6db324658b..f71011b6bff 100644 --- a/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/config/BaseSailConfigTest.java +++ b/core/sail/base/src/test/java/org/eclipse/rdf4j/sail/base/config/BaseSailConfigTest.java @@ -20,10 +20,10 @@ import org.eclipse.rdf4j.sail.config.SailConfigException; import org.junit.jupiter.api.Test; -public class BaseSailConfigTest { +class BaseSailConfigTest { @Test - public void testParseQueryEvaluationMode() throws Exception { + void testParseQueryEvaluationMode() throws Exception { var implNode = bnode(); { diff --git a/core/sail/elasticsearch-store/pom.xml b/core/sail/elasticsearch-store/pom.xml index 98716296116..743293c819c 100644 --- a/core/sail/elasticsearch-store/pom.xml +++ b/core/sail/elasticsearch-store/pom.xml @@ -56,6 +56,11 @@ + + org.junit.jupiter + junit-jupiter + test + org.apache.commons commons-lang3 diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreIT.java index 0bac77bae94..06bc1c85ce4 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreIT.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.elasticsearchstore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.IOException; @@ -53,7 +53,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ElasticsearchStoreIT { +class ElasticsearchStoreIT { private static final Logger logger = LoggerFactory.getLogger(ElasticsearchStoreIT.class); private static final SimpleValueFactory vf = SimpleValueFactory.getInstance(); @@ -63,17 +63,17 @@ public class ElasticsearchStoreIT { static File installLocation; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); } @AfterAll - public static void afterClass() throws IOException { + static void afterClass() throws IOException { TestHelpers.stopElasticsearch(runner); } @AfterEach - public void after() throws UnknownHostException { + void after() throws UnknownHostException { runner.admin().indices().refresh(Requests.refreshRequest("*")).actionGet(); printAllDocs(); @@ -82,7 +82,7 @@ public void after() throws UnknownHostException { } @BeforeEach - public void before() throws UnknownHostException { + void before() throws UnknownHostException { // embeddedElastic.refreshIndices(); // // embeddedElastic.deleteIndices(); @@ -127,14 +127,14 @@ private String[] getIndexes() { } @Test - public void testInstantiate() { + void testInstantiate() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex"); elasticsearchStore.shutDown(); } @Test - public void testGetConneciton() { + void testGetConneciton() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex"); try (NotifyingSailConnection connection = elasticsearchStore.getConnection()) { @@ -144,14 +144,14 @@ public void testGetConneciton() { } @Test - public void testSailRepository() { + void testSailRepository() { SailRepository elasticsearchStore = new SailRepository( new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex")); elasticsearchStore.shutDown(); } @Test - public void testGetSailRepositoryConneciton() { + void testGetSailRepositoryConneciton() { SailRepository elasticsearchStore = new SailRepository( new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex")); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -160,7 +160,7 @@ public void testGetSailRepositoryConneciton() { } @Test - public void testShutdownAndRecreate() { + void testShutdownAndRecreate() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex"); try (NotifyingSailConnection connection = elasticsearchStore.getConnection()) { @@ -181,7 +181,7 @@ public void testShutdownAndRecreate() { } @Test - public void testShutdownAndReinit() { + void testShutdownAndReinit() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex"); try (NotifyingSailConnection connection = elasticsearchStore.getConnection()) { @@ -195,7 +195,7 @@ public void testShutdownAndReinit() { } @Test - public void testAddRemoveData() { + void testAddRemoveData() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex"); try (NotifyingSailConnection connection = elasticsearchStore.getConnection()) { @@ -215,7 +215,7 @@ public void testAddRemoveData() { } @Test - public void testAddLargeDataset() { + void testAddLargeDataset() { StopWatch stopWatch = StopWatch.createStarted(); SailRepository elasticsearchStore = new SailRepository( new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex")); @@ -246,7 +246,7 @@ public void testAddLargeDataset() { } @Test - public void testGC() { + void testGC() { ClientProvider clientProvider = initElasticsearchStoreForGcTest(); @@ -276,7 +276,7 @@ private ClientProvider initElasticsearchStoreForGcTest() { } @Test - public void testNamespacePersistenc() { + void testNamespacePersistenc() { SailRepository elasticsearchStore = new SailRepository( new ElasticsearchStore("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER, "testindex")); diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreTransactionsIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreTransactionsIT.java index 33e07f414ae..ca66e06ec77 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreTransactionsIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreTransactionsIT.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.elasticsearchstore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.File; import java.io.IOException; @@ -78,7 +78,7 @@ public class ElasticsearchStoreTransactionsIT { private static ElasticsearchStore elasticsearchStore; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); @@ -88,13 +88,13 @@ public static void beforeClass() throws IOException, InterruptedException { } @AfterAll - public static void afterClass() throws IOException { + static void afterClass() throws IOException { elasticsearchStore.shutDown(); TestHelpers.stopElasticsearch(runner); } @BeforeEach - public void before() throws UnknownHostException { + void before() throws UnknownHostException { elasticsearchStore.setElasticsearchScrollTimeout(60000); @@ -157,7 +157,7 @@ private String[] getIndexes() { } @Test - public void testAddData() { + void testAddData() { try (NotifyingSailConnection connection = elasticsearchStore.getConnection()) { connection.begin(IsolationLevels.NONE); connection.addStatement(RDF.TYPE, RDF.TYPE, RDFS.RESOURCE); @@ -167,7 +167,7 @@ public void testAddData() { } @Test - public void testGetData() { + void testGetData() { try (NotifyingSailConnection connection = elasticsearchStore.getConnection()) { connection.begin(IsolationLevels.NONE); connection.addStatement(RDF.TYPE, RDF.TYPE, RDFS.RESOURCE); @@ -186,7 +186,7 @@ public void testGetData() { } @Test - public void testGetDataSailRepository() { + void testGetDataSailRepository() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { connection.add(RDF.TYPE, RDF.TYPE, RDFS.RESOURCE); @@ -203,7 +203,7 @@ public void testGetDataSailRepository() { } @Test - public void testGetDataSailRepositorySpecificStatement() { + void testGetDataSailRepositorySpecificStatement() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { connection.add(RDF.TYPE, RDF.TYPE, RDFS.RESOURCE); @@ -221,7 +221,7 @@ public void testGetDataSailRepositorySpecificStatement() { } @Test - public void testGetDataSailRepositoryBNodeSubject() { + void testGetDataSailRepositoryBNodeSubject() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -242,7 +242,7 @@ public void testGetDataSailRepositoryBNodeSubject() { } @Test - public void testGetDataSailRepositoryBNodeObject() { + void testGetDataSailRepositoryBNodeObject() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -264,7 +264,7 @@ public void testGetDataSailRepositoryBNodeObject() { } @Test - public void testGetDataSailRepositoryStringObject() { + void testGetDataSailRepositoryStringObject() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -285,7 +285,7 @@ public void testGetDataSailRepositoryStringObject() { } @Test - public void testGetDataSailRepositoryStringObjectWhitespace() { + void testGetDataSailRepositoryStringObjectWhitespace() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -306,7 +306,7 @@ public void testGetDataSailRepositoryStringObjectWhitespace() { } @Test - public void testGetDataSailRepositoryLongString() { + void testGetDataSailRepositoryLongString() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -330,7 +330,7 @@ public void testGetDataSailRepositoryLongString() { } @Test - public void testGetDataSailRepositoryDate() { + void testGetDataSailRepositoryDate() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -351,7 +351,7 @@ public void testGetDataSailRepositoryDate() { } @Test - public void testGetDataSailRepositoryLang() { + void testGetDataSailRepositoryLang() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -372,7 +372,7 @@ public void testGetDataSailRepositoryLang() { } @Test - public void testGetDataSailRepositoryIRISubjectWhitespace() { + void testGetDataSailRepositoryIRISubjectWhitespace() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -398,7 +398,7 @@ public void testGetDataSailRepositoryIRISubjectWhitespace() { } @Test - public void testGetDataSailRepositoryContextIRI() { + void testGetDataSailRepositoryContextIRI() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -478,7 +478,7 @@ public void testGetDataSailRepositoryContextIRI() { } @Test - public void sparqlTest() throws IOException { + void sparqlTest() throws IOException { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { connection.begin(IsolationLevels.NONE); @@ -515,7 +515,7 @@ public void sparqlTest() throws IOException { } @Test - public void testAddDelete() { + void testAddDelete() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -535,7 +535,7 @@ public void testAddDelete() { } @Test - public void testRollback() { + void testRollback() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -549,7 +549,7 @@ public void testRollback() { } @Test - public void testRollback2() { + void testRollback2() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -564,7 +564,7 @@ public void testRollback2() { } @Test - public void testRollback3() { + void testRollback3() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -580,7 +580,7 @@ public void testRollback3() { } @Test - public void testRollbackClear() { + void testRollbackClear() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -609,7 +609,7 @@ public void testRollbackClear() { } @Test - public void testRollbackClearSimple() { + void testRollbackClearSimple() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { @@ -632,7 +632,7 @@ public void testRollbackClearSimple() { } @Test - public void testHashCollision() { + void testHashCollision() { String fb = "FB"; String ea = "Ea"; @@ -665,7 +665,7 @@ public void testHashCollision() { // RepositoryException or something like that @Disabled("slow test") @Test - public void testScrollTimeout() throws InterruptedException { + void testScrollTimeout() throws InterruptedException { assertThrows(RepositoryException.class, () -> { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); this.elasticsearchStore.setElasticsearchScrollTimeout(1); @@ -694,7 +694,7 @@ public void testScrollTimeout() throws InterruptedException { } @Test - public void testAddSameStatement() { + void testAddSameStatement() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); @@ -724,7 +724,7 @@ public void testAddSameStatement() { } @Test - public void testAddSameStatement2() { + void testAddSameStatement2() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); @@ -752,7 +752,7 @@ public void testAddSameStatement2() { } @Test - public void testNamespace() { + void testNamespace() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); @@ -769,7 +769,7 @@ public void testNamespace() { } @Test - public void testClear() { + void testClear() { SailRepository elasticsearchStore = new SailRepository(this.elasticsearchStore); try (SailRepositoryConnection connection = elasticsearchStore.getConnection()) { diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreWalIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreWalIT.java index 9a6524e04eb..44c2c7ee8dd 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreWalIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/ElasticsearchStoreWalIT.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.elasticsearchstore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.IOException; @@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory; // Tests transaction failures that the Write-Ahead-Log should be able to recover from -public class ElasticsearchStoreWalIT { +class ElasticsearchStoreWalIT { private static final Logger logger = LoggerFactory.getLogger(ElasticsearchStoreWalIT.class); private static ElasticsearchClusterRunner runner; @@ -51,24 +51,24 @@ public class ElasticsearchStoreWalIT { static File installLocation; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); } @AfterAll - public static void afterClass() throws IOException { + static void afterClass() throws IOException { TestHelpers.stopElasticsearch(runner); } @AfterEach - public void after() throws UnknownHostException { + void after() throws UnknownHostException { runner.admin().indices().refresh(Requests.refreshRequest("*")).actionGet(); deleteAllIndexes(); } @BeforeEach - public void before() throws UnknownHostException { + void before() throws UnknownHostException { // embeddedElastic.refreshIndices(); // // embeddedElastic.deleteIndices(); @@ -103,7 +103,7 @@ private String[] getIndexes() { @Disabled // No WAL implemented yet @Test - public void testAddLargeDataset() { + void testAddLargeDataset() { boolean transactionFaild = false; int count = 100000; @@ -123,7 +123,7 @@ public void testAddLargeDataset() { long size = connection.size(); System.out.println(size); - assertEquals("Since transaction failed there should be no statements in the store", 0, size); + assertEquals(0, size, "Since transaction failed there should be no statements in the store"); } @@ -165,7 +165,7 @@ private void failedTransactionAdd(int count) { @Disabled // No WAL implemented yet @Test - public void testRemoveLargeDataset() { + void testRemoveLargeDataset() { int count = 100000; @@ -188,7 +188,7 @@ public void testRemoveLargeDataset() { long size = connection.size(); System.out.println(size); - assertEquals("Since transaction failed there should be no statements in the store", count, size); + assertEquals(count, size, "Since transaction failed there should be no statements in the store"); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/InferenceIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/InferenceIT.java index a79c85b60f7..5843222c6d0 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/InferenceIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/InferenceIT.java @@ -11,9 +11,9 @@ package org.eclipse.rdf4j.sail.elasticsearchstore; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.IOException; @@ -44,7 +44,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class InferenceIT { +class InferenceIT { private static final Logger logger = LoggerFactory.getLogger(ElasticsearchStoreIT.class); private static final SimpleValueFactory vf = SimpleValueFactory.getInstance(); @@ -56,20 +56,20 @@ public class InferenceIT { static File installLocation; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); singletonClientProvider = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } @AfterAll - public static void afterClass() throws Exception { + static void afterClass() throws Exception { singletonClientProvider.close(); TestHelpers.stopElasticsearch(runner); } @AfterEach - public void after() { + void after() { runner.admin().indices().refresh(Requests.refreshRequest("*")).actionGet(); deleteAllIndexes(); } @@ -100,7 +100,7 @@ private String[] getIndexes() { } @Test - public void initiallyInferredStatementsTest() { + void initiallyInferredStatementsTest() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore(singletonClientProvider, "testindex"); SailRepository sailRepository = new SailRepository(new SchemaCachingRDFSInferencer(elasticsearchStore)); @@ -117,7 +117,7 @@ public void initiallyInferredStatementsTest() { } @Test - public void simpleInferenceTest() { + void simpleInferenceTest() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore(singletonClientProvider, "testindex"); SailRepository sailRepository = new SailRepository(new SchemaCachingRDFSInferencer(elasticsearchStore)); @@ -138,7 +138,7 @@ public void simpleInferenceTest() { } @Test - public void removeInferredData() { + void removeInferredData() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore(singletonClientProvider, "testindex"); SailRepository sailRepository = new SailRepository(new SchemaCachingRDFSInferencer(elasticsearchStore)); @@ -172,7 +172,7 @@ public void removeInferredData() { } @Test - public void addInferredStatement() { + void addInferredStatement() { ElasticsearchStore elasticsearchStore = new ElasticsearchStore(singletonClientProvider, "testindex"); SailRepository sailRepository = new SailRepository(new SchemaCachingRDFSInferencer(elasticsearchStore)); diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchGraphQueryResultIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchGraphQueryResultIT.java index 17de5d2c13c..f0a7f765b33 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchGraphQueryResultIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchGraphQueryResultIT.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.io.TempDir; -public class ElasticsearchGraphQueryResultIT extends GraphQueryResultTest { +class ElasticsearchGraphQueryResultIT extends GraphQueryResultTest { @TempDir static File installLocation; @@ -32,7 +32,7 @@ public class ElasticsearchGraphQueryResultIT extends GraphQueryResultTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreConcurrencyIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreConcurrencyIT.java index 648582e6fb4..3da9d71232d 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreConcurrencyIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreConcurrencyIT.java @@ -29,7 +29,7 @@ * An extension of {@link SailConcurrencyTest} for testing the class * {@link org.eclipse.rdf4j.sail.elasticsearchstore.ElasticsearchStore}. */ -public class ElasticsearchStoreConcurrencyIT extends SailConcurrencyTest { +class ElasticsearchStoreConcurrencyIT extends SailConcurrencyTest { @TempDir static File installLocation; @@ -37,13 +37,13 @@ public class ElasticsearchStoreConcurrencyIT extends SailConcurrencyTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } @AfterAll - public static void afterClass() throws Exception { + static void afterClass() throws Exception { clientPool.close(); TestHelpers.stopElasticsearch(runner); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreConnectionIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreConnectionIT.java index 7619dde8b9e..cdc361970db 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreConnectionIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreConnectionIT.java @@ -31,13 +31,13 @@ public class ElasticsearchStoreConnectionIT extends RepositoryConnectionTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass(@TempDir File installLocation) throws IOException, InterruptedException { + static void beforeClass(@TempDir File installLocation) throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } @AfterAll - public static void afterClass() throws Exception { + static void afterClass() throws Exception { clientPool.close(); TestHelpers.stopElasticsearch(runner); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreContextIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreContextIT.java index c39bafc53ec..2237e9e5d32 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreContextIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreContextIT.java @@ -28,14 +28,14 @@ * An extension of RDFStoreTest for testing the class * {@link org.eclipse.rdf4j.sail.elasticsearchstore.ElasticsearchStore}. */ -public class ElasticsearchStoreContextIT extends RDFNotifyingStoreTest { +class ElasticsearchStoreContextIT extends RDFNotifyingStoreTest { private static final File installLocation = Files.newTemporaryFolder(); private static ElasticsearchClusterRunner runner; private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreIT.java index fd3f9d19df2..f07db745790 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreIT.java @@ -29,7 +29,7 @@ * An extension of RDFStoreTest for testing the class * org.eclipse.rdf4j.sail.elasticsearchstore.ElasticsearchStore. */ -public class ElasticsearchStoreIT extends RDFNotifyingStoreTest { +class ElasticsearchStoreIT extends RDFNotifyingStoreTest { /*---------* * Methods * @@ -40,7 +40,7 @@ public class ElasticsearchStoreIT extends RDFNotifyingStoreTest { static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreInterruptIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreInterruptIT.java index c87e90f82e7..5294f9834c8 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreInterruptIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreInterruptIT.java @@ -29,7 +29,7 @@ * An extension of {@link SailConcurrencyTest} for testing the class * {@link org.eclipse.rdf4j.sail.elasticsearchstore.ElasticsearchStore}. */ -public class ElasticsearchStoreInterruptIT extends SailInterruptTest { +class ElasticsearchStoreInterruptIT extends SailInterruptTest { @TempDir static File installLocation; @@ -37,7 +37,7 @@ public class ElasticsearchStoreInterruptIT extends SailInterruptTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreIsolationLevelIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreIsolationLevelIT.java index 527ddab0aad..afe7947a31e 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreIsolationLevelIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreIsolationLevelIT.java @@ -29,7 +29,7 @@ * An extension of {@link SailIsolationLevelTest} for testing the class * {@link org.eclipse.rdf4j.sail.elasticsearchstore.ElasticsearchStore}. */ -public class ElasticsearchStoreIsolationLevelIT extends SailIsolationLevelTest { +class ElasticsearchStoreIsolationLevelIT extends SailIsolationLevelTest { @TempDir static File installLocation; @@ -37,14 +37,14 @@ public class ElasticsearchStoreIsolationLevelIT extends SailIsolationLevelTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws Exception { + static void beforeClass() throws Exception { SailIsolationLevelTest.setUpClass(); runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } @AfterAll - public static void afterClass2() throws Exception { + static void afterClass2() throws Exception { SailIsolationLevelTest.afterClass(); clientPool.close(); TestHelpers.stopElasticsearch(runner); diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreRepositoryIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreRepositoryIT.java index 2d0d38ab091..88e701c9580 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreRepositoryIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreRepositoryIT.java @@ -32,7 +32,7 @@ public class ElasticsearchStoreRepositoryIT extends RepositoryTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreSparqlOrderByIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreSparqlOrderByIT.java index 96e2e21697e..759e03ceb79 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreSparqlOrderByIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreSparqlOrderByIT.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.io.TempDir; -public class ElasticsearchStoreSparqlOrderByIT extends SparqlOrderByTest { +class ElasticsearchStoreSparqlOrderByIT extends SparqlOrderByTest { @TempDir static File installLocation; @@ -32,7 +32,7 @@ public class ElasticsearchStoreSparqlOrderByIT extends SparqlOrderByTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreSparqlRegexIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreSparqlRegexIT.java index 9272c53a37f..1cd6ff2cc7c 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreSparqlRegexIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreSparqlRegexIT.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.io.TempDir; -public class ElasticsearchStoreSparqlRegexIT extends SparqlRegexTest { +class ElasticsearchStoreSparqlRegexIT extends SparqlRegexTest { @TempDir static File installLocation; @@ -32,7 +32,7 @@ public class ElasticsearchStoreSparqlRegexIT extends SparqlRegexTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreTupleQueryResultIT.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreTupleQueryResultIT.java index afc7b748161..16495ec3714 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreTupleQueryResultIT.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/compliance/ElasticsearchStoreTupleQueryResultIT.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.io.TempDir; -public class ElasticsearchStoreTupleQueryResultIT extends TupleQueryResultTest { +class ElasticsearchStoreTupleQueryResultIT extends TupleQueryResultTest { @TempDir static File installLocation; @@ -32,13 +32,13 @@ public class ElasticsearchStoreTupleQueryResultIT extends TupleQueryResultTest { private static SingletonClientProvider clientPool; @BeforeAll - public static void beforeClass() throws IOException, InterruptedException { + static void beforeClass() throws IOException, InterruptedException { runner = TestHelpers.startElasticsearch(installLocation); clientPool = new SingletonClientProvider("localhost", TestHelpers.getPort(runner), TestHelpers.CLUSTER); } @AfterAll - public static void afterClass() throws Exception { + static void afterClass() throws Exception { clientPool.close(); TestHelpers.stopElasticsearch(runner); } diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/config/ElasticsearchStoreConfigTest.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/config/ElasticsearchStoreConfigTest.java index 495f198be4b..b7c2b700af3 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/config/ElasticsearchStoreConfigTest.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/config/ElasticsearchStoreConfigTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ElasticsearchStoreConfigTest { +class ElasticsearchStoreConfigTest { private ElasticsearchStoreConfig subject; @@ -33,14 +33,14 @@ public class ElasticsearchStoreConfigTest { private ModelBuilder mb; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { subject = new ElasticsearchStoreConfig(); implNode = SimpleValueFactory.getInstance().createBNode(); mb = new ModelBuilder().subject(implNode); } @Test - public void defaultsCorrectlySet() { + void defaultsCorrectlySet() { assertThat(subject.getClusterName()).isNull(); assertThat(subject.getHostname()).isNull(); assertThat(subject.getIndex()).isNull(); @@ -49,7 +49,7 @@ public void defaultsCorrectlySet() { } @Test - public void parseFromModelSetValuesCorrectly() { + void parseFromModelSetValuesCorrectly() { // FIXME we need to set formatting guidelines for this kind of thing // @formatter:off @@ -70,7 +70,7 @@ public void parseFromModelSetValuesCorrectly() { } @Test - public void parseFromPartialModelSetValuesCorrectly() { + void parseFromPartialModelSetValuesCorrectly() { mb .add(CONFIG.Ess.hostname, "host1") .add(CONFIG.Ess.port, 9300); @@ -82,7 +82,7 @@ public void parseFromPartialModelSetValuesCorrectly() { } @Test - public void parseInvalidModelGivesCorrectException() { + void parseInvalidModelGivesCorrectException() { mb .add(CONFIG.Ess.port, "port1"); @@ -92,7 +92,7 @@ public void parseInvalidModelGivesCorrectException() { } @Test - public void exportAddsAllConfigData() { + void exportAddsAllConfigData() { mb .add(CONFIG.Ess.hostname, "host1") diff --git a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/config/ElasticsearchStoreFactoryTest.java b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/config/ElasticsearchStoreFactoryTest.java index fb4e0b1ea43..a288328a410 100644 --- a/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/config/ElasticsearchStoreFactoryTest.java +++ b/core/sail/elasticsearch-store/src/test/java/org/eclipse/rdf4j/sail/elasticsearchstore/config/ElasticsearchStoreFactoryTest.java @@ -18,17 +18,17 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ElasticsearchStoreFactoryTest { +class ElasticsearchStoreFactoryTest { private ElasticsearchStoreFactory subject; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { subject = new ElasticsearchStoreFactory(); } @Test - public void getSailTypeReturnsCorrectValue() { + void getSailTypeReturnsCorrectValue() { assertThat(subject.getSailType()).isEqualTo(ElasticsearchStoreFactory.SAIL_TYPE); } @@ -36,7 +36,7 @@ public void getSailTypeReturnsCorrectValue() { * Verify that the created sail is configured according to the supplied default configuration. */ @Test - public void getSailWithDefaultConfigFails() { + void getSailWithDefaultConfigFails() { ElasticsearchStoreConfig config = new ElasticsearchStoreConfig(); assertThrows(SailConfigException.class, () -> subject.getSail(config)); } @@ -45,7 +45,7 @@ public void getSailWithDefaultConfigFails() { * Verify that the created sail is configured according to the supplied customized configuration. */ @Test - public void getSailWithCustomConfigSetsConfigurationCorrectly() { + void getSailWithCustomConfigSetsConfigurationCorrectly() { ElasticsearchStoreConfig config = new ElasticsearchStoreConfig(); // set everything to the opposite of its default diff --git a/core/sail/extensible-store/pom.xml b/core/sail/extensible-store/pom.xml index 9394729b61a..0c255bad758 100644 --- a/core/sail/extensible-store/pom.xml +++ b/core/sail/extensible-store/pom.xml @@ -63,6 +63,11 @@ assertj-core test + + org.junit.jupiter + junit-jupiter + test + org.openjdk.jmh jmh-core diff --git a/core/sail/extensible-store/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/TransactionIsolationAndWalTests.java b/core/sail/extensible-store/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/TransactionIsolationAndWalTests.java index 64d53dd685d..864a676e112 100644 --- a/core/sail/extensible-store/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/TransactionIsolationAndWalTests.java +++ b/core/sail/extensible-store/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/TransactionIsolationAndWalTests.java @@ -14,12 +14,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class TransactionIsolationAndWalTests { +class TransactionIsolationAndWalTests { private static final Logger logger = LoggerFactory.getLogger(TransactionIsolationAndWalTests.class); @Test - public void noTestsHereYet() { + void noTestsHereYet() { } diff --git a/core/sail/extensible-store/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/evaluationstatistics/EvaluationStatisticsTest.java b/core/sail/extensible-store/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/evaluationstatistics/EvaluationStatisticsTest.java index 47f7154651c..323d3524846 100644 --- a/core/sail/extensible-store/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/evaluationstatistics/EvaluationStatisticsTest.java +++ b/core/sail/extensible-store/src/test/java/org/eclipse/rdf4j/sail/extensiblestore/evaluationstatistics/EvaluationStatisticsTest.java @@ -31,7 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class EvaluationStatisticsTest { +class EvaluationStatisticsTest { private static final Logger logger = LoggerFactory.getLogger(EvaluationStatisticsTest.class); private static final SimpleValueFactory vf = SimpleValueFactory.getInstance(); @@ -48,7 +48,7 @@ public class EvaluationStatisticsTest { } @Test - public void testStaleStats() throws InterruptedException { + void testStaleStats() throws InterruptedException { ExtensibleDynamicEvaluationStatistics extensibleDynamicEvaluationStatistics = new ExtensibleDynamicEvaluationStatistics( null); @@ -87,7 +87,7 @@ public void testStaleStats() throws InterruptedException { } @Test - public void stalenessCalculationTest() throws InterruptedException { + void stalenessCalculationTest() throws InterruptedException { SimpleValueFactory vf = SimpleValueFactory.getInstance(); ExtensibleDynamicEvaluationStatistics extensibleDynamicEvaluationStatistics = new ExtensibleDynamicEvaluationStatistics( @@ -108,7 +108,7 @@ public void stalenessCalculationTest() throws InterruptedException { } @Test - public void testAcurracy() throws InterruptedException { + void testAcurracy() throws InterruptedException { SimpleValueFactory vf = SimpleValueFactory.getInstance(); ExtensibleDynamicEvaluationStatistics extensibleDynamicEvaluationStatistics = new ExtensibleDynamicEvaluationStatistics( diff --git a/core/sail/inferencer/pom.xml b/core/sail/inferencer/pom.xml index e686efa2506..39dc521b1f8 100644 --- a/core/sail/inferencer/pom.xml +++ b/core/sail/inferencer/pom.xml @@ -60,6 +60,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-repository-testsuite diff --git a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/InferredContextTest.java b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/InferredContextTest.java index 3a954953df7..327b0e89bbb 100644 --- a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/InferredContextTest.java +++ b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/InferredContextTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.inferencer.fc; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.rdf4j.common.iteration.CloseableIteration; import org.eclipse.rdf4j.model.BNode; @@ -24,7 +24,7 @@ import org.eclipse.rdf4j.sail.memory.MemoryStore; import org.junit.jupiter.api.Test; -public class InferredContextTest { +class InferredContextTest { SimpleValueFactory vf = SimpleValueFactory.getInstance(); @@ -33,7 +33,7 @@ public class InferredContextTest { BNode context = vf.createBNode(); @Test - public void testInferrecContextNull() { + void testInferrecContextNull() { SchemaCachingRDFSInferencer sail = new SchemaCachingRDFSInferencer(new MemoryStore()); sail.setAddInferredStatementsToDefaultContext(true); @@ -50,7 +50,7 @@ public void testInferrecContextNull() { } @Test - public void testInferrecContextNoNull() { + void testInferrecContextNoNull() { SchemaCachingRDFSInferencer sail = new SchemaCachingRDFSInferencer(new MemoryStore()); sail.setAddInferredStatementsToDefaultContext(false); @@ -65,7 +65,7 @@ public void testInferrecContextNoNull() { RDF.TYPE, RDFS.RESOURCE, true)) { while (statements.hasNext()) { Statement next = statements.next(); - assertEquals("Context should be equal", context, next.getContext()); + assertEquals(context, next.getContext(), "Context should be equal"); } } } @@ -73,11 +73,11 @@ public void testInferrecContextNoNull() { } @Test - public void testDefaultBehaviour() { + void testDefaultBehaviour() { SchemaCachingRDFSInferencer sail = new SchemaCachingRDFSInferencer(new MemoryStore()); - assertFalse("Current default behaviour should be to add all statements to default context", - sail.isAddInferredStatementsToDefaultContext()); + assertFalse(sail.isAddInferredStatementsToDefaultContext(), + "Current default behaviour should be to add all statements to default context"); } diff --git a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/MemInferencingTest.java b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/MemInferencingTest.java index 157195202bf..b3460255f80 100644 --- a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/MemInferencingTest.java +++ b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/MemInferencingTest.java @@ -30,7 +30,7 @@ import org.eclipse.rdf4j.testsuite.sail.InferencingTest; import org.junit.jupiter.api.Test; -public class MemInferencingTest extends InferencingTest { +class MemInferencingTest extends InferencingTest { @Override protected Sail createSail() { @@ -39,7 +39,7 @@ protected Sail createSail() { } @Test - public void testPersistence() { + void testPersistence() { File datadir = Files.newTemporaryFolder(); SchemaCachingRDFSInferencer sailStack = new SchemaCachingRDFSInferencer(new MemoryStore(datadir), true); @@ -70,7 +70,7 @@ public void testPersistence() { } @Test - public void testBlankNodePredicateInference() { + void testBlankNodePredicateInference() { Repository sailRepository = new SailRepository(createSail()); ValueFactory vf = sailRepository.getValueFactory(); @@ -93,7 +93,7 @@ public void testBlankNodePredicateInference() { } @Test - public void testRollback() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + void testRollback() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Repository sailRepository = new SailRepository(createSail()); ValueFactory vf = sailRepository.getValueFactory(); @@ -140,7 +140,7 @@ public void testRollback() throws NoSuchMethodException, InvocationTargetExcepti } @Test - public void testFastInstantiate() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + void testFastInstantiate() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Repository sailRepository = new SailRepository(createSail()); ValueFactory vf = sailRepository.getValueFactory(); diff --git a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/SchemaCachingRDFSInferencerNativeRepositoryConnectionTest.java b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/SchemaCachingRDFSInferencerNativeRepositoryConnectionTest.java index 93ea3106bb6..1e498d7f5e6 100644 --- a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/SchemaCachingRDFSInferencerNativeRepositoryConnectionTest.java +++ b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/SchemaCachingRDFSInferencerNativeRepositoryConnectionTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class SchemaCachingRDFSInferencerNativeRepositoryConnectionTest extends RDFSchemaRepositoryConnectionTest { +class SchemaCachingRDFSInferencerNativeRepositoryConnectionTest extends RDFSchemaRepositoryConnectionTest { @Override protected Repository createRepository(File dataDir) throws IOException { SchemaCachingRDFSInferencer sail = new SchemaCachingRDFSInferencer(new NativeStore(dataDir, "spoc"), @@ -72,7 +72,7 @@ public void testContextStatementsNotDuplicated2(IsolationLevel level) throws Exc @ParameterizedTest @MethodSource("parameters") - public void testContextTbox(IsolationLevel level) { + void testContextTbox(IsolationLevel level) { setupTest(level); // Man subClassOf Human g1 diff --git a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/SchemaCachingRDFSInferencerRDFSchemaMemoryRepositoryConnectionTest.java b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/SchemaCachingRDFSInferencerRDFSchemaMemoryRepositoryConnectionTest.java index fc43cf8dc65..a2056d97829 100644 --- a/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/SchemaCachingRDFSInferencerRDFSchemaMemoryRepositoryConnectionTest.java +++ b/core/sail/inferencer/src/test/java/org/eclipse/rdf4j/sail/inferencer/fc/SchemaCachingRDFSInferencerRDFSchemaMemoryRepositoryConnectionTest.java @@ -31,7 +31,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class SchemaCachingRDFSInferencerRDFSchemaMemoryRepositoryConnectionTest +class SchemaCachingRDFSInferencerRDFSchemaMemoryRepositoryConnectionTest extends RDFSchemaRepositoryConnectionTest { @Override @@ -76,7 +76,7 @@ public void testContextStatementsNotDuplicated2(IsolationLevel level) throws Exc @ParameterizedTest @MethodSource("parameters") - public void testContextTbox(IsolationLevel level) { + void testContextTbox(IsolationLevel level) { setupTest(level); // Man subClassOf Human g1 @@ -116,7 +116,7 @@ public void testContextTbox(IsolationLevel level) { @ParameterizedTest @MethodSource("parameters") - public void testUpdateInsertData(IsolationLevel level) { + void testUpdateInsertData(IsolationLevel level) { setupTest(level); SailRepository sail = new SailRepository(new SchemaCachingRDFSInferencer(new MemoryStore())); @@ -138,7 +138,7 @@ public void testUpdateInsertData(IsolationLevel level) { @ParameterizedTest @MethodSource("parameters") - public void testUpdateInsert(IsolationLevel level) { + void testUpdateInsert(IsolationLevel level) { setupTest(level); SailRepository sail = new SailRepository(new SchemaCachingRDFSInferencer(new MemoryStore())); @@ -161,7 +161,7 @@ public void testUpdateInsert(IsolationLevel level) { @ParameterizedTest @MethodSource("parameters") - public void testInsert(IsolationLevel level) { + void testInsert(IsolationLevel level) { setupTest(level); SailRepository sail = new SailRepository(new SchemaCachingRDFSInferencer(new MemoryStore())); @@ -184,7 +184,7 @@ public void testInsert(IsolationLevel level) { @ParameterizedTest @MethodSource("parameters") - public void testUpdateRemove(IsolationLevel level) { + void testUpdateRemove(IsolationLevel level) { setupTest(level); SailRepository sail = new SailRepository(new SchemaCachingRDFSInferencer(new MemoryStore())); diff --git a/core/sail/lmdb/pom.xml b/core/sail/lmdb/pom.xml index ab637ee2c74..8b5eac59427 100644 --- a/core/sail/lmdb/pom.xml +++ b/core/sail/lmdb/pom.xml @@ -143,6 +143,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-repository-testsuite diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/CardinalityTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/CardinalityTest.java index bf4083803ee..7c52256ee70 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/CardinalityTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/CardinalityTest.java @@ -27,7 +27,7 @@ /** * Low-level tests for {@link TripleStore}. */ -public class CardinalityTest { +class CardinalityTest { final static Logger logger = LoggerFactory.getLogger(CardinalityTest.class); @TempDir @@ -36,7 +36,7 @@ public class CardinalityTest { protected TripleStore tripleStore; @BeforeEach - public void before() throws Exception { + void before() throws Exception { File dataDir = new File(tempFolder, "triplestore"); dataDir.mkdir(); tripleStore = new TripleStore(dataDir, new LmdbStoreConfig("spoc,posc")); @@ -51,7 +51,7 @@ int count(RecordIterator it) throws IOException { } @Test - public void testCardinalities() throws Exception { + void testCardinalities() throws Exception { Random random = new Random(); int nrOfResources = 1000; @@ -83,7 +83,7 @@ public void testCardinalities() throws Exception { } @AfterEach - public void after() throws Exception { + void after() throws Exception { tripleStore.close(); } } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/ContextStoreTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/ContextStoreTest.java index 277f51b06fa..23b388dbe3d 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/ContextStoreTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/ContextStoreTest.java @@ -27,7 +27,7 @@ /** * Unit tests for {@link ContextStore} */ -public class ContextStoreTest { +class ContextStoreTest { private ContextStore subject; @@ -42,7 +42,7 @@ public class ContextStoreTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp(@TempDir File tmpDir) throws Exception { + void setUp(@TempDir File tmpDir) throws Exception { dataDir = tmpDir; LmdbSailStore sailStore = mock(LmdbSailStore.class); @@ -53,26 +53,26 @@ public void setUp(@TempDir File tmpDir) throws Exception { } @Test - public void testIncrementNew() throws Exception { + void testIncrementNew() throws Exception { subject.increment(g1); assertThat(countContexts(subject)).isEqualTo(1); } @Test - public void testIncrementNewBNode() throws Exception { + void testIncrementNewBNode() throws Exception { subject.increment(g2); assertThat(countContexts(subject)).isEqualTo(1); } @Test - public void testIncrementExisting() throws Exception { + void testIncrementExisting() throws Exception { subject.increment(g1); subject.increment(g1); assertThat(countContexts(subject)).isEqualTo(1); } @Test - public void testDecrementExisting() throws Exception { + void testDecrementExisting() throws Exception { subject.increment(g1); subject.increment(g1); @@ -84,7 +84,7 @@ public void testDecrementExisting() throws Exception { } @Test - public void testDecrementExistingBySeveral() throws Exception { + void testDecrementExistingBySeveral() throws Exception { subject.increment(g1); subject.increment(g1); @@ -93,7 +93,7 @@ public void testDecrementExistingBySeveral() throws Exception { } @Test - public void testDecrementExistingBNode() throws Exception { + void testDecrementExistingBNode() throws Exception { subject.increment(g2); subject.increment(g2); @@ -105,13 +105,13 @@ public void testDecrementExistingBNode() throws Exception { } @Test - public void testDecrementNonExisting() throws Exception { + void testDecrementNonExisting() throws Exception { subject.decrementBy(g1, 1); assertThat(countContexts(subject)).isEqualTo(0); } @Test - public void testSync() throws Exception { + void testSync() throws Exception { File datafile = new File(dataDir, "contexts.dat"); assertThat(datafile.exists()); long size = datafile.length(); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/DefaultIndexTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/DefaultIndexTest.java index 9af0da5a956..b5eaa29e0d4 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/DefaultIndexTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/DefaultIndexTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; import java.io.FileInputStream; @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class DefaultIndexTest { +class DefaultIndexTest { @Test - public void testDefaultIndex(@TempDir File dir) throws Exception { + void testDefaultIndex(@TempDir File dir) throws Exception { TripleStore store = new TripleStore(dir, new LmdbStoreConfig()); store.close(); // check that the triple store used the default index @@ -34,7 +34,7 @@ public void testDefaultIndex(@TempDir File dir) throws Exception { } @Test - public void testExistingIndex(@TempDir File dir) throws Exception { + void testExistingIndex(@TempDir File dir) throws Exception { // set a non-default index TripleStore store = new TripleStore(dir, new LmdbStoreConfig("spoc,opsc")); store.close(); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbOptimisticIsolationTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbOptimisticIsolationTest.java index 444796eb978..e730b21492c 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbOptimisticIsolationTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbOptimisticIsolationTest.java @@ -15,12 +15,12 @@ import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory; import org.eclipse.rdf4j.sail.lmdb.config.LmdbStoreFactory; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; -public class LmdbOptimisticIsolationTest extends OptimisticIsolationTest { +class LmdbOptimisticIsolationTest extends OptimisticIsolationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { setRepositoryFactory(new SailRepositoryFactory() { @Override @@ -30,8 +30,8 @@ public RepositoryImplConfig getConfig() { }); } - @AfterClass - public static void tearDown() throws Exception { + @AfterAll + static void tearDown() throws Exception { setRepositoryFactory(null); } } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSailStoreTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSailStoreTest.java index 5365fb38693..1ac1984a8d2 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSailStoreTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSailStoreTest.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; @@ -37,7 +37,7 @@ /** * Extended test for {@link LmdbStore}. */ -public class LmdbSailStoreTest { +class LmdbSailStoreTest { protected Repository repo; @@ -55,7 +55,7 @@ public class LmdbSailStoreTest { F.createLiteral("two")); @BeforeEach - public void before(@TempDir File dataDir) throws Exception { + void before(@TempDir File dataDir) throws Exception { repo = new SailRepository(new LmdbStore(dataDir, new LmdbStoreConfig("spoc,posc"))); repo.init(); @@ -67,67 +67,67 @@ public void before(@TempDir File dataDir) throws Exception { } @Test - public void testRemoveValidContext() { + void testRemoveValidContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.remove((IRI) null, null, null, CTX_1); } try (RepositoryConnection conn = repo.getConnection()) { - assertTrue("Statement 0 incorrectly removed", conn.hasStatement(S0, false)); - assertFalse("Statement 1 still not removed", conn.hasStatement(S1, false, CTX_1)); - assertTrue("Statement 2 incorrectly removed", conn.hasStatement(S2, false, CTX_2)); + assertTrue(conn.hasStatement(S0, false), "Statement 0 incorrectly removed"); + assertFalse(conn.hasStatement(S1, false, CTX_1), "Statement 1 still not removed"); + assertTrue(conn.hasStatement(S2, false, CTX_2), "Statement 2 incorrectly removed"); } } @Test - public void testRemoveEmptyContext() { + void testRemoveEmptyContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.remove((IRI) null, null, null, (Resource) null); } try (RepositoryConnection conn = repo.getConnection()) { - assertFalse("Statement 0 still not removed", conn.hasStatement(S0, false)); - assertTrue("Statement 1 incorrectly removed", conn.hasStatement(S1, false, CTX_1)); - assertTrue("Statement 2 incorrectly removed", conn.hasStatement(S2, false, CTX_2)); + assertFalse(conn.hasStatement(S0, false), "Statement 0 still not removed"); + assertTrue(conn.hasStatement(S1, false, CTX_1), "Statement 1 incorrectly removed"); + assertTrue(conn.hasStatement(S2, false, CTX_2), "Statement 2 incorrectly removed"); } } @Test - public void testRemoveInvalidContext() { + void testRemoveInvalidContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.remove((IRI) null, null, null, CTX_INV); } try (RepositoryConnection conn = repo.getConnection()) { - assertTrue("Statement 0 incorrectly removed", conn.hasStatement(S0, false)); - assertTrue("Statement 1 incorrectly removed", conn.hasStatement(S1, false, CTX_1)); - assertTrue("Statement 2 incorrectly removed", conn.hasStatement(S2, false, CTX_2)); + assertTrue(conn.hasStatement(S0, false), "Statement 0 incorrectly removed"); + assertTrue(conn.hasStatement(S1, false, CTX_1), "Statement 1 incorrectly removed"); + assertTrue(conn.hasStatement(S2, false, CTX_2), "Statement 2 incorrectly removed"); } } @Test - public void testRemoveMultipleValidContext() { + void testRemoveMultipleValidContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.remove((IRI) null, null, null, CTX_1, CTX_2); } try (RepositoryConnection conn = repo.getConnection()) { - assertTrue("Statement 0 incorrectly removed", conn.hasStatement(S0, false)); - assertFalse("Statement 1 still not removed", conn.hasStatement(S1, false, CTX_1)); - assertFalse("Statement 2 still not removed", conn.hasStatement(S2, false, CTX_2)); + assertTrue(conn.hasStatement(S0, false), "Statement 0 incorrectly removed"); + assertFalse(conn.hasStatement(S1, false, CTX_1), "Statement 1 still not removed"); + assertFalse(conn.hasStatement(S2, false, CTX_2), "Statement 2 still not removed"); } } @Test - public void testClearMultipleValidContext() { + void testClearMultipleValidContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.clear(CTX_1, CTX_2); } try (RepositoryConnection conn = repo.getConnection()) { - assertTrue("Statement 0 incorrectly removed", conn.hasStatement(S0, false)); - assertFalse("Statement 1 still not removed", conn.hasStatement(S1, false, CTX_1)); - assertFalse("Statement 2 still not removed", conn.hasStatement(S2, false, CTX_2)); + assertTrue(conn.hasStatement(S0, false), "Statement 0 incorrectly removed"); + assertFalse(conn.hasStatement(S1, false, CTX_1), "Statement 1 still not removed"); + assertFalse(conn.hasStatement(S2, false, CTX_2), "Statement 2 still not removed"); } } @Test - public void testPassConnectionBetweenThreads() throws InterruptedException { + void testPassConnectionBetweenThreads() throws InterruptedException { RepositoryConnection[] conn = { null }; TupleQuery[] query = { null }; TupleQueryResult[] result = { null }; @@ -158,7 +158,7 @@ public void testPassConnectionBetweenThreads() throws InterruptedException { } @Test - public void testPassConnectionBetweenThreadsWithTx() throws InterruptedException { + void testPassConnectionBetweenThreadsWithTx() throws InterruptedException { RepositoryConnection[] conn = { null }; TupleQuery[] query = { null }; TupleQueryResult[] result = { null }; @@ -194,7 +194,7 @@ public void testPassConnectionBetweenThreadsWithTx() throws InterruptedException } @AfterEach - public void after() throws Exception { + void after() throws Exception { repo.shutDown(); } } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConnectionTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConnectionTest.java index 8767ed227ec..717d83e5dbf 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConnectionTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConnectionTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class LmdbStoreConnectionTest extends RepositoryConnectionTest { +class LmdbStoreConnectionTest extends RepositoryConnectionTest { @Override protected Repository createRepository(File dataDir) throws IOException { return new SailRepository(new LmdbStore(dataDir, new LmdbStoreConfig("spoc"))); @@ -34,7 +34,7 @@ protected Repository createRepository(File dataDir) throws IOException { @ParameterizedTest @MethodSource("parameters") - public void testSES715(IsolationLevel level) throws Exception { + void testSES715(IsolationLevel level) throws Exception { setupTest(level); // load 1000 triples in two different contexts diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConsistencyIT.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConsistencyIT.java index f6654782355..59cb34297b7 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConsistencyIT.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreConsistencyIT.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; import java.util.List; @@ -39,7 +39,7 @@ /** * Integration tests for checking Lmdb Store index consistency. */ -public class LmdbStoreConsistencyIT { +class LmdbStoreConsistencyIT { private static final Logger logger = LoggerFactory.getLogger(LmdbStoreConsistencyIT.class); @@ -52,7 +52,7 @@ public class LmdbStoreConsistencyIT { *---------*/ @Test - public void testSES1867IndexCorruption(@TempDir File dataDir) throws Exception { + void testSES1867IndexCorruption(@TempDir File dataDir) throws Exception { ValueFactory vf = SimpleValueFactory.getInstance(); IRI oldContext = vf.createIRI("http://example.org/oldContext"); IRI newContext = vf.createIRI("http://example.org/newContext"); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreDirLockTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreDirLockTest.java index 00595b8df51..44710eaae94 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreDirLockTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreDirLockTest.java @@ -10,8 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; import java.io.File; @@ -20,10 +20,10 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class LmdbStoreDirLockTest { +class LmdbStoreDirLockTest { @Test - public void testLocking(@TempDir File dataDir) throws Exception { + void testLocking(@TempDir File dataDir) throws Exception { LmdbStore sail = new LmdbStore(dataDir, new LmdbStoreConfig("spoc,posc")); sail.init(); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreErrorHandlingTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreErrorHandlingTest.java index 30769788436..7f952399d6f 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreErrorHandlingTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreErrorHandlingTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.File; @@ -26,10 +26,10 @@ /** * Tests for the correct handling of internal LMDB store errors. */ -public class LmdbStoreErrorHandlingTest { +class LmdbStoreErrorHandlingTest { @Test - public void testMapFullError(@TempDir File dataDir) throws Exception { + void testMapFullError(@TempDir File dataDir) throws Exception { LmdbStoreConfig config = new LmdbStoreConfig("spoc,psoc"); // set small db size config.setValueDBSize(50000); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreRepositoryTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreRepositoryTest.java index 6b283fbfe90..3b72cf4e747 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreRepositoryTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreRepositoryTest.java @@ -17,9 +17,7 @@ import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.sail.lmdb.config.LmdbStoreConfig; import org.eclipse.rdf4j.testsuite.repository.RepositoryTest; -import org.junit.Rule; import org.junit.jupiter.api.io.TempDir; -import org.junit.rules.TemporaryFolder; public class LmdbStoreRepositoryTest extends RepositoryTest { @TempDir diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTest.java index db3b1420b40..d17c8cbda14 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTest.java @@ -51,7 +51,7 @@ protected NotifyingSail createSail() throws SailException { // Test for SES-542 @Test - public void testGetNamespacePersistence() throws Exception { + void testGetNamespacePersistence() throws Exception { con.begin(); con.setNamespace("rdf", RDF.NAMESPACE); con.commit(); @@ -66,7 +66,7 @@ public void testGetNamespacePersistence() throws Exception { } @Test - public void testContextCacheReconstruction() throws Exception { + void testContextCacheReconstruction() throws Exception { con.begin(); con.addStatement(RDF.TYPE, RDF.TYPE, RDF.TYPE, RDF.ALT); con.commit(); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTmpDatadirTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTmpDatadirTest.java index 90034460bd5..9567ab3762b 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTmpDatadirTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbStoreTmpDatadirTest.java @@ -10,8 +10,10 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +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.assertTrue; import java.io.File; import java.io.IOException; @@ -19,32 +21,32 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class LmdbStoreTmpDatadirTest { +class LmdbStoreTmpDatadirTest { @Test - public void testNoTmpDatadir(@TempDir File dataDir) throws IOException { + void testNoTmpDatadir(@TempDir File dataDir) throws IOException { LmdbStore store = new LmdbStore(dataDir); store.init(); - assertTrue("Data dir not set correctly", dataDir.equals(store.getDataDir())); + assertEquals(dataDir, store.getDataDir(), "Data dir not set correctly"); store.shutDown(); - assertTrue("Data dir does not exist anymore", dataDir.exists()); + assertTrue(dataDir.exists(), "Data dir does not exist anymore"); } @Test - public void testTmpDatadir() throws IOException { + void testTmpDatadir() throws IOException { LmdbStore store = new LmdbStore(); store.init(); File dataDir = store.getDataDir(); - assertTrue("Temp data dir not created", dataDir != null && dataDir.exists()); + assertTrue(dataDir != null && dataDir.exists(), "Temp data dir not created"); store.shutDown(); - assertFalse("Temp data dir still exists", dataDir.exists()); + assertFalse(dataDir.exists(), "Temp data dir still exists"); } @Test - public void testTmpDatadirReinit() throws IOException { + void testTmpDatadirReinit() throws IOException { LmdbStore store = new LmdbStore(); store.init(); File dataDir1 = store.getDataDir(); @@ -53,11 +55,11 @@ public void testTmpDatadirReinit() throws IOException { store.init(); File dataDir2 = store.getDataDir(); store.shutDown(); - assertFalse("Temp data dirs are the same", dataDir1.equals(dataDir2)); + assertNotEquals(dataDir1, dataDir2, "Temp data dirs are the same"); } @Test - public void testDatadirMix(@TempDir File dataDir) throws IOException { + void testDatadirMix(@TempDir File dataDir) throws IOException { LmdbStore store = new LmdbStore(dataDir); store.init(); @@ -68,7 +70,7 @@ public void testDatadirMix(@TempDir File dataDir) throws IOException { File tmpDataDir = store.getDataDir(); store.shutDown(); - assertFalse("Temp data dir still exists", tmpDataDir.exists()); - assertTrue("Data dir does not exist anymore", dataDir.exists()); + assertFalse(tmpDataDir.exists(), "Temp data dir still exists"); + assertTrue(dataDir.exists(), "Data dir does not exist anymore"); } } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LongMultithreadedTransactions.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LongMultithreadedTransactions.java index edd04bc6fac..df6861e8196 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LongMultithreadedTransactions.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/LongMultithreadedTransactions.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class LongMultithreadedTransactions { +class LongMultithreadedTransactions { @TempDir File tmpDir; @@ -37,7 +37,7 @@ NotifyingSail getBaseSail() { @Test @Disabled - public void test() { + void test() { ValueFactory vf = SimpleValueFactory.getInstance(); @@ -68,7 +68,7 @@ public void test() { @Test @Disabled - public void test1() { + void test1() { ValueFactory vf = SimpleValueFactory.getInstance(); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/QueryBenchmarkTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/QueryBenchmarkTest.java index 9cd9e1063fe..1fc42e802af 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/QueryBenchmarkTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/QueryBenchmarkTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.io.TempDir; /** * @@ -39,7 +39,8 @@ public class QueryBenchmarkTest { private static SailRepository repository; - public static TemporaryFolder tempDir = new TemporaryFolder(); + @TempDir + public static File tempDir; private static final String query1; private static final String query2; @@ -62,9 +63,8 @@ public class QueryBenchmarkTest { } @BeforeAll - public static void beforeClass() throws IOException { - tempDir.create(); - File file = tempDir.newFolder(); + static void beforeClass() throws IOException { + File file = newFolder(tempDir, "junit"); LmdbStoreConfig config = new LmdbStoreConfig("spoc,ospc,psoc"); repository = new SailRepository(new LmdbStore(file, config)); @@ -85,7 +85,7 @@ private static InputStream getResourceAsStream(String name) { } @AfterAll - public static void afterClass() throws IOException { + static void afterClass() throws IOException { tempDir.delete(); repository.shutDown(); tempDir = null; @@ -94,7 +94,7 @@ public static void afterClass() throws IOException { } @Test - public void groupByQuery() { + void groupByQuery() { try (SailRepositoryConnection connection = repository.getConnection()) { long count = connection .prepareTupleQuery(query1) @@ -106,7 +106,7 @@ public void groupByQuery() { } @Test - public void complexQuery() { + void complexQuery() { try (SailRepositoryConnection connection = repository.getConnection()) { long count = connection .prepareTupleQuery(query4) @@ -118,7 +118,7 @@ public void complexQuery() { } @Test - public void distinctPredicatesQuery() { + void distinctPredicatesQuery() { try (SailRepositoryConnection connection = repository.getConnection()) { long count = connection .prepareTupleQuery(query5) @@ -130,7 +130,7 @@ public void distinctPredicatesQuery() { } @Test - public void removeByQuery() { + void removeByQuery() { try (SailRepositoryConnection connection = repository.getConnection()) { connection.begin(IsolationLevels.NONE); connection.remove((Resource) null, RDF.TYPE, null); @@ -144,7 +144,7 @@ public void removeByQuery() { } @Test - public void removeByQueryReadCommitted() { + void removeByQueryReadCommitted() { try (SailRepositoryConnection connection = repository.getConnection()) { connection.begin(IsolationLevels.READ_COMMITTED); connection.remove((Resource) null, RDF.TYPE, null); @@ -158,7 +158,7 @@ public void removeByQueryReadCommitted() { } @Test - public void simpleUpdateQueryIsolationReadCommitted() { + void simpleUpdateQueryIsolationReadCommitted() { try (SailRepositoryConnection connection = repository.getConnection()) { connection.begin(IsolationLevels.READ_COMMITTED); connection.prepareUpdate(query2).execute(); @@ -175,7 +175,7 @@ public void simpleUpdateQueryIsolationReadCommitted() { } @Test - public void simpleUpdateQueryIsolationNone() { + void simpleUpdateQueryIsolationNone() { try (SailRepositoryConnection connection = repository.getConnection()) { connection.begin(IsolationLevels.NONE); connection.prepareUpdate(query2).execute(); @@ -197,4 +197,13 @@ private boolean hasStatement() { } } + private static File newFolder(File root, String... subDirs) throws IOException { + String subFolder = String.join("/", subDirs); + File result = new File(root, subFolder); + if (!result.mkdirs()) { + throw new IOException("Couldn't create folders " + root); + } + return result; + } + } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/SailSourceModelTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/SailSourceModelTest.java index 01ddf213bf0..6004fcb5d09 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/SailSourceModelTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/SailSourceModelTest.java @@ -30,11 +30,11 @@ import org.junit.jupiter.api.Timeout; @Timeout(value = 3000, unit = MILLISECONDS) -public class SailSourceModelTest extends ModelTest { +class SailSourceModelTest extends ModelTest { List stores = new ArrayList<>(); @Test - public void testRemove() { + void testRemove() { SailSourceModel sailSourceModel = getNewModel(); sailSourceModel.add(RDF.TYPE, RDF.TYPE, RDF.TYPE); sailSourceModel.remove(RDF.TYPE, RDF.TYPE, RDF.TYPE); @@ -42,7 +42,7 @@ public void testRemove() { } @Test - public void testRemoveTermIteration() { + void testRemoveTermIteration() { SailSourceModel sailSourceModel = getNewModel(); sailSourceModel.add(RDF.TYPE, RDF.TYPE, RDF.TYPE); sailSourceModel.removeTermIteration((Iterator) mock(Iterator.class), RDF.TYPE, RDF.TYPE, RDF.TYPE); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreMemoryOverflow.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreMemoryOverflow.java index c8e397b43da..b8620eada89 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreMemoryOverflow.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreMemoryOverflow.java @@ -35,7 +35,7 @@ /** * */ -public class TestLmdbStoreMemoryOverflow { +class TestLmdbStoreMemoryOverflow { private Repository testRepository; private RepositoryConnection testCon; @@ -43,7 +43,7 @@ public class TestLmdbStoreMemoryOverflow { private RepositoryConnection testCon2; @BeforeEach - public void setUp(@TempDir File dataDir) throws Exception { + void setUp(@TempDir File dataDir) throws Exception { testRepository = createRepository(dataDir); testRepository.init(); } @@ -63,7 +63,7 @@ private Repository createRepository(File dataDir) throws IOException { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { testCon2.close(); testCon.close(); testRepository.shutDown(); @@ -71,7 +71,7 @@ public void tearDown() throws Exception { @ParameterizedTest @EnumSource(IsolationLevels.class) - public void test(IsolationLevel level) throws Exception { + void test(IsolationLevel level) throws Exception { setupConnections(level); int size = 10000; // this should really be bigger diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java index d3b1e3a96a0..2d336d22960 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TestLmdbStoreUpgrade.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; import java.io.IOException; @@ -31,7 +31,7 @@ public class TestLmdbStoreUpgrade { @Test - public void testDevel(@TempDir File dataDir) throws IOException, SailException { + void testDevel(@TempDir File dataDir) throws IOException, SailException { LmdbStore store = new LmdbStore(dataDir); try { store.init(); diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleStoreTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleStoreTest.java index 1d707ee9a35..f93ffc02697 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleStoreTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/TripleStoreTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; import java.io.IOException; @@ -25,11 +25,11 @@ /** * Low-level tests for {@link TripleStore}. */ -public class TripleStoreTest { +class TripleStoreTest { protected TripleStore tripleStore; @BeforeEach - public void before(@TempDir File dataDir) throws Exception { + void before(@TempDir File dataDir) throws Exception { tripleStore = new TripleStore(dataDir, new LmdbStoreConfig("spoc,posc")); } @@ -42,32 +42,36 @@ int count(RecordIterator it) throws IOException { } @Test - public void testInferredStmts() throws Exception { + void testInferredStmts() throws Exception { tripleStore.startTransaction(); tripleStore.storeTriple(1, 2, 3, 1, false); tripleStore.commit(); try (Txn txn = tripleStore.getTxnManager().createReadTxn()) { - assertEquals("Store should have 1 inferred statement", 1, - count(tripleStore.getTriples(txn, 1, 2, 3, 1, false))); + assertEquals(1, + count(tripleStore.getTriples(txn, 1, 2, 3, 1, false)), + "Store should have 1 inferred statement"); - assertEquals("Store should have 0 explicit statements", 0, - count(tripleStore.getTriples(txn, 1, 2, 3, 1, true))); + assertEquals(0, + count(tripleStore.getTriples(txn, 1, 2, 3, 1, true)), + "Store should have 0 explicit statements"); tripleStore.startTransaction(); tripleStore.storeTriple(1, 2, 3, 1, true); tripleStore.commit(); - assertEquals("Store should have 0 inferred statements", 0, - count(tripleStore.getTriples(txn, 1, 2, 3, 1, false))); + assertEquals(0, + count(tripleStore.getTriples(txn, 1, 2, 3, 1, false)), + "Store should have 0 inferred statements"); - assertEquals("Store should have 1 explicit statements", 1, - count(tripleStore.getTriples(txn, 1, 2, 3, 1, true))); + assertEquals(1, + count(tripleStore.getTriples(txn, 1, 2, 3, 1, true)), + "Store should have 1 explicit statements"); } } @AfterEach - public void after() throws Exception { + void after() throws Exception { tripleStore.close(); } } diff --git a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/VarintTest.java b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/VarintTest.java index 79cdf1b293d..1ab196ba3f4 100644 --- a/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/VarintTest.java +++ b/core/sail/lmdb/src/test/java/org/eclipse/rdf4j/sail/lmdb/VarintTest.java @@ -10,14 +10,14 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.lmdb; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.nio.ByteBuffer; import org.junit.jupiter.api.Test; -public class VarintTest { +class VarintTest { long[] values = new long[] { 240, 2287, 67823, 16777215, 4294967295L, 1099511627775L, 281474976710655L, 72057594037927935L, @@ -25,19 +25,19 @@ public class VarintTest { }; @Test - public void testVarint() { + void testVarint() { ByteBuffer bb = ByteBuffer.allocate(9); for (int i = 0; i < values.length; i++) { bb.clear(); Varint.writeUnsigned(bb, values[i]); bb.flip(); - assertEquals("Encoding should use " + (i + 1) + " bytes", i + 1, bb.remaining()); - assertEquals("Encoded and decoded value should be equal", values[i], Varint.readUnsigned(bb)); + assertEquals(i + 1, bb.remaining(), "Encoding should use " + (i + 1) + " bytes"); + assertEquals(values[i], Varint.readUnsigned(bb), "Encoded and decoded value should be equal"); } } @Test - public void testVarintList() { + void testVarintList() { ByteBuffer bb = ByteBuffer.allocate(2 + 4 * Long.BYTES); for (int i = 0; i < values.length - 4; i++) { long[] expected = new long[4]; @@ -47,7 +47,7 @@ public void testVarintList() { bb.flip(); long[] actual = new long[4]; Varint.readListUnsigned(bb, actual); - assertArrayEquals("Encoded and decoded value should be equal", expected, actual); + assertArrayEquals(expected, actual, "Encoded and decoded value should be equal"); } } } diff --git a/core/sail/lucene-api/pom.xml b/core/sail/lucene-api/pom.xml index 1bb9118fefc..c2151180921 100644 --- a/core/sail/lucene-api/pom.xml +++ b/core/sail/lucene-api/pom.xml @@ -37,6 +37,11 @@ org.slf4j slf4j-api + + org.junit.jupiter + junit-jupiter + test + org.apache.lucene lucene-queryparser diff --git a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/DistanceQuerySpecTest.java b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/DistanceQuerySpecTest.java index a3b12e07635..9bdb111e5e3 100644 --- a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/DistanceQuerySpecTest.java +++ b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/DistanceQuerySpecTest.java @@ -26,7 +26,7 @@ import org.eclipse.rdf4j.query.parser.ParsedQuery; import org.junit.jupiter.api.Test; -public class DistanceQuerySpecTest extends SearchQueryEvaluatorTest { +class DistanceQuerySpecTest extends SearchQueryEvaluatorTest { private static final ValueFactory VF = SimpleValueFactory.getInstance(); @@ -42,7 +42,7 @@ public class DistanceQuerySpecTest extends SearchQueryEvaluatorTest { "}"; @Test - public void testReplaceQueryPatternsWithNonEmptyResults() { + void testReplaceQueryPatternsWithNonEmptyResults() { final String expectedQueryPlan = "Projection\n" + " ProjectionElemList\n" + " ProjectionElem \"toUri\"\n" + @@ -71,7 +71,7 @@ public void testReplaceQueryPatternsWithNonEmptyResults() { } @Test - public void testReplaceQueryPatternsWithEmptyResults() { + void testReplaceQueryPatternsWithEmptyResults() { final String expectedQueryPlan = "Projection\n" + " ProjectionElemList\n" + " ProjectionElem \"toUri\"\n" + diff --git a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/GeoRelationQuerySpecTest.java b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/GeoRelationQuerySpecTest.java index edb0c0dd3da..da62fd4d2d1 100644 --- a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/GeoRelationQuerySpecTest.java +++ b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/GeoRelationQuerySpecTest.java @@ -26,7 +26,7 @@ import org.eclipse.rdf4j.query.parser.ParsedQuery; import org.junit.jupiter.api.Test; -public class GeoRelationQuerySpecTest extends SearchQueryEvaluatorTest { +class GeoRelationQuerySpecTest extends SearchQueryEvaluatorTest { private static final ValueFactory VF = SimpleValueFactory.getInstance(); private static final String QUERY = "PREFIX geo: <" + GEO.NAMESPACE + ">\n" + @@ -39,7 +39,7 @@ public class GeoRelationQuerySpecTest extends SearchQueryEvaluatorTest { "}"; @Test - public void testReplaceQueryPatternsWithNonEmptyResults() { + void testReplaceQueryPatternsWithNonEmptyResults() { final String expectedQueryPlan = "Projection\n" + " ProjectionElemList\n" + " ProjectionElem \"matchUri\"\n" + @@ -69,7 +69,7 @@ public void testReplaceQueryPatternsWithNonEmptyResults() { } @Test - public void testReplaceQueryPatternsWithEmptyResults() { + void testReplaceQueryPatternsWithEmptyResults() { final String expectedQueryPlan = "Projection\n" + " ProjectionElemList\n" + " ProjectionElem \"matchUri\"\n" + diff --git a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/LangSpecTest.java b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/LangSpecTest.java index 04de2d278ee..ea7f60b2425 100644 --- a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/LangSpecTest.java +++ b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/LangSpecTest.java @@ -25,7 +25,7 @@ import org.locationtech.spatial4j.context.SpatialContext; import org.locationtech.spatial4j.shape.Point; -public class LangSpecTest { +class LangSpecTest { private static final ValueFactory VF = SimpleValueFactory.getInstance(); protected static class SearchIndexImpl extends AbstractSearchIndex { @@ -127,13 +127,13 @@ public void clear() { Properties prop; @BeforeEach - public void setup() { + void setup() { index = new SearchIndexImpl(); prop = new Properties(); } @Test - public void noLangTest() throws Exception { + void noLangTest() throws Exception { index.initialize(prop); // test that without setting the LuceneSail.INDEXEDLANG property, the accept method is still @@ -144,7 +144,7 @@ public void noLangTest() throws Exception { } @Test - public void langTest() throws Exception { + void langTest() throws Exception { prop.setProperty(LuceneSail.INDEXEDLANG, "fr"); index.initialize(prop); @@ -155,7 +155,7 @@ public void langTest() throws Exception { } @Test - public void multipleLangTest() throws Exception { + void multipleLangTest() throws Exception { prop.setProperty(LuceneSail.INDEXEDLANG, "fr en"); index.initialize(prop); diff --git a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/QuerySpecBuilderTest.java b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/QuerySpecBuilderTest.java index 489ca4be1ae..607f772dfe0 100644 --- a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/QuerySpecBuilderTest.java +++ b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/QuerySpecBuilderTest.java @@ -36,20 +36,20 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class QuerySpecBuilderTest { +class QuerySpecBuilderTest { private QuerySpecBuilder interpreter; private SPARQLParser parser; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { interpreter = new QuerySpecBuilder(true); parser = new SPARQLParser(); } @Test - public void testQueryInterpretation() { + void testQueryInterpretation() { String buffer = "SELECT ?Subject ?Score ?Snippet " + "WHERE { ?Subject <" + MATCHES + "> [ " + "<" + TYPE + "> <" + LUCENE_QUERY + ">; " + @@ -74,7 +74,7 @@ public void testQueryInterpretation() { } @Test - public void testMultipleQueriesInterpretation() { + void testMultipleQueriesInterpretation() { String buffer = "SELECT ?sub1 ?score1 ?snippet1 ?sub2 ?score2 ?snippet2 ?x ?p1 ?p2 " + "WHERE { ?sub1 <" + MATCHES + "> [ " + "<" + TYPE + "> <" + LUCENE_QUERY + ">; " + @@ -138,7 +138,7 @@ public void testMultipleQueriesInterpretation() { } @Test - public void testQueryInterpretation2() { + void testQueryInterpretation2() { String buffer = "SELECT ?Subject ?Score ?Snippet " + "WHERE { ?Subject <" + MATCHES + "> [ " + "<" + TYPE + "> <" + LUCENE_QUERY + ">; " + @@ -163,7 +163,7 @@ public void testQueryInterpretation2() { } @Test - public void testMultipleQueriesInterpretation2() { + void testMultipleQueriesInterpretation2() { String buffer = "SELECT ?sub1 ?score1 ?snippet1 ?sub2 ?score2 ?snippet2 ?x ?p1 ?p2 " + "WHERE { ?sub1 <" + MATCHES + "> [ " + "<" + TYPE + "> <" + LUCENE_QUERY + ">; " + @@ -227,7 +227,7 @@ public void testMultipleQueriesInterpretation2() { } @Test - public void testQueryInterpretationMulti() { + void testQueryInterpretationMulti() { String buffer = "SELECT ?sub1 ?sub2 ?sub3 ?Subject ?Score ?Snippet ?Snippet2 " + "WHERE { ?Subject <" + MATCHES + "> [ " + "<" + TYPE + "> <" + LUCENE_QUERY + ">; " + @@ -298,7 +298,7 @@ public void testQueryInterpretationMulti() { * @throws Exception */ @Test - public void testIncompleteFail() throws Exception { + void testIncompleteFail() throws Exception { // default works String queryString = "SELECT ?sub1 ?score1 ?snippet1 WHERE " + "{ ?sub1 <" + MATCHES + "> [ " + "<" + TYPE + "> <" + LUCENE_QUERY + ">; " + "<" + QUERY + "> \"my Lucene query\"; " + "<" + SCORE diff --git a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/QuerySpecTest.java b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/QuerySpecTest.java index 2e9d88c0807..56d27407720 100644 --- a/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/QuerySpecTest.java +++ b/core/sail/lucene-api/src/test/java/org/eclipse/rdf4j/sail/lucene/QuerySpecTest.java @@ -20,7 +20,7 @@ import org.eclipse.rdf4j.query.parser.ParsedQuery; import org.junit.jupiter.api.Test; -public class QuerySpecTest extends SearchQueryEvaluatorTest { +class QuerySpecTest extends SearchQueryEvaluatorTest { private static final String QUERY = "PREFIX search: \n" + "SELECT * {" + " ?searchR search:matches [" + @@ -31,7 +31,7 @@ public class QuerySpecTest extends SearchQueryEvaluatorTest { "}"; @Test - public void testReplaceQueryPatternsWithNonEmptyResults() { + void testReplaceQueryPatternsWithNonEmptyResults() { final String expectedQueryPlan = "Join\n" + " Join\n" + " SingletonSet\n" + @@ -51,7 +51,7 @@ public void testReplaceQueryPatternsWithNonEmptyResults() { } @Test - public void testReplaceQueryPatternsWithEmptyResults() { + void testReplaceQueryPatternsWithEmptyResults() { final String expectedQueryPlan = "Join\n" + " Join\n" + " SingletonSet\n" + diff --git a/core/sail/lucene/pom.xml b/core/sail/lucene/pom.xml index ff4ebe6ff79..54d8e8420a3 100644 --- a/core/sail/lucene/pom.xml +++ b/core/sail/lucene/pom.xml @@ -70,13 +70,13 @@ test - org.locationtech.jts - jts-core + org.junit.jupiter + junit-jupiter + test - org.junit.vintage - junit-vintage-engine - test + org.locationtech.jts + jts-core diff --git a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/LuceneFuzzinessPrefixTest.java b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/LuceneFuzzinessPrefixTest.java index 4a0c53d7475..eabddce76a6 100644 --- a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/LuceneFuzzinessPrefixTest.java +++ b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/LuceneFuzzinessPrefixTest.java @@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class LuceneFuzzinessPrefixTest { +class LuceneFuzzinessPrefixTest { private static final ValueFactory VF = SimpleValueFactory.getInstance(); private static final String NAMESPACE = "http://example.org/"; private static final String PREFIXES = joinLines( @@ -56,7 +56,7 @@ private static String joinLines(String... lines) { private File dataDir; @BeforeEach - public void setup() throws IOException { + void setup() throws IOException { memoryStore = new MemoryStore(); sail = new LuceneSail(); sail.setParameter(LuceneSail.LUCENE_DIR_KEY, "lucene-index"); @@ -85,7 +85,7 @@ private void add(Statement... statements) { } @Test - public void testFuzzinessPrefixLength_default() { + void testFuzzinessPrefixLength_default() { // Arrange initSail(); @@ -97,7 +97,7 @@ public void testFuzzinessPrefixLength_default() { } @Test - public void testFuzzinessPrefixLength_custom() { + void testFuzzinessPrefixLength_custom() { // Arrange sail.setParameter(FUZZY_PREFIX_LENGTH_KEY, "1"); initSail(); @@ -110,7 +110,7 @@ public void testFuzzinessPrefixLength_custom() { } @Test - public void testFuzzinessPrefixLength_custom_shouldExcludeResult() { + void testFuzzinessPrefixLength_custom_shouldExcludeResult() { // Arrange sail.setParameter(FUZZY_PREFIX_LENGTH_KEY, "2"); initSail(); diff --git a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/LuceneIndexIdFilteringTest.java b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/LuceneIndexIdFilteringTest.java index c406d3faa6b..14cb0e22cd2 100644 --- a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/LuceneIndexIdFilteringTest.java +++ b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/LuceneIndexIdFilteringTest.java @@ -40,7 +40,7 @@ import com.google.common.collect.Lists; -public class LuceneIndexIdFilteringTest { +class LuceneIndexIdFilteringTest { private static final Logger LOG = LoggerFactory.getLogger(LuceneIndexIdFilteringTest.class); private static final ValueFactory VF = SimpleValueFactory.getInstance(); @@ -62,7 +62,7 @@ private static String joinLines(String... lines) { SailRepository repository; @BeforeEach - public void setup(@TempDir File dataDir) throws IOException { + void setup(@TempDir File dataDir) throws IOException { // sails schema // sailType1(LuceneSail) -> sailType2(LuceneSail) -> sailType3(LuceneSail) -> memoryStore(MemoryStore) @@ -145,7 +145,7 @@ private void assertSearchQuery(String queryStr, String... exceptedElements) { } @Test - public void noConfigTest() { + void noConfigTest() { // no config initSails(); @@ -158,7 +158,7 @@ public void noConfigTest() { } @Test - public void idConfigTest() { + void idConfigTest() { sailType1.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene1"); sailType2.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene2"); sailType3.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene3"); @@ -301,7 +301,7 @@ private void assertJoinSearchQuery(String queryStr, QueryElement... exceptedElem } @Test - public void idConfigUnionTest() { + void idConfigUnionTest() { sailType1.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene1"); sailType2.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene2"); sailType3.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene3"); @@ -365,7 +365,7 @@ public void idConfigUnionTest() { } @Test - public void idConfigJoinTest() { + void idConfigJoinTest() { sailType1.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene1"); sailType2.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene2"); sailType3.setParameter(LuceneSail.INDEX_ID, NAMESPACE + "lucene3"); diff --git a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/MultiParamTest.java b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/MultiParamTest.java index 8397cbe32b3..48865ee723c 100644 --- a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/MultiParamTest.java +++ b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/MultiParamTest.java @@ -11,10 +11,11 @@ package org.eclipse.rdf4j.sail.lucene; import static org.eclipse.rdf4j.model.util.Values.literal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.HashSet; @@ -30,11 +31,10 @@ import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.eclipse.rdf4j.sail.evaluation.TupleFunctionEvaluationMode; import org.eclipse.rdf4j.sail.memory.MemoryStore; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; public class MultiParamTest { private static final String NAMESPACE = "http://example.org/"; @@ -63,22 +63,22 @@ private static String joinLines(String... lines) { private static final IRI p2 = iri("p2"); private static final IRI p3 = iri("p3"); - @Rule - public TemporaryFolder tmpFolder = new TemporaryFolder(); + @TempDir + public File tmpFolder; LuceneSail luceneSail; SailRepository repository; SailRepositoryConnection conn; - @Before - public void setup() throws IOException { + @BeforeEach + void setup() throws IOException { MemoryStore memoryStore = new MemoryStore(); // sail with the ex:text1 filter luceneSail = new LuceneSail(); luceneSail.setParameter(LuceneSail.INDEX_CLASS_KEY, LuceneSail.DEFAULT_INDEX_CLASS); luceneSail.setEvaluationMode(TupleFunctionEvaluationMode.NATIVE); luceneSail.setBaseSail(memoryStore); - luceneSail.setDataDir(tmpFolder.newFolder()); + luceneSail.setDataDir(newFolder(tmpFolder, "junit")); repository = new SailRepository(luceneSail); repository.init(); @@ -117,8 +117,8 @@ public void setup() throws IOException { conn.commit(); } - @After - public void complete() { + @AfterEach + void complete() { try { conn.close(); } finally { @@ -127,7 +127,7 @@ public void complete() { } @Test - public void testPredicateSimple() { + void testPredicateSimple() { try (TupleQueryResult result = conn.prepareTupleQuery(joinLines( PREFIXES, "SELECT * {", @@ -144,14 +144,14 @@ public void testPredicateSimple() { while (result.hasNext()) { Value next = result.next().getValue("subj"); - assertTrue("unknown value: " + next, values.remove(next.toString())); + assertTrue(values.remove(next.toString()), "unknown value: " + next); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @Test - public void testPredicateMulti() { + void testPredicateMulti() { try (TupleQueryResult result = conn.prepareTupleQuery(joinLines( PREFIXES, "SELECT * {", @@ -170,14 +170,14 @@ public void testPredicateMulti() { while (result.hasNext()) { Value next = result.next().getValue("subj"); - assertTrue("unknown value: " + next, values.remove(next.toString())); + assertTrue(values.remove(next.toString()), "unknown value: " + next); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @Test - public void testMultiPredicate() { + void testMultiPredicate() { try (TupleQueryResult result = conn.prepareTupleQuery(joinLines( PREFIXES, "SELECT * {", @@ -196,14 +196,14 @@ public void testMultiPredicate() { while (result.hasNext()) { Value next = result.next().getValue("subj"); - assertTrue("unknown value: " + next, values.remove(next.toString())); + assertTrue(values.remove(next.toString()), "unknown value: " + next); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @Test - public void testMultiQuery() { + void testMultiQuery() { try (TupleQueryResult result = conn.prepareTupleQuery(joinLines( PREFIXES, "SELECT * {", @@ -228,14 +228,14 @@ public void testMultiQuery() { while (result.hasNext()) { BindingSet binding = result.next(); Value next = binding.getValue("subj"); - assertTrue("unknown value: " + next, values.remove(next.toString())); + assertTrue(values.remove(next.toString()), "unknown value: " + next); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @Test - public void testMultiSnippetQuery() { + void testMultiSnippetQuery() { try (TupleQueryResult result = conn.prepareTupleQuery(joinLines( PREFIXES, "SELECT * {", @@ -265,14 +265,14 @@ public void testMultiSnippetQuery() { Value snippet1 = bindings.getValue("sp1"); Value snippet2 = bindings.getValue("sp2"); String obj = next + ":" + snippet1 + ":" + snippet2; - assertTrue("unknown value: " + obj, values.remove(obj)); + assertTrue(values.remove(obj), "unknown value: " + obj); } - assertTrue("missing value" + values, values.isEmpty()); + assertTrue(values.isEmpty(), "missing value" + values); } } @Test - public void testMultiOrderQuery() { + void testMultiOrderQuery() { try (TupleQueryResult result = conn.prepareTupleQuery(joinLines( PREFIXES, "SELECT * {", @@ -362,7 +362,7 @@ public void testMultiOrderQuery() { } @Test - public void testMultiOrderSnippetQuery() { + void testMultiOrderSnippetQuery() { try (TupleQueryResult result = conn.prepareTupleQuery(joinLines( PREFIXES, "SELECT * {", @@ -464,4 +464,13 @@ public void testMultiOrderSnippetQuery() { } } } + + private static File newFolder(File root, String... subDirs) throws IOException { + String subFolder = String.join("/", subDirs); + File result = new File(root, subFolder); + if (!result.mkdirs()) { + throw new IOException("Couldn't create folders " + root); + } + return result; + } } diff --git a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/TypeSpecTest.java b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/TypeSpecTest.java index 97546c861ae..8a9cbefdb0f 100644 --- a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/TypeSpecTest.java +++ b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/TypeSpecTest.java @@ -35,7 +35,7 @@ import com.google.common.collect.Sets; -public class TypeSpecTest { +class TypeSpecTest { private static final Logger LOG = LoggerFactory.getLogger(TypeSpecTest.class); private static final ValueFactory VF = SimpleValueFactory.getInstance(); @@ -74,7 +74,7 @@ private static Statement literal(String subject, String value) { File dataDir; @BeforeEach - public void setup() throws IOException { + void setup() throws IOException { memoryStore = new MemoryStore(); // enable lock tracking sail = new LuceneSail(); @@ -163,7 +163,7 @@ private void assertQuery(String... exceptedDocuments) { } @Test - public void noConfigTest() { + void noConfigTest() { // no config to add initSail(); @@ -244,7 +244,7 @@ public void noConfigTest() { } @Test - public void typeTest() { + void typeTest() { sail.setParameter(LuceneSail.INDEXEDTYPES, (PREDICATE_TYPEOF + "=" + EX_NS + "type1") .replaceAll("[:]", "\\\\:")); initSail(); @@ -326,7 +326,7 @@ public void typeTest() { } @Test - public void typePartialModeTest() { + void typePartialModeTest() { sail.setParameter(LuceneSail.INDEXEDTYPES, (PREDICATE_TYPEOF + "=" + EX_NS + "type1") .replaceAll("[:]", "\\\\:")); sail.setIndexBacktraceMode(TypeBacktraceMode.PARTIAL); @@ -409,7 +409,7 @@ public void typePartialModeTest() { } @Test - public void typeRDFTest() { + void typeRDFTest() { sail.setParameter(LuceneSail.INDEXEDTYPES, ("a=" + EX_NS + "type2") .replaceAll("[:]", "\\\\:")); initSail(); diff --git a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndexLocationTest.java b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndexLocationTest.java index a21adea06ae..cb509271f7d 100644 --- a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndexLocationTest.java +++ b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndexLocationTest.java @@ -39,7 +39,7 @@ * * @author Jacek Grzebyta */ -public class LuceneIndexLocationTest { +class LuceneIndexLocationTest { private final Logger log = LoggerFactory.getLogger(getClass()); @@ -59,7 +59,7 @@ public class LuceneIndexLocationTest { * @throws Exception */ @BeforeEach - public void setUp(@TempDir File dataDir) throws Exception { + void setUp(@TempDir File dataDir) throws Exception { sail = new MemoryStore(); LuceneSail lucene = new LuceneSail(); @@ -83,7 +83,7 @@ public void setUp(@TempDir File dataDir) throws Exception { } @AfterEach - public void tearDown() throws IOException, RepositoryException { + void tearDown() throws IOException, RepositoryException { try { if (connection != null) { connection.close(); @@ -101,7 +101,7 @@ public void tearDown() throws IOException, RepositoryException { * @throws Exception */ @Test - public void IndexLocationTest() throws Exception { + void IndexLocationTest() throws Exception { File dataDir = repository.getDataDir(); Path lucenePath = repository.getDataDir().toPath().resolve(luceneIndexPath); diff --git a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndexTest.java b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndexTest.java index 9317304286d..eecc812ccd3 100644 --- a/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndexTest.java +++ b/core/sail/lucene/src/test/java/org/eclipse/rdf4j/sail/lucene/impl/LuceneIndexTest.java @@ -109,20 +109,20 @@ public class LuceneIndexTest { LuceneIndex index; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { directory = new RAMDirectory(); analyzer = new StandardAnalyzer(); index = new LuceneIndex(directory, analyzer); } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { index.shutDown(); Properties.setLockTrackingEnabled(false); } @Test - public void testAddStatement() throws IOException, ParseException { + void testAddStatement() throws IOException, ParseException { // add a statement to an index index.begin(); index.addStatement(statement11); @@ -231,7 +231,7 @@ private static boolean next(PostingsEnum docs) throws IOException { } @Test - public void testAddMultiple() throws Exception { + void testAddMultiple() throws Exception { // add a statement to an index HashSet added = new HashSet<>(); HashSet removed = new HashSet<>(); @@ -298,7 +298,7 @@ public void testAddMultiple() throws Exception { * @throws Exception */ @Test - public void testContexts() throws Exception { + void testContexts() throws Exception { // add a sail MemoryStore memoryStore = new MemoryStore(); // enable lock tracking @@ -349,7 +349,7 @@ public void testContexts() throws Exception { * @throws Exception */ @Test - public void testContextsRemoveContext2() throws Exception { + void testContextsRemoveContext2() throws Exception { // add a sail MemoryStore memoryStore = new MemoryStore(); // enable lock tracking @@ -395,7 +395,7 @@ public void testContextsRemoveContext2() throws Exception { } @Test - public void testRejectedDatatypes() { + void testRejectedDatatypes() { IRI STRING = vf.createIRI("http://www.w3.org/2001/XMLSchema#string"); IRI FLOAT = vf.createIRI("http://www.w3.org/2001/XMLSchema#float"); Literal literal1 = vf.createLiteral("hi there"); @@ -409,7 +409,7 @@ public void testRejectedDatatypes() { } @Test - public void testInstantiatesCustomQueryAnalyzer() throws Exception { + void testInstantiatesCustomQueryAnalyzer() throws Exception { LuceneIndex index = new LuceneIndex(); java.util.Properties props = new java.util.Properties(); props.put(LuceneSail.QUERY_ANALYZER_CLASS_KEY, EnglishAnalyzer.class.getName()); diff --git a/core/sail/memory/pom.xml b/core/sail/memory/pom.xml index 626cd8e0926..558495a9213 100644 --- a/core/sail/memory/pom.xml +++ b/core/sail/memory/pom.xml @@ -51,6 +51,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-repository-testsuite diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/InferredMemStatementTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/InferredMemStatementTest.java index d64744c5d22..7d418d8563c 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/InferredMemStatementTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/InferredMemStatementTest.java @@ -18,17 +18,17 @@ import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.model.vocabulary.RDF; import org.eclipse.rdf4j.sail.memory.model.MemStatement; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * This test class should be removed when we remove * {@link org.eclipse.rdf4j.sail.memory.model.MemStatement#setExplicit(boolean)} */ @Deprecated(since = "4.0.0", forRemoval = true) -public class InferredMemStatementTest { +class InferredMemStatementTest { @Test - public void testChangingInferredStatement() { + void testChangingInferredStatement() { MemoryStore memoryStore = new MemoryStore(); // add our explicit statement diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemTripleSourceTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemTripleSourceTest.java index 84127a21a23..184f8ceb656 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemTripleSourceTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemTripleSourceTest.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.memory; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.io.IOException; import java.io.InputStream; import java.util.List; @@ -36,7 +38,6 @@ import org.eclipse.rdf4j.sail.base.SailDataset; import org.eclipse.rdf4j.sail.base.SailSource; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.slf4j.Logger; @@ -47,7 +48,7 @@ * * @author Peter Ansell */ -public class MemTripleSourceTest { +class MemTripleSourceTest { private static final Logger logger = LoggerFactory.getLogger(MemTripleSourceTest.class); @@ -71,7 +72,7 @@ public class MemTripleSourceTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { store = new MemoryStore(); store.init(); f = store.getValueFactory(); @@ -85,7 +86,7 @@ public void setUp() throws Exception { * @throws java.lang.Exception */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { if (snapshot != null) { snapshot.close(); } @@ -101,7 +102,7 @@ public void tearDown() throws Exception { * . */ @Test - public final void testGetStatementsNoContextsAllNull() throws Exception { + final void testGetStatementsNoContextsAllNull() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -109,7 +110,7 @@ public final void testGetStatementsNoContextsAllNull() throws Exception { null, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(8, list.size()); + assertEquals(8, list.size()); } } @@ -119,7 +120,7 @@ public final void testGetStatementsNoContextsAllNull() throws Exception { * . */ @Test - public final void testGetStatementsOneContextAllNull() throws Exception { + final void testGetStatementsOneContextAllNull() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -127,7 +128,7 @@ public final void testGetStatementsOneContextAllNull() throws Exception { null, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(8, list.size()); + assertEquals(8, list.size()); } } @@ -137,7 +138,7 @@ public final void testGetStatementsOneContextAllNull() throws Exception { * . */ @Test - public final void testGetStatementsTwoContextsAllNull() throws Exception { + final void testGetStatementsTwoContextsAllNull() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -145,7 +146,7 @@ public final void testGetStatementsTwoContextsAllNull() throws Exception { null, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(16, list.size()); + assertEquals(16, list.size()); } } @@ -155,7 +156,7 @@ public final void testGetStatementsTwoContextsAllNull() throws Exception { * . */ @Test - public final void testGetStatementsNoContextsOnePredicate() throws Exception { + final void testGetStatementsNoContextsOnePredicate() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -163,7 +164,7 @@ public final void testGetStatementsNoContextsOnePredicate() throws Exception { RDFS.SUBCLASSOF, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(4, list.size()); + assertEquals(4, list.size()); } } @@ -173,7 +174,7 @@ public final void testGetStatementsNoContextsOnePredicate() throws Exception { * . */ @Test - public final void testGetStatementsOneContextOnePredicate() throws Exception { + final void testGetStatementsOneContextOnePredicate() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -181,7 +182,7 @@ public final void testGetStatementsOneContextOnePredicate() throws Exception { RDFS.SUBCLASSOF, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(4, list.size()); + assertEquals(4, list.size()); } } @@ -191,7 +192,7 @@ public final void testGetStatementsOneContextOnePredicate() throws Exception { * . */ @Test - public final void testGetStatementsTwoContextsOnePredicate() throws Exception { + final void testGetStatementsTwoContextsOnePredicate() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -199,7 +200,7 @@ public final void testGetStatementsTwoContextsOnePredicate() throws Exception { RDFS.SUBCLASSOF, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(8, list.size()); + assertEquals(8, list.size()); } } @@ -209,7 +210,7 @@ public final void testGetStatementsTwoContextsOnePredicate() throws Exception { * . */ @Test - public final void testGetStatementsNoContextsOnePredicateOneContext() throws Exception { + final void testGetStatementsNoContextsOnePredicateOneContext() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -217,7 +218,7 @@ public final void testGetStatementsNoContextsOnePredicateOneContext() throws Exc RDFS.SUBCLASSOF, null, this.alice)) { List list = Iterations.asList(statements); - Assertions.assertEquals(0, list.size()); + assertEquals(0, list.size()); } } @@ -227,7 +228,7 @@ public final void testGetStatementsNoContextsOnePredicateOneContext() throws Exc * . */ @Test - public final void testGetStatementsOneContextOnePredicateOneContext() throws Exception { + final void testGetStatementsOneContextOnePredicateOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -235,7 +236,7 @@ public final void testGetStatementsOneContextOnePredicateOneContext() throws Exc RDFS.SUBCLASSOF, null, this.alice)) { List list = Iterations.asList(statements); - Assertions.assertEquals(4, list.size()); + assertEquals(4, list.size()); } } @@ -245,7 +246,7 @@ public final void testGetStatementsOneContextOnePredicateOneContext() throws Exc * . */ @Test - public final void testGetStatementsTwoContextsOnePredicateOneContext() throws Exception { + final void testGetStatementsTwoContextsOnePredicateOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -253,7 +254,7 @@ public final void testGetStatementsTwoContextsOnePredicateOneContext() throws Ex RDFS.SUBCLASSOF, null, this.alice)) { List list = Iterations.asList(statements); - Assertions.assertEquals(4, list.size()); + assertEquals(4, list.size()); } } @@ -263,7 +264,7 @@ public final void testGetStatementsTwoContextsOnePredicateOneContext() throws Ex * . */ @Test - public final void testGetStatementsNoContextsOnePredicateTwoContexts() throws Exception { + final void testGetStatementsNoContextsOnePredicateTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -271,7 +272,7 @@ public final void testGetStatementsNoContextsOnePredicateTwoContexts() throws Ex RDFS.SUBCLASSOF, null, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(0, list.size()); + assertEquals(0, list.size()); } } @@ -281,7 +282,7 @@ public final void testGetStatementsNoContextsOnePredicateTwoContexts() throws Ex * . */ @Test - public final void testGetStatementsOneContextOnePredicateTwoContexts() throws Exception { + final void testGetStatementsOneContextOnePredicateTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -289,7 +290,7 @@ public final void testGetStatementsOneContextOnePredicateTwoContexts() throws Ex RDFS.SUBCLASSOF, null, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(4, list.size()); + assertEquals(4, list.size()); } } @@ -299,7 +300,7 @@ public final void testGetStatementsOneContextOnePredicateTwoContexts() throws Ex * . */ @Test - public final void testGetStatementsTwoContextsOnePredicateTwoContexts() throws Exception { + final void testGetStatementsTwoContextsOnePredicateTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -307,7 +308,7 @@ public final void testGetStatementsTwoContextsOnePredicateTwoContexts() throws E RDFS.SUBCLASSOF, null, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(8, list.size()); + assertEquals(8, list.size()); } } @@ -317,7 +318,7 @@ public final void testGetStatementsTwoContextsOnePredicateTwoContexts() throws E * . */ @Test - public final void testGetStatementsNoContextsPredicateOwlThingTwoContexts() throws Exception { + final void testGetStatementsNoContextsPredicateOwlThingTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -325,7 +326,7 @@ public final void testGetStatementsNoContextsPredicateOwlThingTwoContexts() thro RDFS.SUBCLASSOF, OWL.THING, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(0, list.size()); + assertEquals(0, list.size()); } } @@ -335,7 +336,7 @@ public final void testGetStatementsNoContextsPredicateOwlThingTwoContexts() thro * . */ @Test - public final void testGetStatementsOneContextPredicateOwlThingTwoContexts() throws Exception { + final void testGetStatementsOneContextPredicateOwlThingTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -343,7 +344,7 @@ public final void testGetStatementsOneContextPredicateOwlThingTwoContexts() thro RDFS.SUBCLASSOF, OWL.THING, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(1, list.size()); + assertEquals(1, list.size()); } } @@ -353,7 +354,7 @@ public final void testGetStatementsOneContextPredicateOwlThingTwoContexts() thro * . */ @Test - public final void testGetStatementsTwoContextsPredicateOwlThingTwoContexts() throws Exception { + final void testGetStatementsTwoContextsPredicateOwlThingTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -361,7 +362,7 @@ public final void testGetStatementsTwoContextsPredicateOwlThingTwoContexts() thr RDFS.SUBCLASSOF, OWL.THING, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(2, list.size()); + assertEquals(2, list.size()); } } @@ -371,7 +372,7 @@ public final void testGetStatementsTwoContextsPredicateOwlThingTwoContexts() thr * . */ @Test - public final void testGetStatementsNoContextsPredicateOwlClassTwoContexts() throws Exception { + final void testGetStatementsNoContextsPredicateOwlClassTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -379,7 +380,7 @@ public final void testGetStatementsNoContextsPredicateOwlClassTwoContexts() thro RDF.TYPE, OWL.CLASS, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(0, list.size()); + assertEquals(0, list.size()); } } @@ -389,7 +390,7 @@ public final void testGetStatementsNoContextsPredicateOwlClassTwoContexts() thro * . */ @Test - public final void testGetStatementsOneContextPredicateOwlClassTwoContexts() throws Exception { + final void testGetStatementsOneContextPredicateOwlClassTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -397,7 +398,7 @@ public final void testGetStatementsOneContextPredicateOwlClassTwoContexts() thro RDF.TYPE, OWL.CLASS, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(4, list.size()); + assertEquals(4, list.size()); } } @@ -407,7 +408,7 @@ public final void testGetStatementsOneContextPredicateOwlClassTwoContexts() thro * . */ @Test - public final void testGetStatementsTwoContextsPredicateOwlClassTwoContexts() throws Exception { + final void testGetStatementsTwoContextsPredicateOwlClassTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -415,7 +416,7 @@ public final void testGetStatementsTwoContextsPredicateOwlClassTwoContexts() thr RDF.TYPE, OWL.CLASS, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(8, list.size()); + assertEquals(8, list.size()); } } @@ -425,7 +426,7 @@ public final void testGetStatementsTwoContextsPredicateOwlClassTwoContexts() thr * . */ @Test - public final void testGetStatementsNoContextsPredicateOwlClassNoContexts() throws Exception { + final void testGetStatementsNoContextsPredicateOwlClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -433,7 +434,7 @@ public final void testGetStatementsNoContextsPredicateOwlClassNoContexts() throw RDF.TYPE, OWL.CLASS)) { List list = Iterations.asList(statements); - Assertions.assertEquals(4, list.size()); + assertEquals(4, list.size()); } } @@ -443,7 +444,7 @@ public final void testGetStatementsNoContextsPredicateOwlClassNoContexts() throw * . */ @Test - public final void testGetStatementsOneContextPredicateOwlClassNoContexts() throws Exception { + final void testGetStatementsOneContextPredicateOwlClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -451,7 +452,7 @@ public final void testGetStatementsOneContextPredicateOwlClassNoContexts() throw RDF.TYPE, OWL.CLASS)) { List list = Iterations.asList(statements); - Assertions.assertEquals(4, list.size()); + assertEquals(4, list.size()); } } @@ -461,7 +462,7 @@ public final void testGetStatementsOneContextPredicateOwlClassNoContexts() throw * . */ @Test - public final void testGetStatementsTwoContextsPredicateOwlClassNoContexts() throws Exception { + final void testGetStatementsTwoContextsPredicateOwlClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -469,7 +470,7 @@ public final void testGetStatementsTwoContextsPredicateOwlClassNoContexts() thro RDF.TYPE, OWL.CLASS)) { List list = Iterations.asList(statements); - Assertions.assertEquals(8, list.size()); + assertEquals(8, list.size()); } } @@ -479,7 +480,7 @@ public final void testGetStatementsTwoContextsPredicateOwlClassNoContexts() thro * . */ @Test - public final void testGetStatementsNoContextsPredicateExClassNoContexts() throws Exception { + final void testGetStatementsNoContextsPredicateExClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -487,7 +488,7 @@ public final void testGetStatementsNoContextsPredicateExClassNoContexts() throws RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"))) { List list = Iterations.asList(statements); - Assertions.assertEquals(3, list.size()); + assertEquals(3, list.size()); } } @@ -497,7 +498,7 @@ public final void testGetStatementsNoContextsPredicateExClassNoContexts() throws * . */ @Test - public final void testGetStatementsOneContextPredicateExClassNoContexts() throws Exception { + final void testGetStatementsOneContextPredicateExClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -505,7 +506,7 @@ public final void testGetStatementsOneContextPredicateExClassNoContexts() throws RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"))) { List list = Iterations.asList(statements); - Assertions.assertEquals(3, list.size()); + assertEquals(3, list.size()); } } @@ -515,7 +516,7 @@ public final void testGetStatementsOneContextPredicateExClassNoContexts() throws * . */ @Test - public final void testGetStatementsTwoContextsPredicateExClassNoContexts() throws Exception { + final void testGetStatementsTwoContextsPredicateExClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -523,7 +524,7 @@ public final void testGetStatementsTwoContextsPredicateExClassNoContexts() throw RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"))) { List list = Iterations.asList(statements); - Assertions.assertEquals(6, list.size()); + assertEquals(6, list.size()); } } @@ -533,7 +534,7 @@ public final void testGetStatementsTwoContextsPredicateExClassNoContexts() throw * . */ @Test - public final void testGetStatementsNoContextsPredicateExClassOneContext() throws Exception { + final void testGetStatementsNoContextsPredicateExClassOneContext() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -541,7 +542,7 @@ public final void testGetStatementsNoContextsPredicateExClassOneContext() throws RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"), this.alice)) { List list = Iterations.asList(statements); - Assertions.assertEquals(0, list.size()); + assertEquals(0, list.size()); } } @@ -551,7 +552,7 @@ public final void testGetStatementsNoContextsPredicateExClassOneContext() throws * . */ @Test - public final void testGetStatementsOneContextPredicateExClassOneContext() throws Exception { + final void testGetStatementsOneContextPredicateExClassOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -559,7 +560,7 @@ public final void testGetStatementsOneContextPredicateExClassOneContext() throws RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"), this.alice)) { List list = Iterations.asList(statements); - Assertions.assertEquals(3, list.size()); + assertEquals(3, list.size()); } } @@ -569,7 +570,7 @@ public final void testGetStatementsOneContextPredicateExClassOneContext() throws * . */ @Test - public final void testGetStatementsTwoContextsPredicateExClassOneContext() throws Exception { + final void testGetStatementsTwoContextsPredicateExClassOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -577,7 +578,7 @@ public final void testGetStatementsTwoContextsPredicateExClassOneContext() throw RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"), this.alice)) { List list = Iterations.asList(statements); - Assertions.assertEquals(3, list.size()); + assertEquals(3, list.size()); } } @@ -587,7 +588,7 @@ public final void testGetStatementsTwoContextsPredicateExClassOneContext() throw * . */ @Test - public final void testGetStatementsNoContextsPredicateExClassTwoContexts() throws Exception { + final void testGetStatementsNoContextsPredicateExClassTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -595,7 +596,7 @@ public final void testGetStatementsNoContextsPredicateExClassTwoContexts() throw RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"), this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(0, list.size()); + assertEquals(0, list.size()); } } @@ -605,7 +606,7 @@ public final void testGetStatementsNoContextsPredicateExClassTwoContexts() throw * . */ @Test - public final void testGetStatementsOneContextPredicateExClassTwoContexts() throws Exception { + final void testGetStatementsOneContextPredicateExClassTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -613,7 +614,7 @@ public final void testGetStatementsOneContextPredicateExClassTwoContexts() throw RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"), this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(3, list.size()); + assertEquals(3, list.size()); } } @@ -623,7 +624,7 @@ public final void testGetStatementsOneContextPredicateExClassTwoContexts() throw * . */ @Test - public final void testGetStatementsTwoContextsPredicateExClassTwoContexts() throws Exception { + final void testGetStatementsTwoContextsPredicateExClassTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -631,7 +632,7 @@ public final void testGetStatementsTwoContextsPredicateExClassTwoContexts() thro RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"), this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(6, list.size()); + assertEquals(6, list.size()); } } @@ -641,7 +642,7 @@ public final void testGetStatementsTwoContextsPredicateExClassTwoContexts() thro * . */ @Test - public final void testGetStatementsNoContextsExClassPredicateTwoContexts() throws Exception { + final void testGetStatementsNoContextsExClassPredicateTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -649,7 +650,7 @@ public final void testGetStatementsNoContextsExClassPredicateTwoContexts() throw .getStatements(f.createIRI(EX_NS, "C"), RDFS.SUBCLASSOF, null, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(0, list.size()); + assertEquals(0, list.size()); } } @@ -659,7 +660,7 @@ public final void testGetStatementsNoContextsExClassPredicateTwoContexts() throw * . */ @Test - public final void testGetStatementsOneContextExClassPredicateTwoContexts() throws Exception { + final void testGetStatementsOneContextExClassPredicateTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -667,7 +668,7 @@ public final void testGetStatementsOneContextExClassPredicateTwoContexts() throw .getStatements(f.createIRI(EX_NS, "C"), RDFS.SUBCLASSOF, null, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(1, list.size()); + assertEquals(1, list.size()); } } @@ -677,7 +678,7 @@ public final void testGetStatementsOneContextExClassPredicateTwoContexts() throw * . */ @Test - public final void testGetStatementsTwoContextsExClassPredicateTwoContexts() throws Exception { + final void testGetStatementsTwoContextsExClassPredicateTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -685,7 +686,7 @@ public final void testGetStatementsTwoContextsExClassPredicateTwoContexts() thro .getStatements(f.createIRI(EX_NS, "C"), RDFS.SUBCLASSOF, null, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(2, list.size()); + assertEquals(2, list.size()); } } @@ -695,7 +696,7 @@ public final void testGetStatementsTwoContextsExClassPredicateTwoContexts() thro * . */ @Test - public final void testGetStatementsNoContextsExClassPredicateNoContexts() throws Exception { + final void testGetStatementsNoContextsExClassPredicateNoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); @@ -703,7 +704,7 @@ public final void testGetStatementsNoContextsExClassPredicateNoContexts() throws .getStatements(f.createIRI(EX_NS, "C"), RDFS.SUBCLASSOF, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(1, list.size()); + assertEquals(1, list.size()); } } @@ -713,7 +714,7 @@ public final void testGetStatementsNoContextsExClassPredicateNoContexts() throws * . */ @Test - public final void testGetStatementsOneContextExClassPredicateNoContexts() throws Exception { + final void testGetStatementsOneContextExClassPredicateNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); @@ -721,7 +722,7 @@ public final void testGetStatementsOneContextExClassPredicateNoContexts() throws .getStatements(f.createIRI(EX_NS, "C"), RDFS.SUBCLASSOF, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(1, list.size()); + assertEquals(1, list.size()); } } @@ -731,7 +732,7 @@ public final void testGetStatementsOneContextExClassPredicateNoContexts() throws * . */ @Test - public final void testGetStatementsTwoContextsExClassPredicateNoContexts() throws Exception { + final void testGetStatementsTwoContextsExClassPredicateNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); @@ -739,7 +740,7 @@ public final void testGetStatementsTwoContextsExClassPredicateNoContexts() throw .getStatements(f.createIRI(EX_NS, "C"), RDFS.SUBCLASSOF, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(2, list.size()); + assertEquals(2, list.size()); } } @@ -749,7 +750,7 @@ public final void testGetStatementsTwoContextsExClassPredicateNoContexts() throw * . */ @Test - public final void testGetStatementsThreeContextsAllNull() throws Exception { + final void testGetStatementsThreeContextsAllNull() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob, this.mary); TripleSource source = getTripleSourceCommitted(); @@ -757,7 +758,7 @@ public final void testGetStatementsThreeContextsAllNull() throws Exception { null, null)) { List list = Iterations.asList(statements); - Assertions.assertEquals(24, list.size()); + assertEquals(24, list.size()); } } @@ -767,7 +768,7 @@ public final void testGetStatementsThreeContextsAllNull() throws Exception { * . */ @Test - public final void testGetStatementsThreeContextsOneContext() throws Exception { + final void testGetStatementsThreeContextsOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob, this.mary); TripleSource source = getTripleSourceCommitted(); @@ -775,7 +776,7 @@ public final void testGetStatementsThreeContextsOneContext() throws Exception { null, null, this.alice)) { List list = Iterations.asList(statements); - Assertions.assertEquals(8, list.size()); + assertEquals(8, list.size()); } } @@ -785,7 +786,7 @@ public final void testGetStatementsThreeContextsOneContext() throws Exception { * . */ @Test - public final void testGetStatementsThreeContextsTwoContexts() throws Exception { + final void testGetStatementsThreeContextsTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob, this.mary); TripleSource source = getTripleSourceCommitted(); @@ -793,7 +794,7 @@ public final void testGetStatementsThreeContextsTwoContexts() throws Exception { null, null, this.alice, this.bob)) { List list = Iterations.asList(statements); - Assertions.assertEquals(16, list.size()); + assertEquals(16, list.size()); } } @@ -803,7 +804,7 @@ public final void testGetStatementsThreeContextsTwoContexts() throws Exception { * . */ @Test - public final void testGetStatementsThreeContextsThreeContexts() throws Exception { + final void testGetStatementsThreeContextsThreeContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob, this.mary); TripleSource source = getTripleSourceCommitted(); @@ -811,7 +812,7 @@ public final void testGetStatementsThreeContextsThreeContexts() throws Exception null, null, this.alice, this.bob, this.mary)) { List list = Iterations.asList(statements); - Assertions.assertEquals(24, list.size()); + assertEquals(24, list.size()); } } diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryOptimisticIsolationTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryOptimisticIsolationTest.java index 0004bd56175..2360dc4a566 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryOptimisticIsolationTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryOptimisticIsolationTest.java @@ -15,12 +15,12 @@ import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory; import org.eclipse.rdf4j.sail.memory.config.MemoryStoreFactory; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; -public class MemoryOptimisticIsolationTest extends OptimisticIsolationTest { +class MemoryOptimisticIsolationTest extends OptimisticIsolationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); setRepositoryFactory(new SailRepositoryFactory() { @@ -31,8 +31,8 @@ public RepositoryImplConfig getConfig() { }); } - @AfterClass - public static void tearDown() throws Exception { + @AfterAll + static void tearDown() throws Exception { setRepositoryFactory(null); System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemorySparqlAggregatesTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemorySparqlAggregatesTest.java index a025bc1fb87..ee2b8de8b88 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemorySparqlAggregatesTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemorySparqlAggregatesTest.java @@ -13,17 +13,17 @@ import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.testsuite.repository.SparqlAggregatesTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; -public class MemorySparqlAggregatesTest extends SparqlAggregatesTest { +class MemorySparqlAggregatesTest extends SparqlAggregatesTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "true"); } - @AfterClass + @AfterAll public static void afterClass() throws Exception { System.setProperty("org.eclipse.rdf4j.repository.debug", "false"); } diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryStoreTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryStoreTest.java index d540cbadeb1..1b5c7b7d9cb 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryStoreTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/MemoryStoreTest.java @@ -31,7 +31,7 @@ /** * An extension of RDFStoreTest for testing the class org.eclipse.rdf4j.sesame.sail.memory.MemoryStore. */ -public class MemoryStoreTest extends RDFNotifyingStoreTest { +class MemoryStoreTest extends RDFNotifyingStoreTest { /*---------* * Methods * @@ -49,7 +49,7 @@ protected NotifyingSail createSail() throws SailException { * @throws Exception */ @Test - public void testZeroOrOnePropPathNonExisting() throws Exception { + void testZeroOrOnePropPathNonExisting() throws Exception { ParsedTupleQuery tupleQuery = (ParsedTupleQuery) QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, "SELECT ?resource WHERE {\n" + " (^()*) / ? ?resource\n" diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/QueryPlanRetrievalTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/QueryPlanRetrievalTest.java index f6b1ad7ffe1..962d6b9364a 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/QueryPlanRetrievalTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/QueryPlanRetrievalTest.java @@ -12,8 +12,8 @@ package org.eclipse.rdf4j.sail.memory; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -80,7 +80,7 @@ private void addData(SailRepository sailRepository) { } @Test - public void testTupleQuery() { + void testTupleQuery() { SailRepository sailRepository = new SailRepository(new MemoryStore()); try (SailRepositoryConnection connection = sailRepository.getConnection()) { Query query = connection.prepareTupleQuery(TUPLE_QUERY); @@ -130,7 +130,7 @@ public void testTupleQuery() { } @Test - public void testTupleQueryOptimized() { + void testTupleQueryOptimized() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -182,7 +182,7 @@ public void testTupleQueryOptimized() { @Test @Disabled - public void testTupleQueryTimed() { + void testTupleQueryTimed() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -209,7 +209,7 @@ public void testTupleQueryTimed() { } @Test - public void testTupleQueryExecuted() { + void testTupleQueryExecuted() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -264,7 +264,7 @@ public void testTupleQueryExecuted() { } @Test - public void testGenericPlanNode() { + void testGenericPlanNode() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -319,7 +319,7 @@ public void testGenericPlanNode() { } @Test - public void testJsonPlanNode() { + void testJsonPlanNode() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -443,7 +443,7 @@ public void testJsonPlanNode() { } @Test - public void testAskQuery() { + void testAskQuery() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -492,7 +492,7 @@ public void testAskQuery() { } @Test - public void testConstructQuery() { + void testConstructQuery() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -558,7 +558,7 @@ public void testConstructQuery() { @Disabled // slow test used for debugging @Test - public void bigDataset() throws IOException { + void bigDataset() throws IOException { SailRepository repository = new SailRepository(new MemoryStore()); try (SailRepositoryConnection connection = repository.getConnection()) { @@ -582,7 +582,7 @@ public void bigDataset() throws IOException { } @Test - public void testSubQuery() { + void testSubQuery() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -649,7 +649,7 @@ public void testSubQuery() { } @Test - public void testUnionQuery() { + void testUnionQuery() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -713,7 +713,7 @@ public void testUnionQuery() { } @Test - public void testTimeout() { + void testTimeout() { SailRepository sailRepository = new SailRepository(new MemoryStore()); try (SailRepositoryConnection connection = sailRepository.getConnection()) { connection.begin(); @@ -752,7 +752,7 @@ public void testTimeout() { } @Test - public void testDot() { + void testDot() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -905,7 +905,7 @@ public void testDot() { } @Test - public void testDotTimed() { + void testDotTimed() { SailRepository sailRepository = new SailRepository(new MemoryStore()); addData(sailRepository); @@ -932,7 +932,7 @@ public void testDotTimed() { } @Test - public void testWildcard() { + void testWildcard() { String expected = "Projection\n" + "╠══ProjectionElemList\n" + @@ -957,7 +957,7 @@ public void testWildcard() { } @Test - public void testArbitraryLengthPath() { + void testArbitraryLengthPath() { String expected = "Projection\n" + "╠══ProjectionElemList\n" + diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/SnapshotMonitorTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/SnapshotMonitorTest.java index 947912def06..15318570040 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/SnapshotMonitorTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/SnapshotMonitorTest.java @@ -11,6 +11,9 @@ package org.eclipse.rdf4j.sail.memory; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + import org.eclipse.rdf4j.common.iteration.CloseableIteration; import org.eclipse.rdf4j.common.transaction.IsolationLevels; import org.eclipse.rdf4j.model.Resource; @@ -18,15 +21,14 @@ import org.eclipse.rdf4j.sail.base.SailDataset; import org.eclipse.rdf4j.sail.base.SailSink; import org.eclipse.rdf4j.sail.base.SailSource; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; -public class SnapshotMonitorTest { +class SnapshotMonitorTest { @Test @Timeout(60) - public void testAutomaticCleanupDataset() throws InterruptedException { + void testAutomaticCleanupDataset() throws InterruptedException { try (MemorySailStore memorySailStore = new MemorySailStore(false)) { try (SailSource explicitSailSource = memorySailStore.getExplicitSailSource()) { @@ -46,7 +48,7 @@ public void testAutomaticCleanupDataset() throws InterruptedException { @Test @Timeout(60) - public void testAutomaticCleanupSink() throws InterruptedException { + void testAutomaticCleanupSink() throws InterruptedException { try (MemorySailStore memorySailStore = new MemorySailStore(false)) { try (SailSource explicitSailSource = memorySailStore.getExplicitSailSource()) { @@ -65,18 +67,18 @@ public void testAutomaticCleanupSink() throws InterruptedException { } @Test - public void testReservationAndReleaseDataset() { + void testReservationAndReleaseDataset() { try (MemorySailStore memorySailStore = new MemorySailStore(false)) { try (SailSource explicitSailSource = memorySailStore.getExplicitSailSource()) { try (SailDataset dataset = explicitSailSource.dataset(IsolationLevels.SNAPSHOT)) { - Assertions.assertEquals(-1, + assertEquals(-1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } memorySailStore.snapshotMonitor.reserve(100, this).release(); - Assertions.assertEquals(99, + assertEquals(99, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } @@ -85,12 +87,12 @@ public void testReservationAndReleaseDataset() { } @Test - public void testReservationAndReleaseDatasetNone() { + void testReservationAndReleaseDatasetNone() { try (MemorySailStore memorySailStore = new MemorySailStore(false)) { try (SailSource explicitSailSource = memorySailStore.getExplicitSailSource()) { try (SailDataset dataset = explicitSailSource.dataset(IsolationLevels.NONE)) { - Assertions.assertEquals(99, + assertEquals(99, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } } @@ -100,17 +102,17 @@ public void testReservationAndReleaseDatasetNone() { } @Test - public void testReservationAndReleaseSinkSerializable() { + void testReservationAndReleaseSinkSerializable() { try (MemorySailStore memorySailStore = new MemorySailStore(false)) { try (SailSource explicitSailSource = memorySailStore.getExplicitSailSource()) { try (SailSink sink = explicitSailSource.sink(IsolationLevels.SERIALIZABLE)) { - Assertions.assertEquals(-1, + assertEquals(-1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } memorySailStore.snapshotMonitor.reserve(100, this).release(); - Assertions.assertEquals(99, + assertEquals(99, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } @@ -119,12 +121,12 @@ public void testReservationAndReleaseSinkSerializable() { } @Test - public void testReservationAndReleaseSink() { + void testReservationAndReleaseSink() { try (MemorySailStore memorySailStore = new MemorySailStore(false)) { try (SailSource explicitSailSource = memorySailStore.getExplicitSailSource()) { try (SailSink sink = explicitSailSource.sink(IsolationLevels.SNAPSHOT)) { - Assertions.assertEquals(-1, + assertEquals(-1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(0)); } } @@ -134,12 +136,12 @@ public void testReservationAndReleaseSink() { } @Test - public void testMultipleReservations() { + void testMultipleReservations() { try (MemorySailStore memorySailStore = new MemorySailStore(true)) { try (SailSource explicitSailSource = memorySailStore.getExplicitSailSource()) { try (SailDataset dataset = explicitSailSource.dataset(IsolationLevels.SNAPSHOT)) { - Assertions.assertEquals(-1, + assertEquals(-1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } try (SailSink sink = explicitSailSource.sink(IsolationLevels.SNAPSHOT)) { @@ -151,24 +153,24 @@ public void testMultipleReservations() { sink.prepare(); sink.flush(); } - Assertions.assertEquals(0, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); + assertEquals(0, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); try (SailDataset dataset2 = explicitSailSource.dataset(IsolationLevels.SNAPSHOT)) { try (SailSink sink = explicitSailSource.sink(IsolationLevels.SNAPSHOT)) { sink.prepare(); sink.flush(); } - Assertions.assertEquals(0, + assertEquals(0, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } } try (SailDataset dataset = explicitSailSource.dataset(IsolationLevels.SNAPSHOT)) { - Assertions.assertEquals(2, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); + assertEquals(2, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } memorySailStore.snapshotMonitor.reserve(100, this).release(); - Assertions.assertEquals(99, + assertEquals(99, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } @@ -177,7 +179,7 @@ public void testMultipleReservations() { } @Test - public void testOverlappingReservations() { + void testOverlappingReservations() { try (MemorySailStore memorySailStore = new MemorySailStore(true)) { try (SailSource explicitSailSource = memorySailStore.getExplicitSailSource()) { @@ -194,27 +196,27 @@ public void testOverlappingReservations() { sink.close(); sink = explicitSailSource.sink(IsolationLevels.SERIALIZABLE); - Assertions.assertEquals(-1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); + assertEquals(-1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); dataset.close(); - Assertions.assertEquals(1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); + assertEquals(1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); sink.prepare(); sink.flush(); dataset = explicitSailSource.dataset(IsolationLevels.SNAPSHOT); - Assertions.assertEquals(1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); + assertEquals(1, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); sink.close(); - Assertions.assertEquals(2, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); + assertEquals(2, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); dataset.close(); memorySailStore.snapshotMonitor.reserve(100, this).release(); - Assertions.assertEquals(99, + assertEquals(99, memorySailStore.snapshotMonitor.getFirstUnusedOrElse(100)); } @@ -227,13 +229,13 @@ private void getAndAbandonDataset(SailSource explicitSailSource, MemorySailStore SailDataset dataset = explicitSailSource.dataset(IsolationLevels.SNAPSHOT); CloseableIteration contextIDs = dataset.getContextIDs(); contextIDs.close(); - Assertions.assertNotEquals(100, snapshotMonitor.getFirstUnusedOrElse(100)); + assertNotEquals(100, snapshotMonitor.getFirstUnusedOrElse(100)); } private void getAndAbandonSink(SailSource explicitSailSource, MemorySailStore.SnapshotMonitor snapshotMonitor) { SailSink sink = explicitSailSource.sink(IsolationLevels.SERIALIZABLE); sink.prepare(); sink.flush(); - Assertions.assertNotEquals(100, snapshotMonitor.getFirstUnusedOrElse(100)); + assertNotEquals(100, snapshotMonitor.getFirstUnusedOrElse(100)); } } diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/StoreSerializationTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/StoreSerializationTest.java index 713d5c0df9a..da16f24a12f 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/StoreSerializationTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/StoreSerializationTest.java @@ -36,7 +36,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class StoreSerializationTest { +class StoreSerializationTest { private File dataDir; @@ -51,7 +51,7 @@ protected void tearDown() throws Exception { } @Test - public void testShortLiterals() { + void testShortLiterals() { MemoryStore store = new MemoryStore(dataDir); store.init(); @@ -83,7 +83,7 @@ public void testShortLiterals() { } @Test - public void testSerialization() { + void testSerialization() { MemoryStore store = new MemoryStore(dataDir); store.init(); @@ -107,7 +107,7 @@ public void testSerialization() { BindingSet bindingSet = iter.next(); assertEquals(bindingSet.getValue("X"), foo); - assertEquals(bindingSet.getValue("P"), RDF.TYPE); + assertEquals(RDF.TYPE, bindingSet.getValue("P")); assertEquals(bindingSet.getValue("Y"), bar); iter.close(); con.close(); @@ -128,7 +128,7 @@ public void testSerialization() { bindingSet = iter.next(); assertEquals(bindingSet.getValue("X"), foo); - assertEquals(bindingSet.getValue("P"), RDF.TYPE); + assertEquals(RDF.TYPE, bindingSet.getValue("P")); assertEquals(bindingSet.getValue("Y"), bar); iter.close(); @@ -141,7 +141,7 @@ public void testSerialization() { } @Test - public void testLongLiterals() { + void testLongLiterals() { MemoryStore store = new MemoryStore(dataDir); store.init(); diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/config/MemoryStoreConfigTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/config/MemoryStoreConfigTest.java index 4aba51b3f56..d6185187dba 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/config/MemoryStoreConfigTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/config/MemoryStoreConfigTest.java @@ -25,7 +25,7 @@ * @author Jeen Broekstra * */ -public class MemoryStoreConfigTest { +class MemoryStoreConfigTest { @Test void testParse() { diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemStatementListTestIT.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemStatementListTestIT.java index c342bf2195a..fc2e9f92a30 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemStatementListTestIT.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemStatementListTestIT.java @@ -52,7 +52,7 @@ public class MemStatementListTestIT { public static final int CHUNKS = 10_000; @BeforeAll - public static void beforeAll() throws IOException { + static void beforeAll() throws IOException { MemoryStore memoryStore = new MemoryStore(); try { try (NotifyingSailConnection connection = memoryStore.getConnection()) { @@ -85,7 +85,7 @@ public static void beforeAll() throws IOException { } @BeforeEach - public void beforeEach() { + void beforeEach() { Random random = new Random(4823924); for (MemStatement statement : statements) { statement.setTillSnapshot(Math.max(6, random.nextInt())); @@ -95,7 +95,7 @@ public void beforeEach() { @Test @Timeout(120) - public void addMultipleThreads() throws ExecutionException, InterruptedException { + void addMultipleThreads() throws ExecutionException, InterruptedException { List> partition = Lists.partition(statements, CHUNKS); @@ -135,7 +135,7 @@ public void addMultipleThreads() throws ExecutionException, InterruptedException @Test @Timeout(120) - public void addRemoveMultipleThreads() throws ExecutionException, InterruptedException { + void addRemoveMultipleThreads() throws ExecutionException, InterruptedException { List> partition = Lists.partition(statements, CHUNKS); ArrayList shuffled = new ArrayList<>(statements); @@ -189,7 +189,7 @@ public void addRemoveMultipleThreads() throws ExecutionException, InterruptedExc @Test @Timeout(120) - public void addRemoveConsistentMultipleThreads() throws ExecutionException, InterruptedException { + void addRemoveConsistentMultipleThreads() throws ExecutionException, InterruptedException { List> partition = Lists.partition(statements, CHUNKS); ArrayList shuffled = new ArrayList<>(statements); @@ -250,7 +250,7 @@ public void addRemoveConsistentMultipleThreads() throws ExecutionException, Inte @Test @Timeout(120) - public void addCleanSnapshotConsistentMultipleThreads() throws ExecutionException, InterruptedException { + void addCleanSnapshotConsistentMultipleThreads() throws ExecutionException, InterruptedException { List> partition = Lists.partition(statements, CHUNKS); diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemTripleTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemTripleTest.java index c403a8abb1c..2c8b6711753 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemTripleTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemTripleTest.java @@ -24,7 +24,7 @@ * * @author Jeen Broekstra */ -public class MemTripleTest { +class MemTripleTest { private MemTriple triple; private MemIRI subject, predicate, object; @@ -32,7 +32,7 @@ public class MemTripleTest { private IRI s1, p1, o1; @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { SimpleValueFactory svf = SimpleValueFactory.getInstance(); @@ -47,7 +47,7 @@ public void setUp() throws Exception { } @Test - public void testStringValue() { + void testStringValue() { assertThat(triple.stringValue()) .startsWith("<<") .contains(s1.stringValue()) @@ -57,7 +57,7 @@ public void testStringValue() { } @Test - public void testEquals() { + void testEquals() { SimpleTriple equalTriple = (SimpleTriple) SimpleValueFactory.getInstance().createTriple(s1, p1, o1); assertThat(triple).isEqualTo(equalTriple); diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemURITest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemURITest.java index 4d834140f0e..49f769406ca 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemURITest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemURITest.java @@ -10,10 +10,11 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.memory.model; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.model.vocabulary.RDF; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -21,13 +22,13 @@ * * @author Arjohn Kampman */ -public class MemURITest { +class MemURITest { /** * Verifies that MemURI's hash code is the same as the hash code of an equivalent URIImpl. */ @Test - public void testEqualsAndHash() throws Exception { + void testEqualsAndHash() throws Exception { compareURIs(RDF.NAMESPACE); compareURIs(RDF.TYPE.toString()); compareURIs("foo:bar"); @@ -39,8 +40,8 @@ private void compareURIs(String uri) throws Exception { IRI uriImpl = SimpleValueFactory.getInstance().createIRI(uri); MemIRI memURI = new MemIRI(this, uriImpl.getNamespace(), uriImpl.getLocalName()); - Assertions.assertEquals(uriImpl, memURI, "MemURI not equal to URIImpl for: " + uri); - Assertions.assertEquals(uriImpl.hashCode(), memURI.hashCode(), + assertEquals(uriImpl, memURI, "MemURI not equal to URIImpl for: " + uri); + assertEquals(uriImpl.hashCode(), memURI.hashCode(), "MemURI has different hash code than URIImpl for: " + uri); } } diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemValueFactoryTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemValueFactoryTest.java index 087af609931..a8876ea6ba9 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemValueFactoryTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/MemValueFactoryTest.java @@ -15,10 +15,10 @@ import org.eclipse.rdf4j.model.IRI; import org.junit.jupiter.api.Test; -public class MemValueFactoryTest { +class MemValueFactoryTest { @Test - public void testCreateIRI_namespace_localName_whitespace() { + void testCreateIRI_namespace_localName_whitespace() { MemValueFactory factory = new MemValueFactory(); String namespace = "http://example.org/with whitespace/"; diff --git a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/WeakObjectRegistryTest.java b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/WeakObjectRegistryTest.java index e96b6727903..c75756d29bd 100644 --- a/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/WeakObjectRegistryTest.java +++ b/core/sail/memory/src/test/java/org/eclipse/rdf4j/sail/memory/model/WeakObjectRegistryTest.java @@ -17,11 +17,11 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; -public class WeakObjectRegistryTest { +class WeakObjectRegistryTest { @Test @Timeout(5) - public void testGC() throws InterruptedException { + void testGC() throws InterruptedException { WeakObjectRegistry objects = new WeakObjectRegistry<>(); diff --git a/core/sail/model/pom.xml b/core/sail/model/pom.xml index 462bdcdb83a..a406829d86e 100644 --- a/core/sail/model/pom.xml +++ b/core/sail/model/pom.xml @@ -35,6 +35,12 @@ com.google.guava guava-testlib test + + + junit + junit + + diff --git a/core/sail/nativerdf/pom.xml b/core/sail/nativerdf/pom.xml index 1a0c97b85df..a1f12bc9c9d 100644 --- a/core/sail/nativerdf/pom.xml +++ b/core/sail/nativerdf/pom.xml @@ -54,6 +54,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-repository-testsuite diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/ContextStoreTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/ContextStoreTest.java index 291558d0195..3faa74a3957 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/ContextStoreTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/ContextStoreTest.java @@ -29,7 +29,7 @@ * * @author Jeen Broekstra */ -public class ContextStoreTest { +class ContextStoreTest { private ContextStore subject; @@ -45,7 +45,7 @@ public class ContextStoreTest { * @throws java.lang.Exception */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { NativeSailStore sailStore = mock(NativeSailStore.class); when(sailStore.getValueFactory()).thenReturn(SimpleValueFactory.getInstance()); @@ -55,26 +55,26 @@ public void setUp() throws Exception { } @Test - public void testIncrementNew() throws Exception { + void testIncrementNew() throws Exception { subject.increment(g1); assertThat(countContexts(subject)).isEqualTo(1); } @Test - public void testIncrementNewBNode() throws Exception { + void testIncrementNewBNode() throws Exception { subject.increment(g2); assertThat(countContexts(subject)).isEqualTo(1); } @Test - public void testIncrementExisting() throws Exception { + void testIncrementExisting() throws Exception { subject.increment(g1); subject.increment(g1); assertThat(countContexts(subject)).isEqualTo(1); } @Test - public void testDecrementExisting() throws Exception { + void testDecrementExisting() throws Exception { subject.increment(g1); subject.increment(g1); @@ -86,7 +86,7 @@ public void testDecrementExisting() throws Exception { } @Test - public void testDecrementExistingBySeveral() throws Exception { + void testDecrementExistingBySeveral() throws Exception { subject.increment(g1); subject.increment(g1); @@ -95,7 +95,7 @@ public void testDecrementExistingBySeveral() throws Exception { } @Test - public void testDecrementExistingBNode() throws Exception { + void testDecrementExistingBNode() throws Exception { subject.increment(g2); subject.increment(g2); @@ -107,13 +107,13 @@ public void testDecrementExistingBNode() throws Exception { } @Test - public void testDecrementNonExisting() throws Exception { + void testDecrementNonExisting() throws Exception { subject.decrementBy(g1, 1); assertThat(countContexts(subject)).isEqualTo(0); } @Test - public void testSync() throws Exception { + void testSync() throws Exception { File datafile = new File(dataDir, "contexts.dat"); assertThat(datafile.exists()); long size = datafile.length(); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/DefaultIndexTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/DefaultIndexTest.java index d7b072d5350..58cdfea7c56 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/DefaultIndexTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/DefaultIndexTest.java @@ -18,16 +18,15 @@ import java.util.Properties; import org.eclipse.rdf4j.common.io.FileUtil; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class DefaultIndexTest { +class DefaultIndexTest { @TempDir File dir; @Test - public void testDefaultIndex() throws Exception { + void testDefaultIndex() throws Exception { TripleStore store = new TripleStore(dir, null); store.close(); // check that the triple store used the default index @@ -36,7 +35,7 @@ public void testDefaultIndex() throws Exception { } @Test - public void testExistingIndex() throws Exception { + void testExistingIndex() throws Exception { // set a non-default index TripleStore store = new TripleStore(dir, "spoc,opsc"); store.close(); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/LimitedSizeNativeStoreConnectionTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/LimitedSizeNativeStoreConnectionTest.java index 8edeb54c7b1..77da08199aa 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/LimitedSizeNativeStoreConnectionTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/LimitedSizeNativeStoreConnectionTest.java @@ -33,7 +33,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class LimitedSizeNativeStoreConnectionTest extends RepositoryConnectionTest { +class LimitedSizeNativeStoreConnectionTest extends RepositoryConnectionTest { @Override protected Repository createRepository(File dataDir) throws IOException { return new SailRepository(new LimitedSizeNativeStore(dataDir, "spoc")); @@ -41,7 +41,7 @@ protected Repository createRepository(File dataDir) throws IOException { @ParameterizedTest @MethodSource("parameters") - public void testSES715(IsolationLevel level) throws Exception { + void testSES715(IsolationLevel level) throws Exception { setupTest(level); // load 1000 triples in two different contexts @@ -78,7 +78,7 @@ public void testSES715(IsolationLevel level) throws Exception { @ParameterizedTest @MethodSource("parameters") - public void testLimit(IsolationLevel level) throws Exception { + void testLimit(IsolationLevel level) throws Exception { setupTest(level); ((LimitedSizeNativeStoreConnection) ((SailRepositoryConnection) testCon).getSailConnection()) diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/LongMultithreadedTransactions.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/LongMultithreadedTransactions.java index 24c3c2ed2b3..d9894b3eb4a 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/LongMultithreadedTransactions.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/LongMultithreadedTransactions.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class LongMultithreadedTransactions { +class LongMultithreadedTransactions { @TempDir File tmpDir; @@ -37,7 +37,7 @@ NotifyingSail getBaseSail() { @Test @Disabled - public void test() { + void test() { ValueFactory vf = SimpleValueFactory.getInstance(); @@ -68,7 +68,7 @@ public void test() { @Test @Disabled - public void test1() { + void test1() { ValueFactory vf = SimpleValueFactory.getInstance(); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/MemoryOverflowToDiskTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/MemoryOverflowToDiskTest.java index 3e721b28c7f..dd0c0733883 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/MemoryOverflowToDiskTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/MemoryOverflowToDiskTest.java @@ -24,11 +24,11 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; -public class MemoryOverflowToDiskTest { +class MemoryOverflowToDiskTest { @Test @Timeout(5) - public void testCleanerRemovesTempDirWhenMemoryOverflowModelGetsGCed() throws IOException, InterruptedException { + void testCleanerRemovesTempDirWhenMemoryOverflowModelGetsGCed() throws IOException, InterruptedException { File file = Files.createTempDirectory("model").toFile(); Model model = createModel(file); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeOptimisticIsolationTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeOptimisticIsolationTest.java index a3722842e51..a188cd9908f 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeOptimisticIsolationTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeOptimisticIsolationTest.java @@ -15,12 +15,12 @@ import org.eclipse.rdf4j.repository.sail.config.SailRepositoryFactory; import org.eclipse.rdf4j.sail.nativerdf.config.NativeStoreFactory; import org.eclipse.rdf4j.testsuite.repository.OptimisticIsolationTest; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; -public class NativeOptimisticIsolationTest extends OptimisticIsolationTest { +class NativeOptimisticIsolationTest extends OptimisticIsolationTest { - @BeforeClass + @BeforeAll public static void setUpClass() throws Exception { setRepositoryFactory(new SailRepositoryFactory() { @Override @@ -30,8 +30,8 @@ public RepositoryImplConfig getConfig() { }); } - @AfterClass - public static void tearDown() throws Exception { + @AfterAll + static void tearDown() throws Exception { setRepositoryFactory(null); } } diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeSailStoreTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeSailStoreTest.java index 22dcf945e1b..d10f379ad00 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeSailStoreTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeSailStoreTest.java @@ -32,7 +32,7 @@ /** * An extension of RDFStoreTest for testing the class {@link NativeStore}. */ -public class NativeSailStoreTest { +class NativeSailStoreTest { @TempDir File tempFolder; @@ -53,7 +53,7 @@ public class NativeSailStoreTest { F.createLiteral("two")); @BeforeEach - public void before() throws Exception { + void before() throws Exception { File dataDir = new File(tempFolder, "dbmodel"); dataDir.mkdir(); repo = new SailRepository(new NativeStore(dataDir, "spoc,posc")); @@ -67,7 +67,7 @@ public void before() throws Exception { } @Test - public void testRemoveValidContext() { + void testRemoveValidContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.remove((IRI) null, null, null, CTX_1); } @@ -79,7 +79,7 @@ public void testRemoveValidContext() { } @Test - public void testRemoveEmptyContext() { + void testRemoveEmptyContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.remove((IRI) null, null, null, (Resource) null); } @@ -91,7 +91,7 @@ public void testRemoveEmptyContext() { } @Test - public void testRemoveInvalidContext() { + void testRemoveInvalidContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.remove((IRI) null, null, null, CTX_INV); } @@ -103,7 +103,7 @@ public void testRemoveInvalidContext() { } @Test - public void testRemoveMultipleValidContext() { + void testRemoveMultipleValidContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.remove((IRI) null, null, null, CTX_1, CTX_2); } @@ -115,7 +115,7 @@ public void testRemoveMultipleValidContext() { } @Test - public void testClearMultipleValidContext() { + void testClearMultipleValidContext() { try (RepositoryConnection conn = repo.getConnection()) { conn.clear(CTX_1, CTX_2); } @@ -127,7 +127,7 @@ public void testClearMultipleValidContext() { } @AfterEach - public void after() throws Exception { + void after() throws Exception { repo.shutDown(); } } diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreConnectionTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreConnectionTest.java index 2bbb8a5f93c..88c5ada499d 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreConnectionTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreConnectionTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -public class NativeStoreConnectionTest extends RepositoryConnectionTest { +class NativeStoreConnectionTest extends RepositoryConnectionTest { @Override protected Repository createRepository(File dataDir) throws IOException { return new SailRepository(new NativeStore(dataDir, "spoc")); @@ -33,7 +33,7 @@ protected Repository createRepository(File dataDir) throws IOException { @ParameterizedTest @MethodSource("parameters") - public void testSES715(IsolationLevel level) throws Exception { + void testSES715(IsolationLevel level) throws Exception { setupTest(level); // load 1000 triples in two different contexts diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreConsistencyIT.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreConsistencyIT.java index 6cc0f2f5080..f18d6df90cb 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreConsistencyIT.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreConsistencyIT.java @@ -40,7 +40,7 @@ * * @author Jeen Broekstra */ -public class NativeStoreConsistencyIT { +class NativeStoreConsistencyIT { private static final Logger logger = LoggerFactory.getLogger(NativeStoreConsistencyIT.class); /*-----------* @@ -52,7 +52,7 @@ public class NativeStoreConsistencyIT { *---------*/ @Test - public void testSES1867IndexCorruption(@TempDir File dataDir) throws Exception { + void testSES1867IndexCorruption(@TempDir File dataDir) throws Exception { ValueFactory vf = SimpleValueFactory.getInstance(); IRI oldContext = vf.createIRI("http://example.org/oldContext"); IRI newContext = vf.createIRI("http://example.org/newContext"); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreDirLockTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreDirLockTest.java index 6d4c8bc68ba..349478bb572 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreDirLockTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreDirLockTest.java @@ -16,17 +16,16 @@ import java.io.File; import org.eclipse.rdf4j.sail.SailLockedException; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class NativeStoreDirLockTest { +class NativeStoreDirLockTest { @TempDir File dataDir; @Test - public void testLocking() throws Exception { + void testLocking() throws Exception { NativeStore sail = new NativeStore(dataDir, "spoc,posc"); sail.init(); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreRepositoryTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreRepositoryTest.java index d4540a1b386..5abf12b8918 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreRepositoryTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreRepositoryTest.java @@ -16,9 +16,7 @@ import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.testsuite.repository.RepositoryTest; -import org.junit.Rule; import org.junit.jupiter.api.io.TempDir; -import org.junit.rules.TemporaryFolder; public class NativeStoreRepositoryTest extends RepositoryTest { @TempDir diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTest.java index b38abd5408b..0dfc3b6687f 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTest.java @@ -50,7 +50,7 @@ protected NotifyingSail createSail() throws SailException { // Test for SES-542 @Test - public void testGetNamespacePersistence() throws Exception { + void testGetNamespacePersistence() throws Exception { con.begin(); con.setNamespace("rdf", RDF.NAMESPACE); con.commit(); @@ -65,7 +65,7 @@ public void testGetNamespacePersistence() throws Exception { } @Test - public void testContextCacheReconstruction() throws Exception { + void testContextCacheReconstruction() throws Exception { con.begin(); con.addStatement(RDF.TYPE, RDF.TYPE, RDF.TYPE, RDF.ALT); con.commit(); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTmpDatadirTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTmpDatadirTest.java index 82eb0d79123..383850c853b 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTmpDatadirTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTmpDatadirTest.java @@ -10,7 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.nativerdf; +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.assertTrue; import java.io.File; @@ -18,24 +20,24 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class NativeStoreTmpDatadirTest { +class NativeStoreTmpDatadirTest { @TempDir File dataDir; @Test - public void testNoTmpDatadir() { + void testNoTmpDatadir() { NativeStore store = new NativeStore(dataDir); store.init(); - assertTrue(dataDir.equals(store.getDataDir()), "Data dir not set correctly"); + assertEquals(dataDir, store.getDataDir(), "Data dir not set correctly"); store.shutDown(); assertTrue(dataDir.exists(), "Data dir does not exist anymore"); } @Test - public void testTmpDatadir() { + void testTmpDatadir() { NativeStore store = new NativeStore(); store.init(); File dataDir = store.getDataDir(); @@ -46,7 +48,7 @@ public void testTmpDatadir() { } @Test - public void testTmpDatadirReinit() { + void testTmpDatadirReinit() { NativeStore store = new NativeStore(); store.init(); File dataDir1 = store.getDataDir(); @@ -55,11 +57,11 @@ public void testTmpDatadirReinit() { store.init(); File dataDir2 = store.getDataDir(); store.shutDown(); - assertFalse(dataDir1.equals(dataDir2), "Temp data dirs are the same"); + assertNotEquals(dataDir1, dataDir2, "Temp data dirs are the same"); } @Test - public void testDatadirMix() { + void testDatadirMix() { NativeStore store = new NativeStore(dataDir); store.init(); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTxnTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTxnTest.java index 10e40d64827..0c19e29b096 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTxnTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/NativeStoreTxnTest.java @@ -38,7 +38,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class NativeStoreTxnTest { +class NativeStoreTxnTest { @TempDir File tempFolder; @@ -50,7 +50,7 @@ public class NativeStoreTxnTest { protected IRI ctx = vf.createIRI("http://ex.org/ctx"); @BeforeEach - public void before() throws Exception { + void before() throws Exception { File dataDir = new File(tempFolder, "dbmodel"); repo = new SailRepository(new NativeStore(dataDir, "spoc,posc")); @@ -58,12 +58,12 @@ public void before() throws Exception { } @AfterEach - public void after() throws Exception { + void after() throws Exception { repo.shutDown(); } @Test - public void testTxncacheCleanup() throws Exception { + void testTxncacheCleanup() throws Exception { /* * Test for issue # On windows the txncacheXXX.dat files did not get properly deleted, as the file is locked @@ -117,7 +117,7 @@ protected void removeStmt(Statement stmt) { } @Test - public void testOldTxnStatusFile() throws Exception { + void testOldTxnStatusFile() throws Exception { TripleStore tripleStore = new TripleStore(repo.getDataDir(), "spoc"); try { @@ -154,7 +154,7 @@ public void testOldTxnStatusFile() throws Exception { } @Test - public void testOldTxnStatusesDoNotConflict() { + void testOldTxnStatusesDoNotConflict() { String[] oldTxtStatuses = { "NONE", "ACTIVE", "COMMITTING", "ROLLING_BACK", "UNKNOWN" }; for (String value1 : oldTxtStatuses) { diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/QueryBenchmarkTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/QueryBenchmarkTest.java index f64ef3210d6..fdaa51e71b0 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/QueryBenchmarkTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/QueryBenchmarkTest.java @@ -34,7 +34,7 @@ /** * @author Håvard Ottestad */ -public class QueryBenchmarkTest { +class QueryBenchmarkTest { private static SailRepository repository; @@ -59,7 +59,7 @@ public class QueryBenchmarkTest { static List statementList; @BeforeAll - public static void beforeClass(@TempDir File dataDir) throws IOException { + static void beforeClass(@TempDir File dataDir) throws IOException { repository = new SailRepository(new NativeStore(dataDir, "spoc,ospc,psoc")); @@ -83,14 +83,14 @@ private static InputStream getResourceAsStream(String name) { } @AfterAll - public static void afterClass() throws IOException { + static void afterClass() throws IOException { repository.shutDown(); repository = null; statementList = null; } @Test - public void groupByQuery() { + void groupByQuery() { try (SailRepositoryConnection connection = repository.getConnection()) { long count = connection .prepareTupleQuery(query1) @@ -102,7 +102,7 @@ public void groupByQuery() { } @Test - public void complexQuery() { + void complexQuery() { try (SailRepositoryConnection connection = repository.getConnection()) { long count = connection .prepareTupleQuery(query4) @@ -114,7 +114,7 @@ public void complexQuery() { } @Test - public void distinctPredicatesQuery() { + void distinctPredicatesQuery() { try (SailRepositoryConnection connection = repository.getConnection()) { long count = connection .prepareTupleQuery(query5) @@ -126,7 +126,7 @@ public void distinctPredicatesQuery() { } @Test - public void removeByQuery() { + void removeByQuery() { try (SailRepositoryConnection connection = repository.getConnection()) { connection.begin(IsolationLevels.NONE); connection.remove((Resource) null, RDF.TYPE, null); @@ -140,7 +140,7 @@ public void removeByQuery() { } @Test - public void removeByQueryReadCommitted() { + void removeByQueryReadCommitted() { try (SailRepositoryConnection connection = repository.getConnection()) { connection.begin(IsolationLevels.READ_COMMITTED); connection.remove((Resource) null, RDF.TYPE, null); @@ -154,7 +154,7 @@ public void removeByQueryReadCommitted() { } @Test - public void simpleUpdateQueryIsolationReadCommitted() { + void simpleUpdateQueryIsolationReadCommitted() { try (SailRepositoryConnection connection = repository.getConnection()) { connection.begin(IsolationLevels.READ_COMMITTED); connection.prepareUpdate(query2).execute(); @@ -171,7 +171,7 @@ public void simpleUpdateQueryIsolationReadCommitted() { } @Test - public void simpleUpdateQueryIsolationNone() { + void simpleUpdateQueryIsolationNone() { try (SailRepositoryConnection connection = repository.getConnection()) { connection.begin(IsolationLevels.NONE); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/SailSourceModelTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/SailSourceModelTest.java index b91c09dc24d..b3370a52ff0 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/SailSourceModelTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/SailSourceModelTest.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -public class SailSourceModelTest extends ModelTest { +class SailSourceModelTest extends ModelTest { @Test - public void testRemove() { + void testRemove() { SailSourceModel sailSourceModel = getNewModel(); sailSourceModel.add(RDF.TYPE, RDF.TYPE, RDF.TYPE); sailSourceModel.remove(RDF.TYPE, RDF.TYPE, RDF.TYPE); @@ -33,7 +33,7 @@ public void testRemove() { } @Test - public void testRemoveTermIteration() { + void testRemoveTermIteration() { SailSourceModel sailSourceModel = getNewModel(); sailSourceModel.add(RDF.TYPE, RDF.TYPE, RDF.TYPE); sailSourceModel.removeTermIteration((Iterator) mock(Iterator.class), RDF.TYPE, RDF.TYPE, RDF.TYPE); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TestNativeStoreMemoryOverflow.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TestNativeStoreMemoryOverflow.java index 1c7321f5452..53a0fcf2606 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TestNativeStoreMemoryOverflow.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TestNativeStoreMemoryOverflow.java @@ -34,7 +34,7 @@ /** * @author James Leigh */ -public class TestNativeStoreMemoryOverflow { +class TestNativeStoreMemoryOverflow { private Repository testRepository; private RepositoryConnection testCon; @@ -42,7 +42,7 @@ public class TestNativeStoreMemoryOverflow { private RepositoryConnection testCon2; @BeforeEach - public void setUp(@TempDir File dataDir) throws Exception { + void setUp(@TempDir File dataDir) throws Exception { testRepository = createRepository(dataDir); } @@ -61,7 +61,7 @@ private Repository createRepository(File dataDir) throws IOException { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { testCon2.close(); testCon.close(); testRepository.shutDown(); @@ -69,7 +69,7 @@ public void tearDown() throws Exception { @ParameterizedTest @EnumSource(IsolationLevels.class) - public void test(IsolationLevel level) throws Exception { + void test(IsolationLevel level) throws Exception { setupConnections(level); int size = 10000; // this should really be bigger diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TestNativeStoreUpgrade.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TestNativeStoreUpgrade.java index 5295005c9e3..702c3cd4ced 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TestNativeStoreUpgrade.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TestNativeStoreUpgrade.java @@ -46,7 +46,7 @@ public class TestNativeStoreUpgrade { File dataDir; @Test - public void testDevel() throws SailException { + void testDevel() throws SailException { NativeStore store = new NativeStore(dataDir); try { store.init(); @@ -65,7 +65,7 @@ public void testDevel() throws SailException { } @Test - public void test2715() throws IOException, SailException { + void test2715() throws IOException, SailException { extractZipResource(ZIP_2_7_15, dataDir); assertFalse(new File(dataDir, "nativerdf.ver").exists()); assertValue(dataDir); @@ -73,7 +73,7 @@ public void test2715() throws IOException, SailException { } @Test - public void test2715Inconsistent() throws IOException, SailException { + void test2715Inconsistent() throws IOException, SailException { extractZipResource(ZIP_2_7_15_INCONSISTENT, dataDir); assertFalse(new File(dataDir, "nativerdf.ver").exists()); NativeStore store = new NativeStore(dataDir); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TripleStoreRecoveryTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TripleStoreRecoveryTest.java index 6c4640bc156..2f17febd3a0 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TripleStoreRecoveryTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/TripleStoreRecoveryTest.java @@ -17,20 +17,19 @@ import org.eclipse.rdf4j.sail.nativerdf.TxnStatusFile.TxnStatus; import org.eclipse.rdf4j.sail.nativerdf.btree.RecordIterator; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; /** * An extension of RDFStoreTest for testing the class {@link NativeStore}. */ -public class TripleStoreRecoveryTest { +class TripleStoreRecoveryTest { @TempDir File dataDir; @Test - public void testRollbackRecovery() throws Exception { + void testRollbackRecovery() throws Exception { TripleStore tripleStore = new TripleStore(dataDir, "spoc"); try { tripleStore.startTransaction(); @@ -52,7 +51,7 @@ public void testRollbackRecovery() throws Exception { } @Test - public void testCommitRecovery() throws Exception { + void testCommitRecovery() throws Exception { TripleStore tripleStore = new TripleStore(dataDir, "spoc"); try { tripleStore.startTransaction(); diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/btree/BTreeBenchmark.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/btree/BTreeBenchmark.java index 59a1cdf0662..69d2595d1a3 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/btree/BTreeBenchmark.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/btree/BTreeBenchmark.java @@ -23,7 +23,7 @@ /** * @author Arjohn Kampman */ -public class BTreeBenchmark { +class BTreeBenchmark { private static final int VALUE_COUNT = 100 * 1000; @@ -41,17 +41,17 @@ public class BTreeBenchmark { *---------*/ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { btree = new BTree(tmpDir, "test", 4096, 8); } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { btree.delete(); } @Test - public void testAddAscending() throws Exception { + void testAddAscending() throws Exception { Thread.sleep(500L); long startTime = System.currentTimeMillis(); @@ -63,7 +63,7 @@ public void testAddAscending() throws Exception { } @Test - public void testAddRandom() throws Exception { + void testAddRandom() throws Exception { Thread.sleep(500L); long startTime = System.currentTimeMillis(); @@ -75,7 +75,7 @@ public void testAddRandom() throws Exception { } @Test - public void testUpdate() throws Exception { + void testUpdate() throws Exception { addAscending(0L, 2L, VALUE_COUNT); btree.sync(); @@ -90,7 +90,7 @@ public void testUpdate() throws Exception { } @Test - public void testRemove() throws Exception { + void testRemove() throws Exception { addAscending(0L, 1L, VALUE_COUNT); btree.sync(); @@ -105,7 +105,7 @@ public void testRemove() throws Exception { } @Test - public void testFullScan() throws Exception { + void testFullScan() throws Exception { addAscending(0L, 1L, VALUE_COUNT); btree.sync(); @@ -122,17 +122,17 @@ public void testFullScan() throws Exception { } @Test - public void testRangeScan4() throws Exception { + void testRangeScan4() throws Exception { testRangeScan(4L); } @Test - public void testRangeScan20() throws Exception { + void testRangeScan20() throws Exception { testRangeScan(20L); } @Test - public void testRangeScan1000() throws Exception { + void testRangeScan1000() throws Exception { testRangeScan(1000L); } diff --git a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/btree/BTreeTest.java b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/btree/BTreeTest.java index b9abe94eb47..b627b77ed60 100644 --- a/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/btree/BTreeTest.java +++ b/core/sail/nativerdf/src/test/java/org/eclipse/rdf4j/sail/nativerdf/btree/BTreeTest.java @@ -23,7 +23,7 @@ /** * @author Arjohn Kampman */ -public class BTreeTest { +class BTreeTest { /*-----------* * Constants * @@ -58,38 +58,38 @@ public class BTreeTest { *---------*/ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { btree = new BTree(tmpDir, "test", 85, 1); } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { btree.delete(); } @Test - public void testAddAscending() throws Exception { + void testAddAscending() throws Exception { for (byte[] value : TEST_VALUES) { btree.insert(value); } } @Test - public void testAddDescending() throws Exception { + void testAddDescending() throws Exception { for (int i = TEST_VALUES.size() - 1; i >= 0; i--) { btree.insert(TEST_VALUES.get(i)); } } @Test - public void testAddRandom() throws Exception { + void testAddRandom() throws Exception { for (byte[] value : RANDOMIZED_TEST_VALUES) { btree.insert(value); } } @Test - public void testRemoveAscending() throws Exception { + void testRemoveAscending() throws Exception { testAddRandom(); for (byte[] value : TEST_VALUES) { @@ -98,7 +98,7 @@ public void testRemoveAscending() throws Exception { } @Test - public void testRemoveDescending() throws Exception { + void testRemoveDescending() throws Exception { testAddRandom(); for (int i = TEST_VALUES.size() - 1; i >= 0; i--) { @@ -107,7 +107,7 @@ public void testRemoveDescending() throws Exception { } @Test - public void testRemoveRandom() throws Exception { + void testRemoveRandom() throws Exception { testAddAscending(); for (byte[] value : RANDOMIZED_TEST_VALUES) { @@ -116,7 +116,7 @@ public void testRemoveRandom() throws Exception { } @Test - public void testConcurrentAccess() throws Exception { + void testConcurrentAccess() throws Exception { int meanIdx = TEST_VALUES.size() / 2; btree.insert(TEST_VALUES.get(meanIdx - 1)); btree.insert(TEST_VALUES.get(meanIdx)); @@ -139,7 +139,7 @@ public void testConcurrentAccess() throws Exception { } @Test - public void testNewAndClear() throws Exception { + void testNewAndClear() throws Exception { btree.clear(); } diff --git a/core/sail/shacl/pom.xml b/core/sail/shacl/pom.xml index 7c25d08d26e..82102a14cac 100644 --- a/core/sail/shacl/pom.xml +++ b/core/sail/shacl/pom.xml @@ -39,6 +39,11 @@ ${project.version} test + + org.junit.jupiter + junit-jupiter + test + ${project.groupId} rdf4j-repository-testsuite diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/AbstractShaclTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/AbstractShaclTest.java index 6cd92dd43c2..34ae1fcc257 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/AbstractShaclTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/AbstractShaclTest.java @@ -11,6 +11,10 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; import static org.junit.jupiter.params.provider.Arguments.arguments; @@ -80,7 +84,6 @@ import org.eclipse.rdf4j.sail.shacl.ast.ContextWithShapes; import org.eclipse.rdf4j.sail.shacl.results.ValidationReport; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.params.provider.Arguments; import org.slf4j.Logger; @@ -302,7 +305,7 @@ void runTestCase(TestCase testCase, IsolationLevel isolationLevel, boolean prelo boolean onlyContainsRdf4jShapesGraph = testCase.getShacl().contexts().equals(Set.of(RDF4J.SHACL_SHAPE_GRAPH)); if (!containsShapesGraphStatements) { - Assertions.assertTrue(onlyContainsRdf4jShapesGraph); + assertTrue(onlyContainsRdf4jShapesGraph); ((ShaclSail) shaclRepository.getSail()).setShapesGraphs(Set.of(RDF4J.SHACL_SHAPE_GRAPH)); } @@ -350,7 +353,7 @@ void runTestCase(TestCase testCase, IsolationLevel isolationLevel, boolean prelo throw sailException; } - Assertions.assertEquals(testCaseQueries.get(testCaseQueries.size() - 1), queryFile, + assertEquals(testCaseQueries.get(testCaseQueries.size() - 1), queryFile, "Validation should only fail on the very last query"); exception = true; logger.debug(sailException.getMessage()); @@ -365,9 +368,9 @@ void runTestCase(TestCase testCase, IsolationLevel isolationLevel, boolean prelo if (ran) { if (testCase.expectedResult == ExpectedResult.valid) { - Assertions.assertFalse(exception, "Expected transaction to succeed"); + assertFalse(exception, "Expected transaction to succeed"); } else { - Assertions.assertTrue(exception, "Expected transaction to fail"); + assertTrue(exception, "Expected transaction to fail"); } } } finally { @@ -412,7 +415,7 @@ private static void testValidationReport(String dataPath, Model validationReport String validationReportExpectedString = modelToString(validationReportExpected, RDFFormat.TURTLE); String validationReportActualString = modelToString(validationReportActual, RDFFormat.TURTLE); - Assertions.assertEquals(validationReportExpectedString, validationReportActualString); + assertEquals(validationReportExpectedString, validationReportActualString); } } catch (IOException e) { @@ -539,9 +542,9 @@ void referenceImplementationTestCaseValidation(TestCase testCase) { boolean conforms = report.getProperty(SH.conforms).getBoolean(); if (testCase.expectedResult == ExpectedResult.valid) { - Assertions.assertTrue(conforms, "Expected test case to conform"); + assertTrue(conforms, "Expected test case to conform"); } else { - Assertions.assertFalse(conforms, "Expected test case to not conform"); + assertFalse(conforms, "Expected test case to not conform"); try { Model validationReportExpected = Rio.parse(new StringReader(ModelPrinter.get().print(model)), @@ -581,7 +584,7 @@ void referenceImplementationTestCaseValidation(TestCase testCase) { String validationReportExpectedString = modelToString(validationReportExpected, RDFFormat.TURTLE); String validationReportActualString = modelToString(validationReportActual, RDFFormat.TURTLE); - Assertions.assertEquals(validationReportExpectedString, validationReportActualString); + assertEquals(validationReportExpectedString, validationReportActualString); } } catch (IOException e) { throw new RuntimeException(e); @@ -626,7 +629,7 @@ private static void checkShapesConformToW3cShaclRecommendation(org.apache.jena.r System.out.println(ModelPrinter.get().print(model)); - Assertions.fail("SHACL does not conform to the W3C SHACL Recommendation"); + fail("SHACL does not conform to the W3C SHACL Recommendation"); } } @@ -890,10 +893,10 @@ void runTestCaseSingleTransaction(TestCase testCase) { if (ran) { if (testCase.expectedResult == ExpectedResult.valid) { - Assertions.assertFalse(exception, + assertFalse(exception, "Expected validation to succeed for " + testCase.getTestCasePath()); } else { - Assertions.assertTrue(exception, "Expected validation to fail for " + testCase.getTestCasePath()); + assertTrue(exception, "Expected validation to fail for " + testCase.getTestCasePath()); } testValidationReport(testCase.testCasePath, validationReportActual); @@ -947,9 +950,9 @@ void runTestCaseRevalidate(TestCase testCase, IsolationLevel isolationLevel) { } if (testCase.getExpectedResult() == ExpectedResult.valid) { - Assertions.assertTrue(report.conforms()); + assertTrue(report.conforms()); } else { - Assertions.assertFalse(report.conforms()); + assertFalse(report.conforms()); } } finally { shaclRepository.shutDown(); @@ -1003,7 +1006,7 @@ void runParsingTest(TestCase testCase) { actual.remove(null, RDF.TYPE, DASH.AllSubjectsTarget); if (!Models.isomorphic(expected, actual)) { - Assertions.assertEquals(modelToString(expected, RDFFormat.TRIG), modelToString(actual, RDFFormat.TRIG)); + assertEquals(modelToString(expected, RDFFormat.TRIG), modelToString(actual, RDFFormat.TRIG)); } } catch (InterruptedException e) { diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/DeadlockTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/DeadlockTest.java index 1445249e161..70c17da6e92 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/DeadlockTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/DeadlockTest.java @@ -23,10 +23,10 @@ import org.junit.jupiter.api.parallel.Isolated; @Isolated -public class DeadlockTest { +class DeadlockTest { @Test - public void test() throws IOException { + void test() throws IOException { for (int i = 0; i < 10; i++) { diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/EqualsJoinTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/EqualsJoinTest.java index ef00e2961f6..c6d6bdd47bc 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/EqualsJoinTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/EqualsJoinTest.java @@ -11,6 +11,9 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -26,7 +29,6 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.ValidationTuple; import org.eclipse.rdf4j.sail.shacl.mock.MockConsumePlanNode; import org.eclipse.rdf4j.sail.shacl.mock.MockInputPlanNode; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -36,7 +38,7 @@ public class EqualsJoinTest { public static final Resource[] CONTEXTS = { null }; @Test - public void testSimple01() { + void testSimple01() { PlanNode left = new MockInputPlanNode(List.of("a")); PlanNode right = new MockInputPlanNode(List.of("a"), List.of("b")); @@ -50,7 +52,7 @@ public void testSimple01() { } @Test - public void testSimple02() { + void testSimple02() { PlanNode left = new MockInputPlanNode(List.of("a"), List.of("c")); PlanNode right = new MockInputPlanNode(List.of("a"), List.of("b"), List.of("c")); @@ -64,7 +66,7 @@ public void testSimple02() { } @Test - public void testSimple03() { + void testSimple03() { PlanNode right = new MockInputPlanNode(List.of("a"), List.of("c")); PlanNode left = new MockInputPlanNode(List.of("a"), List.of("b"), List.of("c")); @@ -78,7 +80,7 @@ public void testSimple03() { } @Test - public void testSimple04() { + void testSimple04() { PlanNode left = new MockInputPlanNode(List.of("b"), List.of("c")); PlanNode right = new MockInputPlanNode(List.of("a"), List.of("d"), List.of("e")); @@ -92,7 +94,7 @@ public void testSimple04() { } @Test - public void testSimple05() { + void testSimple05() { PlanNode left = new MockInputPlanNode(List.of("b"), List.of("c")); PlanNode right = new MockInputPlanNode(List.of("a"), List.of("d"), List.of("c")); @@ -106,7 +108,7 @@ public void testSimple05() { } @Test - public void testSimple06() { + void testSimple06() { PlanNode left = new MockInputPlanNode(Arrays.asList("a", "1"), Arrays.asList("b", "1"), Arrays.asList("b", "1"), Arrays.asList("c", "1")); @@ -142,10 +144,10 @@ private void verify(List actual, List... expect) { Set actualSet = new HashSet<>(actual); - Assertions.assertEquals(collect, actualSet); + assertEquals(collect, actualSet); - Assertions.assertTrue(collect.containsAll(actualSet)); - Assertions.assertTrue(actualSet.containsAll(collect)); + assertTrue(collect.containsAll(actualSet)); + assertTrue(actualSet.containsAll(collect)); } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ExtendedFeaturesetTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ExtendedFeaturesetTest.java index 279c628bdfe..08455a679e0 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ExtendedFeaturesetTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ExtendedFeaturesetTest.java @@ -29,14 +29,14 @@ /** * @author Håvard Ottestad */ -public class ExtendedFeaturesetTest { +class ExtendedFeaturesetTest { SimpleValueFactory vf = SimpleValueFactory.getInstance(); IRI ex_knows = vf.createIRI("http://example.com/ns#knows"); IRI ex_Person = vf.createIRI("http://example.com/ns#Person"); @Test - public void testDashIsDisabledByDefault() throws Exception { + void testDashIsDisabledByDefault() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("test-cases/class/allSubjects/shacl.trig" ); @@ -53,7 +53,7 @@ public void testDashIsDisabledByDefault() throws Exception { } @Test - public void testThatDashCanBeEnabled() throws Throwable { + void testThatDashCanBeEnabled() throws Throwable { SailRepository shaclRepository = Utils.getInitializedShaclRepository("test-cases/class/allSubjects/shacl.trig"); ((ShaclSail) shaclRepository.getSail()).setDashDataShapes(true); @@ -77,7 +77,7 @@ public void testThatDashCanBeEnabled() throws Throwable { } @Test - public void testTargetShapeIsDisabledByDefault() throws Exception { + void testTargetShapeIsDisabledByDefault() throws Exception { SailRepository shaclRepository = Utils .getInitializedShaclRepository("test-cases/class/simpleTargetShape/shacl.trig"); @@ -97,7 +97,7 @@ public void testTargetShapeIsDisabledByDefault() throws Exception { } @Test - public void testThatTargetShapesCanBeEnabled() throws Throwable { + void testThatTargetShapesCanBeEnabled() throws Throwable { SailRepository shaclRepository = Utils .getInitializedShaclRepository("test-cases/class/simpleTargetShape/shacl.trig"); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/InnerJoinTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/InnerJoinTest.java index aeb1324dee5..1c4c40f1d07 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/InnerJoinTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/InnerJoinTest.java @@ -11,6 +11,8 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -27,7 +29,6 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.ValidationTuple; import org.eclipse.rdf4j.sail.shacl.mock.MockConsumePlanNode; import org.eclipse.rdf4j.sail.shacl.mock.MockInputPlanNode; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** @@ -37,7 +38,7 @@ public class InnerJoinTest { public static final Resource[] CONTEXTS = { null }; @Test - public void testSimple() { + void testSimple() { PlanNode left = new MockInputPlanNode(List.of("a")); PlanNode right = new MockInputPlanNode(Arrays.asList("a", "b")); @@ -53,7 +54,7 @@ public void testSimple() { } @Test - public void testSimple2() { + void testSimple2() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2")); PlanNode right = new MockInputPlanNode(Arrays.asList("a1", "b")); @@ -69,7 +70,7 @@ public void testSimple2() { } @Test - public void testSimple3() { + void testSimple3() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2")); PlanNode right = new MockInputPlanNode(Arrays.asList("a2", "b")); @@ -85,7 +86,7 @@ public void testSimple3() { } @Test - public void testSimple4() { + void testSimple4() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2")); PlanNode right = new MockInputPlanNode(List.of()); @@ -101,7 +102,7 @@ public void testSimple4() { } @Test - public void testSimple5() { + void testSimple5() { PlanNode left = new MockInputPlanNode(); PlanNode right = new MockInputPlanNode(List.of("a1"), List.of("a2")); @@ -117,7 +118,7 @@ public void testSimple5() { } @Test - public void testSimple6() { + void testSimple6() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2"), List.of("a3"), List.of("a4")); @@ -136,7 +137,7 @@ public void testSimple6() { } @Test - public void testSimple7() { + void testSimple7() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2")); PlanNode right = new MockInputPlanNode(Arrays.asList("a1", "b1"), Arrays.asList("a2", "b2")); @@ -152,7 +153,7 @@ public void testSimple7() { } @Test - public void testSimple8() { + void testSimple8() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2"), List.of("a3")); PlanNode right = new MockInputPlanNode(Arrays.asList("a1", "b1"), Arrays.asList("a2", "b2"), @@ -169,7 +170,7 @@ public void testSimple8() { } @Test - public void testSimple9() { + void testSimple9() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2"), List.of("a3"), List.of("a4")); @@ -188,7 +189,7 @@ public void testSimple9() { } @Test - public void testSimple10() { + void testSimple10() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2"), List.of("a3"), List.of("a4")); @@ -207,7 +208,7 @@ public void testSimple10() { } @Test - public void testSimple11() { + void testSimple11() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2"), List.of("a3"), List.of("a4")); @@ -225,7 +226,7 @@ public void testSimple11() { } @Test - public void testSimple12() { + void testSimple12() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2"), List.of("a3"), List.of("a4")); @@ -242,7 +243,7 @@ public void testSimple12() { } @Test - public void testSimple13() { + void testSimple13() { PlanNode left = new MockInputPlanNode(List.of("a1"), List.of("a2"), List.of("a3"), List.of("a4")); @@ -276,8 +277,8 @@ private void verify(List actual, List... expect) { Set actualSet = new HashSet<>(actual); - Assertions.assertTrue(collect.containsAll(actualSet)); - Assertions.assertTrue(actualSet.containsAll(collect)); + assertTrue(collect.containsAll(actualSet)); + assertTrue(actualSet.containsAll(collect)); } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedNativeStoreIT.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedNativeStoreIT.java index c0a70b6915a..ad8299bdb33 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedNativeStoreIT.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedNativeStoreIT.java @@ -24,12 +24,12 @@ import org.junit.jupiter.api.Tag; @Tag("slow") -public class MultithreadedNativeStoreIT extends MultithreadedTest { +class MultithreadedNativeStoreIT extends MultithreadedTest { File file; @AfterEach - public void after() { + void after() { try { FileUtils.deleteDirectory(file); } catch (IOException e) { @@ -38,7 +38,7 @@ public void after() { } @BeforeEach - public void before() { + void before() { file = Files.newTemporaryFolder(); System.out.println("Max memory: " + Runtime.getRuntime().maxMemory() / 1024 / 1024 + " MB"); } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedNativeStoreRDFSIT.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedNativeStoreRDFSIT.java index ab1d4c689a6..8ff99e498b4 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedNativeStoreRDFSIT.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/MultithreadedNativeStoreRDFSIT.java @@ -25,12 +25,12 @@ import org.junit.jupiter.api.Tag; @Tag("slow") -public class MultithreadedNativeStoreRDFSIT extends MultithreadedTest { +class MultithreadedNativeStoreRDFSIT extends MultithreadedTest { File file; @AfterEach - public void after() { + void after() { try { FileUtils.deleteDirectory(file); } catch (IOException e) { @@ -39,7 +39,7 @@ public void after() { } @BeforeEach - public void before() { + void before() { file = Files.newTemporaryFolder(); } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NativeStoreTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NativeStoreTest.java index cc5aeaf099f..7db6f0d7b65 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NativeStoreTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NativeStoreTest.java @@ -25,17 +25,17 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class NativeStoreTest { +class NativeStoreTest { @Test - public void testEmpty(@TempDir File file) throws IOException { + void testEmpty(@TempDir File file) throws IOException { SailRepository shaclSail = new SailRepository(new ShaclSail(new NativeStore(file))); shaclSail.init(); shaclSail.shutDown(); } @Test - public void testPersistedShapes(@TempDir File file) throws Throwable { + void testPersistedShapes(@TempDir File file) throws Throwable { SailRepository shaclSail = new SailRepository(new ShaclSail(new NativeStore(file))); shaclSail.init(); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NoChangeTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NoChangeTest.java index 31e64994e4b..e706129d5f3 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NoChangeTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NoChangeTest.java @@ -27,10 +27,10 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class NoChangeTest { +class NoChangeTest { @Test - public void testSkippingValidationWhenThereAreNoChanges() throws IOException, InterruptedException { + void testSkippingValidationWhenThereAreNoChanges() throws IOException, InterruptedException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.init(); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NoShapesTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NoShapesTest.java index c2a437aa237..9afae512b76 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NoShapesTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/NoShapesTest.java @@ -21,10 +21,10 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class NoShapesTest { +class NoShapesTest { @Test - public void testSkippingValidationWhenThereAreNoShapes() throws InterruptedException { + void testSkippingValidationWhenThereAreNoShapes() throws InterruptedException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/PrepareCommitTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/PrepareCommitTest.java index 728fc9743e2..04c7f6b6da0 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/PrepareCommitTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/PrepareCommitTest.java @@ -12,7 +12,10 @@ package org.eclipse.rdf4j.sail.shacl; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.IOException; import java.util.Set; @@ -34,13 +37,12 @@ import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.rio.Rio; import org.eclipse.rdf4j.sail.NotifyingSailConnection; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class PrepareCommitTest { +class PrepareCommitTest { @Test - public void testFailureWhenChangesAfterPrepare() throws IOException { + void testFailureWhenChangesAfterPrepare() throws IOException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shacl.trig"); try (NotifyingSailConnection connection = shaclSail.getConnection()) { @@ -71,7 +73,7 @@ public void testFailureWhenChangesAfterPrepare() throws IOException { } @Test - public void testPrepareFollowedByRollback() throws IOException { + void testPrepareFollowedByRollback() throws IOException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shaclMinCountZero.trig"); NotifyingSailConnection conn = shaclSail.getConnection(); try { @@ -85,7 +87,7 @@ public void testPrepareFollowedByRollback() throws IOException { conn.addStatement(bob, RDF.TYPE, RDFS.RESOURCE); conn.prepare(); // should fail because bob has no label - Assertions.fail("constraint violation not detected on prepare call"); + fail("constraint violation not detected on prepare call"); } catch (ShaclSailValidationException e) { conn.rollback(); @@ -103,7 +105,7 @@ public void testPrepareFollowedByRollback() throws IOException { } @Test - public void testMultiplePrepare() throws IOException { + void testMultiplePrepare() throws IOException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shacl.trig"); try (NotifyingSailConnection connection = shaclSail.getConnection()) { @@ -123,7 +125,7 @@ public void testMultiplePrepare() throws IOException { } @Test - public void testWithoutPrepare() throws IOException { + void testWithoutPrepare() throws IOException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shacl.trig"); try (NotifyingSailConnection connection = shaclSail.getConnection()) { @@ -137,7 +139,7 @@ public void testWithoutPrepare() throws IOException { } @Test - public void testPrepareAfterRollback() throws IOException { + void testPrepareAfterRollback() throws IOException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shacl.trig"); try (NotifyingSailConnection connection = shaclSail.getConnection()) { @@ -159,7 +161,7 @@ public void testPrepareAfterRollback() throws IOException { } @Test - public void testAutomaticRollback() throws IOException { + void testAutomaticRollback() throws IOException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shacl.trig"); BNode bNode = SimpleValueFactory.getInstance().createBNode(); @@ -176,21 +178,21 @@ public void testAutomaticRollback() throws IOException { } finally { if (connection != null) { // check that nothing has been rolled back yet - Assertions.assertTrue(connection.hasStatement(bNode, RDF.TYPE, RDFS.RESOURCE, false)); + assertTrue(connection.hasStatement(bNode, RDF.TYPE, RDFS.RESOURCE, false)); connection.close(); } } // check that close() called rollback try (NotifyingSailConnection connection1 = shaclSail.getConnection()) { - Assertions.assertFalse(connection1.hasStatement(RDFS.RESOURCE, RDF.TYPE, RDFS.RESOURCE, false)); + assertFalse(connection1.hasStatement(RDFS.RESOURCE, RDF.TYPE, RDFS.RESOURCE, false)); } shaclSail.shutDown(); } @Test - public void testAutomaticRollback2() throws IOException { + void testAutomaticRollback2() throws IOException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shacl.trig"); boolean exception = false; @@ -208,23 +210,23 @@ public void testAutomaticRollback2() throws IOException { } finally { if (connection != null) { // check that nothing has been rolled back yet - Assertions.assertTrue(connection.hasStatement(bNode, RDF.TYPE, RDFS.RESOURCE, false)); + assertTrue(connection.hasStatement(bNode, RDF.TYPE, RDFS.RESOURCE, false)); connection.close(); } } // check that close() called rollback try (NotifyingSailConnection connection1 = shaclSail.getConnection()) { - Assertions.assertFalse(connection1.hasStatement(RDFS.RESOURCE, RDF.TYPE, RDFS.RESOURCE, false)); + assertFalse(connection1.hasStatement(RDFS.RESOURCE, RDF.TYPE, RDFS.RESOURCE, false)); } shaclSail.shutDown(); - Assertions.assertTrue(exception); + assertTrue(exception); } @Test - public void testAutomaticRollbackRepository() throws IOException { + void testAutomaticRollbackRepository() throws IOException { SailRepository shaclSail = Utils.getInitializedShaclRepository("shacl.trig"); boolean exception = false; @@ -242,19 +244,19 @@ public void testAutomaticRollbackRepository() throws IOException { } finally { if (connection != null) { // check that nothing has been rolled back yet - Assertions.assertTrue(connection.hasStatement(bNode, RDF.TYPE, RDFS.RESOURCE, false)); + assertTrue(connection.hasStatement(bNode, RDF.TYPE, RDFS.RESOURCE, false)); connection.close(); } } // check that close() called rollback try (SailRepositoryConnection connection1 = shaclSail.getConnection()) { - Assertions.assertFalse(connection1.hasStatement(RDFS.RESOURCE, RDF.TYPE, RDFS.RESOURCE, false)); + assertFalse(connection1.hasStatement(RDFS.RESOURCE, RDF.TYPE, RDFS.RESOURCE, false)); } shaclSail.shutDown(); - Assertions.assertTrue(exception); + assertTrue(exception); } } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/RdfsShaclConnectionTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/RdfsShaclConnectionTest.java index 39ca16e7ff0..6a007dd4d0a 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/RdfsShaclConnectionTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/RdfsShaclConnectionTest.java @@ -11,6 +11,9 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -27,10 +30,9 @@ import org.eclipse.rdf4j.sail.memory.MemoryStore; import org.eclipse.rdf4j.sail.shacl.wrapper.data.RdfsSubClassOfReasoner; import org.eclipse.rdf4j.sail.shacl.wrapper.data.VerySimpleRdfsBackwardsChainingConnection; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class RdfsShaclConnectionTest { +class RdfsShaclConnectionTest { SimpleValueFactory vf = SimpleValueFactory.getInstance(); IRI sup = vf.createIRI("http://example.com/sup"); @@ -41,7 +43,7 @@ public class RdfsShaclConnectionTest { IRI aSup = vf.createIRI("http://example.com/aSup"); @Test - public void testHasStatement() { + void testHasStatement() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.init(); @@ -55,14 +57,14 @@ public void testHasStatement() { connection, ((ShaclSailConnection) connection).getRdfsSubClassOfReasoner()); - Assertions.assertTrue(connection2.hasStatement(aSubSub, RDF.TYPE, sup, true)); + assertTrue(connection2.hasStatement(aSubSub, RDF.TYPE, sup, true)); } shaclSail.shutDown(); } @Test - public void testGetStatement() { + void testGetStatement() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.init(); @@ -82,7 +84,7 @@ public void testGetStatement() { Set collect = stream.collect(Collectors.toSet()); HashSet expected = new HashSet<>( Collections.singletonList(vf.createStatement(aSubSub, RDF.TYPE, sup))); - Assertions.assertEquals(expected, collect); + assertEquals(expected, collect); } try (Stream stream = connection2.getStatements(aSubSub, RDF.TYPE, sub, true) @@ -90,7 +92,7 @@ public void testGetStatement() { Set collect = stream.collect(Collectors.toSet()); HashSet expected = new HashSet<>( Collections.singletonList(vf.createStatement(aSubSub, RDF.TYPE, sub))); - Assertions.assertEquals(expected, collect); + assertEquals(expected, collect); } try (Stream stream = connection2.getStatements(aSubSub, RDF.TYPE, subSub, true) @@ -98,7 +100,7 @@ public void testGetStatement() { Set collect = stream.collect(Collectors.toSet()); HashSet expected = new HashSet<>( Collections.singletonList(vf.createStatement(aSubSub, RDF.TYPE, subSub))); - Assertions.assertEquals(expected, collect); + assertEquals(expected, collect); } } @@ -107,7 +109,7 @@ public void testGetStatement() { } @Test - public void testGetStatementNoDuplicates() { + void testGetStatementNoDuplicates() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.init(); @@ -130,7 +132,7 @@ public void testGetStatementNoDuplicates() { try (Stream stream = connection2.getStatements(aSubSub, RDF.TYPE, sup, true) .stream()) { List collect = stream.collect(Collectors.toList()); - Assertions.assertEquals(new HashSet<>(collect).size(), collect.size()); + assertEquals(new HashSet<>(collect).size(), collect.size()); } } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ReduceNumberOfPlansTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ReduceNumberOfPlansTest.java index fb9cf0e6194..8db0b1880d6 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ReduceNumberOfPlansTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ReduceNumberOfPlansTest.java @@ -11,6 +11,8 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.io.IOException; import java.util.List; import java.util.stream.Collectors; @@ -25,16 +27,15 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.EmptyNode; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; import org.eclipse.rdf4j.sail.shacl.wrapper.data.ConnectionsGroup; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** * @author Håvard Ottestad */ -public class ReduceNumberOfPlansTest { +class ReduceNumberOfPlansTest { @Test - public void testAddingTypeStatement() + void testAddingTypeStatement() throws RDFParseException, UnsupportedRDFormatException, IOException, InterruptedException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.init(); @@ -57,7 +58,7 @@ public void testAddingTypeStatement() .filter(s -> !(s instanceof EmptyNode)) .collect(Collectors.toList()); - Assertions.assertEquals(0, collect.size()); + assertEquals(0, collect.size()); } IRI person1 = Utils.Ex.createIri(); connection.addStatement(person1, RDF.TYPE, Utils.Ex.Person); @@ -73,7 +74,7 @@ public void testAddingTypeStatement() .map(shape -> shape.generatePlans(connectionsGroup, new ValidationSettings())) .filter(s -> !(s instanceof EmptyNode)) .collect(Collectors.toList()); - Assertions.assertEquals(2, collect2.size()); + assertEquals(2, collect2.size()); } ValueFactory vf = shaclSail.getValueFactory(); @@ -90,7 +91,7 @@ public void testAddingTypeStatement() } @Test - public void testRemovingPredicate() + void testRemovingPredicate() throws RDF4JException, UnsupportedRDFormatException, IOException, InterruptedException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.init(); @@ -126,7 +127,7 @@ public void testRemovingPredicate() .map(shape -> shape.generatePlans(connectionsGroup, new ValidationSettings())) .filter(s -> !(s instanceof EmptyNode)) .collect(Collectors.toList()); - Assertions.assertEquals(1, collect1.size()); + assertEquals(1, collect1.size()); } @@ -144,7 +145,7 @@ public void testRemovingPredicate() .filter(s -> !(s instanceof EmptyNode)) .collect(Collectors.toList()); - Assertions.assertEquals(1, collect2.size()); + assertEquals(1, collect2.size()); } connection.removeStatements(person1, Utils.Ex.name, vf.createLiteral("c")); @@ -160,7 +161,7 @@ public void testRemovingPredicate() .filter(s -> !(s instanceof EmptyNode)) .collect(Collectors.toList()); - Assertions.assertEquals(2, collect3.size()); + assertEquals(2, collect3.size()); } connection.rollback(); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/SerializableTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/SerializableTest.java index 8f0b7f21656..84dc4898d0b 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/SerializableTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/SerializableTest.java @@ -12,6 +12,7 @@ package org.eclipse.rdf4j.sail.shacl; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -31,15 +32,14 @@ import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.eclipse.rdf4j.sail.shacl.results.ValidationReport; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.parallel.Isolated; @Isolated -public class SerializableTest { +class SerializableTest { @Test - public void testMaxCountSnapshot() throws IOException, InterruptedException { + void testMaxCountSnapshot() throws IOException, InterruptedException { for (int i = 0; i < 10; i++) { SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.trig"); @@ -53,7 +53,7 @@ public void testMaxCountSnapshot() throws IOException, InterruptedException { ValidationReport revalidate = ((ShaclSailConnection) connection.getSailConnection()).revalidate(); // Rio.write(revalidate.asModel(), System.out, RDFFormat.TRIG); - Assertions.assertTrue(revalidate.conforms()); + assertTrue(revalidate.conforms()); connection.commit(); } @@ -64,7 +64,7 @@ public void testMaxCountSnapshot() throws IOException, InterruptedException { } @Test - public void testMaxCountSerializable() throws IOException, InterruptedException { + void testMaxCountSerializable() throws IOException, InterruptedException { SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.trig"); @@ -76,7 +76,7 @@ public void testMaxCountSerializable() throws IOException, InterruptedException ValidationReport revalidate = ((ShaclSailConnection) connection.getSailConnection()).revalidate(); // Rio.write(revalidate.asModel(), System.out, RDFFormat.TRIG); - Assertions.assertTrue(revalidate.conforms()); + assertTrue(revalidate.conforms()); connection.commit(); } @@ -85,7 +85,7 @@ public void testMaxCountSerializable() throws IOException, InterruptedException } @Test - public void testMaxCount2Serializable() throws IOException, InterruptedException { + void testMaxCount2Serializable() throws IOException, InterruptedException { SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.trig"); @@ -97,7 +97,7 @@ public void testMaxCount2Serializable() throws IOException, InterruptedException ValidationReport revalidate = ((ShaclSailConnection) connection.getSailConnection()).revalidate(); // Rio.write(revalidate.asModel(), System.out, RDFFormat.TRIG); - Assertions.assertTrue(revalidate.conforms()); + assertTrue(revalidate.conforms()); connection.commit(); } @@ -106,7 +106,7 @@ public void testMaxCount2Serializable() throws IOException, InterruptedException } @Test - public void testMaxCount2Snapshot() throws IOException, InterruptedException { + void testMaxCount2Snapshot() throws IOException, InterruptedException { SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.trig"); @@ -118,7 +118,7 @@ public void testMaxCount2Snapshot() throws IOException, InterruptedException { ValidationReport revalidate = ((ShaclSailConnection) connection.getSailConnection()).revalidate(); // Rio.write(revalidate.asModel(), System.out, RDFFormat.TRIG); - Assertions.assertTrue(revalidate.conforms()); + assertTrue(revalidate.conforms()); connection.commit(); } @@ -127,7 +127,7 @@ public void testMaxCount2Snapshot() throws IOException, InterruptedException { } @Test - public void testMaxCount3Snapshot() throws IOException, InterruptedException { + void testMaxCount3Snapshot() throws IOException, InterruptedException { SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.trig"); @@ -139,7 +139,7 @@ public void testMaxCount3Snapshot() throws IOException, InterruptedException { ValidationReport revalidate = ((ShaclSailConnection) connection.getSailConnection()).revalidate(); // Rio.write(revalidate.asModel(), System.out, RDFFormat.TRIG); - Assertions.assertTrue(revalidate.conforms()); + assertTrue(revalidate.conforms()); connection.commit(); } @@ -148,7 +148,7 @@ public void testMaxCount3Snapshot() throws IOException, InterruptedException { } @Test - public void serializableParallelValidation() throws Throwable { + void serializableParallelValidation() throws Throwable { SailRepository repo = Utils .getInitializedShaclRepository("test-cases/complex/targetShapeAndQualifiedShape/shacl.trig"); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclSailSupportedPredicatesDocumentationIT.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclSailSupportedPredicatesDocumentationIT.java index d3beeff514e..05e96948b19 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclSailSupportedPredicatesDocumentationIT.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclSailSupportedPredicatesDocumentationIT.java @@ -11,6 +11,8 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.io.IOException; import java.util.Arrays; import java.util.HashSet; @@ -24,29 +26,28 @@ import org.eclipse.rdf4j.model.vocabulary.RSX; import org.eclipse.rdf4j.model.vocabulary.SHACL; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; /** * @author Håvard Ottestad */ -public class ShaclSailSupportedPredicatesDocumentationIT extends AbstractShaclTest { +class ShaclSailSupportedPredicatesDocumentationIT extends AbstractShaclTest { private static final Set STATIC_SHACL_PREDICATES = new CopyOnWriteArraySet<>( ShaclSail.getSupportedShaclPredicates()); @AfterAll - public static void afterClass() { + static void afterClass() { - Assertions.assertTrue(STATIC_SHACL_PREDICATES.isEmpty(), + assertTrue(STATIC_SHACL_PREDICATES.isEmpty(), "No test uses the following predicate that the ShaclSail announces as supported: " + Arrays.toString(STATIC_SHACL_PREDICATES.toArray())); } @ParameterizedTest @MethodSource("testCases") - public void testShaclSailSupportedPredicatesDocumentation(TestCase testCase) throws IOException { + void testShaclSailSupportedPredicatesDocumentation(TestCase testCase) throws IOException { HashSet shaclPredicates = new HashSet<>(ShaclSail.getSupportedShaclPredicates()); @@ -60,7 +61,7 @@ public void testShaclSailSupportedPredicatesDocumentation(TestCase testCase) thr .collect(Collectors.toSet()); for (IRI predicate : predicatesInUseInTest) { - Assertions.assertTrue(shaclPredicates.contains(predicate), + assertTrue(shaclPredicates.contains(predicate), "Predicate used in test but not listed in ShaclSail: " + predicate); STATIC_SHACL_PREDICATES.remove(predicate); } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTest.java index e9bdeed3463..628003678cc 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTest.java @@ -18,41 +18,41 @@ /** * @author Håvard Ottestad */ -public class ShaclTest extends AbstractShaclTest { +class ShaclTest extends AbstractShaclTest { @ParameterizedTest @MethodSource("testsToRunWithIsolationLevel") - public void test(TestCase testCase, IsolationLevel isolationLevel) { + void test(TestCase testCase, IsolationLevel isolationLevel) { runWithAutomaticLogging(() -> runTestCase(testCase, isolationLevel, false)); } @ParameterizedTest @MethodSource("testCases") - public void testSingleTransaction(TestCase testCase) { + void testSingleTransaction(TestCase testCase) { runWithAutomaticLogging(() -> runTestCaseSingleTransaction(testCase)); } @ParameterizedTest @MethodSource("testsToRunWithIsolationLevel") - public void testRevalidation(TestCase testCase, IsolationLevel isolationLevel) { + void testRevalidation(TestCase testCase, IsolationLevel isolationLevel) { runWithAutomaticLogging(() -> runTestCaseRevalidate(testCase, isolationLevel)); } @ParameterizedTest @MethodSource("testsToRunWithIsolationLevel") - public void testNonEmpty(TestCase testCase, IsolationLevel isolationLevel) { + void testNonEmpty(TestCase testCase, IsolationLevel isolationLevel) { runWithAutomaticLogging(() -> runTestCase(testCase, isolationLevel, true)); } @ParameterizedTest @MethodSource("testCases") - public void testParsing(TestCase testCase) { + void testParsing(TestCase testCase) { runWithAutomaticLogging(() -> runParsingTest(testCase)); } @ParameterizedTest @MethodSource("testCases") - public void testReferenceImplementation(TestCase testCase) { + void testReferenceImplementation(TestCase testCase) { runWithAutomaticLogging(() -> referenceImplementationTestCaseValidation(testCase)); } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTestWithoutRdfsReasonerTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTestWithoutRdfsReasonerTest.java index f3890d4ad2b..e6ec64bc3ae 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTestWithoutRdfsReasonerTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShaclTestWithoutRdfsReasonerTest.java @@ -25,11 +25,11 @@ * @author Håvard Ottestad */ @Tag("slow") -public class ShaclTestWithoutRdfsReasonerTest extends AbstractShaclTest { +class ShaclTestWithoutRdfsReasonerTest extends AbstractShaclTest { @ParameterizedTest @MethodSource("testsToRunWithIsolationLevel") - public void test(TestCase testCase, IsolationLevel isolationLevel) { + void test(TestCase testCase, IsolationLevel isolationLevel) { if (ignoredTest(testCase)) { return; } @@ -38,7 +38,7 @@ public void test(TestCase testCase, IsolationLevel isolationLevel) { @ParameterizedTest @MethodSource("testsToRunWithIsolationLevel") - public void testRevalidation(TestCase testCase, IsolationLevel isolationLevel) { + void testRevalidation(TestCase testCase, IsolationLevel isolationLevel) { if (ignoredTest(testCase)) { return; } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShapesGraphTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShapesGraphTest.java index 00f4280178a..414aa672c8c 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShapesGraphTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShapesGraphTest.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; @@ -32,10 +33,9 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.EmptyNode; import org.eclipse.rdf4j.sail.shacl.ast.planNodes.PlanNode; import org.eclipse.rdf4j.sail.shacl.wrapper.data.ConnectionsGroup; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ShapesGraphTest { +class ShapesGraphTest { static final private String EX = "http://example.com/ns#"; @@ -49,7 +49,7 @@ public class ShapesGraphTest { static final private IRI olivia = Values.iri(EX, "olivia"); @Test - public void testValidSplitAcrossGraphs() throws Throwable { + void testValidSplitAcrossGraphs() throws Throwable { test(repository -> { @@ -76,7 +76,7 @@ public void testValidSplitAcrossGraphs() throws Throwable { } @Test - public void testInvalid() throws Throwable { + void testInvalid() throws Throwable { test(repository -> { @@ -93,7 +93,7 @@ public void testInvalid() throws Throwable { } @Test - public void testInvalidUnionGraph() throws Throwable { + void testInvalidUnionGraph() throws Throwable { test(repository -> { @@ -121,7 +121,7 @@ public void testInvalidUnionGraph() throws Throwable { } @Test - public void testInvalidSplitAcrossGraphs() throws Throwable { + void testInvalidSplitAcrossGraphs() throws Throwable { test(repository -> { @@ -139,7 +139,7 @@ public void testInvalidSplitAcrossGraphs() throws Throwable { } @Test - public void testInvalidSwitchGraph() throws Throwable { + void testInvalidSwitchGraph() throws Throwable { test(repository -> { @@ -163,7 +163,7 @@ public void testInvalidSwitchGraph() throws Throwable { } @Test - public void testValidationRequired() throws IOException, InterruptedException { + void testValidationRequired() throws IOException, InterruptedException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository repository = new SailRepository(shaclSail); @@ -191,7 +191,7 @@ public void testValidationRequired() throws IOException, InterruptedException { .filter(s -> !(s instanceof EmptyNode)) .collect(Collectors.toList()); - Assertions.assertEquals(0, collect.size()); + assertEquals(0, collect.size()); } } @@ -200,7 +200,7 @@ public void testValidationRequired() throws IOException, InterruptedException { } @Test - public void testDefaultShapesGraph() throws IOException { + void testDefaultShapesGraph() throws IOException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository repository = new SailRepository(shaclSail); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShutdownTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShutdownTest.java index 2df175f1374..6a6dac6af55 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShutdownTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ShutdownTest.java @@ -11,6 +11,11 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + import java.io.IOException; import java.io.StringReader; import java.lang.reflect.Field; @@ -32,14 +37,13 @@ import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.sail.memory.MemoryStore; import org.eclipse.rdf4j.sail.nativerdf.NativeStore; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -public class ShutdownTest { +class ShutdownTest { @Test - public void shutdownWhileRunningValidation() throws InterruptedException { + void shutdownWhileRunningValidation() throws InterruptedException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.init(); @@ -51,15 +55,15 @@ public void shutdownWhileRunningValidation() throws InterruptedException { } catch (ExecutionException | TimeoutException ignored) { } - Assertions.assertFalse(objectFuture.isDone()); + assertFalse(objectFuture.isDone()); shaclSail.shutDown(); Thread.sleep(100); - Assertions.assertTrue(objectFuture.isDone(), "The thread should have be stopped after calling shutdown()"); + assertTrue(objectFuture.isDone(), "The thread should have be stopped after calling shutdown()"); } @Test - public void shutdownAndInitializeThreadPool() throws InterruptedException { + void shutdownAndInitializeThreadPool() throws InterruptedException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); for (int j = 0; j < 3; j++) { @@ -72,17 +76,17 @@ public void shutdownAndInitializeThreadPool() throws InterruptedException { } catch (ExecutionException | TimeoutException ignored) { } - Assertions.assertFalse(objectFuture.isDone()); + assertFalse(objectFuture.isDone()); shaclSail.shutDown(); Thread.sleep(100); - Assertions.assertTrue(objectFuture.isDone(), "The thread should have be stopped after calling shutdown()"); + assertTrue(objectFuture.isDone(), "The thread should have be stopped after calling shutdown()"); } } @Test - public void shutdownWithPersistence(@TempDir Path tempDir) throws IOException { + void shutdownWithPersistence(@TempDir Path tempDir) throws IOException { IRI shapesGraph = Values.iri("http://example.com/ns#shapesGraph"); IRI dataGraph = Values.iri("http://example.com/ns#dataGraph"); @@ -143,7 +147,7 @@ public void shutdownWithPersistence(@TempDir Path tempDir) throws IOException { connection.commit(); } - Assertions.assertThrows(RepositoryException.class, () -> { + assertThrows(RepositoryException.class, () -> { connection.begin(); StringReader data = new StringReader( String.join("\n", "", @@ -168,7 +172,7 @@ public void shutdownWithPersistence(@TempDir Path tempDir) throws IOException { try (RepositoryConnection connection = repository.getConnection()) { - Assertions.assertThrows(RepositoryException.class, () -> { + assertThrows(RepositoryException.class, () -> { connection.begin(); StringReader data = new StringReader( String.join("\n", "", @@ -189,7 +193,7 @@ public void shutdownWithPersistence(@TempDir Path tempDir) throws IOException { try (RepositoryConnection connection = repository.getConnection()) { - Assertions.assertThrows(RepositoryException.class, () -> { + assertThrows(RepositoryException.class, () -> { connection.begin(); StringReader data = new StringReader( String.join("\n", "", @@ -213,12 +217,12 @@ public void shutdownWithPersistence(@TempDir Path tempDir) throws IOException { } @Test - public void testThatGarbadgeCollectionWillShutdownTheThreadPool() + void testThatGarbadgeCollectionWillShutdownTheThreadPool() throws InterruptedException, NoSuchFieldException, IllegalAccessException { ExecutorService executorServices = startShaclSailAndTask(); - Assertions.assertFalse(executorServices.isShutdown()); + assertFalse(executorServices.isShutdown()); for (int i = 0; i < 100; i++) { System.gc(); @@ -229,7 +233,7 @@ public void testThatGarbadgeCollectionWillShutdownTheThreadPool() Thread.sleep(100); } - Assertions.fail("Executor service should have been shutdown due to GC"); + fail("Executor service should have been shutdown due to GC"); } private ExecutorService startShaclSailAndTask() diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TargetNodeMinCountEdgeCaseTests.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TargetNodeMinCountEdgeCaseTests.java index 420884d851e..2aeb27182a9 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TargetNodeMinCountEdgeCaseTests.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TargetNodeMinCountEdgeCaseTests.java @@ -29,7 +29,7 @@ /** * Some shapes may cause a validation error even if the targets don't exist. These tests check some of those scenarios. */ -public class TargetNodeMinCountEdgeCaseTests { +class TargetNodeMinCountEdgeCaseTests { String shaclShapes = String.join("\n", "", "@base .", @@ -58,7 +58,7 @@ public class TargetNodeMinCountEdgeCaseTests { Value value2 = vf.createLiteral(2); @Test - public void testMinCountWithEmptyState() throws Throwable { + void testMinCountWithEmptyState() throws Throwable { SailRepository sailRepository = new SailRepository(new ShaclSail(new MemoryStore())); @@ -79,7 +79,7 @@ public void testMinCountWithEmptyState() throws Throwable { } @Test - public void testMinCountWithInvalidInitialDataset() throws Throwable { + void testMinCountWithInvalidInitialDataset() throws Throwable { SailRepository sailRepository = new SailRepository(new ShaclSail(new MemoryStore())); @@ -105,7 +105,7 @@ public void testMinCountWithInvalidInitialDataset() throws Throwable { } @Test - public void testMinCountWithInvalidInitialDataset2() throws Throwable { + void testMinCountWithInvalidInitialDataset2() throws Throwable { SailRepository sailRepository = new SailRepository(new ShaclSail(new MemoryStore())); @@ -131,7 +131,7 @@ public void testMinCountWithInvalidInitialDataset2() throws Throwable { } @Test - public void testMinCountWithInvalidInitialDataset3() throws Throwable { + void testMinCountWithInvalidInitialDataset3() throws Throwable { SailRepository sailRepository = new SailRepository(new ShaclSail(new MemoryStore())); @@ -154,7 +154,7 @@ public void testMinCountWithInvalidInitialDataset3() throws Throwable { } @Test - public void testMinCountWithValidInitialDataset() throws Throwable { + void testMinCountWithValidInitialDataset() throws Throwable { SailRepository sailRepository = new SailRepository(new ShaclSail(new MemoryStore())); @@ -178,7 +178,7 @@ public void testMinCountWithValidInitialDataset() throws Throwable { } @Test - public void testMinCountWithValidInitialDataset2() throws Throwable { + void testMinCountWithValidInitialDataset2() throws Throwable { SailRepository sailRepository = new SailRepository(new ShaclSail(new MemoryStore())); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TempTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TempTest.java index 3ea6db9ed81..0fe9943a4a1 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TempTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TempTest.java @@ -30,10 +30,10 @@ /** * @author Håvard Ottestad */ -public class TempTest { +class TempTest { @Test - public void a() throws Exception { + void a() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -72,7 +72,7 @@ public void a() throws Exception { } @Test - public void b() throws Exception { + void b() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); try (SailRepositoryConnection connection = shaclRepository.getConnection()) { @@ -100,7 +100,7 @@ public void b() throws Exception { } @Test - public void maxCount() throws Exception { + void maxCount() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclMax.trig"); try (SailRepositoryConnection connection = shaclRepository.getConnection()) { @@ -138,7 +138,7 @@ public void maxCount() throws Exception { } @Test - public void minCount() throws Exception { + void minCount() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -164,7 +164,7 @@ public void minCount() throws Exception { } @Test - public void leftOuterJoin() throws Exception { + void leftOuterJoin() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -201,7 +201,7 @@ public void leftOuterJoin() throws Exception { } @Test - public void testUndefinedTargetClassValidatesAllSubjects3() throws Throwable { + void testUndefinedTargetClassValidatesAllSubjects3() throws Throwable { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclNoTargetClass.trig"); @@ -249,9 +249,10 @@ public void testUndefinedTargetClassValidatesAllSubjects3() throws Throwable { } } + // this method is used to produce the log examples in the documentation @Test - @Disabled // this method is used to produce the log examples in the documentation - public void doc() throws IOException { + @Disabled + void doc() throws IOException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); // Logger root = (Logger) LoggerFactory.getLogger(ShaclSail.class.getName()); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TrackAddedStatementsTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TrackAddedStatementsTest.java index 1a3cbeb64c9..2122fc85afc 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TrackAddedStatementsTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TrackAddedStatementsTest.java @@ -11,6 +11,11 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; + import org.eclipse.rdf4j.model.vocabulary.RDF; import org.eclipse.rdf4j.model.vocabulary.RDFS; import org.eclipse.rdf4j.repository.Repository; @@ -20,16 +25,15 @@ import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.eclipse.rdf4j.sail.SailConnection; import org.eclipse.rdf4j.sail.shacl.wrapper.data.ConnectionsGroup; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** * @author Håvard Ottestad */ -public class TrackAddedStatementsTest { +class TrackAddedStatementsTest { @Test - public void testCleanup() throws Exception { + void testCleanup() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -40,8 +44,8 @@ public void testCleanup() throws Exception { ShaclSailConnection shaclSailConnection = (ShaclSailConnection) connection.getSailConnection(); - Assertions.assertNull(shaclSailConnection.addedStatements); - Assertions.assertNull(shaclSailConnection.removedStatements); + assertNull(shaclSailConnection.addedStatements); + assertNull(shaclSailConnection.removedStatements); } finally { shaclRepository.shutDown(); } @@ -49,7 +53,7 @@ public void testCleanup() throws Exception { } @Test - public void testTransactions() throws Exception { + void testTransactions() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -61,8 +65,8 @@ public void testTransactions() throws Exception { ShaclSailConnection shaclSailConnection = (ShaclSailConnection) connection.getSailConnection(); shaclSailConnection.fillAddedAndRemovedStatementRepositories(); - Assertions.assertNotNull(shaclSailConnection.addedStatements); - Assertions.assertNotNull(shaclSailConnection.removedStatements); + assertNotNull(shaclSailConnection.addedStatements); + assertNotNull(shaclSailConnection.removedStatements); connection.commit(); @@ -73,7 +77,7 @@ public void testTransactions() throws Exception { } @Test - public void testRollback() throws Exception { + void testRollback() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -85,18 +89,18 @@ public void testRollback() throws Exception { ShaclSailConnection shaclSailConnection = (ShaclSailConnection) connection.getSailConnection(); shaclSailConnection.fillAddedAndRemovedStatementRepositories(); - Assertions.assertNotNull(shaclSailConnection.addedStatements); - Assertions.assertNotNull(shaclSailConnection.removedStatements); + assertNotNull(shaclSailConnection.addedStatements); + assertNotNull(shaclSailConnection.removedStatements); connection.rollback(); - Assertions.assertNull(shaclSailConnection.addedStatements); - Assertions.assertNull(shaclSailConnection.removedStatements); + assertNull(shaclSailConnection.addedStatements); + assertNull(shaclSailConnection.removedStatements); connection.add(RDFS.RESOURCE, RDF.TYPE, RDFS.RESOURCE); - Assertions.assertNull(shaclSailConnection.addedStatements); - Assertions.assertNull(shaclSailConnection.removedStatements); + assertNull(shaclSailConnection.addedStatements); + assertNull(shaclSailConnection.removedStatements); } finally { shaclRepository.shutDown(); @@ -105,7 +109,7 @@ public void testRollback() throws Exception { } @Test - public void testTrandactionRollbackCleanup() throws Exception { + void testTrandactionRollbackCleanup() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -125,8 +129,8 @@ public void testTrandactionRollbackCleanup() throws Exception { ShaclSailConnection shaclSailConnection = (ShaclSailConnection) connection.getSailConnection(); - Assertions.assertNull(shaclSailConnection.addedStatements); - Assertions.assertNull(shaclSailConnection.removedStatements); + assertNull(shaclSailConnection.addedStatements); + assertNull(shaclSailConnection.removedStatements); } finally { shaclRepository.shutDown(); @@ -135,7 +139,7 @@ public void testTrandactionRollbackCleanup() throws Exception { } @Test - public void testValidationFailedCausesRollback() throws Exception { + void testValidationFailedCausesRollback() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -147,7 +151,7 @@ public void testValidationFailedCausesRollback() throws Exception { try { connection.commit(); - Assertions.fail("commit should have failed"); + fail("commit should have failed"); } catch (RepositoryException e) { // do nothing, expected } @@ -155,7 +159,7 @@ public void testValidationFailedCausesRollback() throws Exception { } try (SailRepositoryConnection connection = shaclRepository.getConnection()) { - Assertions.assertEquals(0, size(connection)); + assertEquals(0, size(connection)); } finally { shaclRepository.shutDown(); } @@ -163,7 +167,7 @@ public void testValidationFailedCausesRollback() throws Exception { } @Test - public void testCleanupOnClose() throws Exception { + void testCleanupOnClose() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -176,17 +180,17 @@ public void testCleanupOnClose() throws Exception { ShaclSailConnection shaclSailConnection = (ShaclSailConnection) connection.getSailConnection(); - Assertions.assertNull(shaclSailConnection.addedStatements); - Assertions.assertNull(shaclSailConnection.removedStatements); + assertNull(shaclSailConnection.addedStatements); + assertNull(shaclSailConnection.removedStatements); - Assertions.assertEquals(0, size(shaclRepository)); + assertEquals(0, size(shaclRepository)); shaclRepository.shutDown(); } @Test - public void testAddRemoveAddRemove() throws Exception { + void testAddRemoveAddRemove() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -204,8 +208,8 @@ public void testAddRemoveAddRemove() throws Exception { shaclSailConnection.fillAddedAndRemovedStatementRepositories(); try (ConnectionsGroup connectionsGroup = shaclSailConnection.getConnectionsGroup()) { - Assertions.assertEquals(0, size(connectionsGroup.getAddedStatements())); - Assertions.assertEquals(1, size(connectionsGroup.getRemovedStatements())); + assertEquals(0, size(connectionsGroup.getAddedStatements())); + assertEquals(1, size(connectionsGroup.getRemovedStatements())); } connection.commit(); @@ -217,7 +221,7 @@ public void testAddRemoveAddRemove() throws Exception { } @Test - public void testAdd() throws Exception { + void testAdd() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -241,8 +245,8 @@ public void testAdd() throws Exception { shaclSailConnection.fillAddedAndRemovedStatementRepositories(); try (ConnectionsGroup connectionsGroup = shaclSailConnection.getConnectionsGroup()) { - Assertions.assertEquals(1, size(connectionsGroup.getAddedStatements())); - Assertions.assertEquals(0, size(connectionsGroup.getRemovedStatements())); + assertEquals(1, size(connectionsGroup.getAddedStatements())); + assertEquals(0, size(connectionsGroup.getRemovedStatements())); } connection.commit(); @@ -261,7 +265,7 @@ private void addDummyData(SailRepository shaclRepository) { } @Test - public void testAddRemove() throws Exception { + void testAddRemove() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -280,8 +284,8 @@ public void testAddRemove() throws Exception { shaclSailConnection.fillAddedAndRemovedStatementRepositories(); try (ConnectionsGroup connectionsGroup = shaclSailConnection.getConnectionsGroup()) { - Assertions.assertEquals(0, size(connectionsGroup.getAddedStatements())); - Assertions.assertEquals(0, size(connectionsGroup.getRemovedStatements())); + assertEquals(0, size(connectionsGroup.getAddedStatements())); + assertEquals(0, size(connectionsGroup.getRemovedStatements())); } connection.commit(); @@ -294,7 +298,7 @@ public void testAddRemove() throws Exception { } @Test - public void testRemove() throws Exception { + void testRemove() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -313,8 +317,8 @@ public void testRemove() throws Exception { shaclSailConnection.fillAddedAndRemovedStatementRepositories(); try (ConnectionsGroup connectionsGroup = shaclSailConnection.getConnectionsGroup()) { - Assertions.assertEquals(0, size(connectionsGroup.getAddedStatements())); - Assertions.assertEquals(1, size(connectionsGroup.getRemovedStatements())); + assertEquals(0, size(connectionsGroup.getAddedStatements())); + assertEquals(1, size(connectionsGroup.getRemovedStatements())); } connection.commit(); @@ -325,7 +329,7 @@ public void testRemove() throws Exception { } @Test - public void testRemoveWithoutAdding() throws Exception { + void testRemoveWithoutAdding() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -340,8 +344,8 @@ public void testRemoveWithoutAdding() throws Exception { shaclSailConnection.fillAddedAndRemovedStatementRepositories(); try (ConnectionsGroup connectionsGroup = shaclSailConnection.getConnectionsGroup()) { - Assertions.assertEquals(0, size(connectionsGroup.getAddedStatements())); - Assertions.assertEquals(0, size(connectionsGroup.getRemovedStatements())); + assertEquals(0, size(connectionsGroup.getAddedStatements())); + assertEquals(0, size(connectionsGroup.getRemovedStatements())); } connection.commit(); @@ -352,7 +356,7 @@ public void testRemoveWithoutAdding() throws Exception { } @Test - public void testSingleRemove() throws Exception { + void testSingleRemove() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -368,8 +372,8 @@ public void testSingleRemove() throws Exception { shaclSailConnection.fillAddedAndRemovedStatementRepositories(); try (ConnectionsGroup connectionsGroup = shaclSailConnection.getConnectionsGroup()) { - Assertions.assertEquals(0, size(connectionsGroup.getAddedStatements())); - Assertions.assertEquals(1, size(connectionsGroup.getRemovedStatements())); + assertEquals(0, size(connectionsGroup.getAddedStatements())); + assertEquals(1, size(connectionsGroup.getRemovedStatements())); } connection.commit(); @@ -380,7 +384,7 @@ public void testSingleRemove() throws Exception { } @Test - public void testSingleAdd() throws Exception { + void testSingleAdd() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("empty.trig"); addDummyData(shaclRepository); @@ -394,8 +398,8 @@ public void testSingleAdd() throws Exception { shaclSailConnection.fillAddedAndRemovedStatementRepositories(); try (ConnectionsGroup connectionsGroup = shaclSailConnection.getConnectionsGroup()) { - Assertions.assertEquals(1, size(connectionsGroup.getAddedStatements())); - Assertions.assertEquals(0, size(connectionsGroup.getRemovedStatements())); + assertEquals(1, size(connectionsGroup.getAddedStatements())); + assertEquals(0, size(connectionsGroup.getRemovedStatements())); } connection.commit(); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionSettingsFactoryTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionSettingsFactoryTest.java index 402755fb81e..897bd2547ad 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionSettingsFactoryTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionSettingsFactoryTest.java @@ -27,7 +27,7 @@ * * @author Jeen Broekstra, Håvard M. Ottestad */ -public class TransactionSettingsFactoryTest { +class TransactionSettingsFactoryTest { // this need static static Class[] transactionSettingsProvider() { @@ -36,7 +36,7 @@ static Class[] transactionSettingsProvider() { @ParameterizedTest @MethodSource("transactionSettingsProvider") - public void testGetTransactionSetting(Class clazz) { + void testGetTransactionSetting(Class clazz) { TransactionSetting[] enumConstants = clazz.getEnumConstants(); @@ -57,7 +57,7 @@ public void testGetTransactionSetting(Class clazz) } @Test - public void testDistinctTransactionSettingsProviders() { + void testDistinctTransactionSettingsProviders() { assertThat(TransactionSettingRegistry.getInstance().getAll()) .extracting("class") .doesNotHaveDuplicates(); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionSettingsTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionSettingsTest.java index 8506d0f1bff..44fa677a1dc 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionSettingsTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionSettingsTest.java @@ -18,7 +18,12 @@ import static org.eclipse.rdf4j.sail.shacl.ShaclSail.TransactionSettings.ValidationApproach.Auto; import static org.eclipse.rdf4j.sail.shacl.ShaclSail.TransactionSettings.ValidationApproach.Bulk; import static org.eclipse.rdf4j.sail.shacl.ShaclSail.TransactionSettings.ValidationApproach.Disabled; +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.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.InputStream; @@ -33,14 +38,13 @@ import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.sail.memory.MemoryStore; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -public class TransactionSettingsTest { +class TransactionSettingsTest { @Test - public void testBulk() { + void testBulk() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setParallelValidation(true); shaclSail.setCacheSelectNodes(true); @@ -55,9 +59,9 @@ public void testBulk() { ShaclSailConnection sailConnection = (ShaclSailConnection) connection.getSailConnection(); ShaclSailConnection.Settings transactionSettings = sailConnection.getTransactionSettings(); - Assertions.assertSame(transactionSettings.getValidationApproach(), Bulk); - Assertions.assertFalse(transactionSettings.isCacheSelectNodes()); - Assertions.assertFalse(transactionSettings.isParallelValidation()); + assertSame(Bulk, transactionSettings.getValidationApproach()); + assertFalse(transactionSettings.isCacheSelectNodes()); + assertFalse(transactionSettings.isParallelValidation()); connection.commit(); @@ -68,7 +72,7 @@ public void testBulk() { } @Test - public void testBulkParallel() { + void testBulkParallel() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setParallelValidation(true); shaclSail.setCacheSelectNodes(true); @@ -83,9 +87,9 @@ public void testBulkParallel() { ShaclSailConnection sailConnection = (ShaclSailConnection) connection.getSailConnection(); ShaclSailConnection.Settings transactionSettings = sailConnection.getTransactionSettings(); - Assertions.assertSame(transactionSettings.getValidationApproach(), Bulk); - Assertions.assertFalse(transactionSettings.isCacheSelectNodes()); - Assertions.assertTrue(transactionSettings.isParallelValidation()); + assertSame(Bulk, transactionSettings.getValidationApproach()); + assertFalse(transactionSettings.isCacheSelectNodes()); + assertTrue(transactionSettings.isParallelValidation()); connection.commit(); @@ -95,7 +99,7 @@ public void testBulkParallel() { } @Test - public void testBulkParallelCache() { + void testBulkParallelCache() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setParallelValidation(true); shaclSail.setCacheSelectNodes(true); @@ -110,9 +114,9 @@ public void testBulkParallelCache() { ShaclSailConnection sailConnection = (ShaclSailConnection) connection.getSailConnection(); ShaclSailConnection.Settings transactionSettings = sailConnection.getTransactionSettings(); - Assertions.assertSame(transactionSettings.getValidationApproach(), Bulk); - Assertions.assertTrue(transactionSettings.isCacheSelectNodes()); - Assertions.assertTrue(transactionSettings.isParallelValidation()); + assertSame(Bulk, transactionSettings.getValidationApproach()); + assertTrue(transactionSettings.isCacheSelectNodes()); + assertTrue(transactionSettings.isParallelValidation()); connection.commit(); @@ -122,7 +126,7 @@ public void testBulkParallelCache() { } @Test - public void testParallelCacheEmptyRepo() { + void testParallelCacheEmptyRepo() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setParallelValidation(true); shaclSail.setCacheSelectNodes(true); @@ -136,9 +140,9 @@ public void testParallelCacheEmptyRepo() { ShaclSailConnection sailConnection = (ShaclSailConnection) connection.getSailConnection(); ShaclSailConnection.Settings transactionSettings = sailConnection.getTransactionSettings(); - Assertions.assertSame(transactionSettings.getValidationApproach(), Bulk); - Assertions.assertTrue(transactionSettings.isCacheSelectNodes()); - Assertions.assertTrue(transactionSettings.isParallelValidation()); + assertSame(Bulk, transactionSettings.getValidationApproach()); + assertTrue(transactionSettings.isCacheSelectNodes()); + assertTrue(transactionSettings.isParallelValidation()); connection.commit(); @@ -148,7 +152,7 @@ public void testParallelCacheEmptyRepo() { } @Test - public void testDefault() { + void testDefault() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setParallelValidation(true); shaclSail.setCacheSelectNodes(true); @@ -163,9 +167,9 @@ public void testDefault() { ShaclSailConnection sailConnection = (ShaclSailConnection) connection.getSailConnection(); ShaclSailConnection.Settings transactionSettings = sailConnection.getTransactionSettings(); - Assertions.assertSame(transactionSettings.getValidationApproach(), Auto); - Assertions.assertTrue(transactionSettings.isCacheSelectNodes()); - Assertions.assertTrue(transactionSettings.isParallelValidation()); + assertSame(Auto, transactionSettings.getValidationApproach()); + assertTrue(transactionSettings.isCacheSelectNodes()); + assertTrue(transactionSettings.isParallelValidation()); connection.commit(); @@ -175,7 +179,7 @@ public void testDefault() { } @Test - public void testNulls() { + void testNulls() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -188,9 +192,9 @@ public void testNulls() { ShaclSailConnection sailConnection = (ShaclSailConnection) connection.getSailConnection(); ShaclSailConnection.Settings transactionSettings = sailConnection.getTransactionSettings(); - Assertions.assertNotNull(transactionSettings.getValidationApproach()); - Assertions.assertTrue(transactionSettings.isCacheSelectNodes()); - Assertions.assertTrue(transactionSettings.isParallelValidation()); + assertNotNull(transactionSettings.getValidationApproach()); + assertTrue(transactionSettings.isCacheSelectNodes()); + assertTrue(transactionSettings.isParallelValidation()); connection.commit(); @@ -200,7 +204,7 @@ public void testNulls() { } @Test - public void testDefaultOverride() { + void testDefaultOverride() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setParallelValidation(true); shaclSail.setCacheSelectNodes(true); @@ -216,10 +220,10 @@ public void testDefaultOverride() { ShaclSailConnection sailConnection = (ShaclSailConnection) connection.getSailConnection(); ShaclSailConnection.Settings transactionSettings = sailConnection.getTransactionSettings(); - Assertions.assertSame(transactionSettings.getValidationApproach(), Auto); - Assertions.assertFalse(transactionSettings.isCacheSelectNodes()); - Assertions.assertFalse(transactionSettings.isParallelValidation()); - Assertions.assertSame(transactionSettings.getIsolationLevel(), IsolationLevels.SNAPSHOT_READ); + assertSame(Auto, transactionSettings.getValidationApproach()); + assertFalse(transactionSettings.isCacheSelectNodes()); + assertFalse(transactionSettings.isParallelValidation()); + assertSame(IsolationLevels.SNAPSHOT_READ, transactionSettings.getIsolationLevel()); connection.commit(); @@ -236,7 +240,7 @@ private void addDummyData(SailRepository sailRepository) { } @Test - public void testSerializableParallelValidation() { + void testSerializableParallelValidation() { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setParallelValidation(true); @@ -250,8 +254,8 @@ public void testSerializableParallelValidation() { ShaclSailConnection sailConnection = (ShaclSailConnection) connection.getSailConnection(); ShaclSailConnection.Settings transactionSettings = sailConnection.getTransactionSettings(); - Assertions.assertSame(transactionSettings.getValidationApproach(), Auto); - Assertions.assertFalse(transactionSettings.isParallelValidation()); + assertSame(Auto, transactionSettings.getValidationApproach()); + assertFalse(transactionSettings.isParallelValidation()); connection.commit(); @@ -261,32 +265,32 @@ public void testSerializableParallelValidation() { } @Test - public void testPriority() { + void testPriority() { // test default behaviour - Assertions.assertEquals(Auto, ShaclSailConnection.Settings.getMostSignificantValidationApproach(null, null)); + assertEquals(Auto, ShaclSailConnection.Settings.getMostSignificantValidationApproach(null, null)); // test single null - Assertions.assertEquals(Bulk, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Bulk, null)); - Assertions.assertEquals(Bulk, ShaclSailConnection.Settings.getMostSignificantValidationApproach(null, Bulk)); + assertEquals(Bulk, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Bulk, null)); + assertEquals(Bulk, ShaclSailConnection.Settings.getMostSignificantValidationApproach(null, Bulk)); // test base overrides transaction - Assertions.assertEquals(Bulk, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Bulk, Auto)); - Assertions.assertEquals(Disabled, + assertEquals(Bulk, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Bulk, Auto)); + assertEquals(Disabled, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Disabled, Auto)); - Assertions.assertEquals(Disabled, + assertEquals(Disabled, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Disabled, Bulk)); // test transaction overrides base - Assertions.assertEquals(Bulk, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Auto, Bulk)); - Assertions.assertEquals(Disabled, + assertEquals(Bulk, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Auto, Bulk)); + assertEquals(Disabled, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Auto, Disabled)); - Assertions.assertEquals(Disabled, + assertEquals(Disabled, ShaclSailConnection.Settings.getMostSignificantValidationApproach(Bulk, Disabled)); } @Test - public void testValid() throws Exception { + void testValid() throws Exception { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); addDummyData(repository); @@ -310,7 +314,7 @@ public void testValid() throws Exception { } @Test - public void testInvalid() throws Throwable { + void testInvalid() throws Throwable { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); addDummyData(repository); @@ -339,7 +343,7 @@ public void testInvalid() throws Throwable { } @Test - public void testInvalidSnapshot() throws Throwable { + void testInvalidSnapshot() throws Throwable { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); addDummyData(repository); @@ -368,7 +372,7 @@ public void testInvalidSnapshot() throws Throwable { } @Test - public void testInvalidRollsBackCorrectly() { + void testInvalidRollsBackCorrectly() { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); addDummyData(repository); @@ -402,7 +406,7 @@ public void testInvalidRollsBackCorrectly() { } @Test - public void testValidationDisabled() throws Throwable { + void testValidationDisabled() throws Throwable { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); addDummyData(repository); @@ -438,7 +442,7 @@ public void testValidationDisabled() throws Throwable { } @Test - public void testValidationDisabledSnapshotSerializableValidation() throws Throwable { + void testValidationDisabledSnapshotSerializableValidation() throws Throwable { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); addDummyData(repository); @@ -472,7 +476,7 @@ public void testValidationDisabledSnapshotSerializableValidation() throws Throwa } @Test - public void testDisabledValidationBulk() throws Throwable { + void testDisabledValidationBulk() throws Throwable { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); addDummyData(repository); @@ -497,7 +501,7 @@ public void testDisabledValidationBulk() throws Throwable { } @Test - public void testDisabledValidationAuto() throws Throwable { + void testDisabledValidationAuto() throws Throwable { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); addDummyData(repository); @@ -526,7 +530,7 @@ public void testDisabledValidationAuto() throws Throwable { } @Test - public void testDisabledValidationAutoEmptyRepo() throws Throwable { + void testDisabledValidationAutoEmptyRepo() throws Throwable { SailRepository repository = new SailRepository(new ShaclSail(new MemoryStore())); ((ShaclSail) repository.getSail()).disableValidation(); @@ -553,7 +557,7 @@ public void testDisabledValidationAutoEmptyRepo() throws Throwable { } @Test - public void testSerialOverrideWithModifiedShapes() throws Throwable { + void testSerialOverrideWithModifiedShapes() throws Throwable { ShaclSail sail = new ShaclSail(new MemoryStore()); ShaclSail spy = Mockito.spy(sail); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionValidationLimitTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionValidationLimitTest.java index a05b28df21f..f7465561ce8 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionValidationLimitTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionValidationLimitTest.java @@ -26,10 +26,10 @@ /** * @author Håvard Ottestad */ -public class TransactionValidationLimitTest { +class TransactionValidationLimitTest { @Test - public void testFailoverToBulkValidationSingleConnection() throws Exception { + void testFailoverToBulkValidationSingleConnection() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -72,7 +72,7 @@ public void testFailoverToBulkValidationSingleConnection() throws Exception { } @Test - public void testFailoverToBulkValidationNewConnection() throws Exception { + void testFailoverToBulkValidationNewConnection() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -119,7 +119,7 @@ public void testFailoverToBulkValidationNewConnection() throws Exception { } @Test - public void testFailoverToBulkValidationTriggersValidation() throws Exception { + void testFailoverToBulkValidationTriggersValidation() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); @@ -153,7 +153,7 @@ public void testFailoverToBulkValidationTriggersValidation() throws Exception { } @Test - public void testBulkValidationForEmptySail() throws Exception { + void testBulkValidationForEmptySail() throws Exception { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.trig"); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionalIsolationSlowIT.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionalIsolationSlowIT.java index 849dcbc8179..a3891e71896 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionalIsolationSlowIT.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionalIsolationSlowIT.java @@ -33,10 +33,10 @@ @Tag("slow") @Isolated -public class TransactionalIsolationSlowIT { +class TransactionalIsolationSlowIT { @Test - public void testIsolationMultithreaded_READ_COMMITTED() throws Throwable { + void testIsolationMultithreaded_READ_COMMITTED() throws Throwable { for (int i = 0; i < 1000; i++) { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); @@ -172,7 +172,7 @@ public void testIsolationMultithreaded_READ_COMMITTED() throws Throwable { } @Test - public void testIsolationMultithreaded_SNAPSHOT() throws Throwable { + void testIsolationMultithreaded_SNAPSHOT() throws Throwable { for (int i = 0; i < 1000; i++) { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionalIsolationTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionalIsolationTest.java index 9e451fbe9a7..cd0564346f8 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionalIsolationTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TransactionalIsolationTest.java @@ -38,10 +38,10 @@ import org.eclipse.rdf4j.sail.shacl.results.ValidationReport; import org.junit.jupiter.api.Test; -public class TransactionalIsolationTest { +class TransactionalIsolationTest { @Test - public void testUpdatingShapes() throws IOException { + void testUpdatingShapes() throws IOException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -92,7 +92,7 @@ public void testUpdatingShapes() throws IOException { } @Test - public void testUpdatingShapesViolation() throws Throwable { + void testUpdatingShapesViolation() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -146,7 +146,7 @@ public void testUpdatingShapesViolation() throws Throwable { } @Test - public void testAddingShapesAfterData() throws Throwable { + void testAddingShapesAfterData() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -185,7 +185,7 @@ public void testAddingShapesAfterData() throws Throwable { } @Test - public void testAddingShapesThatFails() throws Throwable { + void testAddingShapesThatFails() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -231,7 +231,7 @@ public void testAddingShapesThatFails() throws Throwable { } @Test - public void testViolation() throws Throwable { + void testViolation() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -275,7 +275,7 @@ public void testViolation() throws Throwable { } @Test - public void testIsolation() throws Throwable { + void testIsolation() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); @@ -330,7 +330,7 @@ public void testIsolation() throws Throwable { } @Test - public void testIsolation_2() throws Throwable { + void testIsolation_2() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); @@ -386,7 +386,7 @@ public void testIsolation_2() throws Throwable { } @Test - public void testIsolation2() throws Throwable { + void testIsolation2() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); @@ -443,7 +443,7 @@ public void testIsolation2() throws Throwable { } @Test - public void testIsolation5() throws Throwable { + void testIsolation5() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); @@ -504,7 +504,7 @@ public void testIsolation5() throws Throwable { } @Test - public void testIsolation2_1() throws Throwable { + void testIsolation2_1() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); @@ -561,7 +561,7 @@ public void testIsolation2_1() throws Throwable { } @Test - public void testIsolation2_2() throws Throwable { + void testIsolation2_2() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); @@ -618,7 +618,7 @@ public void testIsolation2_2() throws Throwable { } @Test - public void testIsolation3() throws Throwable { + void testIsolation3() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); @@ -674,7 +674,7 @@ public void testIsolation3() throws Throwable { } @Test - public void testIsolation4() throws Throwable { + void testIsolation4() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); @@ -730,7 +730,7 @@ public void testIsolation4() throws Throwable { } @Test - public void testRollbak() throws Throwable { + void testRollbak() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -769,7 +769,7 @@ public void testRollbak() throws Throwable { } @Test() - public void checkForNoExceptionWithEmptyTransaction() { + void checkForNoExceptionWithEmptyTransaction() { SailRepository sailRepository = new SailRepository(new ShaclSail(new MemoryStore())); sailRepository.init(); @@ -783,7 +783,7 @@ public void checkForNoExceptionWithEmptyTransaction() { } @Test - public void testRemoveShapes() throws IOException { + void testRemoveShapes() throws IOException { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -838,7 +838,7 @@ public void testRemoveShapes() throws IOException { } @Test - public void testUpdateShapesSparql() throws Throwable { + void testUpdateShapesSparql() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -891,7 +891,7 @@ public void testUpdateShapesSparql() throws Throwable { } @Test - public void testReadShapes() throws Throwable { + void testReadShapes() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); SailRepository sailRepository = new SailRepository(shaclSail); @@ -939,7 +939,7 @@ public void testReadShapes() throws Throwable { } @Test - public void testSerializableValidationAndTransactionalValidationLimit() throws Throwable { + void testSerializableValidationAndTransactionalValidationLimit() throws Throwable { ShaclSail shaclSail = new ShaclSail(new MemoryStore()); shaclSail.setSerializableValidation(true); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TruncatedValidationReportTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TruncatedValidationReportTest.java index e9787dea31b..c9c3498d016 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TruncatedValidationReportTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/TruncatedValidationReportTest.java @@ -11,6 +11,10 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.io.IOException; import java.util.Map; import java.util.stream.Collectors; @@ -26,18 +30,17 @@ import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.eclipse.rdf4j.sail.shacl.results.ValidationReport; import org.eclipse.rdf4j.sail.shacl.results.ValidationResult; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; /** * @author Håvard Ottestad */ -public class TruncatedValidationReportTest { +class TruncatedValidationReportTest { private static final int NUMBER_OF_FAILURES = 5000; @Test - public void testTotal() throws IOException { + void testTotal() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); ShaclSail sail = (ShaclSail) shaclRepository.getSail(); @@ -51,13 +54,13 @@ public void testTotal() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertEquals(10, total); + assertTrue(validationReport.isTruncated()); + assertEquals(10, total); } @Test - public void testPerConstraint() throws IOException { + void testPerConstraint() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -72,15 +75,15 @@ public void testPerConstraint() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertEquals(10, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); - Assertions.assertEquals(10, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); - Assertions.assertEquals(20, total); + assertTrue(validationReport.isTruncated()); + assertEquals(10, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); + assertEquals(10, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); + assertEquals(20, total); } @Test - public void testPerConstraint2() throws IOException { + void testPerConstraint2() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -97,15 +100,15 @@ public void testPerConstraint2() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertEquals(10, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); - Assertions.assertEquals(10, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); - Assertions.assertEquals(20, total); + assertTrue(validationReport.isTruncated()); + assertEquals(10, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); + assertEquals(10, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); + assertEquals(20, total); } @Test - public void testZeroTotal() throws IOException { + void testZeroTotal() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -120,14 +123,14 @@ public void testZeroTotal() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertFalse(validationReport.conforms()); - Assertions.assertEquals(0, total); + assertTrue(validationReport.isTruncated()); + assertFalse(validationReport.conforms()); + assertEquals(0, total); } @Test - public void testZeroPerConstraint() throws IOException { + void testZeroPerConstraint() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -142,14 +145,14 @@ public void testZeroPerConstraint() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertFalse(validationReport.conforms()); - Assertions.assertEquals(0, total); + assertTrue(validationReport.isTruncated()); + assertFalse(validationReport.conforms()); + assertEquals(0, total); } @Test - public void testTotalAndPerConstraint() throws IOException { + void testTotalAndPerConstraint() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -165,15 +168,15 @@ public void testTotalAndPerConstraint() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertEquals(5, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); - Assertions.assertEquals(5, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); - Assertions.assertEquals(10, total); + assertTrue(validationReport.isTruncated()); + assertEquals(5, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); + assertEquals(5, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); + assertEquals(10, total); } @Test - public void testTotalAndPerConstraint2() throws IOException { + void testTotalAndPerConstraint2() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -189,14 +192,14 @@ public void testTotalAndPerConstraint2() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertEquals(20, total); + assertTrue(validationReport.isTruncated()); + assertEquals(20, total); - Assertions.assertTrue(validationReport.asModel().contains(null, RDF4J.TRUNCATED, BooleanLiteral.TRUE)); + assertTrue(validationReport.asModel().contains(null, RDF4J.TRUNCATED, BooleanLiteral.TRUE)); } @Test - public void testNoLimit() throws IOException { + void testNoLimit() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -211,17 +214,17 @@ public void testNoLimit() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertFalse(validationReport.isTruncated()); - Assertions.assertEquals(NUMBER_OF_FAILURES, + assertFalse(validationReport.isTruncated()); + assertEquals(NUMBER_OF_FAILURES, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); - Assertions.assertEquals(NUMBER_OF_FAILURES, + assertEquals(NUMBER_OF_FAILURES, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); - Assertions.assertEquals(NUMBER_OF_FAILURES * 2, total); + assertEquals(NUMBER_OF_FAILURES * 2, total); } @Test - public void testDefaultLimit() throws IOException { + void testDefaultLimit() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -233,15 +236,15 @@ public void testDefaultLimit() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertEquals(1000, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); - Assertions.assertEquals(1000, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); - Assertions.assertEquals(2000, total); + assertTrue(validationReport.isTruncated()); + assertEquals(1000, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); + assertEquals(1000, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); + assertEquals(2000, total); } @Test - public void testLimitIsEqualToSize() throws IOException { + void testLimitIsEqualToSize() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); @@ -257,17 +260,17 @@ public void testLimitIsEqualToSize() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertFalse(validationReport.isTruncated()); - Assertions.assertEquals(NUMBER_OF_FAILURES, + assertFalse(validationReport.isTruncated()); + assertEquals(NUMBER_OF_FAILURES, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); - Assertions.assertEquals(NUMBER_OF_FAILURES, + assertEquals(NUMBER_OF_FAILURES, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); - Assertions.assertEquals(NUMBER_OF_FAILURES * 2, total); + assertEquals(NUMBER_OF_FAILURES * 2, total); } @Test - public void testRevalidate() throws IOException { + void testRevalidate() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclDatatypeAndMinCount.trig"); ShaclSail sail = (ShaclSail) shaclRepository.getSail(); @@ -292,10 +295,10 @@ public void testRevalidate() throws IOException { .collect(Collectors.groupingBy(ValidationResult::getSourceConstraintComponent, Collectors.counting())); long total = collect.values().stream().mapToLong(l -> l).sum(); - Assertions.assertTrue(validationReport.isTruncated()); - Assertions.assertEquals(15, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); - Assertions.assertEquals(15, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); - Assertions.assertEquals(30, total); + assertTrue(validationReport.isTruncated()); + assertEquals(15, collect.get(SourceConstraintComponent.MinCountConstraintComponent).longValue()); + assertEquals(15, collect.get(SourceConstraintComponent.DatatypeConstraintComponent).longValue()); + assertEquals(30, total); } private ValidationReport getValidationReport(SailRepository shaclRepository) { diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/UniqueTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/UniqueTest.java index 11d1347349e..ed5ea333d9b 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/UniqueTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/UniqueTest.java @@ -11,6 +11,8 @@ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -21,13 +23,12 @@ import org.eclipse.rdf4j.sail.shacl.ast.planNodes.ValidationTuple; import org.eclipse.rdf4j.sail.shacl.mock.MockConsumePlanNode; import org.eclipse.rdf4j.sail.shacl.mock.MockInputPlanNode; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class UniqueTest { +class UniqueTest { @Test - public void tupleCardinality1() { + void tupleCardinality1() { MockInputPlanNode input = new MockInputPlanNode(List.of("a"), List.of("b"), List.of("b"), List.of("c")); @@ -37,7 +38,7 @@ public void tupleCardinality1() { } @Test - public void tupleCardinality2() { + void tupleCardinality2() { MockInputPlanNode input = new MockInputPlanNode(List.of("a"), Arrays.asList("b", "2"), List.of("b"), Arrays.asList("b", "3"), Arrays.asList("b", "2"), Arrays.asList("c", "1")); @@ -47,7 +48,7 @@ public void tupleCardinality2() { } @Test - public void tupleCardinality3() { + void tupleCardinality3() { MockInputPlanNode input = new MockInputPlanNode(Arrays.asList("a", "1"), Arrays.asList("a", "1"), Arrays.asList("a", "1"), Arrays.asList("a", "1")); @@ -57,7 +58,7 @@ public void tupleCardinality3() { } @Test - public void compressPropertyShape() { + void compressPropertyShape() { MockInputPlanNode input = new MockInputPlanNode( Arrays.asList("a", "1"), @@ -72,7 +73,7 @@ public void compressPropertyShape() { } @Test - public void compressPropertyShape2() { + void compressPropertyShape2() { MockInputPlanNode input = new MockInputPlanNode( Arrays.asList("a", "a", "1"), @@ -86,7 +87,7 @@ public void compressPropertyShape2() { List tuples = new MockConsumePlanNode(unique).asList(); - Assertions.assertEquals(2, tuples.size()); + assertEquals(2, tuples.size()); } @@ -103,7 +104,7 @@ private void runTest(MockInputPlanNode input, boolean compress) { tuples.sort(ValidationTuple::compareFullTarget); expected.sort(ValidationTuple::compareFullTarget); - Assertions.assertEquals(expected, tuples); + assertEquals(expected, tuples); } } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/UnknownShapesTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/UnknownShapesTest.java index 3c8c4d36858..7da3cf71038 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/UnknownShapesTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/UnknownShapesTest.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.io.IOException; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -23,7 +25,6 @@ import org.eclipse.rdf4j.repository.sail.SailRepository; import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; @@ -35,7 +36,7 @@ import ch.qos.logback.core.AppenderBase; @Isolated -public class UnknownShapesTest { +class UnknownShapesTest { private TestAppender appender; @@ -55,7 +56,7 @@ void detachAppender() { @Test @Timeout(5) - public void testPropertyShapes() throws IOException { + void testPropertyShapes() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("unknownProperties.trig"); try (SailRepositoryConnection connection = shaclRepository.getConnection()) { @@ -71,7 +72,7 @@ public void testPropertyShapes() throws IOException { "Unsupported SHACL feature detected sh:unknownTarget in statement (http://example.com/ns#PersonShape, http://www.w3.org/ns/shacl#unknownTarget, http://www.w3.org/2000/01/rdf-schema#Class) [http://rdf4j.org/schema/rdf4j#SHACLShapeGraph]" ); - Assertions.assertEquals(expected, relevantLog); + assertEquals(expected, relevantLog); shaclRepository.shutDown(); @@ -91,7 +92,7 @@ private Set getRelevantLog(int expectedNumberOfItems) { @Test @Timeout(5) - public void testComplexPath() throws IOException { + void testComplexPath() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("complexPath.trig"); try (SailRepositoryConnection connection = shaclRepository.getConnection()) { @@ -113,13 +114,13 @@ public void testComplexPath() throws IOException { "Unsupported SHACL feature detected: InversePath{ ZeroOrMorePath{ SimplePath{ } } }. Shape ignored! a sh:PropertyShape; sh:path [ sh:inversePath [ sh:zeroOrMorePath ] ]; sh:minCount 1 ." ); - Assertions.assertEquals(expected, relevantLog); + assertEquals(expected, relevantLog); shaclRepository.shutDown(); } @Test - public void testThatUnknownPathsAreIgnored() throws IOException { + void testThatUnknownPathsAreIgnored() throws IOException { SailRepository shaclRepository = Utils.getInitializedShaclRepository("complexPath.trig"); // trigger SPARQL based validation diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ValidationReportTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ValidationReportTest.java index ee90e5c5eb7..41616c5ca53 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ValidationReportTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ValidationReportTest.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.shacl; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + import java.io.IOException; import java.io.StringReader; import java.nio.charset.StandardCharsets; @@ -26,15 +29,14 @@ import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection; import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.rio.Rio; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ValidationReportTest { +class ValidationReportTest { ValueFactory vf = SimpleValueFactory.getInstance(); @Test - public void simpleFirstTest() throws IOException { + void simpleFirstTest() throws IOException { SailRepository shaclSail = Utils.getInitializedShaclRepository("shacl.trig"); try (SailRepositoryConnection connection = shaclSail.getConnection()) { @@ -46,7 +48,7 @@ public void simpleFirstTest() throws IOException { connection.add(RDF.SUBJECT, RDF.TYPE, RDFS.RESOURCE); connection.commit(); - Assertions.fail(); + fail(); } catch (RepositoryException e) { ShaclSailValidationException cause = (ShaclSailValidationException) e.getCause(); @@ -87,7 +89,7 @@ public void simpleFirstTest() throws IOException { " sh:minCount 1 ." + ""), "", RDFFormat.TURTLE); - Assertions.assertTrue(Models.isomorphic(expected, actual)); + assertTrue(Models.isomorphic(expected, actual)); } finally { shaclSail.shutDown(); @@ -95,7 +97,7 @@ public void simpleFirstTest() throws IOException { } @Test - public void withoutPathTest() throws IOException { + void withoutPathTest() throws IOException { SailRepository shaclSail = Utils.getInitializedShaclRepository("shaclValidateTarget.trig"); try (SailRepositoryConnection connection = shaclSail.getConnection()) { @@ -105,7 +107,7 @@ public void withoutPathTest() throws IOException { vf.createIRI("http://example.com/ns#", "SecondTarget")); connection.commit(); - Assertions.fail(); + fail(); } catch (RepositoryException e) { ShaclSailValidationException cause = (ShaclSailValidationException) e.getCause(); @@ -139,7 +141,7 @@ public void withoutPathTest() throws IOException { " sh:class .\n" + ""), "", RDFFormat.TRIG); - Assertions.assertTrue(Models.isomorphic(expected, actual)); + assertTrue(Models.isomorphic(expected, actual)); } finally { shaclSail.shutDown(); @@ -147,7 +149,7 @@ public void withoutPathTest() throws IOException { } @Test - public void nestedLogicalOrSupport() throws IOException { + void nestedLogicalOrSupport() throws IOException { SailRepository shaclSail = Utils.getInitializedShaclRepository("test-cases/or/datatype/shacl.trig"); @@ -158,7 +160,7 @@ public void nestedLogicalOrSupport() throws IOException { .getResourceAsStream("test-cases/or/datatype/invalid/case1/query1.rq"), StandardCharsets.UTF_8)) .execute(); connection.commit(); - Assertions.fail(); + fail(); } catch (RepositoryException e) { ShaclSailValidationException cause = (ShaclSailValidationException) e.getCause(); @@ -200,7 +202,7 @@ public void nestedLogicalOrSupport() throws IOException { " sh:datatype .\n" + ""), "", RDFFormat.TURTLE); - Assertions.assertTrue(Models.isomorphic(expected, actual)); + assertTrue(Models.isomorphic(expected, actual)); } finally { shaclSail.shutDown(); @@ -208,7 +210,7 @@ public void nestedLogicalOrSupport() throws IOException { } @Test - public void testHasValueIn() throws IOException { + void testHasValueIn() throws IOException { SailRepository shaclSail = Utils.getInitializedShaclRepository("test-cases/hasValueIn/simple/shacl.trig"); @@ -223,7 +225,7 @@ public void testHasValueIn() throws IOException { StandardCharsets.UTF_8)) .execute(); connection.commit(); - Assertions.fail(); + fail(); } catch (RepositoryException e) { ShaclSailValidationException cause = (ShaclSailValidationException) e.getCause(); @@ -258,7 +260,7 @@ public void testHasValueIn() throws IOException { " ] ." + ""), "", RDFFormat.TRIG); - Assertions.assertTrue(Models.isomorphic(expected, actual)); + assertTrue(Models.isomorphic(expected, actual)); } finally { shaclSail.shutDown(); @@ -266,7 +268,7 @@ public void testHasValueIn() throws IOException { } @Test - public void testHasValue() throws IOException { + void testHasValue() throws IOException { SailRepository shaclSail = Utils.getInitializedShaclRepository("test-cases/hasValue/simple/shacl.trig"); @@ -281,7 +283,7 @@ public void testHasValue() throws IOException { StandardCharsets.UTF_8)) .execute(); connection.commit(); - Assertions.fail(); + fail(); } catch (RepositoryException e) { ShaclSailValidationException cause = (ShaclSailValidationException) e.getCause(); @@ -313,7 +315,7 @@ public void testHasValue() throws IOException { " ]\n" + " ] ."), "", RDFFormat.TRIG); - Assertions.assertTrue(Models.isomorphic(expected, actual)); + assertTrue(Models.isomorphic(expected, actual)); } finally { shaclSail.shutDown(); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/VisualizerTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/VisualizerTest.java index 4899f7df08c..72ea9422059 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/VisualizerTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/VisualizerTest.java @@ -22,10 +22,10 @@ import org.eclipse.rdf4j.sail.SailException; import org.junit.jupiter.api.Test; -public class VisualizerTest { +class VisualizerTest { @Test - public void datatype() throws Exception { + void datatype() throws Exception { ShaclSail shaclSail = Utils.getInitializedShaclSail("shaclDatatype.trig"); @@ -53,7 +53,7 @@ public void datatype() throws Exception { } @Test - public void maxCount() throws Exception { + void maxCount() throws Exception { ShaclSail shaclSail = Utils.getInitializedShaclSail("shaclMax.trig"); @@ -80,7 +80,7 @@ public void maxCount() throws Exception { } @Test - public void minCount() throws Exception { + void minCount() throws Exception { ShaclSail shaclSail = Utils.getInitializedShaclSail("shacl.trig"); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/W3cComplianceTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/W3cComplianceTest.java index 6b0e27c878a..6aa7a7ba665 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/W3cComplianceTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/W3cComplianceTest.java @@ -58,13 +58,13 @@ public static Stream data() { @Disabled @ParameterizedTest @MethodSource("data") - public void test(URL testCasePath) throws IOException, InterruptedException { + void test(URL testCasePath) throws IOException, InterruptedException { runTest(testCasePath); } @ParameterizedTest @MethodSource("data") - public void parsingTest(URL testCasePath) throws IOException, InterruptedException { + void parsingTest(URL testCasePath) throws IOException, InterruptedException { runParsingTest(testCasePath); } @@ -83,7 +83,7 @@ private void runParsingTest(URL resourceName) throws IOException, InterruptedExc .subjects() .forEach(s -> { int size = statements.filter(s, RDF.REST, null).objects().size(); - assertEquals(size, 1, s + " has more than one rdf:rest"); + assertEquals(1, size, s + " has more than one rdf:rest"); }); // System.out.println(AbstractShaclTest.modelToString(statements)); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/ParsingTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/ParsingTest.java index bdbd55f46a6..1b8ced8fb8b 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/ParsingTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/ParsingTest.java @@ -11,6 +11,8 @@ package org.eclipse.rdf4j.sail.shacl.ast; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.io.IOException; import java.util.HashSet; import java.util.List; @@ -19,13 +21,12 @@ import org.eclipse.rdf4j.model.impl.DynamicModelFactory; import org.eclipse.rdf4j.sail.shacl.ShaclSail; import org.eclipse.rdf4j.sail.shacl.Utils; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class ParsingTest { +class ParsingTest { @Test - public void initialTest() throws IOException, InterruptedException { + void initialTest() throws IOException, InterruptedException { ShaclSail shaclSail = Utils.getInitializedShaclSail("test-cases/datatype/not/shacl.trig"); List shapes = shaclSail.getCachedShapes().getDataAndRelease().get(0).getShapes(); @@ -38,19 +39,19 @@ public void initialTest() throws IOException, InterruptedException { } @Test - public void testSplitting() throws IOException, InterruptedException { + void testSplitting() throws IOException, InterruptedException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shaclExactly.trig"); List shapes = shaclSail.getCachedShapes().getDataAndRelease().get(0).getShapes(); - Assertions.assertEquals(14, shapes.size()); + assertEquals(14, shapes.size()); shapes.forEach(shape -> { - Assertions.assertEquals(1, shape.target.size()); - Assertions.assertEquals(1, shape.constraintComponents.size()); + assertEquals(1, shape.target.size()); + assertEquals(1, shape.constraintComponents.size()); if (shape.constraintComponents.get(0) instanceof PropertyShape) { - Assertions.assertEquals(1, + assertEquals(1, ((PropertyShape) shape.constraintComponents.get(0)).constraintComponents.size()); } }); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/TargetChainTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/TargetChainTest.java index df9c6196c01..df91678614f 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/TargetChainTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/TargetChainTest.java @@ -19,10 +19,10 @@ import org.eclipse.rdf4j.sail.shacl.ast.constraintcomponents.OrConstraintComponent; import org.junit.jupiter.api.Test; -public class TargetChainTest { +class TargetChainTest { @Test - public void testTargetChain() throws IOException, InterruptedException { + void testTargetChain() throws IOException, InterruptedException { ShaclSail shaclSail = Utils.getInitializedShaclSail("shaclExactly.trig"); List shapes = shaclSail.getCachedShapes().getDataAndRelease(); @@ -31,7 +31,7 @@ public void testTargetChain() throws IOException, InterruptedException { } @Test - public void testTargetChainOr() throws IOException, InterruptedException { + void testTargetChainOr() throws IOException, InterruptedException { ShaclSail shaclSail = Utils.getInitializedShaclSail("test-cases/or/maxCount/shacl.trig"); List shapes = shaclSail.getCachedShapes().getDataAndRelease(); diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/PathTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/PathTest.java index 323216ce410..9fca94c4175 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/PathTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/PathTest.java @@ -11,6 +11,8 @@ package org.eclipse.rdf4j.sail.shacl.ast.paths; +import static org.junit.jupiter.api.Assertions.assertTrue; + import java.io.IOException; import java.io.StringReader; import java.util.HashSet; @@ -30,13 +32,12 @@ import org.eclipse.rdf4j.rio.helpers.BasicWriterSettings; import org.eclipse.rdf4j.sail.memory.MemoryStore; import org.eclipse.rdf4j.sail.shacl.wrapper.shape.RepositoryConnectionShapeSource; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class PathTest { +class PathTest { @Test - public void simplePath() throws IOException { + void simplePath() throws IOException { String pathString = "ex:1 sh:path ex:hasChild."; @@ -45,7 +46,7 @@ public void simplePath() throws IOException { } @Test - public void inversePath() throws IOException { + void inversePath() throws IOException { String pathString = "ex:1 sh:path [sh:inversePath ex:childOf]."; @@ -54,7 +55,7 @@ public void inversePath() throws IOException { } @Test - public void alternativePath() throws IOException { + void alternativePath() throws IOException { String pathString = "ex:1 sh:path [sh:alternativePath (ex:hasChild ex:child)]."; @@ -63,7 +64,7 @@ public void alternativePath() throws IOException { } @Test - public void sequencePath() throws IOException { + void sequencePath() throws IOException { String pathString = "ex:1 sh:path (ex:hasChild ex:hasChild) ."; @@ -72,7 +73,7 @@ public void sequencePath() throws IOException { } @Test - public void nestedSequencePath() throws IOException { + void nestedSequencePath() throws IOException { String pathString = "ex:1 sh:path (ex:hasChild (ex:hasChild (((ex:hasChild ex:hasChild) (ex:hasChild ex:hasChild)) ex:hasChild))) ."; @@ -81,7 +82,7 @@ public void nestedSequencePath() throws IOException { } @Test - public void zeroOrMorePath() throws IOException { + void zeroOrMorePath() throws IOException { String pathString = "ex:1 sh:path [sh:zeroOrMorePath ex:hasChild]."; @@ -90,7 +91,7 @@ public void zeroOrMorePath() throws IOException { } @Test - public void oneOrMorePath() throws IOException { + void oneOrMorePath() throws IOException { String pathString = "ex:1 sh:path [sh:oneOrMorePath ex:hasChild]."; @@ -99,7 +100,7 @@ public void oneOrMorePath() throws IOException { } @Test - public void zeroOrOnePath() throws IOException { + void zeroOrOnePath() throws IOException { String pathString = "ex:1 sh:path [sh:zeroOrOnePath ex:hasChild]."; @@ -108,7 +109,7 @@ public void zeroOrOnePath() throws IOException { } @Test - public void combination() throws IOException { + void combination() throws IOException { String pathString = "ex:1 sh:path (ex:hasChild [sh:inversePath ex:childOf] [sh:zeroOrMorePath ex:hasChild])."; @@ -117,7 +118,7 @@ public void combination() throws IOException { } @Test - public void combination2() throws IOException { + void combination2() throws IOException { String pathString = "ex:1 sh:path [sh:inversePath (sh:childOf sh:childOf)]."; @@ -126,7 +127,7 @@ public void combination2() throws IOException { } @Test - public void combination3() throws IOException { + void combination3() throws IOException { String pathString = "ex:1 sh:path [sh:zeroOrMorePath [sh:inversePath ex:childOf]]."; @@ -162,7 +163,7 @@ private void testPath(String pathString) throws IOException { } - Assertions.assertTrue(Models.isomorphic(actual, expected)); + assertTrue(Models.isomorphic(actual, expected)); } private DynamicModel convertToPathAndBackToModel(Model expected) { diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/SparqlPathStringTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/SparqlPathStringTest.java index 0906f15fa47..8452defbf1b 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/SparqlPathStringTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/paths/SparqlPathStringTest.java @@ -17,7 +17,7 @@ import org.eclipse.rdf4j.model.IRI; import org.eclipse.rdf4j.model.util.Values; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class SparqlPathStringTest { @@ -27,37 +27,37 @@ public class SparqlPathStringTest { public static final IRI PREDICATE3 = Values.iri("http://example.com/predicate3"); @Test - public void simplePath() { + void simplePath() { Path path = new SimplePath(PREDICATE); assertEquals("", path.toSparqlPathString()); } @Test - public void inversePath() { + void inversePath() { Path path = new InversePath(null, new SimplePath(PREDICATE)); assertEquals("^", path.toSparqlPathString()); } @Test - public void oneOrMorePath() { + void oneOrMorePath() { Path path = new OneOrMorePath(null, new SimplePath(PREDICATE)); assertEquals("+", path.toSparqlPathString()); } @Test - public void zeroOrMore() { + void zeroOrMore() { Path path = new ZeroOrMorePath(null, new SimplePath(PREDICATE)); assertEquals("*", path.toSparqlPathString()); } @Test - public void zeroOrOne() { + void zeroOrOne() { Path path = new ZeroOrOnePath(null, new SimplePath(PREDICATE)); assertEquals("?", path.toSparqlPathString()); } @Test - public void sequencePath() { + void sequencePath() { Path path = new SequencePath(null, List.of(new SimplePath(PREDICATE1), new SimplePath(PREDICATE2), new SimplePath(PREDICATE3))); assertEquals( @@ -66,7 +66,7 @@ public void sequencePath() { } @Test - public void alternativePath() { + void alternativePath() { Path path = new AlternativePath(null, null, List.of(new SimplePath(PREDICATE1), new SimplePath(PREDICATE2), new SimplePath(PREDICATE3))); assertEquals( @@ -75,7 +75,7 @@ public void alternativePath() { } @Test - public void complexPath() { + void complexPath() { Path path = new AlternativePath(null, null, List.of(new SimplePath(PREDICATE1), new SimplePath(PREDICATE2), new SimplePath(PREDICATE3))); path = new SequencePath(null, diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ValidationTupleTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ValidationTupleTest.java index f79d49c9759..b1c3f941606 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ValidationTupleTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/planNodes/ValidationTupleTest.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.rdf4j.sail.shacl.ast.planNodes; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.util.ArrayList; import java.util.Arrays; @@ -17,14 +19,13 @@ import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.model.vocabulary.RDF; import org.eclipse.rdf4j.sail.shacl.ast.constraintcomponents.ConstraintComponent; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class ValidationTupleTest { public static final Resource[] CONTEXTS = { null }; @Test - public void testEqualsAndHashCode() { + void testEqualsAndHashCode() { ValidationTuple abc = new ValidationTuple( new ArrayList<>( @@ -36,8 +37,8 @@ public void testEqualsAndHashCode() { Arrays.asList(RDF.TYPE, RDF.HTML, SimpleValueFactory.getInstance().createLiteral("abc"))), ConstraintComponent.Scope.nodeShape, false, CONTEXTS); - Assertions.assertEquals(abc, abc1); - Assertions.assertEquals(abc.hashCode(), abc1.hashCode()); + assertEquals(abc, abc1); + assertEquals(abc.hashCode(), abc1.hashCode()); } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/targets/StableQueryGenerationTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/targets/StableQueryGenerationTest.java index e4f68e5b36c..79d14b823e5 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/targets/StableQueryGenerationTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/ast/targets/StableQueryGenerationTest.java @@ -25,10 +25,10 @@ import org.eclipse.rdf4j.sail.shacl.ast.StatementMatcher; import org.junit.jupiter.api.Test; -public class StableQueryGenerationTest { +class StableQueryGenerationTest { @Test - public void testTargetClass() { + void testTargetClass() { List collect = Arrays.asList(Values.iri("http://b"), Values.iri("http://a"), Values.iri("http://c")); @@ -55,7 +55,7 @@ public void testTargetClass() { } @Test - public void testNormalizationOfQuery() { + void testNormalizationOfQuery() { StatementMatcher.StableRandomVariableProvider stableRandomVariableProvider = new StatementMatcher.StableRandomVariableProvider(); String[] names = { stableRandomVariableProvider.next().getName(), diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/benchmark/BenchmarkIT.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/benchmark/BenchmarkIT.java index d8c8769bf4c..4b1ee6948ad 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/benchmark/BenchmarkIT.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/benchmark/BenchmarkIT.java @@ -28,10 +28,10 @@ */ @Tag("slow") @Isolated -public class BenchmarkIT { +class BenchmarkIT { @Test - public void test() throws RunnerException { + void test() throws RunnerException { Options opt = new OptionsBuilder() .include("") .exclude(ComplexLargeBenchmark.class.getSimpleName()) diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/config/ShaclSailConfigTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/config/ShaclSailConfigTest.java index 60e4c2cdd79..4d89bf44a49 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/config/ShaclSailConfigTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/config/ShaclSailConfigTest.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Set; @@ -26,7 +27,6 @@ import org.eclipse.rdf4j.model.vocabulary.CONFIG; import org.eclipse.rdf4j.model.vocabulary.RDF4J; import org.eclipse.rdf4j.sail.config.SailConfigException; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class ShaclSailConfigTest { @@ -34,7 +34,7 @@ public class ShaclSailConfigTest { public static final SimpleValueFactory vf = SimpleValueFactory.getInstance(); @Test - public void defaultsCorrectlySet() { + void defaultsCorrectlySet() { ShaclSailConfig shaclSailConfig = new ShaclSailConfig(); assertThat(shaclSailConfig.isParallelValidation()).isTrue(); assertThat(shaclSailConfig.isLogValidationPlans()).isFalse(); @@ -55,7 +55,7 @@ public void defaultsCorrectlySet() { } @Test - public void parseFromModelSetValuesCorrectly() { + void parseFromModelSetValuesCorrectly() { ShaclSailConfig shaclSailConfig = new ShaclSailConfig(); BNode implNode = vf.createBNode(); @@ -103,7 +103,7 @@ public void parseFromModelSetValuesCorrectly() { } @Test - public void parseFromPartialModelSetValuesCorrectly() { + void parseFromPartialModelSetValuesCorrectly() { ShaclSailConfig shaclSailConfig = new ShaclSailConfig(); BNode implNode = SimpleValueFactory.getInstance().createBNode(); ModelBuilder mb = new ModelBuilder().subject(implNode); @@ -117,7 +117,7 @@ public void parseFromPartialModelSetValuesCorrectly() { } @Test - public void parseInvalidModelGivesCorrectException() { + void parseInvalidModelGivesCorrectException() { ShaclSailConfig shaclSailConfig = new ShaclSailConfig(); BNode implNode = SimpleValueFactory.getInstance().createBNode(); ModelBuilder mb = new ModelBuilder().subject(implNode); @@ -130,7 +130,7 @@ public void parseInvalidModelGivesCorrectException() { } @Test - public void parseInvalidModelGivesCorrectExceptionBnode() { + void parseInvalidModelGivesCorrectExceptionBnode() { ShaclSailConfig shaclSailConfig = new ShaclSailConfig(); BNode implNode = SimpleValueFactory.getInstance().createBNode(); ModelBuilder mb = new ModelBuilder().subject(implNode); @@ -143,26 +143,26 @@ public void parseInvalidModelGivesCorrectExceptionBnode() { } @Test - public void exportAddsAllConfigData() { + void exportAddsAllConfigData() { ShaclSailConfig shaclSailConfig = new ShaclSailConfig(); Model m = new TreeModel(); Resource node = shaclSailConfig.export(m); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.parallelValidation, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.logValidationPlans, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.logValidationViolations, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.validationEnabled, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.cacheSelectNodes, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.globalLogValidationExecution, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.rdfsSubClassReasoning, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.performanceLogging, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.serializableValidation, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.eclipseRdf4jShaclExtensions, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.dashDataShapes, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.validationResultsLimitTotal, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.validationResultsLimitPerConstraint, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.transactionalValidationLimit, null)); - Assertions.assertTrue(m.contains(node, CONFIG.Shacl.shapesGraph, null)); + assertTrue(m.contains(node, CONFIG.Shacl.parallelValidation, null)); + assertTrue(m.contains(node, CONFIG.Shacl.logValidationPlans, null)); + assertTrue(m.contains(node, CONFIG.Shacl.logValidationViolations, null)); + assertTrue(m.contains(node, CONFIG.Shacl.validationEnabled, null)); + assertTrue(m.contains(node, CONFIG.Shacl.cacheSelectNodes, null)); + assertTrue(m.contains(node, CONFIG.Shacl.globalLogValidationExecution, null)); + assertTrue(m.contains(node, CONFIG.Shacl.rdfsSubClassReasoning, null)); + assertTrue(m.contains(node, CONFIG.Shacl.performanceLogging, null)); + assertTrue(m.contains(node, CONFIG.Shacl.serializableValidation, null)); + assertTrue(m.contains(node, CONFIG.Shacl.eclipseRdf4jShaclExtensions, null)); + assertTrue(m.contains(node, CONFIG.Shacl.dashDataShapes, null)); + assertTrue(m.contains(node, CONFIG.Shacl.validationResultsLimitTotal, null)); + assertTrue(m.contains(node, CONFIG.Shacl.validationResultsLimitPerConstraint, null)); + assertTrue(m.contains(node, CONFIG.Shacl.transactionalValidationLimit, null)); + assertTrue(m.contains(node, CONFIG.Shacl.shapesGraph, null)); } diff --git a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/config/ShaclSailFactoryTest.java b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/config/ShaclSailFactoryTest.java index e49aa9ef95d..0d997b91a71 100644 --- a/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/config/ShaclSailFactoryTest.java +++ b/core/sail/shacl/src/test/java/org/eclipse/rdf4j/sail/shacl/config/ShaclSailFactoryTest.java @@ -31,10 +31,10 @@ * * @author Jeen Broekstra */ -public class ShaclSailFactoryTest { +class ShaclSailFactoryTest { @Test - public void getSailTypeReturnsCorrectValue() { + void getSailTypeReturnsCorrectValue() { ShaclSailFactory subject = new ShaclSailFactory(); assertThat(subject.getSailType()).isEqualTo(ShaclSailFactory.SAIL_TYPE); } @@ -43,7 +43,7 @@ public void getSailTypeReturnsCorrectValue() { * Verify that the created sail is configured according to the supplied default configuration. */ @Test - public void getSailWithDefaultConfigSetsConfigurationCorrectly() { + void getSailWithDefaultConfigSetsConfigurationCorrectly() { ShaclSailFactory subject = new ShaclSailFactory(); ShaclSailConfig config = new ShaclSailConfig(); @@ -60,7 +60,7 @@ public void getSailWithDefaultConfigSetsConfigurationCorrectly() { * Verify that the created sail is configured according to the supplied default configuration. */ @Test - public void serializableValidationLimitedBySupportIsolationLevelsTest() { + void serializableValidationLimitedBySupportIsolationLevelsTest() { ShaclSailFactory subject = new ShaclSailFactory(); ShaclSailConfig config = new ShaclSailConfig(); @@ -112,7 +112,7 @@ public List getSupportedIsolationLevels() { * Verify that the created sail is configured according to the supplied customized configuration. */ @Test - public void getSailWithCustomConfigSetsConfigurationCorrectly() { + void getSailWithCustomConfigSetsConfigurationCorrectly() { ShaclSailFactory subject = new ShaclSailFactory(); ShaclSailConfig config = new ShaclSailConfig(); diff --git a/core/sparqlbuilder/pom.xml b/core/sparqlbuilder/pom.xml index 3e614ba68eb..539ef5f1ca1 100644 --- a/core/sparqlbuilder/pom.xml +++ b/core/sparqlbuilder/pom.xml @@ -21,6 +21,11 @@ 1.3 test + + org.junit.jupiter + junit-jupiter + test + org.assertj assertj-core diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/constraint/ExpressionsTest.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/constraint/ExpressionsTest.java index 0db2d594e23..60241daaa6f 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/constraint/ExpressionsTest.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/constraint/ExpressionsTest.java @@ -20,51 +20,51 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf; import org.junit.jupiter.api.Test; -public class ExpressionsTest { +class ExpressionsTest { @Test - public void bnodeProducesProperQueryString() { + void bnodeProducesProperQueryString() { Expression expression = Expressions.bnode("name"); assertEquals("BNODE( \"name\" )", expression.getQueryString()); } @Test - public void bnodeNoArgumentProducesProperQueryString() { + void bnodeNoArgumentProducesProperQueryString() { Expression expression = Expressions.bnode(); assertEquals("BNODE()", expression.getQueryString()); } @Test - public void testLogicalExpression() { + void testLogicalExpression() { Expression expression = Expressions.or(Expressions.lt(Rdf.literalOf(30), Rdf.literalOf(20)), Expressions.and(Expressions.gt(Rdf.literalOf(30), Rdf.literalOf(50)), Expressions.or(Expressions.gt(Rdf.literalOf(30), Rdf.literalOf(60)), Expressions.lt(Rdf.literalOf(30), Rdf.literalOf(70))))); - assertEquals(expression.getQueryString(), "( 30 < 20 || ( 30 > 50 && ( 30 > 60 || 30 < 70 ) ) )"); + assertEquals("( 30 < 20 || ( 30 > 50 && ( 30 > 60 || 30 < 70 ) ) )", expression.getQueryString()); } @Test - public void testArithmeticExpression() { + void testArithmeticExpression() { Expression expression = Expressions.lt(Rdf.literalOf(30), Expressions.subtract( Expressions.divide(Rdf.literalOf(100), Rdf.literalOf(20)), Expressions.multiply(Rdf.literalOf(2), Expressions.add(Rdf.literalOf(5), Rdf.literalOf(3))))); - assertEquals(expression.getQueryString(), "30 < ( ( 100 / 20 ) - ( 2 * ( 5 + 3 ) ) )"); + assertEquals("30 < ( ( 100 / 20 ) - ( 2 * ( 5 + 3 ) ) )", expression.getQueryString()); } @Test - public void testArithmeticAndLogicalExpression() { + void testArithmeticAndLogicalExpression() { Expression expression = Expressions.or(Expressions.lt(Rdf.literalOf(30), Expressions.add(Rdf.literalOf(20), Expressions.divide(Rdf.literalOf(10), Rdf.literalOf(5)))), Expressions.lt(Rdf.literalOf(30), Rdf.literalOf(50))); - assertEquals(expression.getQueryString(), "( 30 < ( 20 + ( 10 / 5 ) ) || 30 < 50 )"); + assertEquals("( 30 < ( 20 + ( 10 / 5 ) ) || 30 < 50 )", expression.getQueryString()); } @Test - public void test_BIND_fromOtherVariable() { + void test_BIND_fromOtherVariable() { Variable from = SparqlBuilder.var("from"); Variable to = SparqlBuilder.var("to"); assertEquals( @@ -72,7 +72,7 @@ public void test_BIND_fromOtherVariable() { } @Test - public void test_NOT_IN_twoIris() { + void test_NOT_IN_twoIris() { Variable test = SparqlBuilder.var("test"); assertEquals( "?test NOT IN ( , )", @@ -81,7 +81,7 @@ public void test_NOT_IN_twoIris() { } @Test - public void test_IS_BLANK() { + void test_IS_BLANK() { Variable test = SparqlBuilder.var("test"); assertEquals( "isBLANK( ?test )", Expressions.isBlank(test).getQueryString()); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/constraint/propertypath/builder/PropertyPathTest.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/constraint/propertypath/builder/PropertyPathTest.java index c4daae6e33c..5d3e9f647fc 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/constraint/propertypath/builder/PropertyPathTest.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/constraint/propertypath/builder/PropertyPathTest.java @@ -23,21 +23,21 @@ import org.eclipse.rdf4j.sparqlbuilder.graphpattern.TriplePattern; import org.junit.jupiter.api.Test; -public class PropertyPathTest { +class PropertyPathTest { @Test - public void testEmptyPropertyPathBuilderFromExpressions() { + void testEmptyPropertyPathBuilderFromExpressions() { PropertyPath p = PropertyPaths.path().pred(iri(RDFS.LABEL)).build(); assertEquals("<" + RDFS.LABEL + ">", p.getQueryString()); } @Test - public void testPredPropertyPathBuilderFromExpressions() { + void testPredPropertyPathBuilderFromExpressions() { PropertyPath p = PropertyPaths.path(iri(RDFS.LABEL)).build(); assertEquals("<" + RDFS.LABEL + ">", p.getQueryString()); } @Test - public void testAlt() { + void testAlt() { PropertyPath p = PropertyPaths .path() .pred(iri(RDFS.LABEL)) @@ -47,7 +47,7 @@ public void testAlt() { } @Test - public void testAltWithSubBuilder() { + void testAltWithSubBuilder() { PropertyPath p = PropertyPaths .path() .pred(iri(RDFS.LABEL)) @@ -57,7 +57,7 @@ public void testAltWithSubBuilder() { } @Test - public void testAltWithSubPath() { + void testAltWithSubPath() { PropertyPath p = PropertyPaths .path() .pred(iri(RDFS.LABEL)) @@ -67,7 +67,7 @@ public void testAltWithSubPath() { } @Test - public void testSeq() { + void testSeq() { PropertyPath p = PropertyPaths .path() .pred(iri(RDFS.SUBCLASSOF)) @@ -77,7 +77,7 @@ public void testSeq() { } @Test - public void testSeqWithSubBuilder() { + void testSeqWithSubBuilder() { PropertyPath p = PropertyPaths .path() .pred(iri(RDFS.SUBCLASSOF)) @@ -87,7 +87,7 @@ public void testSeqWithSubBuilder() { } @Test - public void testSeqWithSubPath() { + void testSeqWithSubPath() { PropertyPath p = PropertyPaths .path() .pred(iri(RDFS.SUBCLASSOF)) @@ -97,7 +97,7 @@ public void testSeqWithSubPath() { } @Test - public void testSeqWithSubAltPath() { + void testSeqWithSubAltPath() { PropertyPath p = PropertyPaths .path() .pred(iri(RDFS.SUBCLASSOF)) @@ -108,7 +108,7 @@ public void testSeqWithSubAltPath() { } @Test - public void testGroupedPath() { + void testGroupedPath() { PropertyPath p = PropertyPaths .path(iri(RDFS.COMMENT)) .group() @@ -117,7 +117,7 @@ public void testGroupedPath() { } @Test - public void testInversePath() { + void testInversePath() { PropertyPath p = PropertyPaths .path(iri(RDFS.COMMENT)) .inv() @@ -126,7 +126,7 @@ public void testInversePath() { } @Test - public void testOneOrMorePath() { + void testOneOrMorePath() { PropertyPath p = PropertyPaths .path(iri(RDFS.COMMENT)) .oneOrMore() @@ -135,7 +135,7 @@ public void testOneOrMorePath() { } @Test - public void testZeroOrMorePath() { + void testZeroOrMorePath() { PropertyPath p = PropertyPaths .path(iri(RDFS.COMMENT)) .zeroOrMore() @@ -144,7 +144,7 @@ public void testZeroOrMorePath() { } @Test - public void testZeroOrOnePath() { + void testZeroOrOnePath() { PropertyPath p = PropertyPaths .path(iri(RDFS.COMMENT)) .zeroOrOne() @@ -153,7 +153,7 @@ public void testZeroOrOnePath() { } @Test - public void testNegatedPropertySetSingle() { + void testNegatedPropertySetSingle() { PropertyPath p = PropertyPaths .path() .negProp() @@ -163,7 +163,7 @@ public void testNegatedPropertySetSingle() { } @Test - public void testNegatedPropertySetSingleInverted() { + void testNegatedPropertySetSingleInverted() { PropertyPath p = PropertyPaths .path() .negProp() @@ -173,7 +173,7 @@ public void testNegatedPropertySetSingleInverted() { } @Test - public void testNegatedPropertySetMultipleInverted() { + void testNegatedPropertySetMultipleInverted() { PropertyPath p = PropertyPaths .path() .negProp() @@ -184,7 +184,7 @@ public void testNegatedPropertySetMultipleInverted() { } @Test - public void testNegatedPropertySetMultipleMixed() { + void testNegatedPropertySetMultipleMixed() { PropertyPath p = PropertyPaths .path() .negProp() @@ -198,7 +198,7 @@ public void testNegatedPropertySetMultipleMixed() { } @Test - public void testRdfSubjectHasPropertyPathRdfObject() { + void testRdfSubjectHasPropertyPathRdfObject() { Variable x = var("x"); TriplePattern tp = x.has(p -> p.pred(iri(FOAF.ACCOUNT)).then(iri(FOAF.MBOX)), toRdfLiteralArray("bob@example.com")); @@ -207,7 +207,7 @@ public void testRdfSubjectHasPropertyPathRdfObject() { } @Test - public void testRdfSubjectHasPropertyPathValue() { + void testRdfSubjectHasPropertyPathValue() { Variable x = var("x"); TriplePattern tp = x.has(p -> p.pred(iri(FOAF.ACCOUNT)).then(iri(FOAF.MBOX)), iri("mailto:bob@example.com")); assertEquals("?x " + iri(FOAF.ACCOUNT).getQueryString() + " / " + iri(FOAF.MBOX).getQueryString() @@ -215,7 +215,7 @@ public void testRdfSubjectHasPropertyPathValue() { } @Test - public void testRdfSubjectHasPropertyPathString() { + void testRdfSubjectHasPropertyPathString() { Variable x = var("x"); TriplePattern tp = x.has(p -> p.pred(iri(FOAF.ACCOUNT)).then(iri(FOAF.MBOX)), "bob@example.com"); assertEquals("?x " + iri(FOAF.ACCOUNT).getQueryString() + " / " + iri(FOAF.MBOX).getQueryString() @@ -223,7 +223,7 @@ public void testRdfSubjectHasPropertyPathString() { } @Test - public void testRdfSubjectHasPropertyPathNumber() { + void testRdfSubjectHasPropertyPathNumber() { Variable x = var("x"); TriplePattern tp = x.has(p -> p.pred(iri(FOAF.KNOWS)).then(iri(FOAF.AGE)), 20); assertEquals("?x " + iri(FOAF.KNOWS).getQueryString() + " / " + iri(FOAF.AGE).getQueryString() + " 20 .", @@ -231,7 +231,7 @@ public void testRdfSubjectHasPropertyPathNumber() { } @Test - public void testRdfSubjectHasPropertyPathBoolean() { + void testRdfSubjectHasPropertyPathBoolean() { Variable x = var("x"); TriplePattern tp = x.has(p -> p.pred(iri(FOAF.ACCOUNT)).then(iri("http://example.com/ns#premium")), true); assertEquals("?x " + iri(FOAF.ACCOUNT).getQueryString() + " / " diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/PrefixDeclarationsTest.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/PrefixDeclarationsTest.java index ea76c80c6aa..d9461f78fd1 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/PrefixDeclarationsTest.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/PrefixDeclarationsTest.java @@ -16,9 +16,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf; import org.junit.jupiter.api.Test; -public class PrefixDeclarationsTest { +class PrefixDeclarationsTest { @Test - public void testReplaceInQuery_nothing() { + void testReplaceInQuery_nothing() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals("nothing to replace", @@ -26,7 +26,7 @@ public void testReplaceInQuery_nothing() { } @Test - public void testReplaceInQuery_justTheNamespace() { + void testReplaceInQuery_justTheNamespace() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals("label: to replace", @@ -34,7 +34,7 @@ public void testReplaceInQuery_justTheNamespace() { } @Test - public void testReplaceInQuery_atStart() { + void testReplaceInQuery_atStart() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals("label:local to replace", @@ -42,7 +42,7 @@ public void testReplaceInQuery_atStart() { } @Test - public void testReplaceInQuery_atEnd() { + void testReplaceInQuery_atEnd() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals("replace label:local", @@ -50,7 +50,7 @@ public void testReplaceInQuery_atEnd() { } @Test - public void testReplaceInQuery_middle() { + void testReplaceInQuery_middle() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals("replace label:local in the middle", @@ -58,7 +58,7 @@ public void testReplaceInQuery_middle() { } @Test - public void testReplaceInQuery_middle_with_angled_brackets() { + void testReplaceInQuery_middle_with_angled_brackets() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals(" the middle", @@ -66,7 +66,7 @@ public void testReplaceInQuery_middle_with_angled_brackets() { } @Test - public void testReplaceInQuery_multiple_long_shared_substring() { + void testReplaceInQuery_multiple_long_shared_substring() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); pd.addPrefix(new Prefix("label2", Rdf.iri("http://example.org/ns2#"))); @@ -76,7 +76,7 @@ public void testReplaceInQuery_multiple_long_shared_substring() { } @Test - public void testReplaceInQuery_do_not_replace_in_string() { + void testReplaceInQuery_do_not_replace_in_string() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals( @@ -86,7 +86,7 @@ public void testReplaceInQuery_do_not_replace_in_string() { } @Test - public void testReplaceInQuery_do_not_replace_in_string_enclosed_with_multiline_quotes() { + void testReplaceInQuery_do_not_replace_in_string_enclosed_with_multiline_quotes() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals( @@ -96,7 +96,7 @@ public void testReplaceInQuery_do_not_replace_in_string_enclosed_with_multiline_ } @Test - public void testReplaceInQuery_do_not_replace_in_string_enclosed_with_escaped_double_quotes() { + void testReplaceInQuery_do_not_replace_in_string_enclosed_with_escaped_double_quotes() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals( @@ -106,7 +106,7 @@ public void testReplaceInQuery_do_not_replace_in_string_enclosed_with_escaped_do } @Test - public void testReplaceInQuery_do_not_replace_in_multiline_string() { + void testReplaceInQuery_do_not_replace_in_multiline_string() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals( @@ -116,7 +116,7 @@ public void testReplaceInQuery_do_not_replace_in_multiline_string() { } @Test - public void testReplaceInQuery_do_not_replace_in_multiline_string_with_nested_quotes() { + void testReplaceInQuery_do_not_replace_in_multiline_string_with_nested_quotes() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals( @@ -126,7 +126,7 @@ public void testReplaceInQuery_do_not_replace_in_multiline_string_with_nested_qu } @Test - public void testReplaceInQuery_do_not_replace_in_multiline_string_enclosed_with_double_quotes() { + void testReplaceInQuery_do_not_replace_in_multiline_string_enclosed_with_double_quotes() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals( @@ -136,7 +136,7 @@ public void testReplaceInQuery_do_not_replace_in_multiline_string_enclosed_with_ } @Test - public void testReplaceInQuery_do_not_replace_in_multiline_string_enclosed_with_escaped_double_quotes() { + void testReplaceInQuery_do_not_replace_in_multiline_string_enclosed_with_escaped_double_quotes() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals( @@ -146,7 +146,7 @@ public void testReplaceInQuery_do_not_replace_in_multiline_string_enclosed_with_ } @Test - public void testReplaceInQuery_do_not_replace_if_continuation_is_not_localname() { + void testReplaceInQuery_do_not_replace_if_continuation_is_not_localname() { PrefixDeclarations pd = new PrefixDeclarations(); pd.addPrefix(new Prefix("label", Rdf.iri("http://example.org/ns#"))); assertEquals( diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/SparqlBuilderTest.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/SparqlBuilderTest.java index 00fa66e7dcc..5f284e81046 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/SparqlBuilderTest.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/SparqlBuilderTest.java @@ -27,19 +27,19 @@ /** * Tests for precedence order of all operators in SPARQL builder Queries. */ -public class SparqlBuilderTest { +class SparqlBuilderTest { protected SelectQuery query; protected static final String EXAMPLE_ORG_NS = "https://example.org/ns#"; protected static final String DC_NS = DC.NAMESPACE; @BeforeEach - public void before() { + void before() { query = Queries.SELECT(); } @Test - public void testLogicalOperatorPrecedence1() { + void testLogicalOperatorPrecedence1() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = SparqlBuilder.var("title"), price = SparqlBuilder.var("price"), x = SparqlBuilder.var("x"); @@ -54,7 +54,7 @@ public void testLogicalOperatorPrecedence1() { } @Test - public void testLogicalOperatorPrecedence2() { + void testLogicalOperatorPrecedence2() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = SparqlBuilder.var("title"), price = SparqlBuilder.var("price"), x = SparqlBuilder.var("x"); @@ -71,7 +71,7 @@ public void testLogicalOperatorPrecedence2() { } @Test - public void testArithmeticOperatorPrecedence1() { + void testArithmeticOperatorPrecedence1() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = SparqlBuilder.var("title"), price = SparqlBuilder.var("price"), x = SparqlBuilder.var("x"); @@ -87,7 +87,7 @@ public void testArithmeticOperatorPrecedence1() { } @Test - public void testArithmeticOperatorPrecedence2() { + void testArithmeticOperatorPrecedence2() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = SparqlBuilder.var("title"), price = SparqlBuilder.var("price"), x = SparqlBuilder.var("x"); @@ -103,7 +103,7 @@ public void testArithmeticOperatorPrecedence2() { } @Test - public void testArithmeticOperatorPrecedence3() { + void testArithmeticOperatorPrecedence3() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = SparqlBuilder.var("title"), price = SparqlBuilder.var("price"), x = SparqlBuilder.var("x"); @@ -118,7 +118,7 @@ public void testArithmeticOperatorPrecedence3() { } @Test - public void testArithmeticLogicalOperatorPrecedence1() { + void testArithmeticLogicalOperatorPrecedence1() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = SparqlBuilder.var("title"), price = SparqlBuilder.var("price"), x = SparqlBuilder.var("x"); @@ -134,7 +134,7 @@ public void testArithmeticLogicalOperatorPrecedence1() { } @Test - public void testMultipleFilters() { + void testMultipleFilters() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = SparqlBuilder.var("title"), price = SparqlBuilder.var("price"), x = SparqlBuilder.var("x"); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/query/ModifyQueryTest.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/query/ModifyQueryTest.java index fe272f7bf54..8d5a4e820fc 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/query/ModifyQueryTest.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/query/ModifyQueryTest.java @@ -22,7 +22,7 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Iri; import org.junit.jupiter.api.Test; -public class ModifyQueryTest extends BaseExamples { +class ModifyQueryTest extends BaseExamples { /** * DELETE { GRAPH ?g1 { ?subject ?object . ?subject ?predicate @@ -30,7 +30,7 @@ public class ModifyQueryTest extends BaseExamples { * . } OPTIONAL { ?subject ?object . } } } */ @Test - public void example_issue_1481() { + void example_issue_1481() { ModifyQuery modify = Queries.MODIFY(); Iri g1 = () -> ""; diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/query/QueryWithPrefixesTest.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/query/QueryWithPrefixesTest.java index 38bd00961b7..1ee1bb97322 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/query/QueryWithPrefixesTest.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/core/query/QueryWithPrefixesTest.java @@ -24,9 +24,9 @@ import org.eclipse.rdf4j.sparqlbuilder.examples.BaseExamples; import org.junit.jupiter.api.Test; -public class QueryWithPrefixesTest extends BaseExamples { +class QueryWithPrefixesTest extends BaseExamples { @Test - public void testSelectQuery1Prefix() { + void testSelectQuery1Prefix() { Variable x = var("x"), name = var("name"); query = Queries .SELECT(name) @@ -40,7 +40,7 @@ public void testSelectQuery1Prefix() { } @Test - public void testSelectQuery2Prefixes() { + void testSelectQuery2Prefixes() { Variable x = var("x"), name = var("name"); query = Queries .SELECT(name) @@ -57,7 +57,7 @@ public void testSelectQuery2Prefixes() { } @Test - public void testInsertQuery1Prefix() { + void testInsertQuery1Prefix() { Variable x = var("x"), name = var("name"); ModifyQuery modifyQuery = Queries .INSERT(x.has(FOAF.NAME, name)) @@ -71,7 +71,7 @@ public void testInsertQuery1Prefix() { } @Test - public void testInsertQuery2Prefixes() { + void testInsertQuery2Prefixes() { Variable x = var("x"), name = var("name"); ModifyQuery modifyQuery = Queries .INSERT(x.has(FOAF.NAME, name)) @@ -88,7 +88,7 @@ public void testInsertQuery2Prefixes() { } @Test - public void testSelectQueryWithPropertyPath2Prefixes() { + void testSelectQueryWithPropertyPath2Prefixes() { Variable x = var("x"), name = var("name"); query = Queries .SELECT(name) @@ -102,7 +102,7 @@ public void testSelectQueryWithPropertyPath2Prefixes() { } @Test - public void testSelectQuery1PrefixWithAngledBracket() { + void testSelectQuery1PrefixWithAngledBracket() { Variable x = var("x"), name = var("name"); query = Queries .SELECT(name) diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/BaseExamples.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/BaseExamples.java index 69c22345e30..8d33a5d0bee 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/BaseExamples.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/BaseExamples.java @@ -51,7 +51,7 @@ public class BaseExamples { protected SelectQuery query; @BeforeEach - public void before() { + void before() { resetQuery(); } diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section11Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section11Test.java index cb91a1be4a8..d3e5c7f5763 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section11Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section11Test.java @@ -26,9 +26,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf; import org.junit.jupiter.api.Test; -public class Section11Test extends BaseExamples { +class Section11Test extends BaseExamples { @Test - public void example_11_1() { + void example_11_1() { Prefix base = SparqlBuilder.prefix(iri("http://books.example/")); Variable lprice = SparqlBuilder.var("lprice"), totalPrice = SparqlBuilder.var("totalPrice"); @@ -56,7 +56,7 @@ public void example_11_1() { } @Test - public void example_11_1_model() { + void example_11_1_model() { String ex = EXAMPLE_ORG_BOOK_NS; IRI affiliates = VF.createIRI(ex, "affiliates"); IRI writesBook = VF.createIRI(ex, "writesBook"); @@ -89,7 +89,7 @@ public void example_11_1_model() { } @Test - public void example_11_2() { + void example_11_2() { Prefix base = SparqlBuilder.prefix((Iri) null); Variable y = SparqlBuilder.var("y"), avg = SparqlBuilder.var("avg"), a = SparqlBuilder.var("a"), x = SparqlBuilder.var("x"); @@ -107,7 +107,7 @@ public void example_11_2() { } @Test - public void example_11_3() { + void example_11_3() { Prefix base = SparqlBuilder.prefix(iri("http://data.example/")); Variable size = SparqlBuilder.var("size"), asize = SparqlBuilder.var("asize"), x = SparqlBuilder.var("x"); Expression avgSize = Expressions.avg(size); @@ -128,7 +128,7 @@ public void example_11_3() { } @Test - public void example_11_4() { + void example_11_4() { Prefix base = SparqlBuilder.prefix(iri("http://example.com/data/#")); Variable x = SparqlBuilder.var("x"), y = SparqlBuilder.var("y"), z = SparqlBuilder.var("z"), min = SparqlBuilder.var("min"); @@ -148,7 +148,7 @@ public void example_11_4() { } @Test - public void example_11_5() { + void example_11_5() { Prefix base = SparqlBuilder.prefix(iri("http://example.com/data/#")); Variable g = SparqlBuilder.var("g"), p = SparqlBuilder.var("p"), avg = SparqlBuilder.var("avg"), c = SparqlBuilder.var("c"); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section12Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section12Test.java index 7942f8cfa0d..a571b2cd5f9 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section12Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section12Test.java @@ -23,9 +23,9 @@ import org.eclipse.rdf4j.sparqlbuilder.graphpattern.SubSelect; import org.junit.jupiter.api.Test; -public class Section12Test extends BaseExamples { +class Section12Test extends BaseExamples { @Test - public void example_12() { + void example_12() { Prefix base = SparqlBuilder.prefix(iri("http://people.example/")); // using this method of variable creation, as ?y and ?minName will be diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section13Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section13Test.java index a3a1298b00e..e99bd1abc9b 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section13Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section13Test.java @@ -25,9 +25,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Iri; import org.junit.jupiter.api.Test; -public class Section13Test extends BaseExamples { +class Section13Test extends BaseExamples { @Test - public void example_13_2_1() { + void example_13_2_1() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable name = var("name"); Variable x = var("x"); @@ -41,7 +41,7 @@ public void example_13_2_1() { } @Test - public void example_13_2_2() { + void example_13_2_2() { Dataset dataset = SparqlBuilder.dataset(SparqlBuilder.fromNamed(iri("http://example.org/alice")), SparqlBuilder.fromNamed(iri("http://example.org/bob"))); assertThat(dataset.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace("" @@ -50,7 +50,7 @@ public void example_13_2_2() { } @Test - public void example_13_2_3() { + void example_13_2_3() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)); From defaultGraph = SparqlBuilder.from(iri("http://example.org/dft.ttl")); @@ -81,7 +81,7 @@ public void example_13_2_3() { } @Test - public void example_13_3_1() { + void example_13_3_1() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable src = var("src"), bobNick = var("bobNick"), x = var("x"); // TODO: still need to bracket GGP's that aren't explicitly GGP instances, @@ -110,7 +110,7 @@ public void example_13_3_1() { } @Test - public void example_13_3_2() { + void example_13_3_2() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Prefix data = SparqlBuilder.prefix("data", iri("http://example.org/foaf/")); Variable x = var("x"), nick = var("nick"); @@ -139,7 +139,7 @@ public void example_13_3_2() { } @Test - public void example_13_3_3() { + void example_13_3_3() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Prefix data = SparqlBuilder.prefix("data", iri("http://example.org/foaf/")); Prefix rdfs = SparqlBuilder.prefix("rdfs", iri("http://www.w3.org/2000/01/rdf-schema#")); @@ -188,7 +188,7 @@ public void example_13_3_3() { } @Test - public void example_13_3_4() { + void example_13_3_4() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)); Variable name = var("name"), diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section15Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section15Test.java index d21b9e05faa..3e965cc379f 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section15Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section15Test.java @@ -25,9 +25,9 @@ import org.eclipse.rdf4j.sparqlbuilder.graphpattern.TriplePattern; import org.junit.jupiter.api.Test; -public class Section15Test extends BaseExamples { +class Section15Test extends BaseExamples { @Test - public void example_15_1() { + void example_15_1() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable name = var("name"), x = var("x"); @@ -81,7 +81,7 @@ public void example_15_1() { } @Test - public void example_15_3_1() { + void example_15_3_1() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable name = var("name"), x = var("x"); @@ -93,12 +93,12 @@ public void example_15_3_1() { } @Test - public void example_15_3_2() { + void example_15_3_2() { System.err.println("REDUCED not yet implemented"); } @Test - public void example_15_4() { + void example_15_4() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable name = var("name"), x = var("x"); @@ -115,7 +115,7 @@ public void example_15_4() { } @Test - public void example_15_5() { + void example_15_5() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable name = var("name"), x = var("x"); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section16Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section16Test.java index cd45d881209..31ebd3b8f9d 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section16Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section16Test.java @@ -39,9 +39,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.RdfBlankNode; import org.junit.jupiter.api.Test; -public class Section16Test extends BaseExamples { +class Section16Test extends BaseExamples { @Test - public void example_16_1_2() { + void example_16_1_2() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)); Prefix ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = var("title"), @@ -87,7 +87,7 @@ public void example_16_1_2() { } @Test - public void example_16_2() { + void example_16_2() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)), vcard = SparqlBuilder.prefix("vcard", iri("http://www.w3.org/2001/vcard-rdf/3.0#")); Iri aliceIri = Rdf.iri("http://example.org/person#", "Alice"); @@ -105,7 +105,7 @@ public void example_16_2() { } @Test - public void example_16_2_1() { + void example_16_2_1() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)), vcard = SparqlBuilder.prefix("vcard", iri("http://www.w3.org/2001/vcard-rdf/3.0#")); @@ -136,7 +136,7 @@ public void example_16_2_1() { } @Test - public void example_16_2_2() { + void example_16_2_2() { Prefix dc = SparqlBuilder.prefix("dc", iri("http://purl.org/dc/elements/1.1/")), app = SparqlBuilder.prefix("app", iri("http://example.org/ns#")), xsd = SparqlBuilder.prefix("xsd", iri("http://www.w3.org/2001/XMLSchema#")); @@ -169,7 +169,7 @@ public void example_16_2_2() { } @Test - public void example_16_2_3() { + void example_16_2_3() { Prefix foaf = SparqlBuilder.prefix("foaf", iri("http://xmlns.com/foaf/0.1/")), site = SparqlBuilder.prefix("site", iri("http://example.org/stats#")); Variable name = var("name"), hits = var("hits"); @@ -195,7 +195,7 @@ public void example_16_2_3() { } @Test - public void example_16_2_4() { + void example_16_2_4() { Prefix foaf = SparqlBuilder.prefix("foaf", iri("http://xmlns.com/foaf/0.1/")); Variable x = var("x"), name = var("name"); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section17Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section17Test.java index aed7b9a2700..4f3a219ec52 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section17Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section17Test.java @@ -22,9 +22,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf; import org.junit.jupiter.api.Test; -public class Section17Test extends BaseExamples { +class Section17Test extends BaseExamples { @Test - public void example_17_4_1_9() { + void example_17_4_1_9() { Prefix rdf = SparqlBuilder.prefix("rdf", Rdf.iri("http://example.com")); Variable attributeIRI = SparqlBuilder.var("attribute_iri"); Iri type = rdf.iri("type"); @@ -35,7 +35,7 @@ public void example_17_4_1_9() { } @Test - public void example_17_4_1_10() { + void example_17_4_1_10() { Prefix rdf = SparqlBuilder.prefix("rdf", Rdf.iri("http://example.com")); Variable attributeIRI = SparqlBuilder.var("attribute_iri"); Iri type = rdf.iri("type"); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section2Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section2Test.java index 4a885bc4aed..eddf550e746 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section2Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section2Test.java @@ -33,9 +33,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf; import org.junit.jupiter.api.Test; -public class Section2Test extends BaseExamples { +class Section2Test extends BaseExamples { @Test - public void example_2_1() { + void example_2_1() { Variable title = var("title"); TriplePattern book1_has_title = GraphPatterns.tp(Rdf.iri(EXAMPLE_ORG_BOOK_NS, "book1"), Rdf.iri(DC_NS, "title"), @@ -52,7 +52,7 @@ public void example_2_1() { } @Test - public void example_2_1_model() { + void example_2_1_model() { Variable title = var("title"); String ex = EXAMPLE_ORG_BOOK_NS; IRI book1 = VF.createIRI(ex, "book1"); @@ -71,7 +71,7 @@ public void example_2_1_model() { } @Test - public void example_2_2() { + void example_2_2() { Prefix foaf = SparqlBuilder.prefix("foaf", Rdf.iri(FOAF_NS)); /** @@ -94,7 +94,7 @@ public void example_2_2() { } @Test - public void example_2_2_model() { + void example_2_2_model() { Prefix foaf = SparqlBuilder.prefix(FOAF.NS); /** @@ -117,7 +117,7 @@ public void example_2_2_model() { } @Test - public void example_2_3_1() { + void example_2_3_1() { Variable v = var("v"), p = var("p"); TriplePattern v_hasP_cat = GraphPatterns.tp(v, p, Rdf.literalOf("cat")); @@ -135,7 +135,7 @@ public void example_2_3_1() { } @Test - public void example_2_3_2() { + void example_2_3_2() { Variable v = var("v"), p = var("p"); TriplePattern v_hasP_42 = GraphPatterns.tp(v, p, Rdf.literalOf(42)); @@ -147,7 +147,7 @@ public void example_2_3_2() { } @Test - public void example_2_3_3() { + void example_2_3_3() { String datatype = "specialDatatype"; Variable v = var("v"), p = var("p"); TriplePattern v_hasP_abc_dt = GraphPatterns.tp(v, p, @@ -160,7 +160,7 @@ public void example_2_3_3() { } @Test - public void example_2_3_3_model() { + void example_2_3_3_model() { String datatype = "specialDatatype"; Variable v = var("v"), p = var("p"); @@ -176,7 +176,7 @@ public void example_2_3_3_model() { } @Test - public void example_2_4() { + void example_2_4() { Prefix foaf = SparqlBuilder.prefix("foaf", Rdf.iri(FOAF_NS)); Variable x = var("x"), name = var("name"); @@ -189,7 +189,7 @@ public void example_2_4() { } @Test - public void example_2_5() { + void example_2_5() { Prefix foaf = SparqlBuilder.prefix("foaf", Rdf.iri(FOAF_NS)); Variable G = var("G"), P = var("P"), S = var("S"), name = var("name"); @@ -225,7 +225,7 @@ public void example_2_5() { } @Test - public void example_2_6() { + void example_2_6() { Prefix foaf = SparqlBuilder.prefix("foaf", Rdf.iri(FOAF_NS)), org = SparqlBuilder.prefix("org", Rdf.iri(EXAMPLE_COM_NS)); PrefixDeclarations prefixes = SparqlBuilder.prefixes(foaf, org); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section3Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section3Test.java index 6058af0ccc6..a77a8887c68 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section3Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section3Test.java @@ -28,9 +28,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf; import org.junit.jupiter.api.Test; -public class Section3Test extends BaseExamples { +class Section3Test extends BaseExamples { @Test - public void example_3_1() { + void example_3_1() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)); Variable x = var("x"), title = var("title"); @@ -59,7 +59,7 @@ public void example_3_1() { } @Test - public void example_3_2() { + void example_3_2() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_COM_NS)); Variable title = var("title"), price = var("price"); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section4Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section4Test.java index c038ee4627a..b97e8acf1cb 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section4Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section4Test.java @@ -28,12 +28,12 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.RdfPredicate; import org.junit.jupiter.api.Test; -public class Section4Test extends BaseExamples { +class Section4Test extends BaseExamples { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable x = SparqlBuilder.var("x"), name = SparqlBuilder.var("name"); @Test - public void example_4_1_4() { + void example_4_1_4() { Prefix defPrefix = SparqlBuilder.prefix(iri(DC_NS)); // [ :p "v" ] . @@ -68,7 +68,7 @@ public void example_4_1_4() { } @Test - public void example_4_2_1() { + void example_4_2_1() { Variable mbox = SparqlBuilder.var("mbox"); TriplePattern tp = GraphPatterns.tp(x, foaf.iri("name"), name).andHas(foaf.iri("mbox"), mbox); @@ -79,7 +79,7 @@ public void example_4_2_1() { } @Test - public void example_4_2_2() { + void example_4_2_2() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable x = SparqlBuilder.var("x"), name = SparqlBuilder.var("name"); Iri nick = foaf.iri("nick"); @@ -97,7 +97,7 @@ public void example_4_2_2() { } @Test - public void example_4_2_4() { + void example_4_2_4() { Prefix defPrefix = SparqlBuilder.prefix(iri(DC_NS)); // isA() is a shortcut method to create triples using the "a" keyword diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section5Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section5Test.java index 95436c9243d..cae3895efb4 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section5Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section5Test.java @@ -24,9 +24,9 @@ import org.eclipse.rdf4j.sparqlbuilder.graphpattern.GraphPattern; import org.junit.jupiter.api.Test; -public class Section5Test extends BaseExamples { +class Section5Test extends BaseExamples { @Test - public void example_5_2() { + void example_5_2() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable name = var("name"), mbox = var("mbox"); Variable x = var("x"); @@ -53,7 +53,7 @@ public void example_5_2() { } @Test - public void example_5_2_1() { + void example_5_2_1() { Variable x = var("x"); query.select(x); assertThat(query.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( @@ -62,7 +62,7 @@ public void example_5_2_1() { } @Test - public void example_5_2_3() { + void example_5_2_3() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable x = var("x"), name = var("name"), mbox = var("mbox"); assertThat( diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section6Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section6Test.java index 26d487021e5..14e05479db4 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section6Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section6Test.java @@ -25,9 +25,9 @@ import org.eclipse.rdf4j.sparqlbuilder.graphpattern.TriplePattern; import org.junit.jupiter.api.Test; -public class Section6Test extends BaseExamples { +class Section6Test extends BaseExamples { @Test - public void example_6_1() { + void example_6_1() { Variable name = var("name"), mbox = var("mbox"); Variable x = var("x"); Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); @@ -46,7 +46,7 @@ public void example_6_1() { } @Test - public void example_6_2() { + void example_6_2() { Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)), ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Variable title = var("title"), price = var("price"), x = var("x"); @@ -66,7 +66,7 @@ public void example_6_2() { } @Test - public void example_6_3() { + void example_6_3() { Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable name = var("name"), mbox = var("mbox"), hpage = var("hpage"); Variable x = var("x"); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section7Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section7Test.java index d02c3a33817..989f8ef8e2d 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section7Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section7Test.java @@ -24,9 +24,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Iri; import org.junit.jupiter.api.Test; -public class Section7Test extends BaseExamples { +class Section7Test extends BaseExamples { @Test - public void example_7() { + void example_7() { String DC_10_NS = "http://purl.org/dc/elements/1.0/"; Prefix dc10 = SparqlBuilder.prefix("dc10", iri(DC_10_NS)), dc11 = SparqlBuilder.prefix("dc11", iri(DC_NS)); Variable title = var("title"), book = var("book"); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section8Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section8Test.java index 9e01f37e58d..93d3c44ff4e 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section8Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section8Test.java @@ -29,9 +29,9 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Rdf; import org.junit.jupiter.api.Test; -public class Section8Test extends BaseExamples { +class Section8Test extends BaseExamples { @Test - public void example_8_1_1() { + void example_8_1_1() { String rdf_ns = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; Prefix rdf = SparqlBuilder.prefix("rdf", iri(rdf_ns)); Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); @@ -54,7 +54,7 @@ public void example_8_1_1() { } @Test - public void example_8_1_2() { + void example_8_1_2() { String rdf_ns = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; Prefix rdf = SparqlBuilder.prefix("rdf", iri(rdf_ns)); Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); @@ -77,7 +77,7 @@ public void example_8_1_2() { } @Test - public void example_8_2() { + void example_8_2() { Prefix base = SparqlBuilder.prefix(iri("http://example/")); Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); Variable s = var("s"), p = var("p"), o = var("o"); @@ -102,7 +102,7 @@ public void example_8_2() { } @Test - public void example_8_3_2() { + void example_8_3_2() { Prefix base = SparqlBuilder.prefix(iri("http://example/")); Variable s = var("s"), p = var("p"), o = var("o"); Iri a = base.iri("a"), b = base.iri("b"), c = base.iri("c"); @@ -134,7 +134,7 @@ public void example_8_3_2() { } @Test - public void example_8_3_3() { + void example_8_3_3() { Prefix base = SparqlBuilder.prefix(iri("http://example.com/")); Variable x = var("x"), m = var("m"), n = var("n"); Expression filter = Expressions.equals(n, m); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section9Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section9Test.java index bef848a821f..b4561512fe2 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section9Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/sparql11spec/Section9Test.java @@ -32,7 +32,7 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.Iri; import org.junit.jupiter.api.Test; -public class Section9Test extends BaseExamples { +class Section9Test extends BaseExamples { private final Prefix rdfs = SparqlBuilder.prefix("rdfs", iri(RDFS.NS.getName())); private final Prefix dc = SparqlBuilder.prefix("dc", iri(DC_NS)); private final Prefix foaf = SparqlBuilder.prefix("foaf", iri(FOAF_NS)); @@ -60,7 +60,7 @@ public class Section9Test extends BaseExamples { private final Iri list = base.iri("list"); @Test - public void example_9_2__1_alt() { + void example_9_2__1_alt() { TriplePattern tp = book1.has(path -> path .pred(dc.iri("title")) .or(rdfs.iri("label")), displayString); @@ -71,7 +71,7 @@ public void example_9_2__1_alt() { } @Test - public void example_9_2__2_alt_noprefix() { + void example_9_2__2_alt_noprefix() { TriplePattern tp = book1.has(path -> path.pred(DC.TITLE).or(RDFS.LABEL), displayString); // NOTE: changed example: removed curly braces around, added brackets in path, added dot at end assertThat(tp.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( @@ -80,7 +80,7 @@ public void example_9_2__2_alt_noprefix() { } @Test - public void example_9_2__3_sequence() { + void example_9_2__3_sequence() { GraphPattern gp = x.has(path -> path.pred(foaf.iri("mbox")), mailto) .and(x.has(path -> path .pred(foaf.iri("knows")) @@ -95,7 +95,7 @@ public void example_9_2__3_sequence() { } @Test - public void example_9_2__4_double_sequence() { + void example_9_2__4_double_sequence() { GraphPattern gp = x.has(path -> path.pred(foaf.iri("mbox")), mailto) .and(x.has(path -> path .pred(foaf.iri("knows")) @@ -111,7 +111,7 @@ public void example_9_2__4_double_sequence() { } @Test - public void example_9_2__5_double_sequence_filter() { + void example_9_2__5_double_sequence_filter() { GraphPattern gp = x.has(path -> path.pred(foaf.iri("mbox")), mailto) .and(x.has(path -> path .pred(foaf.iri("knows")) @@ -129,7 +129,7 @@ public void example_9_2__5_double_sequence_filter() { } @Test - public void example_9_2__6_inverse() { + void example_9_2__6_inverse() { TriplePattern tp = mailto.has(path -> path.pred(foaf.iri("mbox")).inv(), x); // NOTE: changed example: removed curly braces, added dot, added brackets in path assertThat(tp.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( @@ -138,7 +138,7 @@ public void example_9_2__6_inverse() { } @Test - public void example_9_2__7_sequence_inverse() { + void example_9_2__7_sequence_inverse() { GraphPattern gp = x.has(path -> path .pred(foaf.iri("knows")) .then(b -> b.pred(foaf.iri("knows")) @@ -155,7 +155,7 @@ public void example_9_2__7_sequence_inverse() { } @Test - public void example_9_2__8_one_or_more() { + void example_9_2__8_one_or_more() { GraphPattern gp = x.has(foaf.iri("mbox"), mailto) .and(x.has(path -> path .pred(foaf.iri("knows")) @@ -172,7 +172,7 @@ public void example_9_2__8_one_or_more() { } @Test - public void example_9_2__9_alt_one_or_more() { + void example_9_2__9_alt_one_or_more() { TriplePattern tp = ancestor.has(path -> path .pred(ex.iri("motherOf")) .or(ex.iri("fatherOf")) @@ -184,7 +184,7 @@ public void example_9_2__9_alt_one_or_more() { } @Test - public void example_9_2__10_sequence_zero_or_more() { + void example_9_2__10_sequence_zero_or_more() { // NOTE: changed example: remove curly braces, added dot TriplePattern tp = thing.has(path -> path .pred(rdf.iri("type")) @@ -197,7 +197,7 @@ public void example_9_2__10_sequence_zero_or_more() { } @Test - public void example_9_2__11_sequence_one_or_more() { + void example_9_2__11_sequence_one_or_more() { // NOTE: changed example: remove curly braces, added dot TriplePattern tp = x.has(path -> path .pred(rdf.iri("type")) @@ -210,7 +210,7 @@ public void example_9_2__11_sequence_one_or_more() { } @Test - public void example_9_2__12_zero_or_more() { + void example_9_2__12_zero_or_more() { // NOTE: changed example: remove curly braces, added dot GraphPattern gp = x.has(p, v) .and(p.has(path -> path @@ -223,7 +223,7 @@ public void example_9_2__12_zero_or_more() { } @Test - public void example_9_2__13_negated_property_set() { + void example_9_2__13_negated_property_set() { TriplePattern tp = x.has(path -> path .negProp() .pred(rdf.iri("type")) @@ -234,7 +234,7 @@ public void example_9_2__13_negated_property_set() { } @Test - public void example_9_2__14_rdf_collection() { + void example_9_2__14_rdf_collection() { // NOTE: changed example: remove curly braces, added dot TriplePattern tp = list.has(path -> path .pred(rdf.iri("rest")) @@ -246,7 +246,7 @@ public void example_9_2__14_rdf_collection() { } @Test - public void example_9_3__1() { + void example_9_3__1() { // Note: changed example: added WHERE, query = Queries.SELECT() .all() @@ -262,7 +262,7 @@ public void example_9_3__1() { } @Test - public void example_9_3__2() { + void example_9_3__2() { // Note: changed example: added WHERE, Variable _a = var("_a"); query = Queries.SELECT() @@ -281,7 +281,7 @@ public void example_9_3__2() { } @Test - public void example_9_3__3() { + void example_9_3__3() { // Note: changed example: added WHERE, Variable _a = var("_a"); query = Queries.SELECT() @@ -300,7 +300,7 @@ public void example_9_3__3() { } @Test - public void example_9_3__4() { + void example_9_3__4() { // Note: changed example: added WHERE, query = Queries.SELECT(SparqlBuilder.as(Expressions.sum(x), total)) .prefix(base) @@ -317,7 +317,7 @@ public void example_9_3__4() { } @Test - public void example_9_4__1() { + void example_9_4__1() { // Note: changed example: added WHERE, added dot query = Queries.SELECT(x, type) .prefix(RDFS.NS) @@ -338,7 +338,7 @@ public void example_9_4__1() { } @Test - public void example_9_4__2() { + void example_9_4__2() { // Note: changed example: added WHERE, added dot query = Queries.SELECT(person) .prefix(FOAF.NS) diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/updatespec/Section3Test.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/updatespec/Section3Test.java index 36ae74b3851..ef8d1d658ce 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/updatespec/Section3Test.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/examples/updatespec/Section3Test.java @@ -41,7 +41,7 @@ /** * Follows the SPARQL 1.1 Update Spec starting here */ -public class Section3Test extends BaseExamples { +class Section3Test extends BaseExamples { Prefix dc = SparqlBuilder.prefix("dc", iri("http://purl.org/dc/elements/1.1/")); Prefix ns = SparqlBuilder.prefix("ns", iri(EXAMPLE_ORG_NS)); Prefix foaf = SparqlBuilder.prefix("foaf", iri("http://xmlns.com/foaf/0.1/")); @@ -53,7 +53,7 @@ public class Section3Test extends BaseExamples { * dc:creator "A.N.Other" . } */ @Test - public void example_1() { + void example_1() { InsertDataQuery insertDataQuery = Queries.INSERT_DATA(); insertDataQuery.prefix(dc) @@ -73,7 +73,7 @@ public void example_1() { * { ns:price 42 } } */ @Test - public void example_2() { + void example_2() { InsertDataQuery insertDataQuery = Queries.INSERT_DATA(); insertDataQuery.prefix(dc, ns) @@ -95,7 +95,7 @@ public void example_2() { * DELETE DATA { dc:title "David Copperfield" ; dc:creator "Edmund Wells" . } */ @Test - public void example_3() { + void example_3() { DeleteDataQuery deleteDataQuery = Queries.DELETE_DATA().prefix(dc); deleteDataQuery.deleteData(iri("http://example/book2").has(dc.iri("title"), Rdf.literalOf("David Copperfield")) @@ -118,7 +118,7 @@ public void example_3() { * dc:title "Fundamentals of Compiler Design" } } */ @Test - public void example_4() { + void example_4() { Iri bookStore = iri("http://example/bookStore"), exampleBook = iri("http://example/book1"), title = dc.iri("title"); @@ -147,7 +147,7 @@ public void example_4() { } @Test - public void example_with() { + void example_with() { TriplePattern abc = GraphPatterns.tp(SparqlBuilder.var("a"), SparqlBuilder.var("b"), SparqlBuilder.var("c")); TriplePattern xyz = GraphPatterns.tp(SparqlBuilder.var("x"), SparqlBuilder.var("y"), SparqlBuilder.var("z")); ModifyQuery modify = Queries.MODIFY(); @@ -177,7 +177,7 @@ public void example_with() { * 'William' } WHERE { ?person foaf:givenName 'Bill' } */ @Test - public void example_5() { + void example_5() { Variable person = SparqlBuilder.var("person"); ModifyQuery modify = Queries.MODIFY(); @@ -203,7 +203,7 @@ public void example_5() { * ?book ?p ?v } */ @Test - public void example_6() { + void example_6() { Variable book = SparqlBuilder.var("book"), p = SparqlBuilder.var("p"), v = SparqlBuilder.var("v"), date = SparqlBuilder.var("date"); @@ -233,7 +233,7 @@ public void example_6() { * foaf:givenName 'Fred' } */ @Test - public void example_7() { + void example_7() { Variable person = SparqlBuilder.var("person"), property = SparqlBuilder.var("property"), value = SparqlBuilder.var("value"); @@ -261,7 +261,7 @@ public void example_7() { * dc:date ?date . FILTER ( ?date > "1970-01-01T00:00:00-02:00"^^xsd:dateTime ) ?book ?p ?v } } */ @Test - public void example_8() { + void example_8() { Variable book = SparqlBuilder.var("book"), p = SparqlBuilder.var("p"), v = SparqlBuilder.var("v"), date = SparqlBuilder.var("date"); @@ -293,7 +293,7 @@ public void example_8() { * { ?person foaf:name ?name . OPTIONAL { ?person foaf:mbox ?email } } } */ @Test - public void example_9() { + void example_9() { Variable person = SparqlBuilder.var("person"), name = SparqlBuilder.var("name"), email = SparqlBuilder.var("email"); TriplePattern personNameTriple = person.has(foaf.iri("name"), name), @@ -335,7 +335,7 @@ public void example_9() { * dcmitype:PhysicalObject . FILTER ( ?date < "2000-01-01T00:00:00-02:00"^^xsd:dateTime ) ?book ?p ?v } */ @Test - public void example_10() { + void example_10() { Variable book = SparqlBuilder.var("book"), p = SparqlBuilder.var("p"), v = SparqlBuilder.var("v"), date = SparqlBuilder.var("date"); Prefix dcmitype = SparqlBuilder.prefix("dcmitype", iri("http://purl.org/dc/dcmitype/")); @@ -388,7 +388,7 @@ public void example_10() { * DELETE WHERE { ?person foaf:givenName 'Fred'; ?property ?value } */ @Test - public void example_11() { + void example_11() { Variable person = SparqlBuilder.var("person"), property = SparqlBuilder.var("property"), value = SparqlBuilder.var("value"); @@ -412,7 +412,7 @@ public void example_11() { * { ?person ?property2 ?value2 } } */ @Test - public void example_12() { + void example_12() { Variable person = SparqlBuilder.var("person"), property1 = SparqlBuilder.var("property1"), value1 = SparqlBuilder.var("value1"), property2 = SparqlBuilder.var("property2"), value2 = SparqlBuilder.var("value2"); @@ -439,7 +439,7 @@ public void example_12() { } @Test - public void example_load() { + void example_load() { LoadQuery load = Queries.LOAD().from(iri(EXAMPLE_ORG_NS)); assertThat(load.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( "LOAD " @@ -451,7 +451,7 @@ public void example_load() { } @Test - public void example_clear() { + void example_clear() { ClearQuery clear = Queries.CLEAR().def(); assertThat(clear.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( "CLEAR DEFAULT" @@ -463,7 +463,7 @@ public void example_clear() { } @Test - public void example_create() { + void example_create() { CreateQuery create = Queries.CREATE().graph(iri(EXAMPLE_ORG_NS)); assertThat(create.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( "CREATE GRAPH " @@ -475,7 +475,7 @@ public void example_create() { } @Test - public void example_drop() { + void example_drop() { DropQuery drop = Queries.DROP().def(); assertThat(drop.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( "DROP DEFAULT" @@ -490,7 +490,7 @@ public void example_drop() { * COPY DEFAULT TO \ */ @Test - public void example_13() { + void example_13() { CopyQuery copy = Queries.COPY().fromDefault().to(iri("http://example.org/named")); assertThat(copy.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( "COPY DEFAULT TO " @@ -501,7 +501,7 @@ public void example_13() { * MOVE DEFAULT TO */ @Test - public void example_14() { + void example_14() { MoveQuery move = Queries.MOVE().fromDefault().to(iri("http://example.org/named")); assertThat(move.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( "MOVE DEFAULT TO " @@ -512,7 +512,7 @@ public void example_14() { * ADD DEFAULT TO */ @Test - public void example_15() { + void example_15() { AddQuery add = Queries.ADD().fromDefault().to(iri("http://example.org/named")); assertThat(add.getQueryString()).is(stringEqualsIgnoreCaseAndWhitespace( "ADD DEFAULT TO " diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/rdf/RdfLiteralTest.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/rdf/RdfLiteralTest.java index c16a9fcfbb3..f200a15f0d3 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/rdf/RdfLiteralTest.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/rdf/RdfLiteralTest.java @@ -17,22 +17,22 @@ import org.eclipse.rdf4j.sparqlbuilder.rdf.RdfLiteral.StringLiteral; import org.junit.jupiter.api.Test; -public class RdfLiteralTest { +class RdfLiteralTest { @Test - public void emptyStringLiteralIsNotPadded() { + void emptyStringLiteralIsNotPadded() { StringLiteral literal = new StringLiteral(""); assertThat(literal.getQueryString()).isEqualTo("\"\""); } @Test - public void simpleStringLiteralIsNotPadded() { + void simpleStringLiteralIsNotPadded() { StringLiteral literal = new StringLiteral("foo"); assertThat(literal.getQueryString()).isEqualTo("\"foo\""); } @Test - public void testNewline() { + void testNewline() { StringLiteral literal = new StringLiteral("foo\nbar"); assertThat(literal.getQueryString()).isEqualTo("\"foo\\nbar\""); literal = new StringLiteral("foo\nbar\n"); @@ -50,7 +50,7 @@ public void testNewline() { } @Test - public void testCarriageReturn() { + void testCarriageReturn() { StringLiteral literal = new StringLiteral("foo\rbar"); assertThat(literal.getQueryString()).isEqualTo("\"foo\\rbar\""); literal = new StringLiteral("foobar\r"); @@ -64,7 +64,7 @@ public void testCarriageReturn() { } @Test - public void testTab() { + void testTab() { StringLiteral literal = new StringLiteral("foo\tbar"); assertThat(literal.getQueryString()).isEqualTo("\"foo\\tbar\""); literal = new StringLiteral("foobar\t"); @@ -78,7 +78,7 @@ public void testTab() { } @Test - public void testBackspace() { + void testBackspace() { StringLiteral literal = new StringLiteral("foo\bbar"); assertThat(literal.getQueryString()).isEqualTo("\"foo\\bbar\""); literal = new StringLiteral("foobar\b"); @@ -92,7 +92,7 @@ public void testBackspace() { } @Test - public void testFormFeed() { + void testFormFeed() { StringLiteral literal = new StringLiteral("foo\fbar"); assertThat(literal.getQueryString()).isEqualTo("\"foo\\fbar\""); literal = new StringLiteral("foobar\f"); @@ -106,7 +106,7 @@ public void testFormFeed() { } @Test - public void testSingleQuote() { + void testSingleQuote() { StringLiteral literal = new StringLiteral("'foobar"); assertThat(literal.getQueryString()).isEqualTo("\"\\'foobar\""); literal = new StringLiteral("foobar'"); @@ -128,7 +128,7 @@ public void testSingleQuote() { } @Test - public void testDoubleQuote() { + void testDoubleQuote() { StringLiteral literal = new StringLiteral("\"foobar"); assertThat(literal.getQueryString()).isEqualTo("\"\\\"foobar\""); literal = new StringLiteral("foobar\""); @@ -150,7 +150,7 @@ public void testDoubleQuote() { } @Test - public void testCornerCases() { + void testCornerCases() { StringLiteral literal = new StringLiteral("\\nfoobar"); assertThat(literal.getQueryString()).isEqualTo("\"\\\\nfoobar\""); literal = new StringLiteral("\\\"foobar"); @@ -162,13 +162,13 @@ public void testCornerCases() { } @Test - public void testBoolean() { + void testBoolean() { RdfLiteral.BooleanLiteral literal = new RdfLiteral.BooleanLiteral(true); assertThat(literal.getQueryString()).isEqualTo("true"); } @Test - public void testNumeric() { + void testNumeric() { RdfLiteral.NumericLiteral literal = new RdfLiteral.NumericLiteral(10); assertThat(literal.getQueryString()).isEqualTo("10"); literal = new RdfLiteral.NumericLiteral(10.00001); diff --git a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/util/SparqlBuilderUtilsTest.java b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/util/SparqlBuilderUtilsTest.java index 52fe7c4bd7c..430140dbe1e 100644 --- a/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/util/SparqlBuilderUtilsTest.java +++ b/core/sparqlbuilder/src/test/java/org/eclipse/rdf4j/sparqlbuilder/util/SparqlBuilderUtilsTest.java @@ -14,30 +14,30 @@ import org.junit.jupiter.api.Test; -public class SparqlBuilderUtilsTest { +class SparqlBuilderUtilsTest { @Test - public void getBracedStringReturnsBracedWithPadding() { + void getBracedStringReturnsBracedWithPadding() { assertThat(SparqlBuilderUtils.getBracedString("string")).isEqualTo("{ string }"); } @Test - public void getBracketedStringReturnsBracketedWithPadding() { + void getBracketedStringReturnsBracketedWithPadding() { assertThat(SparqlBuilderUtils.getBracketedString("string")).isEqualTo("[ string ]"); } @Test - public void getQuotedStringReturnsQuotedNoPadding() { + void getQuotedStringReturnsQuotedNoPadding() { assertThat(SparqlBuilderUtils.getQuotedString("string")).isEqualTo("\"string\""); } @Test - public void getQuotedStringOnEmptyAddsNoPadding() { + void getQuotedStringOnEmptyAddsNoPadding() { assertThat(SparqlBuilderUtils.getQuotedString("")).isEqualTo("\"\""); } @Test - public void getLongQuotedStringReturnsTripleSingleQuotes() { + void getLongQuotedStringReturnsTripleSingleQuotes() { assertThat(SparqlBuilderUtils.getLongQuotedString("string")).isEqualTo("'''string'''"); } diff --git a/core/spin/src/test/java/org/eclipse/rdf4j/spin/SpinParserTest.java b/core/spin/src/test/java/org/eclipse/rdf4j/spin/SpinParserTest.java index 96642d92202..6d9361abf84 100644 --- a/core/spin/src/test/java/org/eclipse/rdf4j/spin/SpinParserTest.java +++ b/core/spin/src/test/java/org/eclipse/rdf4j/spin/SpinParserTest.java @@ -67,7 +67,7 @@ public static Stream testData() { @ParameterizedTest(name = "{0}") @MethodSource("testData") - public void testSpinParser(String testName, URL testURL) throws IOException, RDF4JException { + void testSpinParser(String testName, URL testURL) throws IOException, RDF4JException { StatementCollector expected = new StatementCollector(); RDFParser parser = Rio.createParser(RDFFormat.TURTLE); parser.setRDFHandler(expected); diff --git a/core/spin/src/test/java/org/eclipse/rdf4j/spin/SpinRendererTest.java b/core/spin/src/test/java/org/eclipse/rdf4j/spin/SpinRendererTest.java index 1065fdd7820..24a9eedebd5 100644 --- a/core/spin/src/test/java/org/eclipse/rdf4j/spin/SpinRendererTest.java +++ b/core/spin/src/test/java/org/eclipse/rdf4j/spin/SpinRendererTest.java @@ -66,7 +66,7 @@ public static Stream testData() { @ParameterizedTest(name = "{0}") @MethodSource("testData") - public void testSpinRenderer(String testName, URL testURL) throws IOException, RDF4JException { + void testSpinRenderer(String testName, URL testURL) throws IOException, RDF4JException { StatementCollector expected = new StatementCollector(); RDFParser parser = Rio.createParser(RDFFormat.TURTLE); parser.setRDFHandler(expected);