mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
🎨 Use explicit types on lambda arguments
This commit is contained in:
parent
44e4ee4416
commit
3039dd018e
@ -48,7 +48,7 @@ public class ApacheHttpDnsClientBuilder implements ApacheHttpClientBuilder {
|
|||||||
|
|
||||||
private DnsResolver dnsResover;
|
private DnsResolver dnsResover;
|
||||||
|
|
||||||
private HttpRequestRetryHandler httpRequestRetryHandler = (exception, executionCount, context) -> false;
|
private HttpRequestRetryHandler httpRequestRetryHandler = (IOException exception, int executionCount, HttpContext context) -> false;
|
||||||
private SSLConnectionSocketFactory sslConnectionSocketFactory = SSLConnectionSocketFactory.getSocketFactory();
|
private SSLConnectionSocketFactory sslConnectionSocketFactory = SSLConnectionSocketFactory.getSocketFactory();
|
||||||
private PlainConnectionSocketFactory plainConnectionSocketFactory = PlainConnectionSocketFactory.getSocketFactory();
|
private PlainConnectionSocketFactory plainConnectionSocketFactory = PlainConnectionSocketFactory.getSocketFactory();
|
||||||
private String httpProxyHost;
|
private String httpProxyHost;
|
||||||
|
@ -92,7 +92,7 @@ public class BaseWxCpServiceImplTest {
|
|||||||
RequestExecutor<Object, Object> re = mock(RequestExecutor.class);
|
RequestExecutor<Object, Object> re = mock(RequestExecutor.class);
|
||||||
|
|
||||||
AtomicInteger counter = new AtomicInteger();
|
AtomicInteger counter = new AtomicInteger();
|
||||||
Mockito.when(re.execute(Mockito.anyString(), Mockito.any(), Mockito.any())).thenAnswer(invocation -> {
|
Mockito.when(re.execute(Mockito.anyString(), Mockito.any(), Mockito.any())).thenAnswer((InvocationOnMock invocation) -> {
|
||||||
counter.incrementAndGet();
|
counter.incrementAndGet();
|
||||||
WxError error = WxError.builder().errorCode(WxMpErrorMsgEnum.CODE_40001.getCode()).errorMsg(WxMpErrorMsgEnum.CODE_40001.getMsg()).build();
|
WxError error = WxError.builder().errorCode(WxMpErrorMsgEnum.CODE_40001.getCode()).errorMsg(WxMpErrorMsgEnum.CODE_40001.getMsg()).build();
|
||||||
throw new WxErrorException(error);
|
throw new WxErrorException(error);
|
||||||
|
@ -49,14 +49,14 @@ public class WxCpDemoServer {
|
|||||||
wxCpService = new WxCpServiceImpl();
|
wxCpService = new WxCpServiceImpl();
|
||||||
wxCpService.setWxCpConfigStorage(config);
|
wxCpService.setWxCpConfigStorage(config);
|
||||||
|
|
||||||
WxCpMessageHandler handler = (wxMessage, context, wxService, sessionManager) -> {
|
WxCpMessageHandler handler = (WxCpXmlMessage wxMessage, Map context, WxCpService wxService, WxSessionManager sessionManager) -> {
|
||||||
WxCpXmlOutTextMessage m = WxCpXmlOutMessage.TEXT().content("测试加密消息")
|
WxCpXmlOutTextMessage m = WxCpXmlOutMessage.TEXT().content("测试加密消息")
|
||||||
.fromUser(wxMessage.getToUserName())
|
.fromUser(wxMessage.getToUserName())
|
||||||
.toUser(wxMessage.getFromUserName()).build();
|
.toUser(wxMessage.getFromUserName()).build();
|
||||||
return m;
|
return m;
|
||||||
};
|
};
|
||||||
|
|
||||||
WxCpMessageHandler oauth2handler = (wxMessage, context, wxService, sessionManager) -> {
|
WxCpMessageHandler oauth2handler = (WxCpXmlMessage wxMessage, Map context, WxCpService wxService, WxSessionManager sessionManager) -> {
|
||||||
String href = "<a href=\""
|
String href = "<a href=\""
|
||||||
+ wxService.getOauth2Service().buildAuthorizationUrl(wxCpConfigStorage.getOauth2redirectUri(), null)
|
+ wxService.getOauth2Service().buildAuthorizationUrl(wxCpConfigStorage.getOauth2redirectUri(), null)
|
||||||
+ "\">测试oauth2</a>";
|
+ "\">测试oauth2</a>";
|
||||||
@ -78,7 +78,7 @@ public class WxCpDemoServer {
|
|||||||
.end()
|
.end()
|
||||||
.rule()
|
.rule()
|
||||||
.event(WxCpConsts.EventType.CHANGE_CONTACT)
|
.event(WxCpConsts.EventType.CHANGE_CONTACT)
|
||||||
.handler((wxMessage, context, wxCpService, sessionManager) -> {
|
.handler((WxCpXmlMessage wxMessage, Map context, WxCpService wxCpService, WxSessionManager sessionManager) -> {
|
||||||
System.out.println("通讯录发生变更");
|
System.out.println("通讯录发生变更");
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
|
@ -127,7 +127,7 @@ public class WxMaServiceImplTest {
|
|||||||
RequestExecutor<Object, Object> re = mock(RequestExecutor.class);
|
RequestExecutor<Object, Object> re = mock(RequestExecutor.class);
|
||||||
|
|
||||||
AtomicInteger counter = new AtomicInteger();
|
AtomicInteger counter = new AtomicInteger();
|
||||||
Mockito.when(re.execute(Mockito.anyString(), Mockito.any(), Mockito.any())).thenAnswer(invocation -> {
|
Mockito.when(re.execute(Mockito.anyString(), Mockito.any(), Mockito.any())).thenAnswer((InvocationOnMock invocation) -> {
|
||||||
counter.incrementAndGet();
|
counter.incrementAndGet();
|
||||||
WxError error = WxError.builder().errorCode(WxMpErrorMsgEnum.CODE_40001.getCode()).errorMsg(WxMpErrorMsgEnum.CODE_40001.getMsg()).build();
|
WxError error = WxError.builder().errorCode(WxMpErrorMsgEnum.CODE_40001.getCode()).errorMsg(WxMpErrorMsgEnum.CODE_40001.getMsg()).build();
|
||||||
throw new WxErrorException(error);
|
throw new WxErrorException(error);
|
||||||
|
@ -237,7 +237,7 @@ public class BaseWxMpServiceImplTest {
|
|||||||
RequestExecutor<Object, Object> re = mock(RequestExecutor.class);
|
RequestExecutor<Object, Object> re = mock(RequestExecutor.class);
|
||||||
|
|
||||||
AtomicInteger counter = new AtomicInteger();
|
AtomicInteger counter = new AtomicInteger();
|
||||||
Mockito.when(re.execute(Mockito.anyString(), Mockito.any(), Mockito.any())).thenAnswer(invocation -> {
|
Mockito.when(re.execute(Mockito.anyString(), Mockito.any(), Mockito.any())).thenAnswer((InvocationOnMock invocation) -> {
|
||||||
counter.incrementAndGet();
|
counter.incrementAndGet();
|
||||||
WxError error = WxError.builder().errorCode(WxMpErrorMsgEnum.CODE_40001.getCode()).errorMsg(WxMpErrorMsgEnum.CODE_40001.getMsg()).build();
|
WxError error = WxError.builder().errorCode(WxMpErrorMsgEnum.CODE_40001.getCode()).errorMsg(WxMpErrorMsgEnum.CODE_40001.getMsg()).build();
|
||||||
throw new WxErrorException(error);
|
throw new WxErrorException(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user