Skip to content

Commit

Permalink
(jcabi#178) Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoss committed Jun 26, 2020
1 parent 2e03bc3 commit 1e8186b
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions src/test/java/com/jcabi/http/RequestTimeoutLossTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public Collection<Map.Entry<String, String>> get() {
ArgumentMatchers.any(InputStream.class),
ArgumentMatchers.anyInt(),
ArgumentMatchers.anyInt(),
ArgumentMatchers.any(SSLContext.class)
ArgumentMatchers.<SSLContext>isNull()
)
).thenReturn(response);
new BaseRequest(original, url).through(wire).fetch();
Expand All @@ -330,7 +330,7 @@ public Collection<Map.Entry<String, String>> get() {
ArgumentMatchers.any(InputStream.class),
ArgumentMatchers.anyInt(),
ArgumentMatchers.anyInt(),
ArgumentMatchers.any(SSLContext.class)
ArgumentMatchers.<SSLContext>isNull()
);
Mockito.verify(wire).send(
ArgumentMatchers.any(Request.class),
Expand All @@ -340,7 +340,7 @@ public Collection<Map.Entry<String, String>> get() {
ArgumentMatchers.any(InputStream.class),
ArgumentMatchers.anyInt(),
ArgumentMatchers.anyInt(),
ArgumentMatchers.any(SSLContext.class)
ArgumentMatchers.<SSLContext>isNull()
);
}

Expand All @@ -360,30 +360,28 @@ private void testTimeoutOrderDoesntMatter(final Callable<Response> exec)
.forClass(Integer.class);
final ArgumentCaptor<Integer> rdc = ArgumentCaptor
.forClass(Integer.class);
MockWire.setMockDelegate(wire);
final Response response = Mockito.mock(Response.class);
Mockito.when(
wire.send(
Mockito.any(Request.class),
Mockito.anyString(),
Mockito.anyString(),
Mockito.<Map.Entry<String, String>>anyCollection(),
Mockito.any(InputStream.class),
Mockito.anyInt(),
Mockito.anyInt(),
ArgumentMatchers.any(SSLContext.class)
)
).thenReturn(response);
Mockito.doReturn(response).when(wire).send(
ArgumentMatchers.any(Request.class),
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString(),
ArgumentMatchers.<Map.Entry<String, String>>anyCollection(),
ArgumentMatchers.any(InputStream.class),
ArgumentMatchers.anyInt(),
ArgumentMatchers.anyInt(),
ArgumentMatchers.<SSLContext>isNull()
);
MockWire.setMockDelegate(wire);
exec.call();
Mockito.verify(wire).send(
Mockito.any(Request.class),
Mockito.anyString(),
Mockito.anyString(),
Mockito.<Map.Entry<String, String>>anyCollection(),
Mockito.any(InputStream.class),
ArgumentMatchers.any(Request.class),
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString(),
ArgumentMatchers.<Map.Entry<String, String>>anyCollection(),
ArgumentMatchers.any(InputStream.class),
cnc.capture(),
rdc.capture(),
ArgumentMatchers.any(SSLContext.class)
ArgumentMatchers.<SSLContext>isNull()
);
MatcherAssert.assertThat(
cnc.getValue().intValue(),
Expand Down

0 comments on commit 1e8186b

Please sign in to comment.