我有以下代码段:
public Optional<Apple> getApple(EmcHeaderV2 headerV2, String appleId) {
try {
String now = DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(ZonedDateTime.now());
String reqId = UUID.randomUUID().toString();
ApiClient apiClient = Configuration.getDefaultApiClient();
apiClient.getHttpClient().register(new LoggingFilter());
apiClient.setBasePath(basePath);
String restTimeout = "30000";
GetAppleApi api = new GetAppleApi(apiClient);
Apple apple= api.gETAPPLE(REQ_APPL, reqId, now, APPLICATION_ID, MODUL_ID,
headerV2.getProcessId(), restTimeout, "aa", "bb",
"ccc", "aa", "aa", "aa");
return Optional.ofNullable(apple);
} catch (Exception e) {
throw new HttpClientErrorException(HttpStatus.I_AM_A_TEAPOT);
}
}
我想嘲笑这一行:
api.gETAPPLE(REQ_APPL, reqId, now, APPLICATION_ID, MODUL_ID,
headerV2.getProcessId(), restTimeout, "aa", "bb",
"ccc", "aa", "aa", "aa");
我写的时候:
GetAppleApi api = mock(GetAppleApi.class);
when(api.gETCUSTOMERACCOUNT((any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any())).thenReturn(AH);
它不会退还AH对象。
有什么想法吗?感谢您的帮助!
谢谢!