adds stub for notifications

This commit is contained in:
2021-12-29 23:22:12 +01:00
parent 734b64ce3b
commit 6e3f3c44af
25 changed files with 267 additions and 43 deletions

View File

@ -1,8 +1,9 @@
package com.example.bump
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.internal.runner.InstrumentationConnection
import androidx.test.platform.app.InstrumentationRegistry
import com.example.bump.util.LocalData
import com.example.bump.util.MessageProcessor
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
@ -15,8 +16,9 @@ class MessageProcessorTest {
val code = "dydoes-unknowledgeable-indiscretion-househusbands-pot-walloper-indiscretion-discophorous-transcriptions-dydoes-poodle-faker-transcriptions-budlike"
// val messageRaw = "M1dEAxKZ5HUHCJoRkgGOvAABhqCAAAAAAGG2eKTSlKXWLDQx5B_wssZsNwsanzQID2UyUm4KKuKYKgfwH5MG2N-qzt6K4mg3pfZmWPaiDB9PiqlX236k6zo9Yvvq"
val messageRaw = "M1dEAxKZ5HUHCJoRkgGOvAABhqCAAAAAAGG8afPPk380EzwcbGzNoTr_I4y6YT8hnUYcToinlgsVkaUx5K-JicdS5epZenOX4u8vVhhMvR0ebeWm_mgp6LZvTw8S"
val data = decryptMessage(code, messageRaw)
Assert.assertEquals(data, "hello")
val processor = MessageProcessor(code)
val decrypted = processor.decrypt(messageRaw)
Assert.assertEquals(decrypted, "hello")
}
@Test
@ -26,7 +28,9 @@ class MessageProcessorTest {
val test = getRandomString(32)
val encrypted = message.encrypt(test)
val decrypted = decryptMessage(code, encrypted)
val processor = MessageProcessor(code)
val decrypted = processor.decrypt(encrypted)
Assert.assertEquals(test, decrypted)
}

View File

@ -2,6 +2,9 @@ package com.example.bump
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.example.bump.util.Message
import com.example.bump.util.MessageProcessor
import com.example.bump.util.RestSingleton
import org.json.JSONArray
import org.json.JSONObject
@ -27,6 +30,13 @@ class ExampleInstrumentedTest {
}
}
class NotificationTest {
@Test
fun showNotification() {
}
}
class RestCryptTest{
@Test
@ -46,6 +56,8 @@ class RestCryptTest{
assertEquals(messageData, encrypted)
val data = message.decrypt(messageData)
assertEquals(data, testMessage)
val m = Message(code, data, messageEncrypted.get("timestamp").toString())
lock.countDown()
}