From 03b0c9cafdce298fb180bf35abf231a4c00aaf4d Mon Sep 17 00:00:00 2001
From: Lewis Marshall <lewis.marshall@ably.com>
Date: Tue, 16 Jul 2024 15:58:06 +0100
Subject: [PATCH] tests: Assert connection error code rather than message

The error messages are subject to change, but the codes are not, so
assert the code instead.

Signed-off-by: Lewis Marshall <lewis.marshall@ably.com>
---
 .../java/io/ably/lib/test/realtime/RealtimeChannelTest.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java
index 8108ae6df..f58fe832f 100644
--- a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java
+++ b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java
@@ -1669,7 +1669,7 @@ public void channel_invalid_resume_reattach_channels() throws AblyException {
 
             ErrorInfo resumeError = connectionWaiter.waitFor(ConnectionState.connected);
             assertNotNull(resumeError);
-            assertTrue(resumeError.message.contains("Invalid connection key"));
+            assertEquals("Verify error code indicates invalid connection key", resumeError.code, 80018);
             assertSame(resumeError, ably.connection.connectionManager.getStateErrorInfo());
             assertNotEquals("A new connection was created", originalConnectionId, ably.connection.id);