Search in sources :

Example 1 with InvalidType

use of org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType in project hibernate-search by hibernate.

the class FieldSearchSortTypeCheckingAndConversionIT method invalidType_noDslConverter.

@Test
public void invalidType_noDslConverter() {
    StubMappingScope scope = mainIndex.createScope();
    String absoluteFieldPath = getFieldPath();
    Object invalidValueToMatch = new InvalidType();
    assertThatThrownBy(() -> scope.sort().field(absoluteFieldPath).missing().use(invalidValueToMatch), "field() sort with invalid parameter type for missing().use() on field " + absoluteFieldPath).isInstanceOf(SearchException.class).hasMessageContaining("Unable to convert DSL argument: ").hasMessageContaining(InvalidType.class.getName()).hasCauseInstanceOf(ClassCastException.class).satisfies(FailureReportUtils.hasContext(EventContexts.fromIndexFieldAbsolutePath(absoluteFieldPath)));
}
Also used : StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) InvalidType(org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType) Test(org.junit.Test)

Example 2 with InvalidType

use of org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType in project hibernate-search by hibernate.

the class FieldSortTypeCheckingAndConversionIT method invalidType_withDslConverter.

@Test
public void invalidType_withDslConverter() {
    StubMappingScope scope = mainIndex.createScope();
    String absoluteFieldPath = getFieldWithDslConverterPath();
    Object invalidValueToMatch = new InvalidType();
    assertThatThrownBy(() -> scope.sort().field(absoluteFieldPath).missing().use(invalidValueToMatch), "field() sort with invalid parameter type for missing().use() on field " + absoluteFieldPath).isInstanceOf(SearchException.class).hasMessageContaining("Unable to convert DSL argument: ").hasMessageContaining(InvalidType.class.getName()).hasCauseInstanceOf(ClassCastException.class).satisfies(FailureReportUtils.hasContext(EventContexts.fromIndexFieldAbsolutePath(absoluteFieldPath)));
}
Also used : StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) InvalidType(org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType) Test(org.junit.Test)

Example 3 with InvalidType

use of org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType in project hibernate-search by hibernate.

the class FieldSearchSortTypeCheckingAndConversionIT method invalidType_withDslConverter.

@Test
public void invalidType_withDslConverter() {
    StubMappingScope scope = mainIndex.createScope();
    String absoluteFieldPath = getFieldWithDslConverterPath();
    Object invalidValueToMatch = new InvalidType();
    assertThatThrownBy(() -> scope.sort().field(absoluteFieldPath).missing().use(invalidValueToMatch), "field() sort with invalid parameter type for missing().use() on field " + absoluteFieldPath).isInstanceOf(SearchException.class).hasMessageContaining("Unable to convert DSL argument: ").hasMessageContaining(InvalidType.class.getName()).hasCauseInstanceOf(ClassCastException.class).satisfies(FailureReportUtils.hasContext(EventContexts.fromIndexFieldAbsolutePath(absoluteFieldPath)));
}
Also used : StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) InvalidType(org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType) Test(org.junit.Test)

Example 4 with InvalidType

use of org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType in project hibernate-search by hibernate.

the class FieldSortTypeCheckingAndConversionIT method invalidType_noDslConverter.

@Test
public void invalidType_noDslConverter() {
    StubMappingScope scope = mainIndex.createScope();
    String absoluteFieldPath = getFieldPath();
    Object invalidValueToMatch = new InvalidType();
    assertThatThrownBy(() -> scope.sort().field(absoluteFieldPath).missing().use(invalidValueToMatch), "field() sort with invalid parameter type for missing().use() on field " + absoluteFieldPath).isInstanceOf(SearchException.class).hasMessageContaining("Unable to convert DSL argument: ").hasMessageContaining(InvalidType.class.getName()).hasCauseInstanceOf(ClassCastException.class).satisfies(FailureReportUtils.hasContext(EventContexts.fromIndexFieldAbsolutePath(absoluteFieldPath)));
}
Also used : StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) InvalidType(org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType) Test(org.junit.Test)

Aggregations

InvalidType (org.hibernate.search.integrationtest.backend.tck.testsupport.util.InvalidType)4 StubMappingScope (org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope)4 Test (org.junit.Test)4