Skip to content

Commit d9149ea

Browse files
ChrisEdwardsclaude
andcommitted
Add validation test for empty string sessionMetadataValue (MCP-3EG)
Added testGetRouteCoverage_SessionMetadataFilter_EmptyValue() to verify that when sessionMetadataName is provided with a non-empty value but sessionMetadataValue is an empty string, an IllegalArgumentException is thrown with the message "sessionMetadataValue is required". This completes the test coverage for MCP-3EG, which was already fixed by the empty string handling changes in MCP-OU8 (commit d7eecba). All 17 unit tests pass. Fixes MCP-3EG 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ee20944 commit d9149ea

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/java/com/contrast/labs/ai/mcp/contrast/RouteCoverageServiceTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,20 @@ void testGetRouteCoverage_SessionMetadataFilter_MissingValue() throws Exception
286286
verify(mockSDKExtension, never()).getRouteCoverage(anyString(), anyString(), any());
287287
}
288288

289+
@Test
290+
void testGetRouteCoverage_SessionMetadataFilter_EmptyValue() throws Exception {
291+
// Test validation with empty string for sessionMetadataValue (MCP-3EG)
292+
// Act & Assert
293+
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> {
294+
routeCoverageService.getRouteCoverage(TEST_APP_ID, TEST_METADATA_NAME, "", null);
295+
});
296+
297+
assertTrue(exception.getMessage().contains("sessionMetadataValue is required"));
298+
299+
// Verify SDK was never called
300+
verify(mockSDKExtension, never()).getRouteCoverage(anyString(), anyString(), any());
301+
}
302+
289303
// ========== Test Case 3: Latest Session Filter ==========
290304

291305
@Test

0 commit comments

Comments
 (0)