3131import static org .junit .Assert .assertTrue ;
3232
3333/**
34- * Tests for REST channel message edit and delete operations
34+ * Tests for realtime channel message edit and delete operations
3535 */
3636public class RealtimeChannelMessageEditTest extends ParameterizedTest {
3737
@@ -387,16 +387,16 @@ public void appendMessage_checkUpdatedData() throws Exception {
387387 Message retrieved = waitForUpdatedMessageAppear (channel , serial );
388388 assertEquals ("Expected updated data in history" , "Initial dataAppend data" , retrieved .data );
389389 assertEquals ("Expected MESSAGE_UPDATE action in history" , MessageAction .MESSAGE_UPDATE , retrieved .action );
390- assertEquals ("Expected MESSAGE_APPEND action through realtime" ,MessageAction .MESSAGE_APPEND , appendWaiter .result .action );
391- assertEquals ("Expected delta through realtime" ,"Append data" , appendWaiter .result .data );
390+ assertEquals ("Expected MESSAGE_APPEND action through realtime" , MessageAction .MESSAGE_APPEND , appendWaiter .result .action );
391+ assertEquals ("Expected delta through realtime" , "Append data" , appendWaiter .result .data );
392392
393393 }
394394
395395 private PaginatedResult <Message > waitForMessageAppearInVersionHistory (Channel channel , String serial , Param [] params , Predicate <Message []> predicate ) throws Exception {
396396 long timeout = System .currentTimeMillis () + 5_000 ;
397397 while (true ) {
398398 PaginatedResult <Message > history = channel .getMessageVersions (serial , params );
399- if (history .items ().length > 0 && predicate .test (history .items ()) || System .currentTimeMillis () > timeout )
399+ if (( history .items ().length > 0 && predicate .test (history .items () )) || System .currentTimeMillis () > timeout )
400400 return history ;
401401 Thread .sleep (200 );
402402 }
@@ -419,7 +419,10 @@ private Message waitForUpdatedMessageAppear(Channel channel, String serial) thro
419419 if ((message != null && message .action == MessageAction .MESSAGE_UPDATE ) || System .currentTimeMillis () > timeout )
420420 return message ;
421421 Thread .sleep (200 );
422- } catch (Exception e ) {}
422+ } catch (AblyException e ) {
423+ // skip not found errors
424+ if (e .errorInfo .statusCode != 404 ) throw e ;
425+ }
423426 }
424427 }
425428
@@ -431,7 +434,10 @@ private Message waitForDeletedMessageAppear(Channel channel, String serial) thro
431434 if ((message != null && message .action == MessageAction .MESSAGE_DELETE ) || System .currentTimeMillis () > timeout )
432435 return message ;
433436 Thread .sleep (200 );
434- } catch (Exception e ) {}
437+ } catch (AblyException e ) {
438+ // skip not found errors
439+ if (e .errorInfo .statusCode != 404 ) throw e ;
440+ }
435441 }
436442 }
437443}
0 commit comments