Skip to content

๐Ÿ”€ :: (#52) move exception file #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build
/consumer-rules.pro
/proguard-rules.pro
13 changes: 13 additions & 0 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
id("stackknowledge.android.core")
id("stackknowledge.android.hilt")
}

android {
namespace = "com.stackknowledge.common"
}

dependencies {
testImplementation(libs.kotlinx.coroutines.test)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.common

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.common.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions core/common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.stackknowledge.exception
package com.example.common.exception

class BadRequestException(
override val message: String?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.stackknowledge.exception
package com.example.common.exception

import java.io.IOException

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.stackknowledge.exception
package com.example.common.exception

class NetworkException : RuntimeException() {
override val message: String
Expand Down
17 changes: 17 additions & 0 deletions core/common/src/test/java/com/example/common/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.example.common

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
1 change: 1 addition & 0 deletions core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android {
}

dependencies {
implementation(project(":core:common"))
implementation(project(":core:model"))
implementation(project(":core:datastore"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.stackknowledge.util
import android.net.http.NetworkException
import android.os.Build
import androidx.annotation.RequiresExtension
import com.stackknowledge.exception.*
import com.example.common.exception.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import retrofit2.HttpException
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencyResolutionManagement {
rootProject.name = "StackKnowledge"
include(":app")

include(":core:common")
include(":core:data")
include(":core:datastore")
include(":core:design-system")
Expand Down
Loading