diff --git a/src/test/java/org/opensearch/neuralsearch/processor/chunker/FixedTokenLengthChunkerTests.java b/src/test/java/org/opensearch/neuralsearch/processor/chunker/FixedTokenLengthChunkerTests.java index 5098d126d..2ad1ea18e 100644 --- a/src/test/java/org/opensearch/neuralsearch/processor/chunker/FixedTokenLengthChunkerTests.java +++ b/src/test/java/org/opensearch/neuralsearch/processor/chunker/FixedTokenLengthChunkerTests.java @@ -105,7 +105,7 @@ public void testParseParameters_whenIllegalOverlapRateType_thenFail() { ); } - public void testParseParameters_whenIllegalOverlapRateValue_thenFail() { + public void testParseParameters_whenTooLargeOverlapRate_thenFail() { Map parameters = new HashMap<>(); parameters.put(OVERLAP_RATE_FIELD, 0.6); IllegalArgumentException illegalArgumentException = assertThrows( @@ -118,6 +118,19 @@ public void testParseParameters_whenIllegalOverlapRateValue_thenFail() { ); } + public void testParseParameters_whenTooSmallOverlapRateValue_thenFail() { + Map parameters = new HashMap<>(); + parameters.put(OVERLAP_RATE_FIELD, -1); + IllegalArgumentException illegalArgumentException = assertThrows( + IllegalArgumentException.class, + () -> fixedTokenLengthChunker.parseParameters(parameters) + ); + assertEquals( + String.format(Locale.ROOT, "Parameter [%s] must be between %s and %s", OVERLAP_RATE_FIELD, 0.0, 0.5), + illegalArgumentException.getMessage() + ); + } + public void testParseParameters_whenIllegalTokenizerType_thenFail() { Map parameters = new HashMap<>(); parameters.put(TOKENIZER_FIELD, 111);