Skip to content

Commit 9a512d0

Browse files
committed
test: add test for QdrantVectorStoreBuilderTests
Add comprehensive test coverage for QdrantObjectFactory and QdrantVectorStore.Builder. Co-authored-by: Oleksandr Klymenko <[email protected]> Signed-off-by: Oleksandr Klymenko <[email protected]>
1 parent 2c5aca7 commit 9a512d0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

vector-stores/spring-ai-qdrant-store/src/test/java/org/springframework/ai/vectorstore/qdrant/QdrantVectorStoreBuilderTests.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,27 @@ void builderShouldMaintainBuilderPattern() {
331331
assertThat(result).isSameAs(builder);
332332
}
333333

334+
@Test
335+
void builderShouldHandleRepeatedConfigurationCalls() {
336+
QdrantVectorStore.Builder builder = QdrantVectorStore.builder(this.qdrantClient, this.embeddingModel);
337+
338+
// Call configuration methods multiple times in different orders
339+
builder.initializeSchema(true)
340+
.collectionName("first")
341+
.initializeSchema(false)
342+
.collectionName("second")
343+
.initializeSchema(true);
344+
345+
QdrantVectorStore vectorStore = builder.build();
346+
347+
// Should use the last set values
348+
assertThat(vectorStore).hasFieldOrPropertyWithValue("collectionName", "second");
349+
assertThat(vectorStore).hasFieldOrPropertyWithValue("initializeSchema", true);
350+
351+
// Verify builder can still be used after build
352+
QdrantVectorStore anotherVectorStore = builder.collectionName("third").build();
353+
assertThat(anotherVectorStore).hasFieldOrPropertyWithValue("collectionName", "third");
354+
assertThat(anotherVectorStore).hasFieldOrPropertyWithValue("initializeSchema", true);
355+
}
356+
334357
}

0 commit comments

Comments
 (0)