Skip to content

Commit c7ac145

Browse files
fix lint issue with gradle 8
1 parent d01cb2a commit c7ac145

38 files changed

Lines changed: 675 additions & 1005 deletions

android-core/src/androidTest/kotlin/com.mparticle/MParticleTest.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,14 +553,13 @@ class MParticleTest : BaseCleanStartedEachTest() {
553553
}
554554
}
555555

556-
private fun getSharedPrefsContents(name: String): String =
557-
try {
558-
val prefs = mContext.getSharedPreferences(name, Context.MODE_PRIVATE)
559-
"""
556+
private fun getSharedPrefsContents(name: String): String = try {
557+
val prefs = mContext.getSharedPreferences(name, Context.MODE_PRIVATE)
558+
"""
560559
$name:
561560
${JSONObject(prefs.all).toString(4)}
562-
""".trimIndent()
563-
} catch (e: JSONException) {
564-
"error printing SharedPrefs :/"
565-
}
561+
""".trimIndent()
562+
} catch (e: JSONException) {
563+
"error printing SharedPrefs :/"
564+
}
566565
}

android-core/src/androidTest/kotlin/com.mparticle/UploadEventKotlinTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ class UploadEventKotlinTest : BaseCleanStartedEachTest() {
8181
.any {
8282
val eventMessageName = messagesArray.getJSONObject(it).optString("n")
8383
assertNotEquals("Should Not Upload", eventMessageName)
84-
if (eventMessageName == "Should Upload 1" || eventMessageName == "Should Upload 2" ||
84+
if (eventMessageName == "Should Upload 1" ||
85+
eventMessageName == "Should Upload 2" ||
8586
eventMessageName == "Should Upload 3"
8687
) {
8788
numUploadedEvents++

android-core/src/androidTest/kotlin/com.mparticle/identity/IdentityApiOutgoingTest.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class IdentityApiOutgoingTest : BaseCleanStartedEachTest() {
1616
Matcher(mServer.Endpoints().loginUrl).bodyMatch(
1717
object :
1818
IdentityMatcher() {
19-
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean =
20-
mStartingMpid == identityRequest.previousMpid
19+
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean = mStartingMpid == identityRequest.previousMpid
2120
},
2221
),
2322
)
@@ -31,8 +30,7 @@ class IdentityApiOutgoingTest : BaseCleanStartedEachTest() {
3130
Matcher(mServer.Endpoints().loginUrl).bodyMatch(
3231
object :
3332
IdentityMatcher() {
34-
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean =
35-
mStartingMpid == identityRequest.previousMpid
33+
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean = mStartingMpid == identityRequest.previousMpid
3634
},
3735
),
3836
)
@@ -46,8 +44,7 @@ class IdentityApiOutgoingTest : BaseCleanStartedEachTest() {
4644
Matcher(mServer.Endpoints().logoutUrl).bodyMatch(
4745
object :
4846
IdentityMatcher() {
49-
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean =
50-
mStartingMpid == identityRequest.previousMpid
47+
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean = mStartingMpid == identityRequest.previousMpid
5148
},
5249
),
5350
)
@@ -61,8 +58,7 @@ class IdentityApiOutgoingTest : BaseCleanStartedEachTest() {
6158
Matcher(mServer.Endpoints().logoutUrl).bodyMatch(
6259
object :
6360
IdentityMatcher() {
64-
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean =
65-
mStartingMpid == identityRequest.previousMpid
61+
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean = mStartingMpid == identityRequest.previousMpid
6662
},
6763
),
6864
)
@@ -88,8 +84,7 @@ class IdentityApiOutgoingTest : BaseCleanStartedEachTest() {
8884
Matcher(mServer.Endpoints().identifyUrl).bodyMatch(
8985
object :
9086
IdentityMatcher() {
91-
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean =
92-
mStartingMpid == identityRequest.previousMpid
87+
override fun isIdentityMatch(identityRequest: IdentityRequestBody): Boolean = mStartingMpid == identityRequest.previousMpid
9388
},
9489
),
9590
)

android-core/src/androidTest/kotlin/com.mparticle/identity/MParticleIdentityClientImplTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ class MParticleIdentityClientImplTest : BaseCleanStartedEachTest() {
249249
mparticle: Boolean,
250250
) {
251251
if (connection.url
252-
.toString()
253-
.contains(MParticleIdentityClientImpl.MODIFY_PATH)
252+
.toString()
253+
.contains(MParticleIdentityClientImpl.MODIFY_PATH)
254254
) {
255255
val jsonObject = payload?.let { JSONObject(it) }
256256
val changedIdentities =

android-core/src/androidTest/kotlin/com.mparticle/internal/AppStateManagerInstrumentedTest.kt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,19 @@ class AppStateManagerInstrumentedTest : BaseCleanStartedEachTest() {
109109

110110
@Test
111111
@Throws(InterruptedException::class)
112-
fun testOnApplicationForeground() =
113-
runTest(StandardTestDispatcher()) {
114-
val latch: CountDownLatch = MPLatch(2)
115-
val kitManagerTester = KitManagerTester(mContext, latch)
116-
com.mparticle.AccessUtils.setKitManager(kitManagerTester)
117-
goToBackground()
118-
Assert.assertNull(mAppStateManager?.currentActivity)
119-
Thread.sleep(AppStateManager.ACTIVITY_DELAY + 100)
120-
goToForeground()
121-
Assert.assertNotNull(mAppStateManager?.currentActivity?.get())
122-
latch.await()
123-
Assert.assertTrue(kitManagerTester.onApplicationBackgroundCalled)
124-
Assert.assertTrue(kitManagerTester.onApplicationForegroundCalled)
125-
}
112+
fun testOnApplicationForeground() = runTest(StandardTestDispatcher()) {
113+
val latch: CountDownLatch = MPLatch(2)
114+
val kitManagerTester = KitManagerTester(mContext, latch)
115+
com.mparticle.AccessUtils.setKitManager(kitManagerTester)
116+
goToBackground()
117+
Assert.assertNull(mAppStateManager?.currentActivity)
118+
Thread.sleep(AppStateManager.ACTIVITY_DELAY + 100)
119+
goToForeground()
120+
Assert.assertNotNull(mAppStateManager?.currentActivity?.get())
121+
latch.await()
122+
Assert.assertTrue(kitManagerTester.onApplicationBackgroundCalled)
123+
Assert.assertTrue(kitManagerTester.onApplicationForegroundCalled)
124+
}
126125

127126
internal inner class KitManagerTester(
128127
context: Context?,

android-core/src/androidTest/kotlin/com.mparticle/internal/BatchSessionInfoTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import kotlin.test.assertNotEquals
1313
class BatchSessionInfoTest : BaseCleanStartedEachTest() {
1414
override fun useInMemoryDatabase() = true
1515

16-
override fun transformMParticleOptions(builder: MParticleOptions.Builder): MParticleOptions.Builder =
17-
builder.logLevel(MParticle.LogLevel.INFO)
16+
override fun transformMParticleOptions(builder: MParticleOptions.Builder): MParticleOptions.Builder = builder.logLevel(MParticle.LogLevel.INFO)
1817

1918
/**
2019
* This test is in response to a bug where, when many messages (> 1 batch worth)

android-core/src/androidTest/kotlin/com.mparticle/internal/ConfigStalenessCheckTest.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,11 @@ class ConfigStalenessCheckTest : BaseCleanInstallEachTest() {
222222
assertEquals(config2.toString(), configManager.config)
223223
}
224224

225-
private fun randomJson(size: Int) =
226-
(1..size)
227-
.map { mRandomUtils.getAlphaNumericString(4) to mRandomUtils.getAlphaNumericString(6) }
228-
.fold(JSONObject()) { init, attribute ->
229-
init.apply { put(attribute.first, attribute.second) }
230-
}
225+
private fun randomJson(size: Int) = (1..size)
226+
.map { mRandomUtils.getAlphaNumericString(4) to mRandomUtils.getAlphaNumericString(6) }
227+
.fold(JSONObject()) { init, attribute ->
228+
init.apply { put(attribute.first, attribute.second) }
229+
}
231230

232231
fun <T> T?.assertNotNull(): T {
233232
assertNotNull(this)

android-core/src/androidTest/kotlin/com.mparticle/internal/database/services/SessionServiceTest.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@ class SessionServiceTest : BaseMPServiceTest() {
7979
internal inner class MockMessageBatch(
8080
var id: Int,
8181
) : MessageBatch() {
82-
override fun equals(other: Any?): Boolean =
83-
if (other is MockMessageBatch) {
84-
id == other.id
85-
} else {
86-
super.equals(other)
87-
}
82+
override fun equals(other: Any?): Boolean = if (other is MockMessageBatch) {
83+
id == other.id
84+
} else {
85+
super.equals(other)
86+
}
8887

8988
override fun hashCode(): Int = id
9089
}

android-core/src/androidTest/kotlin/com.mparticle/networking/PinningTestNetworkOptionsDisabled.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import com.mparticle.MParticleOptions
66
class PinningTestNetworkOptionsDisabled : PinningTest() {
77
override fun shouldPin(): Boolean = true
88

9-
override fun transformMParticleOptions(builder: MParticleOptions.Builder): MParticleOptions.Builder =
10-
builder
11-
.environment(MParticle.Environment.Production)
12-
.networkOptions(
13-
NetworkOptions
14-
.builder()
15-
.setPinningDisabledInDevelopment(true)
16-
.build(),
17-
)
9+
override fun transformMParticleOptions(builder: MParticleOptions.Builder): MParticleOptions.Builder = builder
10+
.environment(MParticle.Environment.Production)
11+
.networkOptions(
12+
NetworkOptions
13+
.builder()
14+
.setPinningDisabledInDevelopment(true)
15+
.build(),
16+
)
1817
}

android-core/src/androidTest/kotlin/com.mparticle/networking/PinningTestNetworkOptionsEnabled.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import com.mparticle.MParticleOptions
66
class PinningTestNetworkOptionsEnabled : PinningTest() {
77
override fun shouldPin(): Boolean = false
88

9-
override fun transformMParticleOptions(builder: MParticleOptions.Builder): MParticleOptions.Builder =
10-
builder
11-
.environment(MParticle.Environment.Development)
12-
.networkOptions(
13-
NetworkOptions
14-
.builder()
15-
.setPinningDisabledInDevelopment(true)
16-
.build(),
17-
)
9+
override fun transformMParticleOptions(builder: MParticleOptions.Builder): MParticleOptions.Builder = builder
10+
.environment(MParticle.Environment.Development)
11+
.networkOptions(
12+
NetworkOptions
13+
.builder()
14+
.setPinningDisabledInDevelopment(true)
15+
.build(),
16+
)
1817
}

0 commit comments

Comments
 (0)