Skip to content

Commit 4f0a805

Browse files
committed
add test (imperative)
1 parent 5f297f1 commit 4f0a805

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchIntegrationTests.java

+16
Original file line numberDiff line numberDiff line change
@@ -3739,6 +3739,22 @@ void shouldSetIndexedIndexNameProperty() {
37393739
assertThat(saved.getIndexedIndexName()).isEqualTo(indexNameProvider.indexName() + "-indexedindexname");
37403740
}
37413741

3742+
@Test // #3007
3743+
@DisplayName("should set IndexedIndexName in search result")
3744+
void shouldSetIndexedIndexNameInSearchResult() {
3745+
3746+
var entity = new IndexedIndexNameEntity();
3747+
entity.setId("42");
3748+
entity.setSomeText("someText");
3749+
operations.save(entity);
3750+
3751+
var searchHits = operations.search(Query.findAll(), IndexedIndexNameEntity.class);
3752+
3753+
assertThat(searchHits.getTotalHits()).isEqualTo(1);
3754+
var foundEntity = searchHits.getSearchHit(0).getContent();
3755+
assertThat(foundEntity.indexedIndexName).isEqualTo(indexNameProvider.indexName() + "-indexedindexname");
3756+
}
3757+
37423758
@Test // #1945
37433759
@DisplayName("should error on sort with unmapped field and default settings")
37443760
void shouldErrorOnSortWithUnmappedFieldAndDefaultSettings() {

0 commit comments

Comments
 (0)