adds rest list receiver, adds local code storage
- rest class now receives a list as well as single messages - adds support for threaded singleton which takes care of continuous checking of the bump server to get the most up-to-date list of messages - adds local data class with tests to get locally saved code in preferences
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package com.example.bump
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.internal.runner.InstrumentationConnection
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@ -28,6 +30,15 @@ class MessageProcessorTest {
|
||||
Assert.assertEquals(test, decrypted)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setCode() {
|
||||
val test = getRandomString(512)
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
val local = LocalData(appContext)
|
||||
local.code = test
|
||||
Assert.assertEquals(local.code, test)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun decryptMessage(code: String, messageData: String): String {
|
||||
|
@ -68,9 +68,8 @@ class RestCryptTest{
|
||||
val lock = CountDownLatch(1)
|
||||
|
||||
|
||||
fun listTester(resultList: JSONObject) {
|
||||
fun listTester(messages: JSONArray) {
|
||||
val message = MessageProcessor(code)
|
||||
val messages: JSONArray = resultList.get("messages") as JSONArray
|
||||
|
||||
var messageEncoded = messages[0] as JSONObject
|
||||
var messageData = messageEncoded.get("data").toString()
|
||||
|
Reference in New Issue
Block a user