diff --git a/core/domain/src/test/java/com/mifos/core/domain/GroupListPagingSourceTest.kt b/core/domain/src/test/java/com/mifos/core/domain/GroupListPagingSourceTest.kt
index e270bc7c4dc..d9c3b49df92 100644
--- a/core/domain/src/test/java/com/mifos/core/domain/GroupListPagingSourceTest.kt
+++ b/core/domain/src/test/java/com/mifos/core/domain/GroupListPagingSourceTest.kt
@@ -5,7 +5,7 @@ import androidx.paging.PagingSource
import androidx.paging.testing.TestPager
import com.mifos.core.objects.group.Group
import com.mifos.core.testing.repository.TestGroupsListRepository
-import com.mifos.core.testing.repository.errorMessage
+import com.mifos.core.testing.repository.ERROR_MESSAGE
import com.mifos.core.testing.repository.getPagedData
import com.mifos.core.testing.repository.sampleGroups
import com.mifos.core.testing.util.MainDispatcherRule
@@ -158,7 +158,7 @@ class GroupListPagingSourceTest {
val result = pager.refresh()
assertTrue(result is PagingSource.LoadResult.Error)
- assertEquals(errorMessage, result.throwable.message)
+ assertEquals(ERROR_MESSAGE, result.throwable.message)
val page = pager.getLastLoadedPage()
assertNull(page)
diff --git a/core/testing/build.gradle.kts b/core/testing/build.gradle.kts
index 03de9cc78fe..53e02cb793a 100644
--- a/core/testing/build.gradle.kts
+++ b/core/testing/build.gradle.kts
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
plugins {
alias(libs.plugins.mifos.android.library)
alias(libs.plugins.mifos.android.library.compose)
diff --git a/core/testing/src/main/AndroidManifest.xml b/core/testing/src/main/AndroidManifest.xml
index 44008a4332e..b1f5dbb779f 100644
--- a/core/testing/src/main/AndroidManifest.xml
+++ b/core/testing/src/main/AndroidManifest.xml
@@ -1,4 +1,13 @@
+
\ No newline at end of file
diff --git a/core/testing/src/main/java/com/mifos/core/testing/MifosTestRunner.kt b/core/testing/src/main/java/com/mifos/core/testing/MifosTestRunner.kt
index 0cce27b7aa1..f1ec69fa87a 100644
--- a/core/testing/src/main/java/com/mifos/core/testing/MifosTestRunner.kt
+++ b/core/testing/src/main/java/com/mifos/core/testing/MifosTestRunner.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.core.testing
import android.app.Application
diff --git a/core/testing/src/main/java/com/mifos/core/testing/di/TestDispatcherModule.kt b/core/testing/src/main/java/com/mifos/core/testing/di/TestDispatcherModule.kt
index f3fd64d4347..3e66236125a 100644
--- a/core/testing/src/main/java/com/mifos/core/testing/di/TestDispatcherModule.kt
+++ b/core/testing/src/main/java/com/mifos/core/testing/di/TestDispatcherModule.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.core.testing.di
import dagger.Module
diff --git a/core/testing/src/main/java/com/mifos/core/testing/di/TestDispatchersModule.kt b/core/testing/src/main/java/com/mifos/core/testing/di/TestDispatchersModule.kt
index 27c8fc83dca..24c21b6e9aa 100644
--- a/core/testing/src/main/java/com/mifos/core/testing/di/TestDispatchersModule.kt
+++ b/core/testing/src/main/java/com/mifos/core/testing/di/TestDispatchersModule.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.core.testing.di
import com.mifos.core.common.network.Dispatcher
diff --git a/core/testing/src/main/java/com/mifos/core/testing/repository/TestGroupsListRepository.kt b/core/testing/src/main/java/com/mifos/core/testing/repository/TestGroupsListRepository.kt
index cf9f742c470..bc9e0d38001 100644
--- a/core/testing/src/main/java/com/mifos/core/testing/repository/TestGroupsListRepository.kt
+++ b/core/testing/src/main/java/com/mifos/core/testing/repository/TestGroupsListRepository.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.core.testing.repository
import com.mifos.core.data.repository.GroupsListRepository
@@ -6,14 +15,14 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.emptyFlow
-const val errorMessage = "Unable to load data from server"
+const val ERROR_MESSAGE = "Unable to load data from server"
class TestGroupsListRepository : GroupsListRepository {
private val data = MutableStateFlow?>(sampleGroups)
override suspend fun getAllGroups(paged: Boolean, offset: Int, limit: Int): List {
return if (data.value == null) {
- throw RuntimeException(errorMessage)
+ throw RuntimeException(ERROR_MESSAGE)
} else {
data.value!!.getPagedData(offset, limit)
}
@@ -178,7 +187,7 @@ val sampleGroups = listOf(
id = 30,
accountNo = "ACC-030",
name = "Group 30",
- )
+ ),
)
fun List.getPagedData(offset: Int, limit: Int): List {
@@ -191,4 +200,4 @@ fun List.getPagedData(offset: Int, limit: Int): List {
}
val endIndex = (adjustedOffset + limit).coerceAtMost(size)
return subList(adjustedOffset, endIndex)
-}
\ No newline at end of file
+}
diff --git a/core/testing/src/main/java/com/mifos/core/testing/repository/TestSearchRepository.kt b/core/testing/src/main/java/com/mifos/core/testing/repository/TestSearchRepository.kt
index 1b4e74253b5..b063fc64656 100644
--- a/core/testing/src/main/java/com/mifos/core/testing/repository/TestSearchRepository.kt
+++ b/core/testing/src/main/java/com/mifos/core/testing/repository/TestSearchRepository.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.core.testing.repository
import com.mifos.core.data.repository.SearchRepository
@@ -15,26 +24,29 @@ class TestSearchRepository : SearchRepository {
override suspend fun searchResources(
query: String,
resources: String?,
- exactMatch: Boolean?
+ exactMatch: Boolean?,
): Flow> {
return sampleResults.map { list ->
when {
query.isBlank() && resources.isNullOrBlank() -> emptyList()
else -> {
list.asSequence().filter { entity ->
- (resources.isNullOrBlank() || entity.entityType.equals(
- resources,
- ignoreCase = true
- )) && (query.isBlank() || when {
- exactMatch == true -> entity.entityName.equals(query, ignoreCase = true) ||
+ (
+ resources.isNullOrBlank() || entity.entityType.equals(
+ resources,
+ ignoreCase = true,
+ )
+ ) && (
+ query.isBlank() || when {
+ exactMatch == true -> entity.entityName.equals(query, ignoreCase = true) ||
entity.entityAccountNo.equals(query, ignoreCase = true) ||
entity.parentName.equals(query, true)
- else -> entity.entityName?.contains(query, ignoreCase = true) == true ||
+ else -> entity.entityName?.contains(query, ignoreCase = true) == true ||
entity.entityAccountNo?.contains(query, ignoreCase = true) == true ||
entity.parentName?.contains(query, true) == true
- }
- )
+ }
+ )
}.toList()
}
}
@@ -45,4 +57,4 @@ class TestSearchRepository : SearchRepository {
fun addSampleResults(results: List) {
sampleResults.update { results }
}
-}
\ No newline at end of file
+}
diff --git a/core/testing/src/main/java/com/mifos/core/testing/util/MainDispatcherRule.kt b/core/testing/src/main/java/com/mifos/core/testing/util/MainDispatcherRule.kt
index a543ecfe70e..7d4a51577fd 100644
--- a/core/testing/src/main/java/com/mifos/core/testing/util/MainDispatcherRule.kt
+++ b/core/testing/src/main/java/com/mifos/core/testing/util/MainDispatcherRule.kt
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2024 Mifos Initiative
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See https://github.com/openMF/android-client/blob/master/LICENSE.md
+ */
package com.mifos.core.testing.util
import kotlinx.coroutines.Dispatchers