@@ -46,7 +46,7 @@ public class GrpcClientFactoryTests {
4646
4747 GrpcClientFactoryTests () {
4848 Mockito .when (channelFactory .createChannel (Mockito .anyString (), Mockito .any ()))
49- .thenReturn (Mockito .mock (ManagedChannel .class ));
49+ .thenReturn (Mockito .mock (ManagedChannel .class ));
5050 context .registerBean (GrpcChannelFactory .class , () -> channelFactory );
5151 factory = new GrpcClientFactory ();
5252 factory .setApplicationContext (context );
@@ -75,7 +75,7 @@ void testCustomStubFactory() {
7575 void testWithExplicitStubFactory () {
7676 context .registerBean (OtherStubFactory .class , () -> new OtherStubFactory ());
7777 GrpcClientFactory .register (context , new GrpcClientRegistrationSpec ("local" , new Class [] { OtherStub .class })
78- .factory (OtherStubFactory .class ));
78+ .factory (OtherStubFactory .class ));
7979 assertThat (factory .getClient ("local" , OtherStub .class , null )).isNotNull ();
8080 }
8181
@@ -96,11 +96,25 @@ void testCoroutineStubFactory() {
9696 context .registerBean (CoroutineStubFactory .class , CoroutineStubFactory ::new );
9797 GrpcClientFactory .register (context ,
9898 GrpcClientRegistrationSpec .of ("local" )
99- .factory (CoroutineStubFactory .class )
100- .types (MyCoroutineStub .class ));
99+ .factory (CoroutineStubFactory .class )
100+ .types (MyCoroutineStub .class ));
101101 assertThat (factory .getClient ("local" , MyCoroutineStub .class , null )).isNotNull ();
102102 }
103103
104+ @ Test
105+ void testCoroutineStubFactoryAfterDefault () {
106+ context .registerBean (CoroutineStubFactory .class , CoroutineStubFactory ::new );
107+ GrpcClientFactory .register (context ,
108+ GrpcClientRegistrationSpec .of ("local" )
109+ .types (MyStub .class ));
110+ GrpcClientFactory .register (context ,
111+ GrpcClientRegistrationSpec .of ("local" )
112+ .factory (CoroutineStubFactory .class )
113+ .types (MyCoroutineStub .class ));
114+ assertThat (factory .getClient ("local" , MyCoroutineStub .class , null )).isNotNull ();
115+ assertThat (factory .getClient ("local" , MyStub .class , null )).isNotNull ();
116+ }
117+
104118 static class OtherStubFactory implements StubFactory <OtherStub > {
105119
106120 @ Override
0 commit comments