161 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
30
views
Unit Test with MockWebServer with OAUTH failing
I am trying to write a unit test for a webclient that has a oauth filter. I see the error ,
org.springframework.security.oauth2.client.ClientAuthorizationException: [server_error]
at org....
0
votes
0
answers
36
views
MockWebServer throwing " unable to find valid certification path to requested target" error
I am trying to create a mockwebserver to unit test a webclient
parent code :
public DetailResponse getDetail(String id) {
WebClient newWebClient = getLoggingWebClient(webClient);
...
0
votes
1
answer
131
views
MockWebServer start on Android API 35 cause
I have an app on API 34 that runs MockWebServer for the tests.
Mockweberser is triggered only for tests that are mocked.
Mockweberser class inits on port 8080
class MockedkWebServer {
...
init {
...
0
votes
1
answer
85
views
Access MockWebServer from outside of the JVM
I am writing Espresso UI tests with okhttp3.mockwebserver.MockWebServer. I am facing an issue, that my MockWebServer is not accessible from the application running in AVD.
This works:
Access the ...
1
vote
1
answer
518
views
Can you enqueue responses within the dispatcher for MockWebServer?
I'm writing tests for my webserver, and I'm making use of MockWebServer (okhttp3.mockwebserver) to mock the responses. As I understand it from the documentation, there are broadly 2 ways to do this:
...
4
votes
1
answer
2k
views
"Cannot resolve com.squareup.okhttp3:mockwebserver:unknown" error after upgrade to Spring Boot 3.4.0
After upgrade to Spring Boot 3.4.0 from 3.3.x, I get an error
Cannot resolve com.squareup.okhttp3:mockwebserver:unknown
My project uses okhttp3.mockwebserver.MockWebServer and has the dependency
<...
1
vote
1
answer
116
views
OkHttp MockWebServer dispatch not getting triggered
Here's my code in isolation
fun getMockServerUrl(): String {
val server = MockWebServer()
server.dispatcher = object : Dispatcher() {
override fun dispatch(request: RecordedRequest): ...
2
votes
0
answers
405
views
How to make sure mockwebserver is started before running test?
How do I ensure that mock web server is started before test runs ?
MockWebServer server = new MockWebServer();
server.enqueue(new MockResponse()
.setResponseCode(200));
...
-1
votes
1
answer
330
views
How to use @BeforeEach and @AfterEach annotations with MockWebServer?
Doing integration tests, I'm trying to mock the comportement of my controller with one or multiple MockWebServer but doesn't found a solution.
I saw the post here saying that a MockWebServer should ...
0
votes
1
answer
62
views
Detect if Macrobenchmark is running
Is there a way to detect when MacroBenchmark is running?
Ideally I wish to use this check to connect to a WireMock server running on my host machine.
1
vote
1
answer
833
views
How to use dispatch of okhttp-MockWebServer? Cannot inherit from final 'okhttp3.Dispatcher'
I want to use the okhttp-MockWebServer not with the normal queue but with the Dispatcher as described in the Readme-section.
The example requires one to inherit from Dispatcher which is not possible ...
1
vote
0
answers
551
views
OkHttp MockWebServer throws java.net.SocketTimeoutException: timeout - exception
I'm using OkHttp's MockWebServer for API mocking in my Android instrumentation tests. It's been effective so far, but I've encountered an issue where making a second call to the same endpoint within ...
1
vote
1
answer
2k
views
MockWebServer is getting error HTTP FAILED: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:8080
I'm working on Android instrumentation tests with MockWebServer of Square. Here are the codes that I'm trying to run. However, I'm getting error from Okhttp client, when I ran the test. I've added ...
0
votes
1
answer
379
views
Is there a way to guarantee coroutine execution order when using coroutineScope and launch?
I have some code I want to test that uses structured concurrency in Kotlin:
suspend fun logic(): Something = coroutineScope {
launch { taskOne() }
launch { taskTwo() }
launch { taskThree() ...
0
votes
1
answer
842
views
java.lang.IllegalArgumentException: A metric named okhttp3.OkHttpClient.connection-pool-total-count already exists
I have upgrade HttpExecutor to v2 version recently. Now start facing duplicate metric issue while running test cases.
Caused by: java.lang.IllegalArgumentException: A metric named okhttp3.OkHttpClient....