/* * Copyright © All Contributors. See LICENSE and AUTHORS in the root directory for details. */ package at.bitfire.davdroid.push import dagger.hilt.android.testing.HiltAndroidRule import dagger.hilt.android.testing.HiltAndroidTest import org.junit.Assert import org.junit.Before import org.junit.Rule import org.junit.Test import javax.inject.Inject @HiltAndroidTest class PushMessageHandlerTest { @get:Rule val hiltRule = HiltAndroidRule(this) @Inject lateinit var handler: PushMessageHandler @Before fun setUp() { hiltRule.inject() } @Test fun testParse_InvalidXml() { Assert.assertNull(handler.parse("Non-XML content")) } @Test fun testParse_WithXmlDeclAndTopic() { val topic = handler.parse( "" + "" + " O7M1nQ7cKkKTKsoS_j6Z3w" + "" ) Assert.assertEquals("O7M1nQ7cKkKTKsoS_j6Z3w", topic) } }