Skip to content

Commit bad14c1

Browse files
puppylpgsothawo
andauthored
Apply suggestions from code review
Co-authored-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
1 parent 160382c commit bad14c1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ void setUp() {
118118
new Student("2", "Michael", "Dunlop"));
119119
}
120120

121-
@AfterEach
122-
void tearDown() {
123-
personIndexOperations.delete();
124-
studentIndexOperations.delete();
121+
@Test
122+
@Order(Integer.MAX_VALUE)
123+
void cleanup() {
124+
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + '*')).delete();
125+
}
125126
}
126127

127128
@Test // #1891
@@ -288,8 +289,11 @@ void shouldSearchWithTemplateMultiSearchWithMultipleIndexCoordinates() {
288289
.build();
289290

290291
// search with multiple index coordinates
291-
var multiSearchHits = operations.multiSearch(List.of(q1, q2), List.of(Person.class, Student.class),
292-
List.of(IndexCoordinates.of(indexNameProvider.indexName()), IndexCoordinates.of("another-index")));
292+
var multiSearchHits = operations.multiSearch(
293+
List.of(q1, q2),
294+
List.of(Person.class, Student.class),
295+
List.of(IndexCoordinates.of(indexNameProvider.indexName() + "-person"),
296+
IndexCoordinates.of(indexNameProvider.indexName() + "-student")));
293297

294298
assertThat(multiSearchHits.size()).isEqualTo(2);
295299
assertThat(multiSearchHits.get(0).getTotalHits()).isEqualTo(2);
@@ -310,15 +314,15 @@ void shouldSearchWithTemplateMultiSearchWithMultipleIndexCoordinates() {
310314
assertThat(operations.deleteScript(SCRIPT_SEARCH_LASTNAME.id())).isTrue();
311315
}
312316

313-
@Document(indexName = "#{@indexNameProvider.indexName()}")
317+
@Document(indexName = "#{@indexNameProvider.indexName()}-person")
314318
record Person( //
315319
@Nullable @Id String id, //
316320
@Field(type = FieldType.Text) String firstName, //
317321
@Field(type = FieldType.Text) String lastName //
318322
) {
319323
}
320324

321-
@Document(indexName = "another-index")
325+
@Document(indexName = "#{@indexNameProvider.indexName()}-student")
322326
record Student( //
323327
@Nullable @Id String id, //
324328
@Field(type = FieldType.Text) String firstName, //

0 commit comments

Comments
 (0)