From 01597a89dc828033836f218828ff02d7b61fdae2 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 14 Feb 2020 17:53:27 +0100 Subject: [PATCH] Avoid code duplication --- .../internal/crypto/ssss/QuadSTests.kt | 36 +++++-------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/ssss/QuadSTests.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/ssss/QuadSTests.kt index f0e2161d4c..57c065aaf8 100644 --- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/ssss/QuadSTests.kt +++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/ssss/QuadSTests.kt @@ -25,11 +25,10 @@ import im.vector.matrix.android.api.session.Session import im.vector.matrix.android.api.session.securestorage.Curve25519AesSha2KeySpec import im.vector.matrix.android.api.session.securestorage.EncryptedSecretContent import im.vector.matrix.android.api.session.securestorage.KeySigner -import im.vector.matrix.android.api.session.securestorage.SsssKeyCreationInfo import im.vector.matrix.android.api.session.securestorage.SecretStorageKeyContent +import im.vector.matrix.android.api.session.securestorage.SsssKeyCreationInfo import im.vector.matrix.android.api.util.Optional import im.vector.matrix.android.common.CommonTestHelper -import im.vector.matrix.android.common.CryptoTestHelper import im.vector.matrix.android.common.SessionTestParams import im.vector.matrix.android.common.TestConstants import im.vector.matrix.android.common.TestMatrixCallback @@ -50,11 +49,16 @@ import org.junit.runners.MethodSorters import java.util.concurrent.CountDownLatch @RunWith(AndroidJUnit4::class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@FixMethodOrder(MethodSorters.JVM) class QuadSTests : InstrumentedTest { private val mTestHelper = CommonTestHelper(context()) - private val mCryptoTestHelper = CryptoTestHelper(mTestHelper) + + private val emptyKeySigner = object : KeySigner { + override fun sign(canonicalJson: String): Map>? { + return null + } + } @Test fun test_Generate4SKey() { @@ -64,12 +68,6 @@ class QuadSTests : InstrumentedTest { val quadS = aliceSession.sharedSecretStorageService - val emptyKeySigner = object : KeySigner { - override fun sign(canonicalJson: String): Map>? { - return null - } - } - var recoveryKey: String? = null val TEST_KEY_ID = "my.test.Key" @@ -207,12 +205,6 @@ class QuadSTests : InstrumentedTest { val quadS = aliceSession.sharedSecretStorageService - val emptyKeySigner = object : KeySigner { - override fun sign(canonicalJson: String): Map>? { - return null - } - } - val TEST_KEY_ID = "my.test.Key" val countDownLatch = CountDownLatch(1) @@ -354,12 +346,6 @@ class QuadSTests : InstrumentedTest { private fun generatedSecret(session: Session, keyId: String, asDefault: Boolean = true): SsssKeyCreationInfo { val quadS = session.sharedSecretStorageService - val emptyKeySigner = object : KeySigner { - override fun sign(canonicalJson: String): Map>? { - return null - } - } - var creationInfo: SsssKeyCreationInfo? = null val generateLatch = CountDownLatch(1) @@ -395,12 +381,6 @@ class QuadSTests : InstrumentedTest { private fun generatedSecretFromPassphrase(session: Session, passphrase: String, keyId: String, asDefault: Boolean = true): SsssKeyCreationInfo { val quadS = session.sharedSecretStorageService - val emptyKeySigner = object : KeySigner { - override fun sign(canonicalJson: String): Map>? { - return null - } - } - var creationInfo: SsssKeyCreationInfo? = null val generateLatch = CountDownLatch(1)