Skip to content

Commit d726d0f

Browse files
chore: Clean up AbstractA2AServerTest (#187)
# Description Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Follow the [`CONTRIBUTING` Guide](../CONTRIBUTING.md). - [x] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - Important Prefixes for [release-please](https://github.com/googleapis/release-please): - `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) patch. - `feat:` represents a new feature, and correlates to a SemVer minor. - `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a SemVer major. - [x] Ensure the tests pass - [x] Appropriate READMEs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent f902f18 commit d726d0f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import io.restassured.specification.RequestSpecification;
7272
import org.junit.jupiter.api.Assertions;
7373
import org.junit.jupiter.api.Test;
74+
import org.junit.jupiter.api.Timeout;
7475

7576
/**
7677
* This test requires doing some work on the server to add/get/delete tasks, and enqueue events. This is exposed via REST,
@@ -622,6 +623,7 @@ public void testSendMessageStreamExistingTaskSuccess() throws Exception {
622623
}
623624

624625
@Test
626+
@Timeout(value = 3, unit = TimeUnit.MINUTES)
625627
public void testResubscribeExistingTaskSuccess() throws Exception {
626628
ExecutorService executorService = Executors.newSingleThreadExecutor();
627629
saveTaskInTaskStore(MINIMAL_TASK);
@@ -904,7 +906,7 @@ protected void saveTaskInTaskStore(Task task) throws Exception {
904906

905907
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
906908
if (response.statusCode() != 200) {
907-
throw new RuntimeException(response.statusCode() + ": Creating task failed! " + response.body());
909+
throw new RuntimeException(String.format("Saving task failed! Status: %d, Body: %s", response.statusCode(), response.body()));
908910
}
909911
}
910912

@@ -922,7 +924,7 @@ protected Task getTaskFromTaskStore(String taskId) throws Exception {
922924
return null;
923925
}
924926
if (response.statusCode() != 200) {
925-
throw new RuntimeException(response.statusCode() + ": Creating task failed! " + response.body());
927+
throw new RuntimeException(String.format("Getting task failed! Status: %d, Body: %s", response.statusCode(), response.body()));
926928
}
927929
return Utils.OBJECT_MAPPER.readValue(response.body(), Task.TYPE_REFERENCE);
928930
}
@@ -951,7 +953,7 @@ protected void ensureQueueForTask(String taskId) throws Exception {
951953
.build();
952954
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8));
953955
if (response.statusCode() != 200) {
954-
throw new RuntimeException(response.statusCode() + ": Deleting task failed!" + response.body());
956+
throw new RuntimeException(String.format("Ensuring queue failed! Status: %d, Body: %s", response.statusCode(), response.body()));
955957
}
956958
}
957959

0 commit comments

Comments
 (0)