在Android集成测试中使用WireMock时出现NoSuchMethodError [英] NoSuchMethodError when using WireMock in an Android integration test

查看:109
本文介绍了在Android集成测试中使用WireMock时出现NoSuchMethodError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的robotium android测试中尝试启动WireMockServer时获得了以下堆栈跟踪. 可能是2个版本的Apache Http客户端之间存在冲突,但我尚未设法解决它. 有什么主意吗?

Got the following stack trace when trying to start a WireMockServer in my robotium android test. Might be a conflict between 2 versions of Apache Http client, but I did not manage to solve it yet. Any idea?

java.lang.NoSuchMethodError: org.apache.http.conn.ssl.SSLSocketFactory.<init>
at com.github.tomakehurst.wiremock.http.HttpClientFactory.createSslSocketFactory(HttpClientFactory.java:110)
at com.github.tomakehurst.wiremock.http.HttpClientFactory.createClientConnectionManagerWithSSLSettings(HttpClientFactory.java:88)
at com.github.tomakehurst.wiremock.http.HttpClientFactory.createClient(HttpClientFactory.java:54)
at com.github.tomakehurst.wiremock.http.HttpClientFactory.createClient(HttpClientFactory.java:70)
at com.github.tomakehurst.wiremock.http.ProxyResponseRenderer.<init>(ProxyResponseRenderer.java:58)
at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:96)
at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:140)
at com.me.expertsystem.AcceptanceTest.setUp(AcceptanceTest.java:63)

推荐答案

恐怕自2015年第1场比赛开始,WireMock不支持Android. github问题中正在跟踪获得支持的进展.

I'm afraid that as of 1st Match 2015 WireMock does not support Android. Progress towards support is being tracked in this github issue.

它在Roboelectric测试中确实能很好地工作,因为它们在标准JVM中运行,因此您至少可以将其用于测试的这一方面.

It does work quite well in Roboelectric tests because these run in a standard JVM, so you may be able use it for that aspect of testing at least.

这篇关于在Android集成测试中使用WireMock时出现NoSuchMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆