Skip to content

Instantly share code, notes, and snippets.

@igorescodro
Created April 29, 2022 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorescodro/e14a983b84971f00568d5f7a871312ec to your computer and use it in GitHub Desktop.
Save igorescodro/e14a983b84971f00568d5f7a871312ec to your computer and use it in GitHub Desktop.
@Test
fun test_myNotification() {
// Send the notification
val id = 13
val name = "Testing my notification"
myNotification.send(id = id, name = name)
// Validate the notification info
val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
with(manager.activeNotifications.first()) {
assertEquals(id, this.id)
assertEquals(name, this.notification.extras[Notification.EXTRA_TEXT])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment