Skip to content

Commit dd9941b

Browse files
committed
Return new instance for newChannel
We should be returning a new instance rather than the same instance from the mock to comply with the interface.
1 parent cbe7b50 commit dd9941b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

http-clients/netty-nio-client/src/test/java/software/amazon/awssdk/http/nio/netty/NettyNioAsyncHttpClientWireMockTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
import org.mockito.Mock;
7474
import org.mockito.Mockito;
7575
import org.mockito.runners.MockitoJUnitRunner;
76+
import org.mockito.stubbing.Answer;
7677
import org.reactivestreams.Subscriber;
7778
import org.reactivestreams.Subscription;
7879
import software.amazon.awssdk.http.SdkHttpConfigurationOption;
@@ -181,7 +182,7 @@ public void customChannelFactoryIsUsed() throws Exception {
181182

182183
ChannelFactory channelFactory = mock(ChannelFactory.class);
183184

184-
when(channelFactory.newChannel()).thenReturn(new NioSocketChannel());
185+
when(channelFactory.newChannel()).thenAnswer((Answer<NioSocketChannel>) invocationOnMock -> new NioSocketChannel());
185186

186187
SdkAsyncHttpClient customClient =
187188
NettyNioAsyncHttpClient.builder()

0 commit comments

Comments
 (0)