Skip to content

Commit

Permalink
Merge pull request #1056 from ably/message-action-changes
Browse files Browse the repository at this point in the history
[ECO-5188] MessageAction enum changes
  • Loading branch information
SimonWoolf authored Jan 13, 2025
2 parents 15bc122 + 0684534 commit a563de2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions lib/src/main/java/io/ably/lib/types/MessageAction.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package io.ably.lib.types;

public enum MessageAction {
MESSAGE_UNSET, // 0
MESSAGE_CREATE, // 1
MESSAGE_UPDATE, // 2
MESSAGE_DELETE, // 3
ANNOTATION_CREATE, // 4
ANNOTATION_DELETE, // 5
META_OCCUPANCY; // 6
MESSAGE_CREATE, // 0
MESSAGE_UPDATE, // 1
MESSAGE_DELETE, // 2
META_OCCUPANCY, // 3
MESSAGE_SUMMARY; // 4

static MessageAction tryFindByOrdinal(int ordinal) {
return values().length <= ordinal ? null: values()[ordinal];
Expand Down
4 changes: 2 additions & 2 deletions lib/src/test/java/io/ably/lib/types/MessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void serialize_message_with_serial() {
assertEquals("test-key", serializedObject.get("connectionKey").getAsString());
assertEquals("test-data", serializedObject.get("data").getAsString());
assertEquals("test-name", serializedObject.get("name").getAsString());
assertEquals(1, serializedObject.get("action").getAsInt());
assertEquals(0, serializedObject.get("action").getAsInt());
assertEquals("01826232498871-001@abcdefghij:001", serializedObject.get("serial").getAsString());
}

Expand All @@ -76,7 +76,7 @@ public void deserialize_message_with_serial() throws Exception {
jsonObject.addProperty("clientId", "test-client-id");
jsonObject.addProperty("data", "test-data");
jsonObject.addProperty("name", "test-name");
jsonObject.addProperty("action", 1);
jsonObject.addProperty("action", 0);
jsonObject.addProperty("serial", "01826232498871-001@abcdefghij:001");

// When
Expand Down

0 comments on commit a563de2

Please sign in to comment.