Use InvocationOnMock.getArgument() where possible
Closes gh-11818
This commit is contained in:
committed by
Stephane Nicoll
parent
fac8970366
commit
c1675c2d5f
@@ -62,8 +62,8 @@ public class MockRestarter implements TestRule {
|
||||
given(this.mock.getInitialUrls()).willReturn(new URL[] {});
|
||||
given(this.mock.getOrAddAttribute(anyString(), any(ObjectFactory.class)))
|
||||
.willAnswer((invocation) -> {
|
||||
String name = (String) invocation.getArguments()[0];
|
||||
ObjectFactory factory = (ObjectFactory) invocation.getArguments()[1];
|
||||
String name = invocation.getArgument(0);
|
||||
ObjectFactory factory = invocation.getArgument(1);
|
||||
Object attribute = MockRestarter.this.attributes.get(name);
|
||||
if (attribute == null) {
|
||||
attribute = factory.getObject();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -90,7 +90,7 @@ public class HttpTunnelServerTests {
|
||||
this.server = new HttpTunnelServer(this.serverConnection);
|
||||
given(this.serverConnection.open(anyInt())).willAnswer((invocation) -> {
|
||||
MockServerChannel channel = HttpTunnelServerTests.this.serverChannel;
|
||||
channel.setTimeout((Integer) invocation.getArguments()[0]);
|
||||
channel.setTimeout(invocation.getArgument(0));
|
||||
return channel;
|
||||
});
|
||||
this.servletRequest = new MockHttpServletRequest();
|
||||
|
||||
Reference in New Issue
Block a user