Fix ktlint issues

This commit is contained in:
Benoit Marty 2020-01-08 18:19:37 +01:00
parent ed773dbb96
commit 35f011ba37
8 changed files with 12 additions and 45 deletions

View file

@ -50,7 +50,6 @@ class CommonTestHelper(context: Context) {
matrix = Matrix.getInstance(context)
}
fun createAccount(userNamePrefix: String, testParams: SessionTestParams): Session {
return createAccount(userNamePrefix, TestConstants.PASSWORD, testParams)
}
@ -129,7 +128,6 @@ class CommonTestHelper(context: Context) {
return sentEvents
}
// PRIVATE METHODS *****************************************************************************
/**

View file

@ -17,7 +17,6 @@
package im.vector.matrix.android.common
import android.os.SystemClock
import android.text.TextUtils
import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.events.model.Event
import im.vector.matrix.android.api.session.events.model.EventType

View file

@ -41,7 +41,6 @@ class MockOkHttpInterceptor : Interceptor {
private var rules: ArrayList<Rule> = ArrayList()
fun addRule(rule: Rule) {
rules.add(rule)
}
@ -60,7 +59,6 @@ class MockOkHttpInterceptor : Interceptor {
return chain.proceed(originalRequest)
}
abstract class Rule(val match: String) {
abstract fun process(originalRequest: Request): Response?
}
@ -81,6 +79,5 @@ class MockOkHttpInterceptor : Interceptor {
.code(code)
.build()
}
}
}

View file

@ -16,7 +16,6 @@
package im.vector.matrix.android.internal.crypto
import android.os.MemoryFile
import android.util.Base64
import androidx.test.ext.junit.runners.AndroidJUnit4

View file

@ -150,7 +150,6 @@ class KeysBackupTest : InstrumentedTest {
var megolmBackupCreationInfo: MegolmBackupCreationInfo? = null
val latch = CountDownLatch(1)
keysBackup.prepareKeysBackupVersion(null, null, object : MatrixCallback<MegolmBackupCreationInfo> {
override fun onSuccess(data: MegolmBackupCreationInfo) {
megolmBackupCreationInfo = data
@ -210,7 +209,6 @@ class KeysBackupTest : InstrumentedTest {
mTestHelper.await(latch)
val nbOfKeys = cryptoTestData.firstSession.inboundGroupSessionsCount(false)
val backedUpKeys = cryptoTestData.firstSession.inboundGroupSessionsCount(true)
@ -230,7 +228,6 @@ class KeysBackupTest : InstrumentedTest {
cryptoTestData.close()
}
/**
* Check that backupAllGroupSessions() returns valid data
*/
@ -258,7 +255,6 @@ class KeysBackupTest : InstrumentedTest {
assertEquals(nbOfKeys, total)
lastBackedUpKeysProgress = progress
}
}, TestMatrixCallback(latch))
mTestHelper.await(latch)
@ -400,7 +396,6 @@ class KeysBackupTest : InstrumentedTest {
testData.cryptoTestData.close()
}
/**
* - Do an e2e backup to the homeserver with a recovery key
* - And log Alice on a new device
@ -1081,7 +1076,6 @@ class KeysBackupTest : InstrumentedTest {
keysBackup.backupAllGroupSessions(object : ProgressListener {
override fun onProgress(progress: Int, total: Int) {
}
}, TestMatrixCallback(latch2, false))
mTestHelper.await(latch2)
@ -1121,7 +1115,6 @@ class KeysBackupTest : InstrumentedTest {
val latch = CountDownLatch(1)
keysBackup.backupAllGroupSessions(object : ProgressListener {
override fun onProgress(progress: Int, total: Int) {
}
}, TestMatrixCallback(latch))
mTestHelper.await(latch)
@ -1153,7 +1146,6 @@ class KeysBackupTest : InstrumentedTest {
keysBackup2.backupAllGroupSessions(object : ProgressListener {
override fun onProgress(progress: Int, total: Int) {
}
}, object : TestMatrixCallback<Unit>(latch2, false) {
override fun onSuccess(data: Unit) {
isSuccessful = true
@ -1274,7 +1266,6 @@ class KeysBackupTest : InstrumentedTest {
var megolmBackupCreationInfo: MegolmBackupCreationInfo? = null
val latch = CountDownLatch(1)
keysBackup.prepareKeysBackupVersion(password, null, object : MatrixCallback<MegolmBackupCreationInfo> {
override fun onSuccess(data: MegolmBackupCreationInfo) {
megolmBackupCreationInfo = data

View file

@ -94,7 +94,6 @@ class SASTest : InstrumentedTest {
val bobListener2 = object : SasVerificationService.SasVerificationListener {
override fun transactionCreated(tx: SasVerificationTransaction) {}
override fun transactionUpdated(tx: SasVerificationTransaction) {
if (tx.transactionId == txID) {
if ((tx as SASVerificationTransaction).state === SasVerificationTxState.OnCancelled) {
@ -166,7 +165,6 @@ class SASTest : InstrumentedTest {
}
aliceSession.getSasVerificationService().addListener(aliceListener)
fakeBobStart(bobSession, aliceUserID, aliceDevice, tid, protocols = protocols)
mTestHelper.await(cancelLatch)
@ -175,7 +173,6 @@ class SASTest : InstrumentedTest {
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
cryptoTestData.close()
}
@Test
@ -213,7 +210,6 @@ class SASTest : InstrumentedTest {
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
cryptoTestData.close()
}
@Test
@ -222,7 +218,6 @@ class SASTest : InstrumentedTest {
val bobSession = cryptoTestData.secondSession!!
val codes = listOf("bin", "foo", "bar")
val tid = "00000000"
@ -252,7 +247,6 @@ class SASTest : InstrumentedTest {
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
cryptoTestData.close()
}
private fun fakeBobStart(bobSession: Session,
@ -284,7 +278,6 @@ class SASTest : InstrumentedTest {
// TODO )
}
// any two devices may only have at most one key verification in flight at a time.
// If a device has two verifications in progress with the same device, then it should cancel both verifications.
@Test
@ -294,7 +287,6 @@ class SASTest : InstrumentedTest {
val aliceSession = cryptoTestData.firstSession
val bobSession = cryptoTestData.secondSession
val aliceSasMgr = aliceSession.getSasVerificationService()
val aliceCreatedLatch = CountDownLatch(2)
@ -343,7 +335,6 @@ class SASTest : InstrumentedTest {
var accepted: KeyVerificationAccept? = null
var startReq: KeyVerificationStart? = null
val aliceAcceptedLatch = CountDownLatch(1)
val aliceListener = object : SasVerificationService.SasVerificationListener {
override fun markedAsManuallyVerified(userId: String, deviceId: String) {}
@ -375,7 +366,6 @@ class SASTest : InstrumentedTest {
}
bobSasMgr.addListener(bobListener)
val bobUserId = bobSession.myUserId
val bobDeviceId = bobSession.getMyDevice().deviceId
aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)
@ -406,7 +396,6 @@ class SASTest : InstrumentedTest {
val aliceSasMgr = aliceSession.getSasVerificationService()
val bobSasMgr = bobSession!!.getSasVerificationService()
val aliceSASLatch = CountDownLatch(1)
val aliceListener = object : SasVerificationService.SasVerificationListener {
override fun transactionCreated(tx: SasVerificationTransaction) {}
@ -446,7 +435,6 @@ class SASTest : InstrumentedTest {
}
bobSasMgr.addListener(bobListener)
val bobUserId = bobSession.myUserId
val bobDeviceId = bobSession.getMyDevice().deviceId
val verificationSAS = aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)
@ -462,7 +450,6 @@ class SASTest : InstrumentedTest {
cryptoTestData.close()
}
@Test
fun test_happyPath() {
val cryptoTestData = mCryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
@ -473,7 +460,6 @@ class SASTest : InstrumentedTest {
val aliceSasMgr = aliceSession.getSasVerificationService()
val bobSasMgr = bobSession!!.getSasVerificationService()
val aliceSASLatch = CountDownLatch(1)
val aliceListener = object : SasVerificationService.SasVerificationListener {
override fun transactionCreated(tx: SasVerificationTransaction) {}
@ -519,7 +505,6 @@ class SASTest : InstrumentedTest {
}
bobSasMgr.addListener(bobListener)
val bobUserId = bobSession.myUserId
val bobDeviceId = bobSession.getMyDevice().deviceId
aliceSasMgr.beginKeyVerificationSAS(bobUserId, bobDeviceId)

View file

@ -1364,7 +1364,6 @@ internal class KeysBackup @Inject constructor(
.executeBy(taskExecutor)
}
companion object {
// Maximum delay in ms in {@link maybeBackupKeys}
private const val KEY_BACKUP_WAITING_TIME_TO_SEND_KEY_BACKUP_MILLIS = 10_000L

View file

@ -16,7 +16,6 @@
package im.vector.matrix.android.internal.crypto.keysbackup.util
import org.junit.Assert.assertArrayEquals
import org.junit.Assert.assertEquals
import org.junit.FixMethodOrder
@ -35,7 +34,7 @@ class Base58Test {
@Test
fun decode() {
// Example comes from https://github.com/keis/base58
assertArrayEquals("hello world".toByteArray(), base58decode("StV1DL6CwTryKyV"));
assertArrayEquals("hello world".toByteArray(), base58decode("StV1DL6CwTryKyV"))
}
@Test