Skip to content

Commit 6d3baed

Browse files
committed
Updating tests
1 parent 08c3bc2 commit 6d3baed

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

opamp-client/src/test/java/io/opentelemetry/opamp/client/internal/request/service/HttpRequestServiceTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import java.time.Duration;
3232
import java.util.concurrent.CompletableFuture;
3333
import java.util.concurrent.ExecutionException;
34+
import java.util.concurrent.TimeUnit;
35+
import java.util.concurrent.TimeoutException;
3436
import java.util.function.Supplier;
3537
import opamp.proto.AgentToServer;
3638
import opamp.proto.RetryInfo;
@@ -144,12 +146,12 @@ void verifySendingRequest_whenTheresAParsingError() {
144146

145147
@Test
146148
void verifySendingRequest_whenThereIsAnExecutionError()
147-
throws ExecutionException, InterruptedException {
149+
throws ExecutionException, InterruptedException, TimeoutException {
148150
prepareRequest();
149151
CompletableFuture<HttpSender.Response> future = mock();
150152
when(requestSender.send(any(), anyInt())).thenReturn(future);
151153
Exception myException = mock();
152-
doThrow(new ExecutionException(myException)).when(future).get();
154+
doThrow(new ExecutionException(myException)).when(future).get(30, TimeUnit.SECONDS);
153155

154156
httpRequestService.run();
155157

@@ -159,12 +161,12 @@ void verifySendingRequest_whenThereIsAnExecutionError()
159161

160162
@Test
161163
void verifySendingRequest_whenThereIsAnInterruptedException()
162-
throws ExecutionException, InterruptedException {
164+
throws ExecutionException, InterruptedException, TimeoutException {
163165
prepareRequest();
164166
CompletableFuture<HttpSender.Response> future = mock();
165167
when(requestSender.send(any(), anyInt())).thenReturn(future);
166168
InterruptedException myException = mock();
167-
doThrow(myException).when(future).get();
169+
doThrow(myException).when(future).get(30, TimeUnit.SECONDS);
168170

169171
httpRequestService.run();
170172

0 commit comments

Comments
 (0)