Skip to content

Commit eb90c44

Browse files
committed
fix: Test cleanup
1 parent df65546 commit eb90c44

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

tests/server-common/src/test/java/io/a2a/server/apps/common/AbstractA2AServerTest.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package io.a2a.server.apps.common;
22

3-
import static io.restassured.RestAssured.given;
4-
import static org.hamcrest.Matchers.equalTo;
53
import static org.junit.jupiter.api.Assertions.assertEquals;
64
import static org.junit.jupiter.api.Assertions.assertFalse;
75
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
@@ -21,8 +19,6 @@
2119
import java.util.List;
2220
import java.util.concurrent.CompletableFuture;
2321
import java.util.concurrent.CountDownLatch;
24-
import java.util.concurrent.ExecutorService;
25-
import java.util.concurrent.Executors;
2622
import java.util.concurrent.TimeUnit;
2723
import java.util.concurrent.atomic.AtomicBoolean;
2824
import java.util.concurrent.atomic.AtomicInteger;
@@ -45,8 +41,6 @@
4541
import io.a2a.client.transport.jsonrpc.JSONRPCTransportConfig;
4642
import io.a2a.client.transport.grpc.GrpcTransportConfig;
4743
import io.a2a.client.http.JdkA2AHttpClient;
48-
import io.a2a.spec.AuthenticatedExtendedCardNotConfiguredError;
49-
import io.a2a.spec.JSONRPCError;
5044
import io.grpc.ManagedChannelBuilder;
5145
import io.a2a.spec.A2AClientException;
5246
import io.a2a.spec.AgentCard;
@@ -474,7 +468,9 @@ public void testResubscribeExistingTaskSuccess() throws Exception {
474468

475469
// Create error handler
476470
Consumer<Throwable> errorHandler = error -> {
477-
errorRef.set(error);
471+
if (!isStreamClosedError(error)) {
472+
errorRef.set(error);
473+
}
478474
eventLatch.countDown();
479475
};
480476

@@ -484,8 +480,7 @@ public void testResubscribeExistingTaskSuccess() throws Exception {
484480
.whenComplete((unused, throwable) -> subscriptionLatch.countDown());
485481

486482
// Resubscribe to the task with specific consumer and error handler
487-
List<BiConsumer<ClientEvent, AgentCard>> consumers = consumer != null ? List.of(consumer) : List.of();
488-
getClient().resubscribe(new TaskIdParams(MINIMAL_TASK.getId()), consumers, errorHandler, null);
483+
getClient().resubscribe(new TaskIdParams(MINIMAL_TASK.getId()), List.of(consumer), errorHandler, null);
489484

490485
// Wait for subscription to be established
491486
assertTrue(subscriptionLatch.await(15, TimeUnit.SECONDS));
@@ -544,7 +539,9 @@ public void testResubscribeNoExistingTaskError() throws Exception {
544539

545540
// Create error handler to capture the TaskNotFoundError
546541
Consumer<Throwable> errorHandler = error -> {
547-
errorRef.set(error);
542+
if (!isStreamClosedError(error)) {
543+
errorRef.set(error);
544+
}
548545
errorLatch.countDown();
549546
};
550547

@@ -578,8 +575,7 @@ public void testResubscribeNoExistingTaskError() throws Exception {
578575
fail("Expected error for non-existent task resubscription");
579576
}
580577
} catch (A2AClientException e) {
581-
// Also acceptable - the client might throw an exception immediately
582-
assertInstanceOf(TaskNotFoundError.class, e.getCause());
578+
fail("Expected error for non-existent task resubscription");
583579
}
584580
}
585581

0 commit comments

Comments
 (0)