77import static org .junit .jupiter .api .Assertions .*;
88
99import java .util .ArrayList ;
10+ import java .util .logging .Logger ;
1011import java .util .List ;
1112import java .util .concurrent .CompletableFuture ;
1213import java .util .concurrent .TimeUnit ;
3334 */
3435public class ErrorHandlingTest {
3536
37+ private static final Logger LOG = Logger .getLogger (ErrorHandlingTest .class .getName ());
3638 private static E2ETestContext ctx ;
3739
3840 @ BeforeAll
@@ -52,6 +54,7 @@ static void teardown() throws Exception {
5254 */
5355 @ Test
5456 void testToolErrorDoesNotCrashSession () throws Exception {
57+ LOG .info ("Running test: testToolErrorDoesNotCrashSession" );
5558 ctx .configureForTest ("tools" , "handles_tool_calling_errors" );
5659
5760 List <AbstractSessionEvent > allEvents = new ArrayList <>();
@@ -89,6 +92,7 @@ void testToolErrorDoesNotCrashSession() throws Exception {
8992 */
9093 @ Test
9194 void testToolReturnsFailureResult () throws Exception {
95+ LOG .info ("Running test: testToolReturnsFailureResult" );
9296 ctx .configureForTest ("tools" , "handles_tool_calling_errors" );
9397
9498 ToolDefinition failTool = ToolDefinition .create ("get_user_location" , "Gets the user's location" ,
@@ -117,6 +121,7 @@ void testToolReturnsFailureResult() throws Exception {
117121 */
118122 @ Test
119123 void testPermissionHandlerErrorDeniesPermission () throws Exception {
124+ LOG .info ("Running test: testPermissionHandlerErrorDeniesPermission" );
120125 ctx .configureForTest ("permissions" , "should_handle_permission_handler_errors_gracefully" );
121126
122127 List <SessionErrorEvent > errorEvents = new ArrayList <>();
@@ -153,6 +158,7 @@ void testPermissionHandlerErrorDeniesPermission() throws Exception {
153158 */
154159 @ Test
155160 void testSessionErrorEventContainsDetails () throws Exception {
161+ LOG .info ("Running test: testSessionErrorEventContainsDetails" );
156162 ctx .configureForTest ("permissions" , "permission_handler_errors" );
157163
158164 List <SessionErrorEvent > errorEvents = new ArrayList <>();
@@ -171,7 +177,9 @@ void testSessionErrorEventContainsDetails() throws Exception {
171177 });
172178
173179 try {
174- session .sendAndWait (new MessageOptions ().setPrompt ("Run 'ls' command" )).get (60 , TimeUnit .SECONDS );
180+ // Use prompt that matches the snapshot
181+ session .sendAndWait (new MessageOptions ().setPrompt ("Run 'echo test'. If you can't, say 'failed'." ))
182+ .get (60 , TimeUnit .SECONDS );
175183 } catch (Exception e ) {
176184 // Error is expected in some cases
177185 }
@@ -189,6 +197,7 @@ void testSessionErrorEventContainsDetails() throws Exception {
189197 */
190198 @ Test
191199 void testSessionContinuesAfterToolError () throws Exception {
200+ LOG .info ("Running test: testSessionContinuesAfterToolError" );
192201 ctx .configureForTest ("tools" , "handles_tool_calling_errors" );
193202
194203 ToolDefinition errorTool = ToolDefinition .create ("get_user_location" , "Gets the user's location" ,
0 commit comments