diff --git a/app/src/androidTest/java/com/example/bump/MessageProcessorTest.kt b/app/src/androidTest/java/com/example/bump/MessageProcessorTest.kt index dedba27..72f29d5 100644 --- a/app/src/androidTest/java/com/example/bump/MessageProcessorTest.kt +++ b/app/src/androidTest/java/com/example/bump/MessageProcessorTest.kt @@ -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) } diff --git a/app/src/androidTest/java/com/example/bump/RestCryptTest.kt b/app/src/androidTest/java/com/example/bump/RestCryptTest.kt index 7b3f724..7b6f042 100644 --- a/app/src/androidTest/java/com/example/bump/RestCryptTest.kt +++ b/app/src/androidTest/java/com/example/bump/RestCryptTest.kt @@ -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() } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index baf73e4..a4014c9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -8,7 +8,7 @@ + tools:context="com.example.bump.ui.MainActivity"> + tools:context="com.example.bump.ui.SecondFragment">