3131import java .time .Duration ;
3232import java .util .concurrent .CompletableFuture ;
3333import java .util .concurrent .ExecutionException ;
34+ import java .util .concurrent .TimeUnit ;
35+ import java .util .concurrent .TimeoutException ;
3436import java .util .function .Supplier ;
3537import opamp .proto .AgentToServer ;
3638import 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