Skip to content

Commit b7287e8

Browse files
authored
Merge pull request #53 from Stack-Knowledge/feature/52_move_exception_file
🔀 :: (#52) move exception file
2 parents 24c9959 + ed898cd commit b7287e8

File tree

11 files changed

+67
-4
lines changed

11 files changed

+67
-4
lines changed

core/common/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/build
2+
/consumer-rules.pro
3+
/proguard-rules.pro

core/common/build.gradle.kts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
2+
plugins {
3+
id("stackknowledge.android.core")
4+
id("stackknowledge.android.hilt")
5+
}
6+
7+
android {
8+
namespace = "com.stackknowledge.common"
9+
}
10+
11+
dependencies {
12+
testImplementation(libs.kotlinx.coroutines.test)
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.example.common
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.example.common.test", appContext.packageName)
23+
}
24+
}
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
</manifest>

core/network/src/main/kotlin/com/stackknowledge/exception/HttpException.kt renamed to core/common/src/main/java/com/example/common/exception/HttpException.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.stackknowledge.exception
1+
package com.example.common.exception
22

33
class BadRequestException(
44
override val message: String?

core/network/src/main/kotlin/com/stackknowledge/exception/NeedLoginException.kt renamed to core/common/src/main/java/com/example/common/exception/NeedLoginException.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.stackknowledge.exception
1+
package com.example.common.exception
22

33
import java.io.IOException
44

core/network/src/main/kotlin/com/stackknowledge/exception/NetworkException.kt renamed to core/common/src/main/java/com/example/common/exception/NetworkException.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.stackknowledge.exception
1+
package com.example.common.exception
22

33
class NetworkException : RuntimeException() {
44
override val message: String
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.example.common
2+
3+
import org.junit.Test
4+
5+
import org.junit.Assert.*
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* See [testing documentation](http://d.android.com/tools/testing).
11+
*/
12+
class ExampleUnitTest {
13+
@Test
14+
fun addition_isCorrect() {
15+
assertEquals(4, 2 + 2)
16+
}
17+
}

core/network/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ android {
2020
}
2121

2222
dependencies {
23+
implementation(project(":core:common"))
2324
implementation(project(":core:model"))
2425
implementation(project(":core:datastore"))
2526

core/network/src/main/kotlin/com/stackknowledge/util/StackKnowledgeApiHandler.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.stackknowledge.util
33
import android.net.http.NetworkException
44
import android.os.Build
55
import androidx.annotation.RequiresExtension
6-
import com.stackknowledge.exception.*
6+
import com.example.common.exception.*
77
import kotlinx.coroutines.Dispatchers
88
import kotlinx.coroutines.withContext
99
import retrofit2.HttpException

settings.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencyResolutionManagement {
1717
rootProject.name = "StackKnowledge"
1818
include(":app")
1919

20+
include(":core:common")
2021
include(":core:data")
2122
include(":core:datastore")
2223
include(":core:design-system")

0 commit comments

Comments
 (0)