Skip to content

Commit 71b836a

Browse files
committed
Fix test, and distinguish failure message.
1 parent edd7f59 commit 71b836a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

libraries/eventformatter/impl/src/test/kotlin/io/element/android/libraries/eventformatter/impl/DefaultRoomLastMessageFormatterTests.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,11 @@ class DefaultRoomLastMessageFormatterTests {
202202
is FileMessageType -> "File"
203203
is LocationMessageType -> "Shared location"
204204
is EmoteMessageType -> "* $senderName ${type.body}"
205-
is TextMessageType, is NoticeMessageType -> body
206-
UnknownMessageType -> "Unsupported event"
205+
is TextMessageType,
206+
is NoticeMessageType,
207+
UnknownMessageType -> body
207208
}
208-
Truth.assertWithMessage("$type was not properly handled").that(result).isEqualTo(expectedResult)
209+
Truth.assertWithMessage("$type was not properly handled for DM").that(result).isEqualTo(expectedResult)
209210
}
210211

211212
// Verify results of Room mode
@@ -217,9 +218,10 @@ class DefaultRoomLastMessageFormatterTests {
217218
is ImageMessageType -> "$senderName: Image"
218219
is FileMessageType -> "$senderName: File"
219220
is LocationMessageType -> "$senderName: Shared location"
221+
is TextMessageType,
222+
is NoticeMessageType,
223+
UnknownMessageType -> "$senderName: $body"
220224
is EmoteMessageType -> "* $senderName ${type.body}"
221-
is TextMessageType, is NoticeMessageType -> "$senderName: $body"
222-
UnknownMessageType -> "$senderName: Unsupported event"
223225
}
224226
val shouldCreateAnnotatedString = when (type) {
225227
is VideoMessageType -> true
@@ -236,7 +238,7 @@ class DefaultRoomLastMessageFormatterTests {
236238
.that(result)
237239
.isInstanceOf(AnnotatedString::class.java)
238240
}
239-
Truth.assertWithMessage("$type was not properly handled").that(string).isEqualTo(expectedResult)
241+
Truth.assertWithMessage("$type was not properly handled for room").that(string).isEqualTo(expectedResult)
240242
}
241243
}
242244

0 commit comments

Comments
 (0)