55package com .github .copilot .sdk ;
66
77import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
8+ import static org .junit .jupiter .api .Assertions .assertEquals ;
89import static org .junit .jupiter .api .Assertions .assertThrows ;
10+ import static org .junit .jupiter .api .Assertions .assertTrue ;
911
1012import org .junit .jupiter .api .AfterAll ;
1113import org .junit .jupiter .api .BeforeAll ;
@@ -55,7 +57,7 @@ void testSendStringThrowsAfterTermination() throws Exception {
5557 IllegalStateException thrown = assertThrows (IllegalStateException .class , () -> {
5658 session .send ("test message" );
5759 });
58- assert thrown .getMessage ().contains ("closed" );
60+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
5961 }
6062 }
6163
@@ -74,7 +76,7 @@ void testSendOptionsThrowsAfterTermination() throws Exception {
7476 IllegalStateException thrown = assertThrows (IllegalStateException .class , () -> {
7577 session .send (new MessageOptions ().setPrompt ("test message" ));
7678 });
77- assert thrown .getMessage ().contains ("closed" );
79+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
7880 }
7981 }
8082
@@ -93,7 +95,7 @@ void testSendAndWaitStringThrowsAfterTermination() throws Exception {
9395 IllegalStateException thrown = assertThrows (IllegalStateException .class , () -> {
9496 session .sendAndWait ("test message" );
9597 });
96- assert thrown .getMessage ().contains ("closed" );
98+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
9799 }
98100 }
99101
@@ -112,7 +114,7 @@ void testSendAndWaitOptionsThrowsAfterTermination() throws Exception {
112114 IllegalStateException thrown = assertThrows (IllegalStateException .class , () -> {
113115 session .sendAndWait (new MessageOptions ().setPrompt ("test message" ));
114116 });
115- assert thrown .getMessage ().contains ("closed" );
117+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
116118 }
117119 }
118120
@@ -131,7 +133,7 @@ void testSendAndWaitWithTimeoutThrowsAfterTermination() throws Exception {
131133 IllegalStateException thrown = assertThrows (IllegalStateException .class , () -> {
132134 session .sendAndWait (new MessageOptions ().setPrompt ("test message" ), 5000 );
133135 });
134- assert thrown .getMessage ().contains ("closed" );
136+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
135137 }
136138 }
137139
@@ -152,7 +154,7 @@ void testOnConsumerThrowsAfterTermination() throws Exception {
152154 // Handler should never be registered
153155 });
154156 });
155- assert thrown .getMessage ().contains ("closed" );
157+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
156158 }
157159 }
158160
@@ -173,7 +175,7 @@ void testOnTypedConsumerThrowsAfterTermination() throws Exception {
173175 // Handler should never be registered
174176 });
175177 });
176- assert thrown .getMessage ().contains ("closed" );
178+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
177179 }
178180 }
179181
@@ -192,7 +194,7 @@ void testGetMessagesThrowsAfterTermination() throws Exception {
192194 IllegalStateException thrown = assertThrows (IllegalStateException .class , () -> {
193195 session .getMessages ();
194196 });
195- assert thrown .getMessage ().contains ("closed" );
197+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
196198 }
197199 }
198200
@@ -211,7 +213,7 @@ void testAbortThrowsAfterTermination() throws Exception {
211213 IllegalStateException thrown = assertThrows (IllegalStateException .class , () -> {
212214 session .abort ();
213215 });
214- assert thrown .getMessage ().contains ("closed" );
216+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
215217 }
216218 }
217219
@@ -232,7 +234,7 @@ void testSetEventErrorHandlerThrowsAfterTermination() throws Exception {
232234 // Handler should never be set
233235 });
234236 });
235- assert thrown .getMessage ().contains ("closed" );
237+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
236238 }
237239 }
238240
@@ -251,7 +253,7 @@ void testSetEventErrorPolicyThrowsAfterTermination() throws Exception {
251253 IllegalStateException thrown = assertThrows (IllegalStateException .class , () -> {
252254 session .setEventErrorPolicy (EventErrorPolicy .SUPPRESS_AND_LOG_ERRORS );
253255 });
254- assert thrown .getMessage ().contains ("closed" );
256+ assertTrue ( thrown .getMessage ().contains ("closed" ), "Exception message should mention session is closed" );
255257 }
256258 }
257259
@@ -269,7 +271,7 @@ void testGetSessionIdWorksAfterTermination() throws Exception {
269271 session .close ();
270272
271273 String sessionIdAfterClose = session .getSessionId ();
272- assert sessionIdBeforeClose . equals ( sessionIdAfterClose );
274+ assertEquals ( sessionIdBeforeClose , sessionIdAfterClose , "Session ID should remain accessible after close" );
273275 }
274276 }
275277
@@ -287,7 +289,7 @@ void testGetWorkspacePathWorksAfterTermination() throws Exception {
287289 session .close ();
288290
289291 String pathAfterClose = session .getWorkspacePath ();
290- assert pathBeforeClose == pathAfterClose ; // Both should be null or same value
292+ assertEquals ( pathBeforeClose , pathAfterClose , "Workspace path should remain accessible after close" );
291293 }
292294 }
293295
0 commit comments