From 6e997d81c563e14f3ef7229fe128b9f9d8d73fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 12 May 2022 10:35:30 +0200 Subject: [PATCH 1/5] HSEARCH-4578 Fix javadoc in FailureReportUtils --- .../util/impl/integrationtest/common/FailureReportUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java index 14572965be0..762cbba9f04 100644 --- a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java +++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java @@ -26,7 +26,7 @@ private FailureReportUtils() { * @param first The first part of the expected context. * @param others The other parts of the expected context, if any. To be concatenated to the first part. * @return A consumer representing an assertion to be passed as a parameter to - * {@link org.assertj.core.api.AbstractThrowableAssert#satisfies(Consumer)}. + * {@link org.assertj.core.api.AbstractThrowableAssert#satisfies(Consumer[])}. */ public static Consumer hasContext(EventContext first, EventContext... others) { return hasContext( @@ -37,7 +37,7 @@ public static Consumer hasContext(EventContext first, E /** * @param contextElements The expect context elements, in order. * @return A consumer representing an assertion to be passed as a parameter to - * {@link org.assertj.core.api.AbstractThrowableAssert#satisfies(Consumer)}. + * {@link org.assertj.core.api.AbstractThrowableAssert#satisfies(Consumer[])}. */ public static Consumer hasContext(EventContextElement... contextElements) { return throwable -> { From 714542379c89e11cdaed9beedc281f24ed469341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 12 May 2022 13:19:03 +0200 Subject: [PATCH 2/5] HSEARCH-4578 Use satifsfies() instead of hasMessageMatching() for failure report checking --- .../ReindexOnUpdateShallowIncorrectIT.java | 5 +- .../ElasticsearchAnalysisConfigurerIT.java | 27 ++--- .../ElasticsearchBootstrapFailureIT.java | 3 +- .../bootstrap/ElasticsearchBootstrapIT.java | 9 +- .../ElasticsearchIndexNamingBaseIT.java | 10 +- ...sticsearchIndexSchemaManagerTestUtils.java | 4 +- ...IndexSchemaManagerValidationAliasesIT.java | 27 ++--- ...ndexSchemaManagerValidationAnalyzerIT.java | 39 +++---- ...maManagerValidationMappingAttributeIT.java | 110 +++++++----------- ...xSchemaManagerValidationMappingBaseIT.java | 25 ++-- ...nagerValidationMappingFieldTemplateIT.java | 62 ++++------ ...exSchemaManagerValidationNormalizerIT.java | 10 +- .../lucene/LuceneDocumentModelDslIT.java | 15 +-- .../analysis/LuceneAnalysisConfigurerIT.java | 9 +- .../directory/AbstractBuiltInDirectoryIT.java | 6 +- .../lowlevel/directory/CustomDirectoryIT.java | 6 +- .../LuceneLocalFileSystemDirectoryIT.java | 3 +- .../document/IndexSchemaElementFieldIT.java | 110 +++++++----------- .../IndexSchemaElementFieldTemplateIT.java | 90 ++++++-------- .../document/IndexSchemaElementTypeIT.java | 20 ++-- ...xtendedBeanManagerBootstrapShutdownIT.java | 5 +- ...tectMultipleBackendTypesInClasspathIT.java | 5 +- .../AbstractMassIndexingFailureIT.java | 5 +- .../mapper/orm/model/TransientPropertyIT.java | 6 +- ...tSearchSchemaManagerSimpleOperationIT.java | 10 +- ...emaManagerValidatingSimpleOperationIT.java | 15 +-- .../AbstractSchemaManagementStrategyIT.java | 10 +- ...tSchemaManagementStrategyValidatingIT.java | 15 +-- .../DefaultReindexOnUpdateIT.java | 6 +- .../alternative/AlternativeBinderIT.java | 12 +- ...CustomPropertyMappingAnnotationBaseIT.java | 12 +- .../CustomTypeMappingAnnotationBaseIT.java | 12 +- .../pojo/mapping/definition/DependencyIT.java | 24 ++-- .../mapping/definition/DocumentIdBaseIT.java | 49 +++----- .../DocumentIdDefaultBridgeAdditionIT.java | 5 +- .../pojo/mapping/definition/FieldBaseIT.java | 39 +++---- .../FieldContainerExtractorBaseIT.java | 21 ++-- .../FieldDefaultBridgeAdditionIT.java | 5 +- .../mapping/definition/FullTextFieldIT.java | 29 ++--- .../mapping/definition/GenericFieldIT.java | 17 +-- .../mapping/definition/IndexedBaseIT.java | 11 +- .../definition/IndexedEmbeddedBaseIT.java | 27 ++--- .../mapping/definition/KeywordFieldIT.java | 29 ++--- .../definition/NonStandardFieldIT.java | 23 ++-- .../definition/PropertyBindingBaseIT.java | 3 +- .../definition/PropertyBridgeBaseIT.java | 72 ++++-------- .../definition/RoutingBridgeBaseIT.java | 27 ++--- .../definition/ScaledNumberFieldIT.java | 29 ++--- .../mapping/definition/TypeBindingBaseIT.java | 3 +- .../mapping/definition/TypeBridgeBaseIT.java | 60 ++++------ .../common/FailureReportUtils.java | 64 +++++----- 51 files changed, 469 insertions(+), 771 deletions(-) diff --git a/documentation/src/test/java/org/hibernate/search/documentation/mapper/orm/reindexing/reindexonupdate/shallow/incorrect/ReindexOnUpdateShallowIncorrectIT.java b/documentation/src/test/java/org/hibernate/search/documentation/mapper/orm/reindexing/reindexonupdate/shallow/incorrect/ReindexOnUpdateShallowIncorrectIT.java index 2b9ea5c127d..5924f64da6f 100644 --- a/documentation/src/test/java/org/hibernate/search/documentation/mapper/orm/reindexing/reindexonupdate/shallow/incorrect/ReindexOnUpdateShallowIncorrectIT.java +++ b/documentation/src/test/java/org/hibernate/search/documentation/mapper/orm/reindexing/reindexonupdate/shallow/incorrect/ReindexOnUpdateShallowIncorrectIT.java @@ -26,7 +26,7 @@ public class ReindexOnUpdateShallowIncorrectIT { public void missingReindexOnUpdateShallow() { assertThatThrownBy( () -> setupHelper.start().setup( Book.class, BookCategory.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( Book.class.getName() ) .pathContext( ".category.name" ) .failure( @@ -35,8 +35,7 @@ public void missingReindexOnUpdateShallow() { "Hibernate Search needs this information", "you can disable automatic reindexing with" + " @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)" - ) - .build() ); + ) ); } } diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/analysis/ElasticsearchAnalysisConfigurerIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/analysis/ElasticsearchAnalysisConfigurerIT.java index 94ce0c673dc..5fded73f3a0 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/analysis/ElasticsearchAnalysisConfigurerIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/analysis/ElasticsearchAnalysisConfigurerIT.java @@ -38,7 +38,7 @@ public void error_invalidReference() { () -> setup( "foobar" ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( @@ -47,7 +47,6 @@ public void error_invalidReference() { + ElasticsearchIndexSettings.ANALYSIS_CONFIGURER + "': 'foobar'", "Unable to load class 'foobar'" ) - .build() ); } @@ -57,14 +56,13 @@ public void error_failingConfigurer() { () -> setup( FailingConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( ANALYSIS_CONFIGURER_ERROR_MESSAGE_PREFIX, FailingConfigurer.FAILURE_MESSAGE ) - .build() ); } @@ -88,7 +86,7 @@ public void error_tokenizer_namingConflict() { () -> setup( TokenizerNamingConflictConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( @@ -96,7 +94,6 @@ public void error_tokenizer_namingConflict() { "Duplicate tokenizer definitions: 'tokenizerName'", "Tokenizer names must be unique" ) - .build() ); } @@ -114,7 +111,7 @@ public void error_tokenizer_missingType() { () -> setup( TokenizerMissingTypeConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( @@ -122,7 +119,6 @@ public void error_tokenizer_missingType() { "Invalid tokenizer definition for name 'tokenizerName'", "Tokenizer definitions must at least define the tokenizer type" ) - .build() ); } @@ -139,7 +135,7 @@ public void error_charFilter_namingConflict() { () -> setup( CharFilterNamingConflictConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( @@ -147,7 +143,6 @@ public void error_charFilter_namingConflict() { "Duplicate char filter definitions: 'charFilterName'", "Char filter names must be unique" ) - .build() ); } @@ -165,7 +160,7 @@ public void error_charFilter_missingType() { () -> setup( CharFilterMissingTypeConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( @@ -173,7 +168,6 @@ public void error_charFilter_missingType() { "Invalid char filter definition for name 'charFilterName'", "Char filter definitions must at least define the char filter type" ) - .build() ); } @@ -190,7 +184,7 @@ public void error_tokenFilter_namingConflict() { () -> setup( TokenFilterNamingConflictConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( @@ -198,7 +192,6 @@ public void error_tokenFilter_namingConflict() { "Duplicate token filter definitions: 'tokenFilterName'", "Token filter names must be unique" ) - .build() ); } @@ -216,7 +209,7 @@ public void error_tokenFilter_missingType() { () -> setup( TokenFilterMissingTypeConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( @@ -224,7 +217,6 @@ public void error_tokenFilter_missingType() { "Invalid token filter definition for name 'tokenFilterName'", "Token filter definitions must at least define the token filter type" ) - .build() ); } @@ -241,7 +233,7 @@ public void error_parameter_namingConflict() { () -> setup( ParameterNamingConflictConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( @@ -250,7 +242,6 @@ public void error_parameter_namingConflict() { "'\"value1\"'", "'\"value2\"'" ) - .build() ); } diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapFailureIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapFailureIT.java index 18dcd6eb1a0..41e5f4d32d9 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapFailureIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapFailureIT.java @@ -45,14 +45,13 @@ public void cannotConnect() { "Closed port" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() .failure( "Unable to detect the Elasticsearch version running on the cluster", "Elasticsearch request failed", "Connection refused" ) - .build() ); } diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapIT.java index 94317c25466..fc3bc3aadb8 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapIT.java @@ -98,13 +98,12 @@ public void noVersionCheck_missingVersion() { "NO version check without explicit version number" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() .failure( "Invalid value for configuration property 'hibernate.search.backend.version': ''", "Missing or imprecise Elasticsearch version", "when configuration property 'hibernate.search.backend.version_check.enabled' is set to 'false'", "the version is mandatory and must be at least as precise as 'x.y', where 'x' and 'y' are integers" ) - .build() ); } @@ -137,13 +136,12 @@ public void noVersionCheck_incompleteVersion() { "NO version check with partial version number" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() .failure( "Invalid value for configuration property 'hibernate.search.backend.version': '" + versionWithMajorOnly + "'", "Missing or imprecise Elasticsearch version", "when configuration property 'hibernate.search.backend.version_check.enabled' is set to 'false'", "the version is mandatory and must be at least as precise as 'x.y', where 'x' and 'y' are integers" ) - .build() ); } @@ -214,7 +212,7 @@ public void noVersionCheck_versionOverrideOnStart_incompatibleVersion() { assertThatThrownBy( () -> partialSetup.doSecondPhase( ConfigurationPropertySource.fromMap( runtimeProperties ) ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() .failure( "Invalid value for configuration property 'hibernate.search.backend.version': '" @@ -225,7 +223,6 @@ public void noVersionCheck_versionOverrideOnStart_incompatibleVersion() { + " when the backend was created.", "You can provide a more precise version on startup," + " but you cannot override the version that was provided when the backend was created." ) - .build() ); } diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/index/naming/ElasticsearchIndexNamingBaseIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/index/naming/ElasticsearchIndexNamingBaseIT.java index 83fb47f344c..121d20492b0 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/index/naming/ElasticsearchIndexNamingBaseIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/index/naming/ElasticsearchIndexNamingBaseIT.java @@ -42,13 +42,12 @@ public void nameConflict_aliasesOfSingleIndex() { "index2-write", "index2-read" ) ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( - FailureReportUtils.buildFailureReportPattern() + .satisfies( + FailureReportUtils.hasFailureReport() .indexContext( index1.name() ) .failure( "Invalid Elasticsearch index layout", "write alias and read alias are set to the same value: 'alias-conflicting'", "The write alias and read alias must be different" ) - .build() ); } @@ -104,15 +103,14 @@ private void setupExpectingCrossIndexNameConflict(String index1WriteAlias, Strin index2WriteAlias, index2ReadAlias ) ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( - FailureReportUtils.buildFailureReportPattern() + .satisfies( + FailureReportUtils.hasFailureReport() .failure( "Conflicting index names: Hibernate Search indexes '" + index1.name() + "' and '" + index2.name() + "' both target the Elasticsearch index name or alias '" + conflictingName + "'" ) - .build() ); } diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerTestUtils.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerTestUtils.java index f83ae2de9fc..81d53e2737f 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerTestUtils.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerTestUtils.java @@ -72,8 +72,8 @@ static String defaultMetadataMappingAndCommaForExpectations() { return mapping.isEmpty() ? "" : mapping + ", "; } - static FailureReportUtils.FailureReportPatternBuilder buildValidationFailureReportPattern() { - return FailureReportUtils.buildFailureReportPattern() + static FailureReportUtils.FailureReportChecker hasValidationFailureReport() { + return FailureReportUtils.hasFailureReport() .contextLiteral( STUB_CONTEXT_LITERAL ) .failure( "Validation of the existing index in the Elasticsearch cluster failed. See below for details." ); } diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAliasesIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAliasesIT.java index 61d900aaba7..d631acf7030 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAliasesIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAliasesIT.java @@ -7,7 +7,7 @@ package org.hibernate.search.integrationtest.backend.elasticsearch.schema.management; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.buildValidationFailureReportPattern; +import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.hasValidationFailureReport; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.simpleAliasDefinition; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.simpleMappingForInitialization; import static org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.ElasticsearchIndexMetadataTestUtils.defaultPrimaryName; @@ -99,11 +99,10 @@ public void writeAlias_missing() { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( - buildValidationFailureReportPattern() + .satisfies( + hasValidationFailureReport() .aliasContext( defaultWriteAlias( index.name() ).original ) .failure( "Missing alias" ) - .build() ); } @@ -122,12 +121,11 @@ public void writeAlias_invalid_filter() { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( - buildValidationFailureReportPattern() + .satisfies( + hasValidationFailureReport() .aliasContext( defaultWriteAlias( index.name() ).original ) .aliasAttributeContext( "filter" ) .failure( "Invalid value. Expected 'null', actual is '{\"term\":{\"user_id\":12}}'" ) - .build() ); } @@ -144,12 +142,11 @@ public void writeAlias_invalid_isWriteIndex() { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( - buildValidationFailureReportPattern() + .satisfies( + hasValidationFailureReport() .aliasContext( defaultWriteAlias( index.name() ).original ) .aliasAttributeContext( "is_write_index" ) .failure( "Invalid value. Expected 'true', actual is 'false'" ) - .build() ); } @@ -163,11 +160,10 @@ public void readAlias_missing() { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( - buildValidationFailureReportPattern() + .satisfies( + hasValidationFailureReport() .aliasContext( defaultReadAlias( index.name() ).original ) .failure( "Missing alias" ) - .build() ); } @@ -183,12 +179,11 @@ public void readAlias_invalid_filter() { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( - buildValidationFailureReportPattern() + .satisfies( + hasValidationFailureReport() .aliasContext( defaultReadAlias( index.name() ).original ) .aliasAttributeContext( "filter" ) .failure( "Invalid value. Expected 'null', actual is '{\"term\":{\"user_id\":12}}'" ) - .build() ); } diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAnalyzerIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAnalyzerIT.java index 636dac90bdd..0ca014cefd9 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAnalyzerIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAnalyzerIT.java @@ -7,7 +7,7 @@ package org.hibernate.search.integrationtest.backend.elasticsearch.schema.management; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.buildValidationFailureReportPattern; +import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.hasValidationFailureReport; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.simpleMappingForInitialization; import java.util.EnumSet; @@ -149,10 +149,9 @@ public void analyzer_missing() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .analyzerContext( "custom-analyzer" ) .failure( "Missing analyzer" ) - .build() ); } @@ -199,13 +198,12 @@ public void analyzer_charFilters_invalid() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .analyzerContext( "custom-analyzer" ) .failure( "Invalid char filters. Expected '[custom-pattern-replace]'," + " actual is '[html_strip]'" ) - .build() ); } @@ -252,13 +250,12 @@ public void analyzer_tokenizer_invalid() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .analyzerContext( "custom-analyzer" ) .failure( "Invalid tokenizer. Expected 'custom-edgeNGram'," + " actual is 'whitespace'" ) - .build() ); } @@ -305,13 +302,12 @@ public void analyzer_tokenFilters_invalid() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .analyzerContext( "custom-analyzer" ) .failure( "Invalid token filters. Expected '[custom-keep-types, custom-word-delimiter]'," + " actual is '[lowercase, custom-word-delimiter]'" ) - .build() ); } @@ -343,12 +339,11 @@ public void charFilter_missing() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .analyzerContext( "custom-analyzer" ) .failure( "Missing analyzer" ) .charFilterContext( "custom-pattern-replace" ) .failure( "Missing char filter" ) - .build() ); } @@ -381,12 +376,11 @@ public void tokenizer_missing() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .analyzerContext( "custom-analyzer" ) .failure( "Missing analyzer" ) .tokenizerContext( "custom-edgeNGram" ) .failure( "Missing tokenizer" ) - .build() ); } @@ -416,12 +410,11 @@ public void tokenFilter_missing() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .analyzerContext( "custom-analyzer" ) .failure( "Missing analyzer" ) .tokenFilterContext( "custom-keep-types" ) .failure( "Missing token filter" ) - .build() ); } @@ -468,12 +461,11 @@ public void charFilter_type_invalid() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .charFilterContext( "custom-pattern-replace" ) .failure( "Invalid type. Expected 'pattern_replace', actual is 'html_strip'" ) - .build() ); } @@ -520,13 +512,12 @@ public void charFilter_parameter_invalid() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .charFilterContext( "custom-pattern-replace" ) .analysisDefinitionParameterContext( "pattern" ) .failure( "Invalid value. Expected '\"[^0-9]\"', actual is '\"[^a-z]\"'" ) - .build() ); } @@ -573,13 +564,12 @@ public void charFilter_parameter_missing() throws Exception { putMapping(); setupAndValidateExpectingFailure( - FailureReportUtils.buildFailureReportPattern() + FailureReportUtils.hasFailureReport() .charFilterContext( "custom-pattern-replace" ) .analysisDefinitionParameterContext( "tags" ) .failure( "Invalid value. Expected '\"CASE_INSENSITIVE|COMMENTS\"', actual is 'null'" ) - .build() ); } @@ -627,20 +617,19 @@ public void tokenFilter_parameter_unexpected() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .tokenFilterContext( "custom-word-delimiter" ) .analysisDefinitionParameterContext( "generate_number_parts" ) .failure( "Invalid value. Expected 'null', actual is '\"false\"'" ) - .build() ); } - private void setupAndValidateExpectingFailure(String failureReportPattern) { + private void setupAndValidateExpectingFailure(FailureReportUtils.FailureReportChecker failureReportChecker) { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( failureReportPattern ); + .satisfies( failureReportChecker ); } private void setupAndValidate() { diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingAttributeIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingAttributeIT.java index 5543958061e..7eb328404ef 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingAttributeIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingAttributeIT.java @@ -7,7 +7,7 @@ package org.hibernate.search.integrationtest.backend.elasticsearch.schema.management; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.buildValidationFailureReportPattern; +import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.hasValidationFailureReport; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.defaultMetadataMappingAndCommaForInitialization; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.simpleMappingForInitialization; import static org.junit.Assume.assumeFalse; @@ -84,10 +84,9 @@ public void attribute_dynamic_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .mappingAttributeContext( "dynamic" ) - .failure( "Invalid value. Expected 'STRICT', actual is 'null'" ) - .build() ); + .failure( "Invalid value. Expected 'STRICT', actual is 'null'" ) ); } @Test @@ -112,10 +111,9 @@ public void attribute_dynamic_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .mappingAttributeContext( "dynamic" ) - .failure( "Invalid value. Expected 'STRICT', actual is 'FALSE'" ) - .build() ); + .failure( "Invalid value. Expected 'STRICT', actual is 'FALSE'" ) ); } @@ -134,12 +132,11 @@ public void attribute_properties_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "_entity_type" ) .failure( "Missing property mapping" ) .indexFieldContext( "myField" ) - .failure( "Missing property mapping" ) - .build() ); + .failure( "Missing property mapping" ) ); } @Test @@ -159,12 +156,11 @@ public void attribute_properties_empty() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "_entity_type" ) .failure( "Missing property mapping" ) .indexFieldContext( "myField" ) - .failure( "Missing property mapping" ) - .build() ); + .failure( "Missing property mapping" ) ); } @Test @@ -185,11 +181,10 @@ public void attribute_type_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "type" ) - .failure( "Invalid value. Expected 'integer', actual is 'keyword'" ) - .build() ); + .failure( "Invalid value. Expected 'integer', actual is 'keyword'" ) ); } @Test @@ -249,11 +244,10 @@ public void attribute_index_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "index" ) - .failure( "Invalid value. Expected 'true', actual is 'false'" ) - .build() ); + .failure( "Invalid value. Expected 'true', actual is 'false'" ) ); } @Test @@ -316,15 +310,14 @@ public void attribute_format_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "format" ) .failure( "The output format (the first element) is invalid." ) .failure( "Invalid formats", "missing elements are '" + allFormats + "'" - ) - .build() ); + ) ); } @Test @@ -374,14 +367,13 @@ public void attribute_format_incomplete() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "format" ) .failure( "Invalid formats", "missing elements are '" + nextFormats + "'" - ) - .build() ); + ) ); } @Test @@ -404,14 +396,13 @@ public void attribute_format_exceeding() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "format" ) .failure( "Invalid formats", "unexpected elements are '[yyyy]'" - ) - .build() ); + ) ); } @Test @@ -432,15 +423,14 @@ public void attribute_format_wrong() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "format" ) .failure( "The output format (the first element) is invalid. Expected '" + elasticSearchClient.getDialect().getFirstLocalDateDefaultMappingFormat() + "', actual is 'epoch_millis'" - ) - .build() ); + ) ); } @Test @@ -461,11 +451,10 @@ public void attribute_analyzer_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "analyzer" ) - .failure( "Invalid value. Expected 'keyword', actual is 'null'" ) - .build() ); + .failure( "Invalid value. Expected 'keyword', actual is 'null'" ) ); } @Test @@ -507,11 +496,10 @@ public void attribute_analyzer_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "analyzer" ) - .failure( "Invalid value. Expected 'default', actual is 'keyword'" ) - .build() ); + .failure( "Invalid value. Expected 'default', actual is 'keyword'" ) ); } @Test @@ -534,11 +522,10 @@ public void attribute_searchAnalyzer_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "search_analyzer" ) - .failure( "Invalid value. Expected 'italian', actual is 'null'" ) - .build() ); + .failure( "Invalid value. Expected 'italian', actual is 'null'" ) ); } @Test @@ -583,11 +570,10 @@ public void attribute_searchAnalyzer_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "search_analyzer" ) - .failure( "Invalid value. Expected 'italian', actual is 'english'" ) - .build() ); + .failure( "Invalid value. Expected 'italian', actual is 'english'" ) ); } @Test @@ -627,11 +613,10 @@ public void property_norms_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "norms" ) .failure( "Invalid value. Expected 'true', actual is 'false'" ) - .build() ); } @@ -729,11 +714,10 @@ public void property_termVector_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "term_vector" ) - .failure( "Invalid value. Expected 'yes', actual is 'with_offsets'" ) - .build() ); + .failure( "Invalid value. Expected 'yes', actual is 'with_offsets'" ) ); } @Test @@ -772,11 +756,10 @@ public void attribute_nullValue_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "null_value" ) - .failure( "Invalid value. Expected '739', actual is 'null'" ) - .build() ); + .failure( "Invalid value. Expected '739', actual is 'null'" ) ); } @Test @@ -797,11 +780,10 @@ public void attribute_nullValue_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "null_value" ) - .failure( "Invalid value. Expected '739', actual is '777'" ) - .build() ); + .failure( "Invalid value. Expected '739', actual is '777'" ) ); } @Test @@ -859,11 +841,10 @@ public void attribute_docValues_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "doc_values" ) - .failure( "Invalid value. Expected 'true', actual is 'false'" ) - .build() ); + .failure( "Invalid value. Expected 'true', actual is 'false'" ) ); } @Test @@ -943,11 +924,10 @@ public void attribute_scaling_factor_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "scaling_factor" ) - .failure( "Invalid value. Expected '100.0', actual is '2.0'" ) - .build() ); + .failure( "Invalid value. Expected '100.0', actual is '2.0'" ) ); } @Test @@ -968,11 +948,10 @@ public void attribute_normalizer_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "normalizer" ) - .failure( "Invalid value. Expected 'default', actual is 'null'" ) - .build() ); + .failure( "Invalid value. Expected 'default', actual is 'null'" ) ); } @Test @@ -1058,11 +1037,10 @@ public void attribute_normalizer_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( Exception.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldContext( "myField" ) .mappingAttributeContext( "normalizer" ) - .failure( "Invalid value. Expected 'another-normalizer', actual is 'custom-normalizer'" ) - .build() ); + .failure( "Invalid value. Expected 'another-normalizer', actual is 'custom-normalizer'" ) ); } private void setupAndValidate(StubMappedIndex index) { diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingBaseIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingBaseIT.java index 03f35f02fcf..7711622e141 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingBaseIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingBaseIT.java @@ -7,7 +7,7 @@ package org.hibernate.search.integrationtest.backend.elasticsearch.schema.management; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.buildValidationFailureReportPattern; +import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.hasValidationFailureReport; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.defaultMetadataMappingAndCommaForInitialization; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.simpleMappingForInitialization; import static org.junit.Assume.assumeTrue; @@ -23,6 +23,7 @@ import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.impl.Futures; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.rule.TestElasticsearchClient; +import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingSchemaManagementStrategy; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; @@ -156,9 +157,8 @@ public void mapping_missing() { setupAndValidateExpectingFailure( index, - buildValidationFailureReportPattern() + hasValidationFailureReport() .failure( "Missing type mapping" ) - .build() ); } @@ -180,10 +180,9 @@ public void attribute_field_notPresent() { setupAndValidateExpectingFailure( index, - buildValidationFailureReportPattern() + hasValidationFailureReport() .indexFieldContext( "myField" ) .failure( "Missing property mapping" ) - .build() ); } @@ -264,14 +263,13 @@ public void floatAndDouble_nullValue_invalids() { ); setupAndValidateExpectingFailure( index, - buildValidationFailureReportPattern() + hasValidationFailureReport() .indexFieldContext( "double" ) .mappingAttributeContext( "null_value" ) .failure( "Invalid value. Expected '1.7', actual is '1.9'" ) .indexFieldContext( "float" ) .mappingAttributeContext( "null_value" ) .failure( "Invalid value. Expected '1.7', actual is '1.9'" ) - .build() ); } @@ -303,14 +301,13 @@ public void floatAndDouble_nullValue_invalids_notNumbers() { ); setupAndValidateExpectingFailure( index, - buildValidationFailureReportPattern() + hasValidationFailureReport() .indexFieldContext( "double" ) .mappingAttributeContext( "null_value" ) .failure( "Invalid value. Expected '\"BBB\"', actual is '1.9'" ) .indexFieldContext( "float" ) .mappingAttributeContext( "null_value" ) .failure( "Invalid value. Expected '\"AAA\"', actual is '1.9'" ) - .build() ); } @@ -346,11 +343,10 @@ public void nestedProperty_attribute_invalid() { setupAndValidateExpectingFailure( index, - buildValidationFailureReportPattern() + hasValidationFailureReport() .indexFieldContext( "myObjectField.myField" ) .mappingAttributeContext( "index" ) .failure( "Invalid value. Expected 'true', actual is 'false'" ) - .build() ); } @@ -376,7 +372,7 @@ public void multipleErrors() { setupAndValidateExpectingFailure( index, - buildValidationFailureReportPattern() + hasValidationFailureReport() .mappingAttributeContext( "dynamic" ) .failure( "Invalid value. Expected 'STRICT', actual is 'FALSE'" @@ -386,14 +382,13 @@ public void multipleErrors() { .failure( "Invalid value. Expected 'keyword', actual is 'integer'" ) - .build() ); } - private void setupAndValidateExpectingFailure(StubMappedIndex index, String failureReportRegex) { + private void setupAndValidateExpectingFailure(StubMappedIndex index, FailureReportUtils.FailureReportChecker failureReportChecker) { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( failureReportRegex ); + .satisfies( failureReportChecker ); } private void setupAndValidate(StubMappedIndex index) { diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingFieldTemplateIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingFieldTemplateIT.java index 7652ab57cd1..1ca1bf76b36 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingFieldTemplateIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingFieldTemplateIT.java @@ -7,7 +7,7 @@ package org.hibernate.search.integrationtest.backend.elasticsearch.schema.management; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.buildValidationFailureReportPattern; +import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.hasValidationFailureReport; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.defaultMetadataMappingForInitialization; import java.util.EnumSet; @@ -128,10 +128,9 @@ public void missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate2" ) - .failure( "Missing dynamic field template" ) - .build() ); + .failure( "Missing dynamic field template" ) ); } @Test @@ -171,10 +170,9 @@ public void extra() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "extraTemplate" ) - .failure( "Unexpected dynamic field template" ) - .build() ); + .failure( "Unexpected dynamic field template" ) ); } @Test @@ -210,13 +208,12 @@ public void wrongOrder() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .failure( "Invalid order for dynamic field templates", "Expected [myTemplate1, myTemplate2, myTemplate3]", "actual is [myTemplate2, myTemplate1, myTemplate3]" - ) - .build() ); + ) ); } @Test @@ -246,13 +243,12 @@ public void duplicate() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate1" ) .failure( "Multiple dynamic field templates with this name", "The names of dynamic field template must be unique" - ) - .build() ); + ) ); } @Test @@ -279,11 +275,10 @@ public void attribute_pathMatch_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate" ) .fieldTemplateAttributeContext( "path_match" ) - .failure( "Invalid value. Expected '*_suffix', actual is 'null'" ) - .build() ); + .failure( "Invalid value. Expected '*_suffix', actual is 'null'" ) ); } @Test @@ -311,11 +306,10 @@ public void attribute_pathMatch_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate" ) .fieldTemplateAttributeContext( "path_match" ) - .failure( "Invalid value. Expected '*_suffix', actual is '*_suffix2'" ) - .build() ); + .failure( "Invalid value. Expected '*_suffix', actual is '*_suffix2'" ) ); } @Test @@ -341,11 +335,10 @@ public void attribute_pathMatch_extra() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate" ) .fieldTemplateAttributeContext( "path_match" ) - .failure( "Invalid value. Expected '*', actual is '*_suffix'" ) - .build() ); + .failure( "Invalid value. Expected '*', actual is '*_suffix'" ) ); } @Test @@ -371,11 +364,10 @@ public void attribute_matchMappingType_missing() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate" ) .fieldTemplateAttributeContext( "match_mapping_type" ) - .failure( "Invalid value. Expected 'object', actual is 'null'" ) - .build() ); + .failure( "Invalid value. Expected 'object', actual is 'null'" ) ); } @Test @@ -402,11 +394,10 @@ public void attribute_matchMappingType_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate" ) .fieldTemplateAttributeContext( "match_mapping_type" ) - .failure( "Invalid value. Expected 'object', actual is 'long'" ) - .build() ); + .failure( "Invalid value. Expected 'object', actual is 'long'" ) ); } @Test @@ -433,11 +424,10 @@ public void attribute_matchMappingType_extra() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate" ) .fieldTemplateAttributeContext( "match_mapping_type" ) - .failure( "Invalid value. Expected 'null', actual is 'long'" ) - .build() ); + .failure( "Invalid value. Expected 'null', actual is 'long'" ) ); } @Test @@ -464,11 +454,10 @@ public void attribute_extra() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate" ) .fieldTemplateAttributeContext( "match" ) - .failure( "Invalid value. Expected 'null', actual is '\"*_suffix\"'" ) - .build() ); + .failure( "Invalid value. Expected 'null', actual is '\"*_suffix\"'" ) ); } @Test @@ -494,12 +483,11 @@ public void mapping_invalid() { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( buildValidationFailureReportPattern() + .satisfies( hasValidationFailureReport() .indexFieldTemplateContext( "myTemplate" ) .fieldTemplateAttributeContext( "mapping" ) .mappingAttributeContext( "type" ) - .failure( "Invalid value. Expected 'keyword', actual is 'integer'" ) - .build() ); + .failure( "Invalid value. Expected 'keyword', actual is 'integer'" ) ); } private void setupAndValidate(StubMappedIndex index) { diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationNormalizerIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationNormalizerIT.java index bc324f77a4b..a3ff355b9fe 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationNormalizerIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationNormalizerIT.java @@ -7,7 +7,7 @@ package org.hibernate.search.integrationtest.backend.elasticsearch.schema.management; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.buildValidationFailureReportPattern; +import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.hasValidationFailureReport; import static org.hibernate.search.integrationtest.backend.elasticsearch.schema.management.ElasticsearchIndexSchemaManagerTestUtils.simpleMappingForInitialization; import java.util.EnumSet; @@ -18,6 +18,7 @@ import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.impl.Futures; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.rule.TestElasticsearchClient; +import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingSchemaManagementStrategy; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; @@ -111,17 +112,16 @@ public void normalizer_missing() throws Exception { putMapping(); setupAndValidateExpectingFailure( - buildValidationFailureReportPattern() + hasValidationFailureReport() .normalizerContext( "custom-normalizer" ) .failure( "Missing normalizer" ) - .build() ); } - private void setupAndValidateExpectingFailure(String failureReportPattern) { + private void setupAndValidateExpectingFailure(FailureReportUtils.FailureReportChecker failureReportChecker) { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( failureReportPattern ); + .satisfies( failureReportChecker ); } private void setupAndValidate() { diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneDocumentModelDslIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneDocumentModelDslIT.java index 9d466723df8..db2d0ba7367 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneDocumentModelDslIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneDocumentModelDslIT.java @@ -37,11 +37,10 @@ public void unknownAnalyzer() { "Referencing an unknown analyzer" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) - .failure( "Unknown analyzer" ) - .build() ); + .failure( "Unknown analyzer" ) ); } @Test @@ -54,11 +53,10 @@ public void unknownNormalizer() { "Referencing an unknown analyzer" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) - .failure( "Unknown normalizer" ) - .build() ); + .failure( "Unknown normalizer" ) ); } @Test @@ -72,11 +70,10 @@ public void unknownSearchAnalyzer() { "Referencing an unknown search analyzer" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) - .failure( "Unknown analyzer" ) - .build() ); + .failure( "Unknown analyzer" ) ); } private void setup(Consumer mappingContributor) { diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/analysis/LuceneAnalysisConfigurerIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/analysis/LuceneAnalysisConfigurerIT.java index 448b738f8cc..e92acdb3e93 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/analysis/LuceneAnalysisConfigurerIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/analysis/LuceneAnalysisConfigurerIT.java @@ -37,7 +37,7 @@ public void error_invalidReference() { () -> setup( "foobar" ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() .failure( ANALYSIS_CONFIGURER_ERROR_MESSAGE_PREFIX, @@ -45,7 +45,6 @@ public void error_invalidReference() { + LuceneBackendSettings.ANALYSIS_CONFIGURER + "': 'foobar'", "Unable to load class 'foobar'" ) - .build() ); } @@ -55,13 +54,12 @@ public void error_failingConfigurer() { () -> setup( FailingConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() .failure( ANALYSIS_CONFIGURER_ERROR_MESSAGE_PREFIX, FailingConfigurer.FAILURE_MESSAGE ) - .build() ); } @@ -85,7 +83,7 @@ public void error_parameter_namingConflict() { () -> setup( ParameterNamingConflictConfigurer.class.getName() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() .failure( ANALYSIS_CONFIGURER_ERROR_MESSAGE_PREFIX, @@ -93,7 +91,6 @@ public void error_parameter_namingConflict() { "'value1'", "'value2'" ) - .build() ); } diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/AbstractBuiltInDirectoryIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/AbstractBuiltInDirectoryIT.java index fefd1c13737..84f4330d384 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/AbstractBuiltInDirectoryIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/AbstractBuiltInDirectoryIT.java @@ -86,14 +86,13 @@ public void lockingStrategy_invalid() { "some_invalid_name" ) ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .indexContext( index.name() ) .failure( "Invalid locking strategy name", "'some_invalid_name'", "Valid names are: [simple-filesystem, native-filesystem, single-instance, none]" ) - .build() ); testValidLockingStrategy( "none", NO_LOCK_FQN ); } @@ -144,13 +143,12 @@ private void testInvalidFSLockingStrategy(String strategyName) { strategyName ) ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .indexContext( index.name() ) .failure( "Unable to initialize index directory", "can only be used with FSDirectory subclasses" ) - .build() ); } diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/CustomDirectoryIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/CustomDirectoryIT.java index 4f65a65fc4c..091bcebd3dc 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/CustomDirectoryIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/CustomDirectoryIT.java @@ -62,7 +62,7 @@ public void invalid() { String invalidDirectoryType = "someInvalidDirectoryType"; assertThatThrownBy( () -> setup( "someInvalidDirectoryType", c -> c.expectCustomBeans() ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .indexContext( index.name() ) .failure( "Invalid value for configuration property 'hibernate.search.backend.directory.type': '" @@ -71,9 +71,7 @@ public void invalid() { + "' and name '" + invalidDirectoryType + "' in Hibernate Search's internal registry", "Unable to load class '" + invalidDirectoryType + "'" - ) - .build() - ); + ) ); } public static class CustomDirectoryProvider implements DirectoryProvider { diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/LuceneLocalFileSystemDirectoryIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/LuceneLocalFileSystemDirectoryIT.java index 6caae3ab6e6..e737dca4f8e 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/LuceneLocalFileSystemDirectoryIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/LuceneLocalFileSystemDirectoryIT.java @@ -112,14 +112,13 @@ public void filesystemAccessStrategy_invalid() { "some_invalid_name" ) ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .indexContext( index.name() ) .failure( "Invalid filesystem access strategy name", "'some_invalid_name'", "Valid names are: [auto, simple, nio, mmap]" ) - .build() ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldIT.java index 5bf641a2c6b..f8eb3865a47 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldIT.java @@ -48,12 +48,11 @@ public void nullFieldName() { "Null field name on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Invalid index field name 'null': field names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field name 'null': field names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -64,12 +63,11 @@ public void nullFieldName() { "Null field name on non-root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) - .failure( "Invalid index field name 'null': field names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field name 'null': field names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -79,12 +77,11 @@ public void nullFieldName() { "Null object field name on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Invalid index field name 'null': field names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field name 'null': field names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -95,12 +92,11 @@ public void nullFieldName() { ) .isInstanceOf( SearchException.class ) .hasMessageContaining( "Invalid index field name 'null': field names cannot be null or empty" ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) - .failure( "Invalid index field name 'null': field names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field name 'null': field names cannot be null or empty" ) ); } @Test @@ -113,12 +109,11 @@ public void emptyFieldName() { "empty field name on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Invalid index field name '': field names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field name '': field names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -128,12 +123,11 @@ public void emptyFieldName() { "empty field name on non-root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) - .failure( "Invalid index field name '': field names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field name '': field names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -143,12 +137,11 @@ public void emptyFieldName() { "empty object field name on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Invalid index field name '': field names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field name '': field names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -158,12 +151,11 @@ public void emptyFieldName() { "empty object field name on non-root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) - .failure( "Invalid index field name '': field names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field name '': field names cannot be null or empty" ) ); } @Test @@ -176,7 +168,7 @@ public void dotInFieldName() { "field name containing a dot on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() @@ -185,8 +177,7 @@ public void dotInFieldName() { " Remove the dot from your field name", "if you are declaring the field in a bridge and want a tree of fields,", " declare an object field using the objectField() method." - ) - .build() ); + ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -196,7 +187,7 @@ public void dotInFieldName() { "field name containing a dot on non-root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) @@ -205,8 +196,7 @@ public void dotInFieldName() { " Remove the dot from your field name", "if you are declaring the field in a bridge and want a tree of fields,", " declare an object field using the objectField() method." - ) - .build() ); + ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -216,7 +206,7 @@ public void dotInFieldName() { "object field name containing a dot on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() @@ -225,8 +215,7 @@ public void dotInFieldName() { " Remove the dot from your field name", "if you are declaring the field in a bridge and want a tree of fields,", " declare an object field using the objectField() method." - ) - .build() ); + ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -236,7 +225,7 @@ public void dotInFieldName() { "object field name containing a dot on non-root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) @@ -245,8 +234,7 @@ public void dotInFieldName() { " Remove the dot from your field name", "if you are declaring the field in a bridge and want a tree of fields,", " declare an object field using the objectField() method." - ) - .build() ); + ) ); } @Test @@ -260,12 +248,11 @@ public void nameCollision_fields() { "Name collision between two fields on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Duplicate index field definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field definition: 'field1'" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -278,12 +265,11 @@ public void nameCollision_fields() { "Name collision between two fields on non-root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "object1.object2" ) - .failure( "Duplicate index field definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field definition: 'field1'" ) ); } @Test @@ -297,12 +283,11 @@ public void nameCollision_objectFields() { "Name collision between two object fields on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Duplicate index field definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field definition: 'field1'" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -315,12 +300,11 @@ public void nameCollision_objectFields() { "Name collision between two object fields on non-root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "object1.object2" ) - .failure( "Duplicate index field definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field definition: 'field1'" ) ); } @Test @@ -334,12 +318,11 @@ public void nameCollision_fieldAndObjectField() { "Name collision between two fields on root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Duplicate index field definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field definition: 'field1'" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -352,12 +335,11 @@ public void nameCollision_fieldAndObjectField() { "Name collision between two fields (object and non-object) on non-root" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "object1.object2" ) - .failure( "Duplicate index field definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field definition: 'field1'" ) ); } @Test @@ -370,12 +352,11 @@ public void missingToReferenceCall() { "Missing toReference() call after field()" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "myField" ) - .failure( "Incomplete field definition" ) - .build() ); + .failure( "Incomplete field definition" ) ); assertThatThrownBy( () -> setup( ctx -> { IndexSchemaElement root = ctx.schemaElement(); @@ -384,12 +365,11 @@ public void missingToReferenceCall() { "Missing toReference() call after objectField()" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "myField" ) - .failure( "Incomplete field definition" ) - .build() ); + .failure( "Incomplete field definition" ) ); } @Test @@ -407,12 +387,11 @@ public void multipleToReferenceCall() { "Multiple toReference() calls after field()" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "myField" ) - .failure( "Multiple calls to toReference() for the same field definition" ) - .build() ); + .failure( "Multiple calls to toReference() for the same field definition" ) ); assertThatThrownBy( () -> setup( ctx -> { IndexSchemaElement root = ctx.schemaElement(); @@ -423,12 +402,11 @@ public void multipleToReferenceCall() { "Multiple toReference() calls after objectField()" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "myField" ) - .failure( "Multiple calls to toReference() for the same field definition" ) - .build() ); + .failure( "Multiple calls to toReference() for the same field definition" ) ); } private IndexFieldTypeFinalStep irrelevantTypeContributor(IndexFieldTypeFactory factoryContext) { diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldTemplateIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldTemplateIT.java index 8d3cc9423ff..357c56469fb 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldTemplateIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldTemplateIT.java @@ -46,12 +46,11 @@ public void nullName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Invalid index field template name 'null': field template names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field template name 'null': field template names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -61,12 +60,11 @@ public void nullName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) - .failure( "Invalid index field template name 'null': field template names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field template name 'null': field template names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -75,12 +73,11 @@ public void nullName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Invalid index field template name 'null': field template names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field template name 'null': field template names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -89,12 +86,11 @@ public void nullName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) - .failure( "Invalid index field template name 'null': field template names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field template name 'null': field template names cannot be null or empty" ) ); } @Test @@ -106,12 +102,11 @@ public void emptyName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Invalid index field template name '': field template names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field template name '': field template names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -120,12 +115,11 @@ public void emptyName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) - .failure( "Invalid index field template name '': field template names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field template name '': field template names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -134,12 +128,11 @@ public void emptyName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Invalid index field template name '': field template names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field template name '': field template names cannot be null or empty" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -148,12 +141,11 @@ public void emptyName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) - .failure( "Invalid index field template name '': field template names cannot be null or empty" ) - .build() ); + .failure( "Invalid index field template name '': field template names cannot be null or empty" ) ); } @Test @@ -165,14 +157,13 @@ public void dotInName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() .failure( "Invalid index field template name 'foo.bar': field template names cannot contain a dot ('.')." - ) - .build() ); + ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -181,14 +172,13 @@ public void dotInName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) .failure( "Invalid index field template name 'foo.bar': field template names cannot contain a dot ('.')." - ) - .build() ); + ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -197,14 +187,13 @@ public void dotInName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() .failure( "Invalid index field template name 'foo.bar': field template names cannot contain a dot ('.')." - ) - .build() ); + ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -213,14 +202,13 @@ public void dotInName() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "nonRoot" ) .failure( "Invalid index field template name 'foo.bar': field template names cannot contain a dot ('.')." - ) - .build() ); + ) ); } @Test @@ -233,12 +221,11 @@ public void nameCollision_fieldTemplates() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Duplicate index field template definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field template definition: 'field1'" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -250,12 +237,11 @@ public void nameCollision_fieldTemplates() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "object1.object2" ) - .failure( "Duplicate index field template definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field template definition: 'field1'" ) ); } @Test @@ -268,12 +254,11 @@ public void nameCollision_objectFieldTemplates() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Duplicate index field template definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field template definition: 'field1'" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -285,12 +270,11 @@ public void nameCollision_objectFieldTemplates() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "object1.object2" ) - .failure( "Duplicate index field template definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field template definition: 'field1'" ) ); } @Test @@ -303,12 +287,11 @@ public void nameCollision_fieldTemplateAndObjectFieldTemplate() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexSchemaRootContext() - .failure( "Duplicate index field template definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field template definition: 'field1'" ) ); assertThatThrownBy( () -> setup( ctx -> { @@ -320,12 +303,11 @@ public void nameCollision_fieldTemplateAndObjectFieldTemplate() { } ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .indexFieldContext( "object1.object2" ) - .failure( "Duplicate index field template definition: 'field1'" ) - .build() ); + .failure( "Duplicate index field template definition: 'field1'" ) ); } private IndexFieldTypeFinalStep irrelevantTypeContributor(IndexFieldTypeFactory factoryContext) { diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementTypeIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementTypeIT.java index 0a324596160..31a904b0064 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementTypeIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementTypeIT.java @@ -53,7 +53,7 @@ public void analyzerOnSortableField() { "Setting an analyzer on sortable field" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .failure( @@ -66,8 +66,7 @@ public void analyzerOnSortableField() { "If you need an actual analyzer (with tokenization), define two separate fields:" + " one with an analyzer that is not sortable," + " and one with a normalizer that is sortable" - ) - .build() ); + ) ); } @Test @@ -86,7 +85,7 @@ public void analyzerOnAggregableField() { "Setting an analyzer on aggregable field" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .failure( @@ -100,8 +99,7 @@ public void analyzerOnAggregableField() { "If you need an actual analyzer (with tokenization), define two separate fields:" + " one with an analyzer that is not aggregable," + " and one with a normalizer that is aggregable." - ) - .build() ); + ) ); } @Test @@ -120,7 +118,7 @@ public void analyzerAndNormalizer() { "Setting an analyzer and a normalizer on the same field" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .failure( @@ -128,8 +126,7 @@ public void analyzerAndNormalizer() { "'" + DefaultAnalysisDefinitions.ANALYZER_STANDARD_ENGLISH.name + "'", "'" + DefaultAnalysisDefinitions.NORMALIZER_LOWERCASE.name + "'", "Either an analyzer or a normalizer can be assigned, but not both" - ) - .build() ); + ) ); } @Test @@ -147,7 +144,7 @@ public void searchAnalyzerWithoutAnalyzer() { "Setting a search analyzer, without setting an analyzer on the same field" ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( index.typeName() ) .indexContext( index.name() ) .failure( @@ -155,8 +152,7 @@ public void searchAnalyzerWithoutAnalyzer() { + DefaultAnalysisDefinitions.ANALYZER_STANDARD_ENGLISH.name + "'" + " is assigned to this type, but the indexing analyzer is missing.", "Assign an indexing analyzer and a search analyzer, or remove the search analyzer" - ) - .build() ); + ) ); } private void setup(Consumer mappingContributor) { diff --git a/integrationtest/mapper/orm-cdi/src/test/java/org/hibernate/search/integrationtest/mapper/orm/cdi/CdiExtendedBeanManagerBootstrapShutdownIT.java b/integrationtest/mapper/orm-cdi/src/test/java/org/hibernate/search/integrationtest/mapper/orm/cdi/CdiExtendedBeanManagerBootstrapShutdownIT.java index d7e97b25846..12f1abe8ad8 100644 --- a/integrationtest/mapper/orm-cdi/src/test/java/org/hibernate/search/integrationtest/mapper/orm/cdi/CdiExtendedBeanManagerBootstrapShutdownIT.java +++ b/integrationtest/mapper/orm-cdi/src/test/java/org/hibernate/search/integrationtest/mapper/orm/cdi/CdiExtendedBeanManagerBootstrapShutdownIT.java @@ -144,10 +144,9 @@ public void failedBoot() { // But once the bean manager is ready... assertThatThrownBy( () -> extendedBeanManager.simulateBoot( DependentBean.class ) ) // Hibernate Search should have attempted to boot, but failed. - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() - .failure( bootFailedException.getMessage() ) - .build() ); + .failure( bootFailedException.getMessage() ) ); // Hibernate Search should have started to boot, then shut down. backendMock.verifyExpectationsMet(); diff --git a/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/bootstrap/BackendTypeAutoDetectMultipleBackendTypesInClasspathIT.java b/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/bootstrap/BackendTypeAutoDetectMultipleBackendTypesInClasspathIT.java index 56d1db390de..f8daa110296 100644 --- a/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/bootstrap/BackendTypeAutoDetectMultipleBackendTypesInClasspathIT.java +++ b/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/bootstrap/BackendTypeAutoDetectMultipleBackendTypesInClasspathIT.java @@ -60,14 +60,13 @@ public void backendType_notSet() { .withBackendProperty( "type", null ) .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .defaultBackendContext() .failure( "Ambiguous backend type", "configuration property 'hibernate.search.backend.type' is not set," + " and multiple backend types are present in the classpath", "Set property 'hibernate.search.backend.type' to one of the following" - + " to select the backend type: [elasticsearch, lucene]" ) - .build() ); + + " to select the backend type: [elasticsearch, lucene]" ) ); } @Test diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/massindexing/AbstractMassIndexingFailureIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/massindexing/AbstractMassIndexingFailureIT.java index 2f2340a5638..6d55d4d769d 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/massindexing/AbstractMassIndexingFailureIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/massindexing/AbstractMassIndexingFailureIT.java @@ -276,10 +276,9 @@ public void dropAndCreateSchema_exception() { Search.mapping( sessionFactory ).scope( Object.class ).massIndexer().dropAndCreateSchemaOnStart( true ), ThreadExpectation.NOT_CREATED, throwable -> assertThat( throwable ).isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( Book.class.getName() ) - .failure( exceptionMessage ) - .build() ), + .failure( exceptionMessage ) ), expectSchemaManagementWorkException( StubSchemaManagementWork.Type.DROP_AND_CREATE ) ); diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java index c2fb98b54f3..a9a61936eb2 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java @@ -52,16 +52,14 @@ public void withoutDerivedFrom() { assertThatThrownBy( () -> ormSetupHelper.start().setup( EntityWithoutDerivedFrom.class ) ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( EntityWithoutDerivedFrom.class.getName() ) .failure( "Unable to resolve path '.APlusB' to a persisted attribute in Hibernate ORM metadata.", "If this path points to a transient attribute, use @IndexingDependency(derivedFrom = ...)" + " to specify which persisted attributes it is derived from.", "See the reference documentation for more information" - ) - .build() - ); + ) ); } @Test diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerSimpleOperationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerSimpleOperationIT.java index ebff0d4d4f2..15eed379c5c 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerSimpleOperationIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerSimpleOperationIT.java @@ -105,10 +105,9 @@ public void exception_single() { assertThatThrownBy( () -> execute( manager ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity2.class.getName() ) - .failure( "My exception" ) - .build() ); + .failure( "My exception" ) ); } @Test @@ -124,12 +123,11 @@ public void exception_multiple() { assertThatThrownBy( () -> execute( manager ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity1.class.getName() ) .failure( "My exception 1" ) .typeContext( IndexedEntity2.class.getName() ) - .failure( "My exception 2" ) - .build() ); + .failure( "My exception 2" ) ); } protected abstract void execute(SearchSchemaManager manager); diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerValidatingSimpleOperationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerValidatingSimpleOperationIT.java index 50297e29c41..9e6a2e5d890 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerValidatingSimpleOperationIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerValidatingSimpleOperationIT.java @@ -34,10 +34,9 @@ public void failure_single() { assertThatThrownBy( () -> execute( manager ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity2.class.getName() ) - .failure( "My failure" ) - .build() ); + .failure( "My failure" ) ); } @Test @@ -57,12 +56,11 @@ public void failure_multiple() { assertThatThrownBy( () -> execute( manager ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity1.class.getName() ) .failure( "My failure 1" ) .typeContext( IndexedEntity2.class.getName() ) - .failure( "My failure 2" ) - .build() ); + .failure( "My failure 2" ) ); } @Test @@ -80,11 +78,10 @@ public void failure_exception() { assertThatThrownBy( () -> execute( manager ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity1.class.getName() ) .failure( "My failure" ) - .failure( "My exception" ) - .build() ); + .failure( "My exception" ) ); } } diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyIT.java index af6f36a1539..ec7dd9b280e 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyIT.java @@ -75,10 +75,9 @@ public void exception_single() { assertThatThrownBy( this::setup ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity2.class.getName() ) - .failure( "My exception" ) - .build() ); + .failure( "My exception" ) ); } @Test @@ -90,12 +89,11 @@ public void exception_multiple() { assertThatThrownBy( this::setup ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity1.class.getName() ) .failure( "My exception 1" ) .typeContext( IndexedEntity2.class.getName() ) - .failure( "My exception 2" ) - .build() ); + .failure( "My exception 2" ) ); } protected abstract SchemaManagementStrategyName getStrategyName(); diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyValidatingIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyValidatingIT.java index 86a0700ed2d..205f7d95eb5 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyValidatingIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyValidatingIT.java @@ -27,10 +27,9 @@ public void failure_single() { assertThatThrownBy( this::setup ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity2.class.getName() ) - .failure( "My failure" ) - .build() ); + .failure( "My failure" ) ); } @Test @@ -46,12 +45,11 @@ public void failure_multiple() { assertThatThrownBy( this::setup ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity1.class.getName() ) .failure( "My failure 1" ) .typeContext( IndexedEntity2.class.getName() ) - .failure( "My failure 2" ) - .build() ); + .failure( "My failure 2" ) ); } @Test @@ -65,11 +63,10 @@ public void failure_exception() { assertThatThrownBy( this::setup ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity1.class.getName() ) .failure( "My failure" ) - .failure( "My exception" ) - .build() ); + .failure( "My exception" ) ); } } diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java index aef03aee9f9..c1ebf54a394 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java @@ -160,7 +160,7 @@ public void default_associationInverseSideUnknown() { .setup() ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( ParentEntity.class.getName() ) .pathContext( ".child.value" ) .failure( @@ -169,9 +169,7 @@ public void default_associationInverseSideUnknown() { "Hibernate Search needs this information in order to reindex '" + ParentEntity.class.getName() + "' when '" + ChildEntity.class.getName() + "' is modified." - ) - .build() - ); + ) ); } /** * If ReindexOnUpdate.NO is the default, diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/alternative/AlternativeBinderIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/alternative/AlternativeBinderIT.java index cc079c0d3b3..a4238538954 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/alternative/AlternativeBinderIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/alternative/AlternativeBinderIT.java @@ -117,14 +117,12 @@ class IndexedEntity { .expectCustomBeans() .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "No property annotated with @Alternative(id = null).", "There must be exactly one such property in order to map property 'text' to multi-alternative fields." ) .failure( "No property annotated with @Alternative(id = null).", - "There must be exactly one such property in order to map property 'title' to multi-alternative fields." ) - .build() - ); + "There must be exactly one such property in order to map property 'title' to multi-alternative fields." ) ); } @Test @@ -147,13 +145,11 @@ class IndexedEntity { .expectCustomBeans() .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Multiple properties annotated with @Alternative(id = null).", "There must be exactly one such property in order to map property 'text' to multi-alternative fields." ) .failure( "Multiple properties annotated with @Alternative(id = null).", - "There must be exactly one such property in order to map property 'title' to multi-alternative fields." ) - .build() - ); + "There must be exactly one such property in order to map property 'title' to multi-alternative fields." ) ); } } diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomPropertyMappingAnnotationBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomPropertyMappingAnnotationBaseIT.java index 3f3ea3a713e..d66ee176a8a 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomPropertyMappingAnnotationBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomPropertyMappingAnnotationBaseIT.java @@ -104,12 +104,10 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .annotationTypeContext( AnnotationWithEmptyProcessorRef.class ) .failure( "Empty annotation processor reference in meta-annotation '" - + PropertyMapping.class.getName() + "'" ) - .build() - ); + + PropertyMapping.class.getName() + "'" ) ); } @Retention(RetentionPolicy.RUNTIME) @@ -128,13 +126,11 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .annotationTypeContext( AnnotationWithProcessorWithDifferentAnnotationType.class ) .failure( "Invalid annotation processor: '" + DifferentAnnotationType.Processor.TO_STRING + "'", "This processor expects annotations of a different type: '" - + DifferentAnnotationType.class.getName() + "'" ) - .build() - ); + + DifferentAnnotationType.class.getName() + "'" ) ); } @Retention(RetentionPolicy.RUNTIME) diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomTypeMappingAnnotationBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomTypeMappingAnnotationBaseIT.java index fabad45ad25..b16b8383daf 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomTypeMappingAnnotationBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomTypeMappingAnnotationBaseIT.java @@ -99,12 +99,10 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .annotationTypeContext( AnnotationWithEmptyProcessorRef.class ) .failure( "Empty annotation processor reference in meta-annotation '" - + TypeMapping.class.getName() + "'" ) - .build() - ); + + TypeMapping.class.getName() + "'" ) ); } @Retention(RetentionPolicy.RUNTIME) @@ -123,13 +121,11 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .annotationTypeContext( AnnotationWithProcessorWithDifferentAnnotationType.class ) .failure( "Invalid annotation processor: '" + DifferentAnnotationType.Processor.TO_STRING + "'", "This processor expects annotations of a different type: '" - + DifferentAnnotationType.class.getName() + "'" ) - .build() - ); + + DifferentAnnotationType.class.getName() + "'" ) ); } @Retention(RetentionPolicy.RUNTIME) diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DependencyIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DependencyIT.java index cdf221d1b3e..90ca05c6d1b 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DependencyIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DependencyIT.java @@ -52,14 +52,13 @@ public IndexedEntity getOther() { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".other" ) .annotationContextAnyParameters( AssociationInverseSide.class ) .failure( "@AssociationInverseSide.inversePath is empty" ) - .build() ); } @@ -79,14 +78,13 @@ public String getDerived() { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".derived" ) .annotationContextAnyParameters( IndexingDependency.class ) .failure( "@IndexingDependency.derivedFrom contains an empty path" ) - .build() ); } @@ -106,13 +104,11 @@ public String getDerived() { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".derived" ) .failure( "No readable property named 'invalidPath' on type '" - + IndexedEntity.class.getName() + "'" ) - .build() - ); + + IndexedEntity.class.getName() + "'" ) ); } @Test @@ -162,7 +158,7 @@ public String getDerivedC() { .setup() ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( DerivedFromCycle.A.class.getName() ) .pathContext( ".derivedA" ) .failure( "Unable to resolve dependencies of a derived property:" @@ -170,9 +166,7 @@ public String getDerivedC() { + " on type '" + DerivedFromCycle.A.class.getName() + "'", "A derived property cannot be marked as derived from itself", "you should consider disabling automatic reindexing" - ) - .build() - ); + ) ); } @Test @@ -246,7 +240,7 @@ class B { ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( CannotInvertAssociation.A.class.getName() ) .pathContext( ".embedded.b.text" ) .failure( @@ -262,9 +256,7 @@ class B { + CannotInvertAssociation.A.class.getName() + "' when '" + CannotInvertAssociation.B.class.getName() + "' is modified", "@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)" - ) - .build() - ); + ) ); } @Test diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdBaseIT.java index 4d62299ed18..b8c7c715f14 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdBaseIT.java @@ -51,13 +51,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "No default identifier bridge implementation for type '" + Object.class.getName() + "'", - "Use a custom bridge" ) - .build() - ); + "Use a custom bridge" ) ); } @Test @@ -72,13 +70,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "No default identifier bridge implementation for type 'java.lang.Enum'", - "Use a custom bridge" ) - .build() - ); + "Use a custom bridge" ) ); } @Test @@ -92,12 +88,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "No default identifier bridge implementation for type 'java.lang.Enum'", "Use a custom bridge" ) - .build() ); } @@ -112,14 +107,12 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "No default identifier bridge implementation for type 'java.lang.Enum<" + EnumForEnumSuperClassTest.class.getName() + ">'", - "Use a custom bridge" ) - .build() - ); + "Use a custom bridge" ) ); } enum EnumForEnumSuperClassTest { @@ -138,14 +131,12 @@ class IndexedEntity { () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "Invalid bridge for input type '" + Integer.class.getName() + "': '" + MyStringBridge.TOSTRING + "'", - "This bridge expects an input of type '" + String.class.getName() + "'." ) - .build() - ); + "This bridge expects an input of type '" + String.class.getName() + "'." ) ); } public static class MyStringBridge implements IdentifierBridge { @@ -175,13 +166,12 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "Invalid bridge for input type '" + Object.class.getName() + "': '" + MyNumberBridge.TOSTRING + "'", - "This bridge expects an input of type '" + Number.class.getName() + "'" ) - .build() ); + "This bridge expects an input of type '" + Number.class.getName() + "'" ) ); } @Test @@ -194,13 +184,12 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "Invalid bridge for input type '" + Integer.class.getName() + "': '" + MyNumberBridge.TOSTRING + "'", - "This bridge expects an input of type '" + Number.class.getName() + "'." ) - .build() ); + "This bridge expects an input of type '" + Number.class.getName() + "'." ) ); } public static class MyNumberBridge implements IdentifierBridge { @@ -234,7 +223,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .annotationContextAnyParameters( DocumentId.class ) @@ -242,7 +231,6 @@ class IndexedEntity { "Ambiguous identifier bridge reference: both 'identifierBridge' and 'identifierBinder' are set." + " Only one can be set." ) - .build() ); } @@ -256,7 +244,7 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "Unable to infer expected identifier type for identifier bridge '" @@ -267,7 +255,6 @@ class IndexedEntity { + " when this type parameter is set to a raw class." + " Use an IdentifierBinder to set the expected identifier type explicitly," + " or set the type parameter I to a definite, raw type." ) - .build() ); } @@ -301,7 +288,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Unable to define a document identifier for indexed type '" @@ -309,9 +296,7 @@ class IndexedEntity { "The property representing the entity identifier is unknown", "Define the document identifier explicitly by annotating" + " a property whose values are unique with @DocumentId" - ) - .build() - ); + ) ); } } diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdDefaultBridgeAdditionIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdDefaultBridgeAdditionIT.java index d99b6b4a642..d22c27c9bf2 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdDefaultBridgeAdditionIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdDefaultBridgeAdditionIT.java @@ -127,11 +127,10 @@ private void doTestFailure(Consumer bridgesConf .withConfiguration( builder -> bridgesConfigurer.accept( builder.bridges() ) ) .setup( indexedType ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( indexedType.getName() ) .pathContext( ".id" ) - .failure( "No default identifier bridge implementation for type", "Use a custom bridge" ) - .build() ); + .failure( "No default identifier bridge implementation for type", "Use a custom bridge" ) ); } @Indexed(index = INDEX_NAME) diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldBaseIT.java index 40fe2bdac0d..ecdb93d03b7 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldBaseIT.java @@ -63,14 +63,12 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".myProperty" ) .failure( "No default value bridge implementation for type '" + Object.class.getName() + "'", - "Use a custom bridge" ) - .build() - ); + "Use a custom bridge" ) ); } @Test @@ -87,13 +85,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".myProperty" ) .failure( "No default value bridge implementation for type 'java.lang.Enum'", - "Use a custom bridge" ) - .build() - ); + "Use a custom bridge" ) ); } @Test @@ -109,12 +105,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".myProperty" ) .failure( "No default value bridge implementation for type 'java.lang.Enum'", "Use a custom bridge" ) - .build() ); } @@ -131,14 +126,12 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".myProperty" ) .failure( "No default value bridge implementation for type 'java.lang.Enum<" + EnumForEnumSuperClassTest.class.getName() + ">'", - "Use a custom bridge" ) - .build() - ); + "Use a custom bridge" ) ); } enum EnumForEnumSuperClassTest { @@ -158,14 +151,12 @@ class IndexedEntity { () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "Invalid bridge for input type '" + Integer.class.getName() + "': '" + MyStringBridge.TOSTRING + "'", - "This bridge expects an input of type '" + String.class.getName() + "'" ) - .build() - ); + "This bridge expects an input of type '" + String.class.getName() + "'" ) ); } @Test @@ -181,14 +172,12 @@ class IndexedEntity { () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".numbers" ) .failure( "Invalid bridge for input type '" + Integer.class.getName() + "': '" + MyStringBridge.TOSTRING + "'", - "This bridge expects an input of type '" + String.class.getName() + "'" ) - .build() - ); + "This bridge expects an input of type '" + String.class.getName() + "'" ) ); } public static class MyStringBridge implements ValueBridge { @@ -219,7 +208,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .annotationContextAnyParameters( GenericField.class ) @@ -227,7 +216,6 @@ class IndexedEntity { "Ambiguous value bridge reference: both 'valueBridge' and 'valueBinder' are set." + " Only one can be set." ) - .build() ); } @@ -242,7 +230,7 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "Unable to infer expected value type for value bridge '" @@ -253,7 +241,6 @@ class IndexedEntity { + " when this type parameter is set to a raw class." + " Use a ValueBinder to set the expected value type explicitly," + " or set the type parameter V to a definite, raw type." ) - .build() ); } diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldContainerExtractorBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldContainerExtractorBaseIT.java index 3f56d9e8448..a5a72717368 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldContainerExtractorBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldContainerExtractorBaseIT.java @@ -123,7 +123,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( @@ -131,9 +131,7 @@ class IndexedEntity { + " Check that this name matches a container extractor," + " either a builtin one whose name is a constant in '" + BuiltinContainerExtractors.class.getName() + "'" + " or a custom one that was properly registered." - ) - .build() - ); + ) ); } @Test @@ -152,16 +150,14 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "Unable to interpret the type arguments to the ContainerExtractor interface in " + " implementation '" + RawContainerExtractor.class.getName() + "'. Only the following implementations of ContainerExtractor are valid" - ) - .build() - ); + ) ); } @SuppressWarnings("rawtypes") @@ -187,15 +183,13 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".numbers" ) .failure( "Invalid container extractor for type '" + List.class.getName() + "<" + Integer.class.getName() + ">': '" + BuiltinContainerExtractors.MAP_VALUE - + "' (implementation class: '" + MapValueExtractor.class.getName() + "')" ) - .build() - ); + + "' (implementation class: '" + MapValueExtractor.class.getName() + "')" ) ); } @Test @@ -214,7 +208,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".numbers" ) .annotationContextAnyParameters( GenericField.class ) @@ -224,7 +218,6 @@ class IndexedEntity { "Either leave 'extract' to its default value to define extractors explicitly", "or leave the 'extractor' list to its default, empty value to disable extraction" ) - .build() ); } } diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldDefaultBridgeAdditionIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldDefaultBridgeAdditionIT.java index bf8c14dd45b..3da37a26800 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldDefaultBridgeAdditionIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldDefaultBridgeAdditionIT.java @@ -133,12 +133,11 @@ private void doTestFailure(Consumer bridgesConf .withConfiguration( builder -> bridgesConfigurer.accept( builder.bridges() ) ) .setup( indexedType ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( indexedType.getName() ) .pathContext( ".property" ) .failure( "No default value bridge implementation for type", - "Use a custom bridge" ) - .build() ); + "Use a custom bridge" ) ); } @Indexed(index = INDEX_NAME) diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FullTextFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FullTextFieldIT.java index df8a86399b1..cf10354e284 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FullTextFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FullTextFieldIT.java @@ -128,13 +128,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".value" ) .annotationContextAnyParameters( FullTextField.class ) - .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) - .build() - ); + .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) ); } @Test @@ -344,7 +342,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".myProperty" ) .failure( @@ -355,9 +353,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type", "encountered type DSL step '", "expected interface '" + StringIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -372,7 +368,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".wrap" ) .failure( @@ -383,9 +379,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type", "encountered type DSL step '", "expected interface '" + StringIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -400,7 +394,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".wrap" ) .failure( @@ -411,9 +405,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type", "encountered type DSL step '", "expected interface '" + StringIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -429,7 +421,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".property" ) .failure( "Unable to infer index field type for value bridge '" @@ -439,8 +431,7 @@ class IndexedEntity { + " The index field type can only be inferred automatically" + " when this type parameter is set to a raw class." + " Use a ValueBinder to set the index field type explicitly," - + " or set the type parameter F to a definite, raw type." ) - .build() ); + + " or set the type parameter F to a definite, raw type." ) ); } private void doTestValidMapping(Class entityType, diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/GenericFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/GenericFieldIT.java index eba321f84e4..9f2c4f8eb8b 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/GenericFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/GenericFieldIT.java @@ -92,13 +92,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".value" ) .annotationContextAnyParameters( GenericField.class ) - .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) - .build() - ); + .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) ); } @Test @@ -199,7 +197,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".wrap" ) .failure( @@ -210,9 +208,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type", "encountered type DSL step '", "expected interface '" + StandardIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -228,7 +224,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".property" ) .failure( "Unable to infer index field type for value bridge '" @@ -238,8 +234,7 @@ class IndexedEntity { + " The index field type can only be inferred automatically" + " when this type parameter is set to a raw class." + " Use a ValueBinder to set the index field type explicitly," - + " or set the type parameter F to a definite, raw type." ) - .build() ); + + " or set the type parameter F to a definite, raw type." ) ); } public static class ValidTypeBridge implements ValueBridge { diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedBaseIT.java index 0faceaf3de7..768119ec84e 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedBaseIT.java @@ -447,16 +447,14 @@ class IndexedWithoutEntityMetadata { .setup() ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedWithoutEntityMetadata.class.getName() ) .failure( "Unable to index type '" + IndexedWithoutEntityMetadata.class.getName() + "': this type is not an entity type." + " If you only expect subtypes to be instantiated, make this type abstract." + " If you expect this exact type to be instantiated and want it to be indexed, make it an entity type." + " Otherwise, ensure this type and its subtypes are never indexed by removing the @Indexed annotation" - + " or by annotating the type with @Indexed(enabled = false)." ) - .build() - ); + + " or by annotating the type with @Indexed(enabled = false)." ) ); } @Test @@ -486,10 +484,9 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) - .failure( "Simulated failure" ) - .build() ); + .failure( "Simulated failure" ) ); } @Test diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedEmbeddedBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedEmbeddedBaseIT.java index bd7ae96e202..1150234292f 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedEmbeddedBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedEmbeddedBaseIT.java @@ -195,13 +195,11 @@ public IndexedEntity(int id, String value) { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".level1" ) .annotationContextAnyParameters( IndexedEmbedded.class ) - .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) - .build() - ); + .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) ); } @Test @@ -227,14 +225,13 @@ public IndexedEntity(int id, String value) { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".level1" ) .annotationContextAnyParameters( IndexedEmbedded.class ) .failure( "Ambiguous @IndexedEmbedded name: both 'name' and 'prefix' are set.", "Only one can be set.", "Name is 'somename', prefix is 'someprefix.'" ) - .build() ); } @@ -602,7 +599,7 @@ public IndexedEntity(int id, String ignoredProperty, String includedProperty) { .setup() ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "An @IndexedEmbedded defines includePaths filters that do not match anything", @@ -611,9 +608,7 @@ public IndexedEntity(int id, String ignoredProperty, String includedProperty) { "Encountered field paths:", CollectionHelper.asLinkedHashSet( "ignoredProperty", "includedProperty" ).toString(), "Check the filters for typos, or remove them if they are not useful" - ) - .build() - ); + ) ); } /** @@ -1309,13 +1304,11 @@ class IndexedEntity { .withAnnotatedEntityTypes( IndexedEntity.class ) .setup() ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".invalid" ) .failure( "Unable to index-embed type '" + String.class.getName() + "': no index mapping" - + " (@GenericField, @FullTextField, custom bridges, ...) is defined for that type." ) - .build() - ); + + " (@GenericField, @FullTextField, custom bridges, ...) is defined for that type." ) ); } @Test @@ -1347,13 +1340,11 @@ class IndexedEntity { .withAnnotatedEntityTypes( IndexedEntity.class ) .setup() ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".invalid" ) .failure( "Unable to index-embed type '" + EmptyNested.class.getName() + "': no index mapping" - + " (@GenericField, @FullTextField, custom bridges, ...) is defined for that type." ) - .build() - ); + + " (@GenericField, @FullTextField, custom bridges, ...) is defined for that type." ) ); } private void doTestEmbeddedRuntime(SearchMapping mapping, diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/KeywordFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/KeywordFieldIT.java index 9c4ab0128a6..ca843d7d3b2 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/KeywordFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/KeywordFieldIT.java @@ -105,13 +105,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".value" ) .annotationContextAnyParameters( KeywordField.class ) - .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) - .build() - ); + .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) ); } @Test @@ -266,7 +264,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".notString" ) .failure( @@ -277,9 +275,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type", "encountered type DSL step '", "expected interface '" + StringIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -295,7 +291,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".wrap" ) .failure( @@ -306,9 +302,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type", "encountered type DSL step '", "expected interface '" + StringIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -324,7 +318,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".wrap" ) .failure( @@ -335,9 +329,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type", "encountered type DSL step '", "expected interface '" + StringIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -353,7 +345,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".property" ) .failure( "Unable to infer index field type for value bridge '" @@ -363,8 +355,7 @@ class IndexedEntity { + " The index field type can only be inferred automatically" + " when this type parameter is set to a raw class." + " Use a ValueBinder to set the index field type explicitly," - + " or set the type parameter F to a definite, raw type." ) - .build() ); + + " or set the type parameter F to a definite, raw type." ) ); } private void doTestValidMapping(Class entityType, diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/NonStandardFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/NonStandardFieldIT.java index 5d298c1142b..e73dbe246a4 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/NonStandardFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/NonStandardFieldIT.java @@ -98,13 +98,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".value" ) .annotationContextAnyParameters( NonStandardField.class ) - .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) - .build() - ); + .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) ); } @Test @@ -137,7 +135,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".myProperty" ) .failure( @@ -146,9 +144,7 @@ class IndexedEntity { "Switch to a standard field annotation such as @GenericField", "encountered type DSL step '", "does extend the interface '" + StandardIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -163,7 +159,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".wrap" ) .failure( @@ -172,9 +168,7 @@ class IndexedEntity { "Switch to a standard field annotation such as @GenericField", "encountered type DSL step '", "does extend the interface '" + StandardIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -190,7 +184,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".property" ) .failure( "Unable to infer index field type for value bridge '" @@ -200,8 +194,7 @@ class IndexedEntity { + " The index field type can only be inferred automatically" + " when this type parameter is set to a raw class." + " Use a ValueBinder to set the index field type explicitly," - + " or set the type parameter F to a definite, raw type." ) - .build() ); + + " or set the type parameter F to a definite, raw type." ) ); } public static class ValidTypeBridge implements ValueBridge { diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBindingBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBindingBaseIT.java index a2978a2d5bf..39c8bf6bb12 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBindingBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBindingBaseIT.java @@ -94,12 +94,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".text" ) .annotationContextAnyParameters( PropertyBinding.class ) .failure( "Empty binder reference." ) - .build() ); } } diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java index 1823e743967..591d70a1c6a 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java @@ -303,13 +303,11 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".contained" ) .failure( "No readable property named 'doesNotExist' on type '" - + Contained.class.getName() + "'" ) - .build() - ); + + Contained.class.getName() + "'" ) ); } @Test @@ -341,14 +339,12 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".contained" ) .failure( "Invalid container extractor for type '" + Contained.class.getName() + "': '" + BuiltinContainerExtractors.COLLECTION - + "' (implementation class: '" + CollectionElementExtractor.class.getName() + "')" ) - .build() - ); + + "' (implementation class: '" + CollectionElementExtractor.class.getName() + "')" ) ); } /** @@ -477,13 +473,11 @@ public void explicitReindexing_error_use_invalidProperty() { ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( PropertyBridgeExplicitIndexingClasses.IndexedEntity.class.getName() ) .pathContext( ".child" ) .failure( "No readable property named 'doesNotExist' on type '" - + PropertyBridgeExplicitIndexingClasses.ContainedLevel2Entity.class.getName() + "'" ) - .build() - ); + + PropertyBridgeExplicitIndexingClasses.ContainedLevel2Entity.class.getName() + "'" ) ); } @Test @@ -509,13 +503,11 @@ public void explicitReindexing_error_fromOtherEntity_invalidProperty() { ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( PropertyBridgeExplicitIndexingClasses.IndexedEntity.class.getName() ) .pathContext( ".child" ) .failure( "No readable property named 'doesNotExist' on type '" - + PropertyBridgeExplicitIndexingClasses.ContainedLevel2Entity.class.getName() + "'" ) - .build() - ); + + PropertyBridgeExplicitIndexingClasses.ContainedLevel2Entity.class.getName() + "'" ) ); } @Test @@ -542,15 +534,13 @@ public void explicitReindexing_error_fromOtherEntity_invalidContainerExtractorPa ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( PropertyBridgeExplicitIndexingClasses.IndexedEntity.class.getName() ) .pathContext( ".child" ) .failure( "Invalid container extractor for type '" + PropertyBridgeExplicitIndexingClasses.ContainedLevel1Entity.class.getName() + "': '" + BuiltinContainerExtractors.COLLECTION - + "' (implementation class: '" + CollectionElementExtractor.class.getName() + "')" ) - .build() - ); + + "' (implementation class: '" + CollectionElementExtractor.class.getName() + "')" ) ); } @Test @@ -577,16 +567,14 @@ public void explicitReindexing_error_fromOtherEntity_bridgedElementNotEntityType ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( PropertyBridgeExplicitIndexingClasses.IndexedEntity.class.getName() ) .pathContext( ".notEntity" ) .failure( "Invalid use of 'fromOtherEntity': this method can only be used when the bridged element has an entity type," + " but the bridged element has type '" + PropertyBridgeExplicitIndexingClasses.NotEntity.class.getName() + "'," + " which is not an entity type." - ) - .build() - ); + ) ); } @Test @@ -613,16 +601,14 @@ public void explicitReindexing_error_fromOtherEntity_otherEntityTypeNotEntityTyp ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( PropertyBridgeExplicitIndexingClasses.IndexedEntity.class.getName() ) .pathContext( ".child" ) .failure( "Invalid type passed to 'fromOtherEntity': the type must be an entity type", "Type '" + PropertyBridgeExplicitIndexingClasses.NotEntity.class.getName() + "' is not an entity type." - ) - .build() - ); + ) ); } @Test @@ -649,15 +635,13 @@ public void explicitReindexing_error_fromOtherEntity_inverseAssociationPathTarge ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( PropertyBridgeExplicitIndexingClasses.IndexedEntity.class.getName() ) .pathContext( ".child" ) .failure( "The inverse association targets type '" + PropertyBridgeExplicitIndexingClasses.DifferentEntity.class.getName() + "'," + " but a supertype or subtype of '" + PropertyBridgeExplicitIndexingClasses.ContainedLevel1Entity.class.getName() + "' was expected." - ) - .build() - ); + ) ); } @Test @@ -685,7 +669,7 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".contained" ) .failure( @@ -693,9 +677,7 @@ class IndexedEntity { "the binder did not declare any dependency to the entity model during binding." + " Declare dependencies using context.dependencies().use(...) or," + " if the bridge really does not depend on the entity model, context.dependencies().useRootOnly()" - ) - .build() - ); + ) ); } @Test @@ -726,16 +708,14 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".contained" ) .failure( "Incorrect binder implementation", "the binder called context.dependencies().useRootOnly() during binding," + " but also declared extra dependencies to the entity model." - ) - .build() - ); + ) ); } @Test @@ -1011,13 +991,11 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".stringProperty" ) .failure( "'.stringProperty' cannot be assigned to '" - + Integer.class.getName() + "'" ) - .build() - ); + + Integer.class.getName() + "'" ) ); } private static class UnusedPropertyBridge implements PropertyBridge { @@ -1038,14 +1016,12 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".id" ) .failure( "Invalid bridge for input type '" + Integer.class.getName() + "': '" + MyStringBridge.TOSTRING + "'", - "This bridge expects an input of type '" + String.class.getName() + "'" ) - .build() - ); + "This bridge expects an input of type '" + String.class.getName() + "'" ) ); } public static class MyStringBridge implements PropertyBridge { diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java index 9a91c8bc636..bca60242c23 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java @@ -64,13 +64,11 @@ class IndexedEntity { } ) .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Invalid routing bridge for entity type '" + IndexedEntity.class.getName() + "': '" + UnusedRoutingBridge.TOSTRING + "'", - "This bridge expects an entity type extending '" + Integer.class.getName() ) - .build() - ); + "This bridge expects an entity type extending '" + Integer.class.getName() ) ); } @Test @@ -366,12 +364,10 @@ class IndexedEntity { } ) .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "'.stringProperty' cannot be assigned to '" - + Integer.class.getName() + "'" ) - .build() - ); + + Integer.class.getName() + "'" ) ); } /** @@ -477,11 +473,10 @@ class IndexedEntity { } ) .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "No readable property named 'doesNotExist' on type '" - + IndexedEntity.class.getName() + "'" ) - .build() ); + + IndexedEntity.class.getName() + "'" ) ); } @Test @@ -503,13 +498,12 @@ class IndexedEntity { } ) .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Incorrect binder implementation", "the binder did not declare any dependency to the entity model during binding.", " Declare dependencies using context.dependencies().use(...) or," - + " if the bridge really does not depend on the entity model, context.dependencies().useRootOnly()" ) - .build() ); + + " if the bridge really does not depend on the entity model, context.dependencies().useRootOnly()" ) ); } @Test @@ -534,12 +528,11 @@ class IndexedEntity { } ) .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Incorrect binder implementation", "the binder called context.dependencies().useRootOnly() during binding," - + " but also declared extra dependencies to the entity model." ) - .build() ); + + " but also declared extra dependencies to the entity model." ) ); } @Test diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/ScaledNumberFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/ScaledNumberFieldIT.java index d6650342971..c65471a70d0 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/ScaledNumberFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/ScaledNumberFieldIT.java @@ -91,13 +91,11 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".value" ) .annotationContextAnyParameters( ScaledNumberField.class ) - .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) - .build() - ); + .failure( "Invalid index field name 'invalid.withdot': field names cannot contain a dot ('.')" ) ); } @Test @@ -162,7 +160,7 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".notScalable" ) .failure( @@ -174,9 +172,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type.", "encountered type DSL step '", "expected interface '" + ScaledNumberIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -278,7 +274,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".wrap" ) .failure( @@ -290,9 +286,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type.", "encountered type DSL step '", "expected interface '" + ScaledNumberIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -307,7 +301,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".wrap" ) .failure( @@ -319,9 +313,7 @@ class IndexedEntity { "If you are already using a custom ValueBridge or ValueBinder, check its field type.", "encountered type DSL step '", "expected interface '" + ScaledNumberIndexFieldTypeOptionsStep.class.getName() + "'" - ) - .build() - ); + ) ); } @Test @@ -337,7 +329,7 @@ class IndexedEntity { assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".property" ) .failure( "Unable to infer index field type for value bridge '" @@ -347,8 +339,7 @@ class IndexedEntity { + " The index field type can only be inferred automatically" + " when this type parameter is set to a raw class." + " Use a ValueBinder to set the index field type explicitly," - + " or set the type parameter F to a definite, raw type." ) - .build() ); + + " or set the type parameter F to a definite, raw type." ) ); } public static class ValidTypeBridge implements ValueBridge { diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBindingBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBindingBaseIT.java index c24a3e6d91d..00c1792c793 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBindingBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBindingBaseIT.java @@ -94,11 +94,10 @@ class IndexedEntity { () -> setupHelper.start().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .annotationContextAnyParameters( TypeBinding.class ) .failure( "Empty binder reference." ) - .build() ); } } diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java index 36dd6c871ab..a8b797fa3e6 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java @@ -207,12 +207,10 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "No readable property named 'doesNotExist' on type '" - + IndexedEntity.class.getName() + "'" ) - .build() - ); + + IndexedEntity.class.getName() + "'" ) ); } /** @@ -326,12 +324,10 @@ class ContainedEntity { .setup( IndexedEntity.class, ContainedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "No readable property named 'doesNotExist' on type '" - + ContainedEntity.class.getName() + "'" ) - .build() - ); + + ContainedEntity.class.getName() + "'" ) ); } @Test @@ -362,12 +358,10 @@ class ContainedEntity { .setup( IndexedEntity.class, ContainedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "No readable property named 'doesNotExist' on type '" - + ContainedEntity.class.getName() + "'" ) - .build() - ); + + ContainedEntity.class.getName() + "'" ) ); } @Test @@ -403,16 +397,14 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .pathContext( ".notEntity" ) .failure( "Invalid use of 'fromOtherEntity': this method can only be used when the bridged element has an entity type," + " but the bridged element has type '" + NotEntity.class.getName() + "'," + " which is not an entity type." - ) - .build() - ); + ) ); } @Test @@ -442,14 +434,12 @@ class NotEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Invalid type passed to 'fromOtherEntity': the type must be an entity type", "Type '" + NotEntity.class.getName() + "' is not an entity type." - ) - .build() - ); + ) ); } @Test @@ -483,14 +473,12 @@ class ContainedEntity { .setup( IndexedEntity.class, ContainedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "The inverse association targets type '" + DifferentEntity.class.getName() + "'," + " but a supertype or subtype of '" + IndexedEntity.class.getName() + "' was expected." - ) - .build() - ); + ) ); } @Test @@ -514,16 +502,14 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Incorrect binder implementation", "the binder did not declare any dependency to the entity model during binding." + " Declare dependencies using context.dependencies().use(...) or," + " if the bridge really does not depend on the entity model, context.dependencies().useRootOnly()" - ) - .build() - ); + ) ); } @Test @@ -550,15 +536,13 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Incorrect binder implementation", "the binder called context.dependencies().useRootOnly() during binding," + " but also declared extra dependencies to the entity model." - ) - .build() - ); + ) ); } @Test @@ -863,12 +847,10 @@ class IndexedEntity { .setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "'.stringProperty' cannot be assigned to '" - + Integer.class.getName() + "'" ) - .build() - ); + + Integer.class.getName() + "'" ) ); } private static class UnusedTypeBridge implements TypeBridge { @@ -889,13 +871,11 @@ class IndexedEntity { } assertThatThrownBy( () -> setupHelper.start().expectCustomBeans().setup( IndexedEntity.class ) ) .isInstanceOf( SearchException.class ) - .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() + .satisfies( FailureReportUtils.hasFailureReport() .typeContext( IndexedEntity.class.getName() ) .failure( "Invalid bridge for input type '" + IndexedEntity.class.getName() + "': '" + MyTargetTypeBridge.TOSTRING + "'", - "This bridge expects an input of type '" + TargetType.class.getName() + "'" ) - .build() - ); + "This bridge expects an input of type '" + TargetType.class.getName() + "'" ) ); } public static class MyTargetTypeBridge implements TypeBridge { diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java index 762cbba9f04..0b615957da2 100644 --- a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java +++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java @@ -60,8 +60,8 @@ public static Consumer hasCauseWithContext(EventContext first, EventC } - public static FailureReportPatternBuilder buildFailureReportPattern() { - return new FailureReportPatternBuilder(); + public static FailureReportChecker hasFailureReport() { + return new FailureReportChecker(); } /* @@ -72,98 +72,98 @@ public static FailureReportPatternBuilder buildFailureReportPattern() { * - "." does not match newline characters * - "[\S\s]" matches any character, including newline characters */ - public static class FailureReportPatternBuilder { + public static class FailureReportChecker implements Consumer { private final StringBuilder patternBuilder = new StringBuilder(); private boolean lastPatternWasFailure = false; - private FailureReportPatternBuilder() { + private FailureReportChecker() { } - public FailureReportPatternBuilder typeContext(String exactTypeName) { + public FailureReportChecker typeContext(String exactTypeName) { return contextLiteral( "type '" + exactTypeName + "'" ); } - public FailureReportPatternBuilder indexContext(String exactIndexName) { + public FailureReportChecker indexContext(String exactIndexName) { return contextLiteral( "index '" + exactIndexName + "'" ); } - public FailureReportPatternBuilder indexSchemaRootContext() { + public FailureReportChecker indexSchemaRootContext() { return contextLiteral( "index schema root" ); } - public FailureReportPatternBuilder defaultBackendContext() { + public FailureReportChecker defaultBackendContext() { return contextLiteral( "default backend" ); } - public FailureReportPatternBuilder backendContext(String exactBackendName) { + public FailureReportChecker backendContext(String exactBackendName) { return contextLiteral( "backend '" + exactBackendName + "'" ); } - public FailureReportPatternBuilder pathContext(String pathPattern) { + public FailureReportChecker pathContext(String pathPattern) { return contextLiteral( "path '" + pathPattern + "'" ); } - public FailureReportPatternBuilder indexFieldContext(String exactPath) { + public FailureReportChecker indexFieldContext(String exactPath) { return contextLiteral( "field '" + exactPath + "'" ); } - public FailureReportPatternBuilder mappingAttributeContext(String exactName) { + public FailureReportChecker mappingAttributeContext(String exactName) { return contextLiteral( "attribute '" + exactName + "'" ); } - public FailureReportPatternBuilder indexFieldTemplateContext(String exactPath) { + public FailureReportChecker indexFieldTemplateContext(String exactPath) { return contextLiteral( "field template '" + exactPath + "'" ); } - public FailureReportPatternBuilder fieldTemplateAttributeContext(String exactPath) { + public FailureReportChecker fieldTemplateAttributeContext(String exactPath) { return contextLiteral( "attribute '" + exactPath + "'" ); } - public FailureReportPatternBuilder analyzerContext(String exactName) { + public FailureReportChecker analyzerContext(String exactName) { return contextLiteral( "analyzer '" + exactName + "'" ); } - public FailureReportPatternBuilder normalizerContext(String exactName) { + public FailureReportChecker normalizerContext(String exactName) { return contextLiteral( "normalizer '" + exactName + "'" ); } - public FailureReportPatternBuilder charFilterContext(String exactName) { + public FailureReportChecker charFilterContext(String exactName) { return contextLiteral( "char filter '" + exactName + "'" ); } - public FailureReportPatternBuilder tokenizerContext(String exactName) { + public FailureReportChecker tokenizerContext(String exactName) { return contextLiteral( "tokenizer '" + exactName + "'" ); } - public FailureReportPatternBuilder tokenFilterContext(String exactName) { + public FailureReportChecker tokenFilterContext(String exactName) { return contextLiteral( "token filter '" + exactName + "'" ); } - public FailureReportPatternBuilder analysisDefinitionParameterContext(String exactName) { + public FailureReportChecker analysisDefinitionParameterContext(String exactName) { return contextLiteral( "parameter '" + exactName + "'" ); } - public FailureReportPatternBuilder aliasContext(String exactName) { + public FailureReportChecker aliasContext(String exactName) { return contextLiteral( "alias '" + exactName + "'" ); } - public FailureReportPatternBuilder aliasAttributeContext(String exactName) { + public FailureReportChecker aliasAttributeContext(String exactName) { return contextLiteral( "attribute '" + exactName + "'" ); } - public FailureReportPatternBuilder annotationContextAnyParameters(Class annotationType) { + public FailureReportChecker annotationContextAnyParameters(Class annotationType) { return contextPattern( "annotation '@\\Q" + annotationType.getName() + "\\E\\(.*'" ); } - public FailureReportPatternBuilder annotationTypeContext(Class annotationType) { + public FailureReportChecker annotationTypeContext(Class annotationType) { return contextLiteral( "annotation type '@" + annotationType.getName() + "'" ); } - public FailureReportPatternBuilder contextLiteral(String contextLiteral) { + public FailureReportChecker contextLiteral(String contextLiteral) { return contextPattern( "\\Q" + contextLiteral + "\\E" ); } - public FailureReportPatternBuilder contextPattern(String contextPattern) { + public FailureReportChecker contextPattern(String contextPattern) { lastPatternWasFailure = false; patternBuilder.append( "\n\\h+" ) .append( contextPattern ) @@ -171,7 +171,7 @@ public FailureReportPatternBuilder contextPattern(String contextPattern) { return this; } - public FailureReportPatternBuilder failure(String ... literalStringsContainedInFailureMessageInOrder) { + public FailureReportChecker failure(String ... literalStringsContainedInFailureMessageInOrder) { if ( !lastPatternWasFailure ) { patternBuilder.append( "\n\\h+failures: " ); } @@ -185,7 +185,7 @@ public FailureReportPatternBuilder failure(String ... literalStringsContainedInF return this; } - public FailureReportPatternBuilder multilineFailure(String ... literalStringsContainedInFailureMessageInOrder) { + public FailureReportChecker multilineFailure(String ... literalStringsContainedInFailureMessageInOrder) { if ( !lastPatternWasFailure ) { patternBuilder.append( "\n\\h+failures: " ); } @@ -199,14 +199,16 @@ public FailureReportPatternBuilder multilineFailure(String ... literalStringsCon return this; } - public String build() { + @Override + public void accept(Throwable throwable) { /* * Prepend and append "[\S\s]*" because we have to match against the entire failure report, * so we must match any characters before and after what we're looking for. */ - return "[\\S\\s]*" - + patternBuilder.toString() + String pattern = "[\\S\\s]*" + + patternBuilder + "[\\S\\s]*"; + assertThat( throwable ).hasMessageMatching( pattern ); } } From a5a183b3fe892ee399fecfaf2c23704b61997c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 12 May 2022 13:19:39 +0200 Subject: [PATCH 3/5] HSEARCH-4578 Upgrade to Assertj 3.22.0 This fixes the signature of AbstractAssert#satisfies, which we're going to need in the next commits. --- pom.xml | 2 +- .../java/org/hibernate/search/util/impl/test/FutureAssert.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5c20421be54..f939a19fe51 100644 --- a/pom.xml +++ b/pom.xml @@ -265,7 +265,7 @@ 2.2 3.5.13 - 3.15.0 + 3.22.0 4.1.0 1.5.0 1.2.7 diff --git a/util/internal/test/src/main/java/org/hibernate/search/util/impl/test/FutureAssert.java b/util/internal/test/src/main/java/org/hibernate/search/util/impl/test/FutureAssert.java index dd0814911d6..2fd6085812f 100644 --- a/util/internal/test/src/main/java/org/hibernate/search/util/impl/test/FutureAssert.java +++ b/util/internal/test/src/main/java/org/hibernate/search/util/impl/test/FutureAssert.java @@ -133,7 +133,7 @@ public AbstractThrowableAssert getFailure() { failWithCauseAndMessage( e, "future <%s> should have failed, but instead it's been cancelled", actual, e ); } catch (ExecutionException e) { - return new ThrowableAssert( e.getCause() ) + return new ThrowableAssert<>( e.getCause() ) .as( "failure reported by future <%s>", actual ); } throw new IllegalStateException( "We should never reach this line" ); From f0cc1f1c006ac0e37c47b8a444efb81324d71dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 12 May 2022 11:10:47 +0200 Subject: [PATCH 4/5] HSEARCH-4578 Move FailureReportUtils/FailureReportChecker to their own package --- .../ReindexOnUpdateShallowIncorrectIT.java | 2 +- .../ElasticsearchAnalysisConfigurerIT.java | 2 +- .../ElasticsearchBootstrapFailureIT.java | 2 +- .../bootstrap/ElasticsearchBootstrapIT.java | 2 +- .../ElasticsearchIndexNamingBaseIT.java | 2 +- ...sticsearchIndexSchemaManagerTestUtils.java | 5 +- ...ndexSchemaManagerValidationAnalyzerIT.java | 5 +- ...xSchemaManagerValidationMappingBaseIT.java | 4 +- ...exSchemaManagerValidationNormalizerIT.java | 4 +- .../lucene/LuceneDocumentModelDslIT.java | 2 +- .../backend/lucene/LuceneExtensionIT.java | 2 +- .../analysis/LuceneAnalysisConfigurerIT.java | 2 +- .../directory/AbstractBuiltInDirectoryIT.java | 2 +- .../lowlevel/directory/CustomDirectoryIT.java | 2 +- .../LuceneLocalFileSystemDirectoryIT.java | 2 +- .../document/IndexSchemaElementFieldIT.java | 2 +- .../IndexSchemaElementFieldTemplateIT.java | 2 +- .../document/IndexSchemaElementTypeIT.java | 2 +- .../tck/search/SearchMultiIndexIT.java | 2 +- ...gleFieldAggregationUnsupportedTypesIT.java | 2 +- .../AbstractPredicateScaleCheckingIT.java | 2 +- .../AbstractPredicateSimpleAnalysisIT.java | 2 +- ...tPredicateTypeCheckingAndConversionIT.java | 2 +- ...ctPredicateTypeCheckingNoConversionIT.java | 2 +- .../AbstractPredicateUnsupportedTypeIT.java | 2 +- .../ExistsPredicateObjectsSpecificsIT.java | 2 +- .../MatchIdPredicateSpecificsIT.java | 2 +- .../predicate/MatchPredicateFuzzyIT.java | 2 +- ...SearchSortTypeCheckingAndConversionIT.java | 2 +- .../DistanceSearchSortUnsupportedTypesIT.java | 2 +- .../FieldSearchSortScaledSpecificsIT.java | 2 +- ...SearchSortTypeCheckingAndConversionIT.java | 2 +- .../FieldSearchSortUnsupportedTypesIT.java | 2 +- ...xtendedBeanManagerBootstrapShutdownIT.java | 2 +- ...tectMultipleBackendTypesInClasspathIT.java | 2 +- .../AbstractMassIndexingFailureIT.java | 2 +- .../mapper/orm/model/TransientPropertyIT.java | 2 +- ...tSearchSchemaManagerSimpleOperationIT.java | 2 +- ...emaManagerValidatingSimpleOperationIT.java | 2 +- .../AbstractSchemaManagementStrategyIT.java | 2 +- ...tSchemaManagementStrategyValidatingIT.java | 2 +- .../DefaultReindexOnUpdateIT.java | 2 +- .../alternative/AlternativeBinderIT.java | 2 +- ...CustomPropertyMappingAnnotationBaseIT.java | 2 +- .../CustomTypeMappingAnnotationBaseIT.java | 2 +- .../pojo/mapping/definition/DependencyIT.java | 2 +- .../mapping/definition/DocumentIdBaseIT.java | 2 +- .../DocumentIdDefaultBridgeAdditionIT.java | 2 +- .../pojo/mapping/definition/FieldBaseIT.java | 2 +- .../FieldContainerExtractorBaseIT.java | 2 +- .../FieldDefaultBridgeAdditionIT.java | 2 +- .../mapping/definition/FullTextFieldIT.java | 2 +- .../mapping/definition/GenericFieldIT.java | 2 +- .../mapping/definition/IndexedBaseIT.java | 2 +- .../definition/IndexedEmbeddedBaseIT.java | 2 +- .../mapping/definition/KeywordFieldIT.java | 2 +- .../definition/NonStandardFieldIT.java | 2 +- .../definition/PropertyBindingBaseIT.java | 2 +- .../definition/PropertyBridgeBaseIT.java | 2 +- .../definition/RoutingBridgeBaseIT.java | 2 +- .../definition/ScaledNumberFieldIT.java | 2 +- .../mapping/definition/TypeBindingBaseIT.java | 2 +- .../mapping/definition/TypeBridgeBaseIT.java | 2 +- .../common/FailureReportUtils.java | 215 ------------------ .../reporting/FailureReportChecker.java | 164 +++++++++++++ .../common/reporting/FailureReportUtils.java | 66 ++++++ 66 files changed, 299 insertions(+), 282 deletions(-) delete mode 100644 util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java create mode 100644 util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportChecker.java create mode 100644 util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportUtils.java diff --git a/documentation/src/test/java/org/hibernate/search/documentation/mapper/orm/reindexing/reindexonupdate/shallow/incorrect/ReindexOnUpdateShallowIncorrectIT.java b/documentation/src/test/java/org/hibernate/search/documentation/mapper/orm/reindexing/reindexonupdate/shallow/incorrect/ReindexOnUpdateShallowIncorrectIT.java index 5924f64da6f..e1d9b3cbb55 100644 --- a/documentation/src/test/java/org/hibernate/search/documentation/mapper/orm/reindexing/reindexonupdate/shallow/incorrect/ReindexOnUpdateShallowIncorrectIT.java +++ b/documentation/src/test/java/org/hibernate/search/documentation/mapper/orm/reindexing/reindexonupdate/shallow/incorrect/ReindexOnUpdateShallowIncorrectIT.java @@ -11,7 +11,7 @@ import org.hibernate.search.documentation.testsupport.BackendConfigurations; import org.hibernate.search.documentation.testsupport.DocumentationSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.junit.Rule; import org.junit.Test; diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/analysis/ElasticsearchAnalysisConfigurerIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/analysis/ElasticsearchAnalysisConfigurerIT.java index 5fded73f3a0..b59dc459ae8 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/analysis/ElasticsearchAnalysisConfigurerIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/analysis/ElasticsearchAnalysisConfigurerIT.java @@ -16,7 +16,7 @@ import org.hibernate.search.engine.mapper.mapping.building.spi.IndexBindingContext; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.junit.Rule; diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapFailureIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapFailureIT.java index 41e5f4d32d9..09a739f1219 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapFailureIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapFailureIT.java @@ -12,7 +12,7 @@ import org.hibernate.search.integrationtest.backend.elasticsearch.testsupport.util.ElasticsearchClientSpy; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapIT.java index fc3bc3aadb8..937d41f27f7 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/bootstrap/ElasticsearchBootstrapIT.java @@ -25,7 +25,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.dialect.ElasticsearchTestDialect; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingSchemaManagementStrategy; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/index/naming/ElasticsearchIndexNamingBaseIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/index/naming/ElasticsearchIndexNamingBaseIT.java index 121d20492b0..a09001c7b5c 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/index/naming/ElasticsearchIndexNamingBaseIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/index/naming/ElasticsearchIndexNamingBaseIT.java @@ -13,7 +13,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.rule.TestElasticsearchClient; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerTestUtils.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerTestUtils.java index 81d53e2737f..d19ed0bcf0f 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerTestUtils.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerTestUtils.java @@ -10,7 +10,8 @@ import static org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.ElasticsearchIndexMetadataTestUtils.discriminatorMappingOmitDefaults; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.ElasticsearchIndexMetadataTestUtils; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportChecker; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; class ElasticsearchIndexSchemaManagerTestUtils { @@ -72,7 +73,7 @@ static String defaultMetadataMappingAndCommaForExpectations() { return mapping.isEmpty() ? "" : mapping + ", "; } - static FailureReportUtils.FailureReportChecker hasValidationFailureReport() { + static FailureReportChecker hasValidationFailureReport() { return FailureReportUtils.hasFailureReport() .contextLiteral( STUB_CONTEXT_LITERAL ) .failure( "Validation of the existing index in the Elasticsearch cluster failed. See below for details." ); diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAnalyzerIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAnalyzerIT.java index 0ca014cefd9..77a71b7286a 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAnalyzerIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationAnalyzerIT.java @@ -18,7 +18,8 @@ import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.impl.Futures; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.rule.TestElasticsearchClient; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportChecker; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingSchemaManagementStrategy; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; @@ -626,7 +627,7 @@ public void tokenFilter_parameter_unexpected() throws Exception { ); } - private void setupAndValidateExpectingFailure(FailureReportUtils.FailureReportChecker failureReportChecker) { + private void setupAndValidateExpectingFailure(FailureReportChecker failureReportChecker) { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) .satisfies( failureReportChecker ); diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingBaseIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingBaseIT.java index 7711622e141..bd9b4d5c422 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingBaseIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationMappingBaseIT.java @@ -23,7 +23,7 @@ import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.impl.Futures; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.rule.TestElasticsearchClient; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportChecker; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingSchemaManagementStrategy; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; @@ -385,7 +385,7 @@ public void multipleErrors() { ); } - private void setupAndValidateExpectingFailure(StubMappedIndex index, FailureReportUtils.FailureReportChecker failureReportChecker) { + private void setupAndValidateExpectingFailure(StubMappedIndex index, FailureReportChecker failureReportChecker) { assertThatThrownBy( () -> setupAndValidate( index ) ) .isInstanceOf( SearchException.class ) .satisfies( failureReportChecker ); diff --git a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationNormalizerIT.java b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationNormalizerIT.java index a3ff355b9fe..fdd351ef774 100644 --- a/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationNormalizerIT.java +++ b/integrationtest/backend/elasticsearch/src/test/java/org/hibernate/search/integrationtest/backend/elasticsearch/schema/management/ElasticsearchIndexSchemaManagerValidationNormalizerIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.impl.Futures; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.rule.TestElasticsearchClient; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportChecker; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingSchemaManagementStrategy; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; @@ -118,7 +118,7 @@ public void normalizer_missing() throws Exception { ); } - private void setupAndValidateExpectingFailure(FailureReportUtils.FailureReportChecker failureReportChecker) { + private void setupAndValidateExpectingFailure(FailureReportChecker failureReportChecker) { assertThatThrownBy( this::setupAndValidate ) .isInstanceOf( SearchException.class ) .satisfies( failureReportChecker ); diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneDocumentModelDslIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneDocumentModelDslIT.java index db2d0ba7367..1700a641c18 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneDocumentModelDslIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneDocumentModelDslIT.java @@ -14,7 +14,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.configuration.DefaultAnalysisDefinitions; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.junit.Rule; diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneExtensionIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneExtensionIT.java index feb297a09ec..cbd8c520983 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneExtensionIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/LuceneExtensionIT.java @@ -77,7 +77,7 @@ import org.hibernate.search.engine.search.sort.SearchSort; import org.hibernate.search.engine.spatial.GeoPoint; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.test.annotation.TestForIssue; import org.junit.Before; diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/analysis/LuceneAnalysisConfigurerIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/analysis/LuceneAnalysisConfigurerIT.java index e92acdb3e93..065c5d11dbb 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/analysis/LuceneAnalysisConfigurerIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/analysis/LuceneAnalysisConfigurerIT.java @@ -16,7 +16,7 @@ import org.hibernate.search.engine.mapper.mapping.building.spi.IndexBindingContext; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.junit.Rule; diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/AbstractBuiltInDirectoryIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/AbstractBuiltInDirectoryIT.java index 84f4330d384..43a47366ac3 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/AbstractBuiltInDirectoryIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/AbstractBuiltInDirectoryIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.backend.lucene.lowlevel.index.impl.IndexAccessorImpl; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/CustomDirectoryIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/CustomDirectoryIT.java index 091bcebd3dc..a8619e06d38 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/CustomDirectoryIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/CustomDirectoryIT.java @@ -16,7 +16,7 @@ import org.hibernate.search.backend.lucene.lowlevel.directory.spi.DirectoryHolder; import org.hibernate.search.backend.lucene.lowlevel.directory.spi.DirectoryProvider; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; import org.hibernate.search.util.impl.test.annotation.TestForIssue; import org.hibernate.search.util.impl.test.rule.StaticCounters; diff --git a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/LuceneLocalFileSystemDirectoryIT.java b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/LuceneLocalFileSystemDirectoryIT.java index e737dca4f8e..4c6992e98fd 100644 --- a/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/LuceneLocalFileSystemDirectoryIT.java +++ b/integrationtest/backend/lucene/src/test/java/org/hibernate/search/integrationtest/backend/lucene/lowlevel/directory/LuceneLocalFileSystemDirectoryIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.backend.lucene.index.impl.Shard; import org.hibernate.search.backend.lucene.lowlevel.index.impl.IndexAccessorImpl; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; import org.hibernate.search.util.impl.test.annotation.TestForIssue; import org.hibernate.search.util.impl.test.rule.ExpectedLog4jLog; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldIT.java index f8eb3865a47..af5cf07ea77 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.engine.mapper.mapping.building.spi.IndexBindingContext; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.junit.Rule; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldTemplateIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldTemplateIT.java index 357c56469fb..5e5d56a7211 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldTemplateIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementFieldTemplateIT.java @@ -17,7 +17,7 @@ import org.hibernate.search.engine.mapper.mapping.building.spi.IndexBindingContext; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.junit.Rule; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementTypeIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementTypeIT.java index 31a904b0064..e53bb30a09b 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementTypeIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/document/IndexSchemaElementTypeIT.java @@ -17,7 +17,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.configuration.DefaultAnalysisDefinitions; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.junit.Rule; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/SearchMultiIndexIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/SearchMultiIndexIT.java index e1dae78fd6c..38cbb4cdabb 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/SearchMultiIndexIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/SearchMultiIndexIT.java @@ -22,7 +22,7 @@ import org.hibernate.search.engine.search.query.SearchScrollResult; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/aggregation/SingleFieldAggregationUnsupportedTypesIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/aggregation/SingleFieldAggregationUnsupportedTypesIT.java index ada7e669788..26b487a80ce 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/aggregation/SingleFieldAggregationUnsupportedTypesIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/aggregation/SingleFieldAggregationUnsupportedTypesIT.java @@ -25,7 +25,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.test.annotation.PortedFromSearch5; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateScaleCheckingIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateScaleCheckingIT.java index 3b15a7da2f8..103321d119d 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateScaleCheckingIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateScaleCheckingIT.java @@ -19,7 +19,7 @@ import org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep; import org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateSimpleAnalysisIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateSimpleAnalysisIT.java index 45f56ff9686..672e54270b2 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateSimpleAnalysisIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateSimpleAnalysisIT.java @@ -22,7 +22,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModel; import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.impl.CollectionHelper; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateTypeCheckingAndConversionIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateTypeCheckingAndConversionIT.java index c7a16b52643..59011209f6a 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateTypeCheckingAndConversionIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateTypeCheckingAndConversionIT.java @@ -27,7 +27,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateTypeCheckingNoConversionIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateTypeCheckingNoConversionIT.java index 5447e9a73a3..293a307613d 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateTypeCheckingNoConversionIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateTypeCheckingNoConversionIT.java @@ -27,7 +27,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateUnsupportedTypeIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateUnsupportedTypeIT.java index a4d49bc2084..f6600b0fbb6 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateUnsupportedTypeIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AbstractPredicateUnsupportedTypeIT.java @@ -16,7 +16,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.types.FieldTypeDescriptor; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.junit.Test; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateObjectsSpecificsIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateObjectsSpecificsIT.java index d0b0b6c49c0..b16b8009d01 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateObjectsSpecificsIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateObjectsSpecificsIT.java @@ -21,7 +21,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.TckConfiguration; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchIdPredicateSpecificsIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchIdPredicateSpecificsIT.java index 81fd3df6729..69e9b388cf1 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchIdPredicateSpecificsIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchIdPredicateSpecificsIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchPredicateFuzzyIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchPredicateFuzzyIT.java index a3aa1b5e1c3..6ac41009300 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchPredicateFuzzyIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchPredicateFuzzyIT.java @@ -30,7 +30,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.impl.CollectionHelper; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/DistanceSearchSortTypeCheckingAndConversionIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/DistanceSearchSortTypeCheckingAndConversionIT.java index 056fdfbf010..cbab603ead0 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/DistanceSearchSortTypeCheckingAndConversionIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/DistanceSearchSortTypeCheckingAndConversionIT.java @@ -38,7 +38,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/DistanceSearchSortUnsupportedTypesIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/DistanceSearchSortUnsupportedTypesIT.java index 432e6702cc2..cede3fc3e98 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/DistanceSearchSortUnsupportedTypesIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/DistanceSearchSortUnsupportedTypesIT.java @@ -19,7 +19,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortScaledSpecificsIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortScaledSpecificsIT.java index 14a9927656f..d9689314d30 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortScaledSpecificsIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortScaledSpecificsIT.java @@ -16,7 +16,7 @@ import org.hibernate.search.engine.reporting.spi.EventContexts; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortTypeCheckingAndConversionIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortTypeCheckingAndConversionIT.java index 72eda8d96d7..be7b28f24ef 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortTypeCheckingAndConversionIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortTypeCheckingAndConversionIT.java @@ -41,7 +41,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.BulkIndexer; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortUnsupportedTypesIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortUnsupportedTypesIT.java index ff83f033cf4..cd370b65d23 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortUnsupportedTypesIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/sort/FieldSearchSortUnsupportedTypesIT.java @@ -19,7 +19,7 @@ import org.hibernate.search.integrationtest.backend.tck.testsupport.util.SimpleFieldModelsByType; import org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex; import org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/orm-cdi/src/test/java/org/hibernate/search/integrationtest/mapper/orm/cdi/CdiExtendedBeanManagerBootstrapShutdownIT.java b/integrationtest/mapper/orm-cdi/src/test/java/org/hibernate/search/integrationtest/mapper/orm/cdi/CdiExtendedBeanManagerBootstrapShutdownIT.java index 12f1abe8ad8..41fb70c97e2 100644 --- a/integrationtest/mapper/orm-cdi/src/test/java/org/hibernate/search/integrationtest/mapper/orm/cdi/CdiExtendedBeanManagerBootstrapShutdownIT.java +++ b/integrationtest/mapper/orm-cdi/src/test/java/org/hibernate/search/integrationtest/mapper/orm/cdi/CdiExtendedBeanManagerBootstrapShutdownIT.java @@ -25,7 +25,7 @@ import org.hibernate.search.mapper.orm.Search; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.common.rule.StubSearchWorkBehavior; import org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmSetupHelper; diff --git a/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/bootstrap/BackendTypeAutoDetectMultipleBackendTypesInClasspathIT.java b/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/bootstrap/BackendTypeAutoDetectMultipleBackendTypesInClasspathIT.java index f8daa110296..d84196745ce 100644 --- a/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/bootstrap/BackendTypeAutoDetectMultipleBackendTypesInClasspathIT.java +++ b/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/bootstrap/BackendTypeAutoDetectMultipleBackendTypesInClasspathIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.ElasticsearchBackendConfiguration; import org.hibernate.search.util.impl.integrationtest.backend.lucene.LuceneBackendConfiguration; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendConfiguration; import org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmSetupHelper; diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/massindexing/AbstractMassIndexingFailureIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/massindexing/AbstractMassIndexingFailureIT.java index 6d55d4d769d..925543b445b 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/massindexing/AbstractMassIndexingFailureIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/massindexing/AbstractMassIndexingFailureIT.java @@ -32,7 +32,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.common.rule.ThreadSpy; import org.hibernate.search.util.impl.integrationtest.common.stub.backend.index.StubIndexScaleWork; diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java index a9a61936eb2..a81fa4c02e6 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/model/TransientPropertyIT.java @@ -27,7 +27,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.ObjectPath; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.PropertyBinding; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.PropertyValue; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmSetupHelper; import org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmUtils; diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerSimpleOperationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerSimpleOperationIT.java index 15eed379c5c..b3d83acfb98 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerSimpleOperationIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerSimpleOperationIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.mapper.orm.schema.management.SearchSchemaManager; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.common.rule.SchemaManagementWorkBehavior; import org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmSetupHelper; diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerValidatingSimpleOperationIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerValidatingSimpleOperationIT.java index 9e6a2e5d890..06cc9f3a8e6 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerValidatingSimpleOperationIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/manager/AbstractSearchSchemaManagerValidatingSimpleOperationIT.java @@ -13,7 +13,7 @@ import org.hibernate.search.mapper.orm.Search; import org.hibernate.search.mapper.orm.schema.management.SearchSchemaManager; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.junit.Test; diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyIT.java index ec7dd9b280e..903059903ae 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyIT.java @@ -17,7 +17,7 @@ import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.common.rule.SchemaManagementWorkBehavior; import org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmSetupHelper; diff --git a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyValidatingIT.java b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyValidatingIT.java index 205f7d95eb5..62b55c24240 100644 --- a/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyValidatingIT.java +++ b/integrationtest/mapper/orm/src/test/java/org/hibernate/search/integrationtest/mapper/orm/schema/management/strategy/AbstractSchemaManagementStrategyValidatingIT.java @@ -11,7 +11,7 @@ import java.util.concurrent.CompletableFuture; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.junit.Test; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java index c1ebf54a394..4b8f131a345 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/automaticindexing/DefaultReindexOnUpdateIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep; import org.hibernate.search.mapper.pojo.model.path.PojoModelPath; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.junit.Before; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/alternative/AlternativeBinderIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/alternative/AlternativeBinderIT.java index a4238538954..1351b6d3561 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/alternative/AlternativeBinderIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/alternative/AlternativeBinderIT.java @@ -18,7 +18,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.DocumentId; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomPropertyMappingAnnotationBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomPropertyMappingAnnotationBaseIT.java index d66ee176a8a..6897058e2de 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomPropertyMappingAnnotationBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomPropertyMappingAnnotationBaseIT.java @@ -34,7 +34,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.reporting.EventContext; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomTypeMappingAnnotationBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomTypeMappingAnnotationBaseIT.java index b16b8383daf..2e9bb11c73f 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomTypeMappingAnnotationBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/annotation/processing/CustomTypeMappingAnnotationBaseIT.java @@ -29,7 +29,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep; import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.reporting.EventContext; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DependencyIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DependencyIT.java index 90ca05c6d1b..466ddc615c7 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DependencyIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DependencyIT.java @@ -21,7 +21,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.ObjectPath; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.PropertyValue; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdBaseIT.java index b8c7c715f14..b181e1d522f 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdBaseIT.java @@ -19,7 +19,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.integrationtest.mapper.pojo.testsupport.util.rule.JavaBeanMappingSetupHelper; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdDefaultBridgeAdditionIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdDefaultBridgeAdditionIT.java index d22c27c9bf2..45fbeb567a5 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdDefaultBridgeAdditionIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/DocumentIdDefaultBridgeAdditionIT.java @@ -22,7 +22,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.DocumentId; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldBaseIT.java index ecdb93d03b7..9f222a7aa0d 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldBaseIT.java @@ -22,7 +22,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldContainerExtractorBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldContainerExtractorBaseIT.java index a5a72717368..d4c15f35a13 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldContainerExtractorBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldContainerExtractorBaseIT.java @@ -26,7 +26,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldDefaultBridgeAdditionIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldDefaultBridgeAdditionIT.java index 3da37a26800..24e3c278267 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldDefaultBridgeAdditionIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FieldDefaultBridgeAdditionIT.java @@ -23,7 +23,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FullTextFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FullTextFieldIT.java index cf10354e284..6e37a2d13f5 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FullTextFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/FullTextFieldIT.java @@ -31,7 +31,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.ProgrammaticMappingConfigurationContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/GenericFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/GenericFieldIT.java index 9f2c4f8eb8b..ea259172c64 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/GenericFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/GenericFieldIT.java @@ -26,7 +26,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.common.stub.backend.StubBackendExtension; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedBaseIT.java index 768119ec84e..cf881561ff2 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedBaseIT.java @@ -26,7 +26,7 @@ import org.hibernate.search.mapper.pojo.route.DocumentRoutes; import org.hibernate.search.util.common.AssertionFailure; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; import org.hibernate.search.util.impl.test.rule.StaticCounters; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedEmbeddedBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedEmbeddedBaseIT.java index 1150234292f..253102f7263 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedEmbeddedBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/IndexedEmbeddedBaseIT.java @@ -46,7 +46,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep; import org.hibernate.search.util.common.SearchException; import org.hibernate.search.util.common.impl.CollectionHelper; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.common.stub.backend.document.StubDocumentNode; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/KeywordFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/KeywordFieldIT.java index ca843d7d3b2..0f466b816b4 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/KeywordFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/KeywordFieldIT.java @@ -28,7 +28,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/NonStandardFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/NonStandardFieldIT.java index e73dbe246a4..d519529deea 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/NonStandardFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/NonStandardFieldIT.java @@ -21,7 +21,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.NonStandardField; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.common.stub.backend.StubBackendExtension; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBindingBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBindingBaseIT.java index 39c8bf6bb12..2b413703fcf 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBindingBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBindingBaseIT.java @@ -22,7 +22,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.PropertyBinding; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java index 591d70a1c6a..712270c4448 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/PropertyBridgeBaseIT.java @@ -39,7 +39,7 @@ import org.hibernate.search.mapper.pojo.model.path.PojoModelPath; import org.hibernate.search.util.common.AssertionFailure; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java index bca60242c23..1bbf3568770 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/RoutingBridgeBaseIT.java @@ -22,7 +22,7 @@ import org.hibernate.search.mapper.pojo.route.DocumentRoutes; import org.hibernate.search.util.common.AssertionFailure; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.integrationtest.common.stub.backend.document.StubDocumentNode; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/ScaledNumberFieldIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/ScaledNumberFieldIT.java index c65471a70d0..4c0676b8b50 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/ScaledNumberFieldIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/ScaledNumberFieldIT.java @@ -26,7 +26,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.ScaledNumberField; import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBindingBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBindingBaseIT.java index 00c1792c793..3b24bc32796 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBindingBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBindingBaseIT.java @@ -22,7 +22,7 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.TypeBinding; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java index a8b797fa3e6..9c40125f213 100644 --- a/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java +++ b/integrationtest/mapper/pojo-base/src/test/java/org/hibernate/search/integrationtest/mapper/pojo/mapping/definition/TypeBridgeBaseIT.java @@ -31,7 +31,7 @@ import org.hibernate.search.mapper.pojo.model.PojoElementAccessor; import org.hibernate.search.util.common.AssertionFailure; import org.hibernate.search.util.common.SearchException; -import org.hibernate.search.util.impl.integrationtest.common.FailureReportUtils; +import org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils; import org.hibernate.search.util.impl.integrationtest.common.rule.BackendMock; import org.hibernate.search.util.impl.test.annotation.TestForIssue; diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java deleted file mode 100644 index 0b615957da2..00000000000 --- a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/FailureReportUtils.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Hibernate Search, full-text search for your domain model - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.search.util.impl.integrationtest.common; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.lang.annotation.Annotation; -import java.util.Arrays; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -import org.hibernate.search.util.common.reporting.EventContext; -import org.hibernate.search.util.common.reporting.EventContextElement; -import org.hibernate.search.util.common.SearchException; - -public final class FailureReportUtils { - - private FailureReportUtils() { - } - - /** - * @param first The first part of the expected context. - * @param others The other parts of the expected context, if any. To be concatenated to the first part. - * @return A consumer representing an assertion to be passed as a parameter to - * {@link org.assertj.core.api.AbstractThrowableAssert#satisfies(Consumer[])}. - */ - public static Consumer hasContext(EventContext first, EventContext... others) { - return hasContext( - EventContext.concat( first, others ).elements().toArray( new EventContextElement[] { } ) - ); - } - - /** - * @param contextElements The expect context elements, in order. - * @return A consumer representing an assertion to be passed as a parameter to - * {@link org.assertj.core.api.AbstractThrowableAssert#satisfies(Consumer[])}. - */ - public static Consumer hasContext(EventContextElement... contextElements) { - return throwable -> { - assertThat( throwable ) - .isInstanceOf( SearchException.class ); - EventContext actualContext = ( (SearchException) throwable ).context(); - assertThat( actualContext ).as( "throwable.getContext()" ).isNotNull(); - assertThat( actualContext.elements() ) - .containsExactly( contextElements ); - String renderedContextElements = Arrays.stream( contextElements ).map( EventContextElement::render ) - .collect( Collectors.joining( ", " ) ); - assertThat( throwable.getMessage() ) - .endsWith( "Context: " + renderedContextElements ); - }; - } - - public static Consumer hasCauseWithContext(EventContext first, EventContext ... others) { - Consumer delegate = hasContext( first, others ); - return e -> delegate.accept( e.getCause() ); - - } - - public static FailureReportChecker hasFailureReport() { - return new FailureReportChecker(); - } - - /* - * Notes on meta-characters used here: - * - "\h" in a regex means "horizontal whitespace characters", i.e. spaces or tabs but not newline - * - "\Q" and "\E" in a regex allow to escape all the characters enclosed between them, - * which comes in handy to escape user-provided strings - * - "." does not match newline characters - * - "[\S\s]" matches any character, including newline characters - */ - public static class FailureReportChecker implements Consumer { - private final StringBuilder patternBuilder = new StringBuilder(); - private boolean lastPatternWasFailure = false; - - private FailureReportChecker() { - } - - public FailureReportChecker typeContext(String exactTypeName) { - return contextLiteral( "type '" + exactTypeName + "'" ); - } - - public FailureReportChecker indexContext(String exactIndexName) { - return contextLiteral( "index '" + exactIndexName + "'" ); - } - - public FailureReportChecker indexSchemaRootContext() { - return contextLiteral( "index schema root" ); - } - - public FailureReportChecker defaultBackendContext() { - return contextLiteral( "default backend" ); - } - - public FailureReportChecker backendContext(String exactBackendName) { - return contextLiteral( "backend '" + exactBackendName + "'" ); - } - - public FailureReportChecker pathContext(String pathPattern) { - return contextLiteral( "path '" + pathPattern + "'" ); - } - - public FailureReportChecker indexFieldContext(String exactPath) { - return contextLiteral( "field '" + exactPath + "'" ); - } - - public FailureReportChecker mappingAttributeContext(String exactName) { - return contextLiteral( "attribute '" + exactName + "'" ); - } - - public FailureReportChecker indexFieldTemplateContext(String exactPath) { - return contextLiteral( "field template '" + exactPath + "'" ); - } - - public FailureReportChecker fieldTemplateAttributeContext(String exactPath) { - return contextLiteral( "attribute '" + exactPath + "'" ); - } - - public FailureReportChecker analyzerContext(String exactName) { - return contextLiteral( "analyzer '" + exactName + "'" ); - } - - public FailureReportChecker normalizerContext(String exactName) { - return contextLiteral( "normalizer '" + exactName + "'" ); - } - - public FailureReportChecker charFilterContext(String exactName) { - return contextLiteral( "char filter '" + exactName + "'" ); - } - - public FailureReportChecker tokenizerContext(String exactName) { - return contextLiteral( "tokenizer '" + exactName + "'" ); - } - - public FailureReportChecker tokenFilterContext(String exactName) { - return contextLiteral( "token filter '" + exactName + "'" ); - } - - public FailureReportChecker analysisDefinitionParameterContext(String exactName) { - return contextLiteral( "parameter '" + exactName + "'" ); - } - - public FailureReportChecker aliasContext(String exactName) { - return contextLiteral( "alias '" + exactName + "'" ); - } - - public FailureReportChecker aliasAttributeContext(String exactName) { - return contextLiteral( "attribute '" + exactName + "'" ); - } - - public FailureReportChecker annotationContextAnyParameters(Class annotationType) { - return contextPattern( "annotation '@\\Q" + annotationType.getName() + "\\E\\(.*'" ); - } - - public FailureReportChecker annotationTypeContext(Class annotationType) { - return contextLiteral( "annotation type '@" + annotationType.getName() + "'" ); - } - - public FailureReportChecker contextLiteral(String contextLiteral) { - return contextPattern( "\\Q" + contextLiteral + "\\E" ); - } - - public FailureReportChecker contextPattern(String contextPattern) { - lastPatternWasFailure = false; - patternBuilder.append( "\n\\h+" ) - .append( contextPattern ) - .append( ": " ); - return this; - } - - public FailureReportChecker failure(String ... literalStringsContainedInFailureMessageInOrder) { - if ( !lastPatternWasFailure ) { - patternBuilder.append( "\n\\h+failures: " ); - } - lastPatternWasFailure = true; - patternBuilder.append( "\n\\h+-\\h" ); - for ( String contained : literalStringsContainedInFailureMessageInOrder ) { - patternBuilder.append( ".*" ) - .append( "\\Q" ).append( contained ).append( "\\E" ); - } - patternBuilder.append( ".*" ); - return this; - } - - public FailureReportChecker multilineFailure(String ... literalStringsContainedInFailureMessageInOrder) { - if ( !lastPatternWasFailure ) { - patternBuilder.append( "\n\\h+failures: " ); - } - lastPatternWasFailure = true; - patternBuilder.append( "\n\\h+-\\h" ); - for ( String contained : literalStringsContainedInFailureMessageInOrder ) { - patternBuilder.append( "[\\S\\s]*" ) - .append( "\\Q" ).append( contained ).append( "\\E" ); - } - patternBuilder.append( "[\\S\\s]*" ); - return this; - } - - @Override - public void accept(Throwable throwable) { - /* - * Prepend and append "[\S\s]*" because we have to match against the entire failure report, - * so we must match any characters before and after what we're looking for. - */ - String pattern = "[\\S\\s]*" - + patternBuilder - + "[\\S\\s]*"; - assertThat( throwable ).hasMessageMatching( pattern ); - } - } - -} diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportChecker.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportChecker.java new file mode 100644 index 00000000000..765d0fd81f0 --- /dev/null +++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportChecker.java @@ -0,0 +1,164 @@ +/* + * Hibernate Search, full-text search for your domain model + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.search.util.impl.integrationtest.common.reporting; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.lang.annotation.Annotation; +import java.util.function.Consumer; + +/* + * Notes on meta-characters used here: + * - "\h" in a regex means "horizontal whitespace characters", i.e. spaces or tabs but not newline + * - "\Q" and "\E" in a regex allow to escape all the characters enclosed between them, + * which comes in handy to escape user-provided strings + * - "." does not match newline characters + * - "[\S\s]" matches any character, including newline characters + */ +public class FailureReportChecker implements Consumer { + private final StringBuilder patternBuilder = new StringBuilder(); + private boolean lastPatternWasFailure = false; + + FailureReportChecker() { + } + + public FailureReportChecker typeContext(String exactTypeName) { + return contextLiteral( "type '" + exactTypeName + "'" ); + } + + public FailureReportChecker indexContext(String exactIndexName) { + return contextLiteral( "index '" + exactIndexName + "'" ); + } + + public FailureReportChecker indexSchemaRootContext() { + return contextLiteral( "index schema root" ); + } + + public FailureReportChecker defaultBackendContext() { + return contextLiteral( "default backend" ); + } + + public FailureReportChecker backendContext(String exactBackendName) { + return contextLiteral( "backend '" + exactBackendName + "'" ); + } + + public FailureReportChecker pathContext(String pathPattern) { + return contextLiteral( "path '" + pathPattern + "'" ); + } + + public FailureReportChecker indexFieldContext(String exactPath) { + return contextLiteral( "field '" + exactPath + "'" ); + } + + public FailureReportChecker mappingAttributeContext(String exactName) { + return contextLiteral( "attribute '" + exactName + "'" ); + } + + public FailureReportChecker indexFieldTemplateContext(String exactPath) { + return contextLiteral( "field template '" + exactPath + "'" ); + } + + public FailureReportChecker fieldTemplateAttributeContext(String exactPath) { + return contextLiteral( "attribute '" + exactPath + "'" ); + } + + public FailureReportChecker analyzerContext(String exactName) { + return contextLiteral( "analyzer '" + exactName + "'" ); + } + + public FailureReportChecker normalizerContext(String exactName) { + return contextLiteral( "normalizer '" + exactName + "'" ); + } + + public FailureReportChecker charFilterContext(String exactName) { + return contextLiteral( "char filter '" + exactName + "'" ); + } + + public FailureReportChecker tokenizerContext(String exactName) { + return contextLiteral( "tokenizer '" + exactName + "'" ); + } + + public FailureReportChecker tokenFilterContext(String exactName) { + return contextLiteral( "token filter '" + exactName + "'" ); + } + + public FailureReportChecker analysisDefinitionParameterContext(String exactName) { + return contextLiteral( "parameter '" + exactName + "'" ); + } + + public FailureReportChecker aliasContext(String exactName) { + return contextLiteral( "alias '" + exactName + "'" ); + } + + public FailureReportChecker aliasAttributeContext(String exactName) { + return contextLiteral( "attribute '" + exactName + "'" ); + } + + public FailureReportChecker indexSettingsCustomAttributeContext(String exactName) { + return contextLiteral( "attribute '" + exactName + "'" ); + } + + public FailureReportChecker annotationContextAnyParameters(Class annotationType) { + return contextPattern( "annotation '@\\Q" + annotationType.getName() + "\\E\\(.*'" ); + } + + public FailureReportChecker annotationTypeContext(Class annotationType) { + return contextLiteral( "annotation type '@" + annotationType.getName() + "'" ); + } + + public FailureReportChecker contextLiteral(String contextLiteral) { + return contextPattern( "\\Q" + contextLiteral + "\\E" ); + } + + public FailureReportChecker contextPattern(String contextPattern) { + lastPatternWasFailure = false; + patternBuilder.append( "\n\\h+" ) + .append( contextPattern ) + .append( ": " ); + return this; + } + + public FailureReportChecker failure(String... literalStringsContainedInFailureMessageInOrder) { + if ( !lastPatternWasFailure ) { + patternBuilder.append( "\n\\h+failures: " ); + } + lastPatternWasFailure = true; + patternBuilder.append( "\n\\h+-\\h" ); + for ( String contained : literalStringsContainedInFailureMessageInOrder ) { + patternBuilder.append( ".*" ) + .append( "\\Q" ).append( contained ).append( "\\E" ); + } + patternBuilder.append( ".*" ); + return this; + } + + public FailureReportChecker multilineFailure(String... literalStringsContainedInFailureMessageInOrder) { + if ( !lastPatternWasFailure ) { + patternBuilder.append( "\n\\h+failures: " ); + } + lastPatternWasFailure = true; + patternBuilder.append( "\n\\h+-\\h" ); + for ( String contained : literalStringsContainedInFailureMessageInOrder ) { + patternBuilder.append( "[\\S\\s]*" ) + .append( "\\Q" ).append( contained ).append( "\\E" ); + } + patternBuilder.append( "[\\S\\s]*" ); + return this; + } + + @Override + public void accept(Throwable throwable) { + /* + * Prepend and append "[\S\s]*" because we have to match against the entire failure report, + * so we must match any characters before and after what we're looking for. + */ + String pattern = "[\\S\\s]*" + + patternBuilder + + "[\\S\\s]*"; + assertThat( throwable ).hasMessageMatching( pattern ); + } +} diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportUtils.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportUtils.java new file mode 100644 index 00000000000..98ef6f6aab0 --- /dev/null +++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportUtils.java @@ -0,0 +1,66 @@ +/* + * Hibernate Search, full-text search for your domain model + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.search.util.impl.integrationtest.common.reporting; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import org.hibernate.search.util.common.reporting.EventContext; +import org.hibernate.search.util.common.reporting.EventContextElement; +import org.hibernate.search.util.common.SearchException; + +public final class FailureReportUtils { + + private FailureReportUtils() { + } + + /** + * @param first The first part of the expected context. + * @param others The other parts of the expected context, if any. To be concatenated to the first part. + * @return A consumer representing an assertion to be passed as a parameter to + * {@link org.assertj.core.api.AbstractThrowableAssert#satisfies(Consumer[])}. + */ + public static Consumer hasContext(EventContext first, EventContext... others) { + return hasContext( + EventContext.concat( first, others ).elements().toArray( new EventContextElement[] { } ) + ); + } + + /** + * @param contextElements The expect context elements, in order. + * @return A consumer representing an assertion to be passed as a parameter to + * {@link org.assertj.core.api.AbstractThrowableAssert#satisfies(Consumer[])}. + */ + public static Consumer hasContext(EventContextElement... contextElements) { + return throwable -> { + assertThat( throwable ) + .isInstanceOf( SearchException.class ); + EventContext actualContext = ( (SearchException) throwable ).context(); + assertThat( actualContext ).as( "throwable.getContext()" ).isNotNull(); + assertThat( actualContext.elements() ) + .containsExactly( contextElements ); + String renderedContextElements = Arrays.stream( contextElements ).map( EventContextElement::render ) + .collect( Collectors.joining( ", " ) ); + assertThat( throwable.getMessage() ) + .endsWith( "Context: " + renderedContextElements ); + }; + } + + public static Consumer hasCauseWithContext(EventContext first, EventContext ... others) { + Consumer delegate = hasContext( first, others ); + return e -> delegate.accept( e.getCause() ); + + } + + public static FailureReportChecker hasFailureReport() { + return new FailureReportChecker(); + } + +} From e13dfc88be9ee0d11179048fca1c4bba9acd1864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 12 May 2022 11:52:15 +0200 Subject: [PATCH 5/5] HSEARCH-4578 Improve error messages when failure report assertions fail --- .../reporting/FailureReportChecker.java | 97 ++++++++++++++----- 1 file changed, 74 insertions(+), 23 deletions(-) diff --git a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportChecker.java b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportChecker.java index 765d0fd81f0..1b2acf5762c 100644 --- a/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportChecker.java +++ b/util/internal/integrationtest/common/src/main/java/org/hibernate/search/util/impl/integrationtest/common/reporting/FailureReportChecker.java @@ -6,10 +6,14 @@ */ package org.hibernate.search.util.impl.integrationtest.common.reporting; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.List; import java.util.function.Consumer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /* * Notes on meta-characters used here: @@ -20,7 +24,7 @@ * - "[\S\s]" matches any character, including newline characters */ public class FailureReportChecker implements Consumer { - private final StringBuilder patternBuilder = new StringBuilder(); + private final List elementsToMatch = new ArrayList<>(); private boolean lastPatternWasFailure = false; FailureReportChecker() { @@ -116,49 +120,96 @@ public FailureReportChecker contextLiteral(String contextLiteral) { public FailureReportChecker contextPattern(String contextPattern) { lastPatternWasFailure = false; - patternBuilder.append( "\n\\h+" ) - .append( contextPattern ) - .append( ": " ); + elementsToMatch.add( new ElementToMatch( "\\n\\h+" + contextPattern + ": " ) ); return this; } public FailureReportChecker failure(String... literalStringsContainedInFailureMessageInOrder) { if ( !lastPatternWasFailure ) { - patternBuilder.append( "\n\\h+failures: " ); + elementsToMatch.add( new ElementToMatch( "\\n\\h+failures: " ) ); } lastPatternWasFailure = true; - patternBuilder.append( "\n\\h+-\\h" ); + elementsToMatch.add( new ElementToMatch( "\\n\\h+-\\h" ) ); for ( String contained : literalStringsContainedInFailureMessageInOrder ) { - patternBuilder.append( ".*" ) - .append( "\\Q" ).append( contained ).append( "\\E" ); + elementsToMatch.add( new ElementToMatch( ".*" + "\\Q" + contained + "\\E" ) ); } - patternBuilder.append( ".*" ); + // Consume the rest of the line + elementsToMatch.add( new ElementToMatch( ".*" ) ); return this; } public FailureReportChecker multilineFailure(String... literalStringsContainedInFailureMessageInOrder) { if ( !lastPatternWasFailure ) { - patternBuilder.append( "\n\\h+failures: " ); + elementsToMatch.add( new ElementToMatch( "\\n\\h+failures: " ) ); } lastPatternWasFailure = true; - patternBuilder.append( "\n\\h+-\\h" ); + elementsToMatch.add( new ElementToMatch( "\\n\\h+-\\h" ) ); for ( String contained : literalStringsContainedInFailureMessageInOrder ) { - patternBuilder.append( "[\\S\\s]*" ) - .append( "\\Q" ).append( contained ).append( "\\E" ); + elementsToMatch.add( new ElementToMatch( "[\\S\\s]*" + "\\Q" + contained + "\\E" ) ); } - patternBuilder.append( "[\\S\\s]*" ); + // Match the rest of the line + // We can't match multiple lines here, or we would run the risk of + // matching text meant for the following elements to match + elementsToMatch.add( new ElementToMatch( ".*" ) ); return this; } + private static class ElementToMatch { + + private final Pattern pattern; + + ElementToMatch(String patternString) { + this.pattern = Pattern.compile( patternString ); + } + + int consumeFirst(String fullMessage) { + Matcher matcher = pattern.matcher( fullMessage ); + if ( matcher.find() ) { + return matcher.end(); + } + else { + return fail( + "Expected to find substring matching the following pattern:" + + "\n\t%s" + + "\n\nbut did not." + + "\n\nFull actual message:\n\t%s", + pattern.pattern(), + fullMessage + ); + } + } + + int consumeNext(String fullMessage, int currentIndex) { + Matcher matcher = pattern.matcher( fullMessage ); + if ( matcher.find( currentIndex ) && matcher.start() == currentIndex ) { + return matcher.end(); + } + else { + return fail( + "After:\n\t[...]%s" + + "\n\nExpected to find substring matching the following pattern:" + + "\n\t%s" + + "\n\nbut found this instead:\n\t%s[..]" + + "\n\nFull actual message:\n\t%s", + fullMessage.substring( Math.max( 0, currentIndex - 200 ), currentIndex ), + pattern.pattern(), + fullMessage.substring( currentIndex, Math.min( fullMessage.length(), currentIndex + 100 + pattern.pattern().length() ) ), + fullMessage + ); + } + } + + } + @Override public void accept(Throwable throwable) { - /* - * Prepend and append "[\S\s]*" because we have to match against the entire failure report, - * so we must match any characters before and after what we're looking for. - */ - String pattern = "[\\S\\s]*" - + patternBuilder - + "[\\S\\s]*"; - assertThat( throwable ).hasMessageMatching( pattern ); + String message = throwable.getMessage(); + if ( elementsToMatch.isEmpty() ) { + throw new IllegalStateException( "Must add at least one element to match" ); + } + int currentIndex = elementsToMatch.get( 0 ).consumeFirst( message ); + for ( int i = 1; i < elementsToMatch.size(); i++ ) { + currentIndex = elementsToMatch.get( i ).consumeNext( message, currentIndex ); + } } }