4646import io .modelcontextprotocol .util .Utils ;
4747import net .javacrumbs .jsonunit .core .Option ;
4848import org .junit .jupiter .params .ParameterizedTest ;
49+ import org .junit .jupiter .params .provider .MethodSource ;
4950import org .junit .jupiter .params .provider .ValueSource ;
5051import reactor .core .publisher .Mono ;
5152import reactor .test .StepVerifier ;
@@ -70,15 +71,14 @@ public abstract class AbstractMcpClientServerIntegrationTests {
7071 abstract protected McpServer .SyncSpecification <?> prepareSyncServerBuilder ();
7172
7273 @ ParameterizedTest (name = "{0} : {displayName} " )
73- @ ValueSource ( strings = { "httpclient" } )
74+ @ MethodSource ( "clientsForTesting" )
7475 void simple (String clientType ) {
7576
7677 var clientBuilder = clientBuilders .get (clientType );
7778
7879 var server = prepareAsyncServerBuilder ().serverInfo ("test-server" , "1.0.0" )
7980 .requestTimeout (Duration .ofSeconds (1000 ))
8081 .build ();
81-
8282 try (
8383 // Create client without sampling capabilities
8484 var client = clientBuilder .clientInfo (new McpSchema .Implementation ("Sample " + "client" , "0.0.0" ))
@@ -97,7 +97,7 @@ void simple(String clientType) {
9797 // Sampling Tests
9898 // ---------------------------------------
9999 @ ParameterizedTest (name = "{0} : {displayName} " )
100- @ ValueSource ( strings = { "httpclient" } )
100+ @ MethodSource ( "clientsForTesting" )
101101 void testCreateMessageWithoutSamplingCapabilities (String clientType ) {
102102
103103 var clientBuilder = clientBuilders .get (clientType );
@@ -133,7 +133,7 @@ void testCreateMessageWithoutSamplingCapabilities(String clientType) {
133133 }
134134
135135 @ ParameterizedTest (name = "{0} : {displayName} " )
136- @ ValueSource ( strings = { "httpclient" } )
136+ @ MethodSource ( "clientsForTesting" )
137137 void testCreateMessageSuccess (String clientType ) {
138138
139139 var clientBuilder = clientBuilders .get (clientType );
@@ -202,7 +202,7 @@ void testCreateMessageSuccess(String clientType) {
202202 }
203203
204204 @ ParameterizedTest (name = "{0} : {displayName} " )
205- @ ValueSource ( strings = { "httpclient" } )
205+ @ MethodSource ( "clientsForTesting" )
206206 void testCreateMessageWithRequestTimeoutSuccess (String clientType ) throws InterruptedException {
207207
208208 // Client
@@ -282,7 +282,7 @@ void testCreateMessageWithRequestTimeoutSuccess(String clientType) throws Interr
282282 }
283283
284284 @ ParameterizedTest (name = "{0} : {displayName} " )
285- @ ValueSource ( strings = { "httpclient" } )
285+ @ MethodSource ( "clientsForTesting" )
286286 void testCreateMessageWithRequestTimeoutFail (String clientType ) throws InterruptedException {
287287
288288 var clientBuilder = clientBuilders .get (clientType );
@@ -348,7 +348,7 @@ void testCreateMessageWithRequestTimeoutFail(String clientType) throws Interrupt
348348 // Elicitation Tests
349349 // ---------------------------------------
350350 @ ParameterizedTest (name = "{0} : {displayName} " )
351- @ ValueSource ( strings = { "httpclient" } )
351+ @ MethodSource ( "clientsForTesting" )
352352 void testCreateElicitationWithoutElicitationCapabilities (String clientType ) {
353353
354354 var clientBuilder = clientBuilders .get (clientType );
@@ -380,7 +380,7 @@ void testCreateElicitationWithoutElicitationCapabilities(String clientType) {
380380 }
381381
382382 @ ParameterizedTest (name = "{0} : {displayName} " )
383- @ ValueSource ( strings = { "httpclient" } )
383+ @ MethodSource ( "clientsForTesting" )
384384 void testCreateElicitationSuccess (String clientType ) {
385385
386386 var clientBuilder = clientBuilders .get (clientType );
@@ -437,7 +437,7 @@ void testCreateElicitationSuccess(String clientType) {
437437 }
438438
439439 @ ParameterizedTest (name = "{0} : {displayName} " )
440- @ ValueSource ( strings = { "httpclient" } )
440+ @ MethodSource ( "clientsForTesting" )
441441 void testCreateElicitationWithRequestTimeoutSuccess (String clientType ) {
442442
443443 var clientBuilder = clientBuilders .get (clientType );
@@ -498,7 +498,7 @@ void testCreateElicitationWithRequestTimeoutSuccess(String clientType) {
498498 }
499499
500500 @ ParameterizedTest (name = "{0} : {displayName} " )
501- @ ValueSource ( strings = { "httpclient" } )
501+ @ MethodSource ( "clientsForTesting" )
502502 void testCreateElicitationWithRequestTimeoutFail (String clientType ) {
503503
504504 var latch = new CountDownLatch (1 );
@@ -569,7 +569,7 @@ void testCreateElicitationWithRequestTimeoutFail(String clientType) {
569569 // Roots Tests
570570 // ---------------------------------------
571571 @ ParameterizedTest (name = "{0} : {displayName} " )
572- @ ValueSource ( strings = { "httpclient" } )
572+ @ MethodSource ( "clientsForTesting" )
573573 void testRootsSuccess (String clientType ) {
574574 var clientBuilder = clientBuilders .get (clientType );
575575
@@ -617,7 +617,7 @@ void testRootsSuccess(String clientType) {
617617 }
618618
619619 @ ParameterizedTest (name = "{0} : {displayName} " )
620- @ ValueSource ( strings = { "httpclient" } )
620+ @ MethodSource ( "clientsForTesting" )
621621 void testRootsWithoutCapability (String clientType ) {
622622
623623 var clientBuilder = clientBuilders .get (clientType );
@@ -656,7 +656,7 @@ void testRootsWithoutCapability(String clientType) {
656656 }
657657
658658 @ ParameterizedTest (name = "{0} : {displayName} " )
659- @ ValueSource ( strings = { "httpclient" } )
659+ @ MethodSource ( "clientsForTesting" )
660660 void testRootsNotificationWithEmptyRootsList (String clientType ) {
661661
662662 var clientBuilder = clientBuilders .get (clientType );
@@ -686,7 +686,7 @@ void testRootsNotificationWithEmptyRootsList(String clientType) {
686686 }
687687
688688 @ ParameterizedTest (name = "{0} : {displayName} " )
689- @ ValueSource ( strings = { "httpclient" } )
689+ @ MethodSource ( "clientsForTesting" )
690690 void testRootsWithMultipleHandlers (String clientType ) {
691691
692692 var clientBuilder = clientBuilders .get (clientType );
@@ -720,7 +720,7 @@ void testRootsWithMultipleHandlers(String clientType) {
720720 }
721721
722722 @ ParameterizedTest (name = "{0} : {displayName} " )
723- @ ValueSource ( strings = { "httpclient" } )
723+ @ MethodSource ( "clientsForTesting" )
724724 void testRootsServerCloseWithActiveSubscription (String clientType ) {
725725
726726 var clientBuilder = clientBuilders .get (clientType );
@@ -755,7 +755,7 @@ void testRootsServerCloseWithActiveSubscription(String clientType) {
755755 // Tools Tests
756756 // ---------------------------------------
757757 @ ParameterizedTest (name = "{0} : {displayName} " )
758- @ ValueSource ( strings = { "httpclient" } )
758+ @ MethodSource ( "clientsForTesting" )
759759 void testToolCallSuccess (String clientType ) {
760760
761761 var clientBuilder = clientBuilders .get (clientType );
@@ -806,7 +806,7 @@ void testToolCallSuccess(String clientType) {
806806 }
807807
808808 @ ParameterizedTest (name = "{0} : {displayName} " )
809- @ ValueSource ( strings = { "httpclient" } )
809+ @ MethodSource ( "clientsForTesting" )
810810 void testThrowingToolCallIsCaughtBeforeTimeout (String clientType ) {
811811
812812 var clientBuilder = clientBuilders .get (clientType );
@@ -844,7 +844,7 @@ void testThrowingToolCallIsCaughtBeforeTimeout(String clientType) {
844844 }
845845
846846 @ ParameterizedTest (name = "{0} : {displayName} " )
847- @ ValueSource ( strings = { "httpclient" } )
847+ @ MethodSource ( "clientsForTesting" )
848848 void testToolCallSuccessWithTranportContextExtraction (String clientType ) {
849849
850850 var clientBuilder = clientBuilders .get (clientType );
@@ -901,7 +901,7 @@ void testToolCallSuccessWithTranportContextExtraction(String clientType) {
901901 }
902902
903903 @ ParameterizedTest (name = "{0} : {displayName} " )
904- @ ValueSource ( strings = { "httpclient" } )
904+ @ MethodSource ( "clientsForTesting" )
905905 void testToolListChangeHandlingSuccess (String clientType ) {
906906
907907 var clientBuilder = clientBuilders .get (clientType );
@@ -994,7 +994,7 @@ void testToolListChangeHandlingSuccess(String clientType) {
994994 }
995995
996996 @ ParameterizedTest (name = "{0} : {displayName} " )
997- @ ValueSource ( strings = { "httpclient" } )
997+ @ MethodSource ( "clientsForTesting" )
998998 void testInitialize (String clientType ) {
999999
10001000 var clientBuilder = clientBuilders .get (clientType );
@@ -1015,7 +1015,7 @@ void testInitialize(String clientType) {
10151015 // Logging Tests
10161016 // ---------------------------------------
10171017 @ ParameterizedTest (name = "{0} : {displayName} " )
1018- @ ValueSource ( strings = { "httpclient" } )
1018+ @ MethodSource ( "clientsForTesting" )
10191019 void testLoggingNotification (String clientType ) throws InterruptedException {
10201020 int expectedNotificationsCount = 3 ;
10211021 CountDownLatch latch = new CountDownLatch (expectedNotificationsCount );
@@ -1128,7 +1128,7 @@ void testLoggingNotification(String clientType) throws InterruptedException {
11281128 // Progress Tests
11291129 // ---------------------------------------
11301130 @ ParameterizedTest (name = "{0} : {displayName} " )
1131- @ ValueSource ( strings = { "httpclient" } )
1131+ @ MethodSource ( "clientsForTesting" )
11321132 void testProgressNotification (String clientType ) throws InterruptedException {
11331133 int expectedNotificationsCount = 4 ; // 3 notifications + 1 for another progress
11341134 // token
@@ -1234,7 +1234,7 @@ void testProgressNotification(String clientType) throws InterruptedException {
12341234 // Completion Tests
12351235 // ---------------------------------------
12361236 @ ParameterizedTest (name = "{0} : Completion call" )
1237- @ ValueSource ( strings = { "httpclient" } )
1237+ @ MethodSource ( "clientsForTesting" )
12381238 void testCompletionShouldReturnExpectedSuggestions (String clientType ) {
12391239 var clientBuilder = clientBuilders .get (clientType );
12401240
@@ -1256,7 +1256,7 @@ void testCompletionShouldReturnExpectedSuggestions(String clientType) {
12561256 List .of (new PromptArgument ("language" , "Language" , "string" , false ))),
12571257 (mcpSyncServerExchange , getPromptRequest ) -> null ))
12581258 .completions (new McpServerFeatures .SyncCompletionSpecification (
1259- new PromptReference ("ref/prompt" , "code_review" , "Code review" ), completionHandler ))
1259+ new McpSchema . PromptReference ("ref/prompt" , "code_review" , "Code review" ), completionHandler ))
12601260 .build ();
12611261
12621262 try (var mcpClient = clientBuilder .build ()) {
@@ -1285,7 +1285,7 @@ void testCompletionShouldReturnExpectedSuggestions(String clientType) {
12851285 // Ping Tests
12861286 // ---------------------------------------
12871287 @ ParameterizedTest (name = "{0} : {displayName} " )
1288- @ ValueSource ( strings = { "httpclient" } )
1288+ @ MethodSource ( "clientsForTesting" )
12891289 void testPingSuccess (String clientType ) {
12901290
12911291 var clientBuilder = clientBuilders .get (clientType );
@@ -1348,7 +1348,7 @@ void testPingSuccess(String clientType) {
13481348 // Tool Structured Output Schema Tests
13491349 // ---------------------------------------
13501350 @ ParameterizedTest (name = "{0} : {displayName} " )
1351- @ ValueSource ( strings = { "httpclient" } )
1351+ @ MethodSource ( "clientsForTesting" )
13521352 void testStructuredOutputValidationSuccess (String clientType ) {
13531353 var clientBuilder = clientBuilders .get (clientType );
13541354
@@ -1593,7 +1593,7 @@ void testStructuredOutputValidationFailure(String clientType) {
15931593 }
15941594
15951595 @ ParameterizedTest (name = "{0} : {displayName} " )
1596- @ ValueSource ( strings = { "httpclient" } )
1596+ @ MethodSource ( "clientsForTesting" )
15971597 void testStructuredOutputMissingStructuredContent (String clientType ) {
15981598
15991599 var clientBuilder = clientBuilders .get (clientType );
@@ -1644,7 +1644,7 @@ void testStructuredOutputMissingStructuredContent(String clientType) {
16441644 }
16451645
16461646 @ ParameterizedTest (name = "{0} : {displayName} " )
1647- @ ValueSource ( strings = { "httpclient" } )
1647+ @ MethodSource ( "clientsForTesting" )
16481648 void testStructuredOutputRuntimeToolAddition (String clientType ) {
16491649
16501650 var clientBuilder = clientBuilders .get (clientType );
0 commit comments