Skip to content

Commit

Permalink
test: exception when batchSize is zero or negative integer
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonghyeonKO committed Nov 17, 2024
1 parent 7843e43 commit 90b81ab
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,21 @@ public void testJsonRoundtripWithoutBatchSize() {
assertEquals("some-tag", deserialized.tag());
assertNull(deserialized.batchSize());
}

@Test
public void testInvalidBatchSizeThrowsException() {
IllegalArgumentException exceptionWhenBatchSizeIsZero = assertThrows(IllegalArgumentException.class, () -> {
new Processor.Builder().textEmbedding(
baseTextEmbeddingProcessor().batchSize(0).build()
).build();
});
assertEquals("batchSize must be a positive integer", exceptionWhenBatchSizeIsZero.getMessage());

IllegalArgumentException exceptionWhenBatchSizeIsNegative = assertThrows(IllegalArgumentException.class, () -> {
new Processor.Builder().textEmbedding(
baseTextEmbeddingProcessor().batchSize(-1).build()
).build();
});
assertEquals("batchSize must be a positive integer", exceptionWhenBatchSizeIsNegative.getMessage());
}
}

0 comments on commit 90b81ab

Please sign in to comment.