-
Notifications
You must be signed in to change notification settings - Fork 1
[Test/#211] 핵심 로직 테스트 코드 작성 #213
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
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
473fca7
chore: Non android test 플러그인 추가
ThirFir ae312f7
chore: domain에 테스트 플러그인 추가
ThirFir d455da3
test: 거리계산 UseCase 테스트 코드 작성
ThirFir 12e447a
chore: common 모듈에 테스트 의존성 추가
ThirFir 45775ab
test: Time 유틸 테스트 코드 작성
ThirFir b5cfc76
refactor: Non안드로이드 테스트 플러그인 제거 -> 그냥 bundle을 이용하도록 수정, Android 테스트 번들 추가
ThirFir 9756966
chore: 단일 이벤트 측정 함수 추상화
ThirFir bfdf2a8
chore: app 모듈 테스트 의존성 추가
ThirFir 705039f
refactor: User/Profile Repository 관심사 정리
ThirFir 6c60fdb
fix: espresso - mocck 충돌 문제 해결
ThirFir 9f295af
chore: implementation -> testImplementation 수정
ThirFir 3c200c1
refactor: Authenticate의 재시작 로직을 AppNavigator로 위임
ThirFir 2056187
test: Authenticator 테스트 코드 작성
ThirFir d81f8bc
chore: TokenSource 미사용 함수 제거
ThirFir d1bc186
refactor: Navigator 인터페이스 core:navigation모듈로 이동
ThirFir 3948405
chore: core-launcher 모듈 생성
ThirFir 08b254e
chore: launcher 모듈 build-logic 적용
ThirFir a59dafc
refactor: Navigator -> Launcher 네이밍 변경
ThirFir ed48a0e
chore: launcher 모듈 의존 주입
ThirFir 9b7626c
refactor: Authenticator data 모듈로 이동
ThirFir 40a06a9
chore: data 모듈 테스트 의존성 추가
ThirFir 75c3666
chore: Token Source 함수 접근 제어 internal
ThirFir 277a624
chore: logout -> signOut
ThirFir 000f445
refactor: Session 관리 UserRepository로 통합
ThirFir c37764e
chore: Authenticator 빌드 에러 수정
ThirFir 3df7825
refactor: Authenticator 테스트 app -> data 모듈로 이동
ThirFir 8800f67
chore: turbine 의존성 새로 추가
ThirFir dfa0997
refactor: 테스트 가능한 구조로 UserType 초기화 방식 개선
ThirFir 60d871c
chore: junit5 의존성 추가 | 4,5 혼용 관련 호환 문제 fix
ThirFir 6425a88
chore: Logout -> SignOut
ThirFir 871f4dc
test: User Repository 테스트 코드 작성
ThirFir c5d141f
fix: 순환 참조 해결 > SessionHandler로 관리
ThirFir 9413f7b
test: UserRepository 테스트 일부를 SessionHandler 테스트로 분리
ThirFir b5487f6
chore: SessionHandler 패키지 정리
ThirFir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/acon/acon/launcher/AppLauncherImpl.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.acon.acon.launcher | ||
|
|
||
| import android.content.Context | ||
| import android.content.Intent | ||
| import com.acon.acon.MainActivity | ||
| import com.acon.acon.core.launcher.AppLauncher | ||
| import javax.inject.Inject | ||
|
|
||
| class AppLauncherImpl @Inject constructor(): AppLauncher { | ||
|
|
||
| override fun restartApp(context: Context) { | ||
| val intent = Intent(context, MainActivity::class.java).apply { | ||
| addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK) | ||
| } | ||
| context.startActivity(intent) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
core/analytics/src/test/java/com/acon/core/analytics/ExampleUnitTest.kt
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/common/src/test/kotlin/com/acon/acon/core/common/TimeExtensionsTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.acon.acon.core.common | ||
|
|
||
| import com.acon.acon.core.common.utils.toHHmm | ||
| import com.acon.acon.core.common.utils.toLocalTime | ||
| import org.junit.Test | ||
| import java.time.LocalTime | ||
| import kotlin.test.assertEquals | ||
|
|
||
| class TimeExtensionsTest { | ||
|
|
||
| @Test | ||
| fun `String_toLocalTime은 24시간 단위 시-분 문자열을 LocalTime으로 변환한다`() { | ||
| val timeString = "15:34" | ||
| val expectedTime = LocalTime.of(15, 34) | ||
| val actualTime = timeString.toLocalTime() | ||
|
|
||
| assertEquals(expectedTime, actualTime) | ||
| } | ||
|
|
||
| @Test | ||
| fun `LocalTime_toHHmm은 LocalTime을 24시간 단위 시-분 문자열로 변환한다`() { | ||
| val time = LocalTime.of(15, 34) | ||
| val expectedTimeString = "15:34" | ||
| val actualTimeString = time.toHHmm() | ||
| } | ||
|
|
||
| @Test | ||
| fun `LocalTime_toHHmmss은 LocalTime을 24시간 단위 시-분 문자열로 변환한다`() { | ||
| val time = LocalTime.of(15, 34, 21) | ||
| val expectedTimeString = "15:34:21" | ||
| val actualTimeString = time.toHHmm() | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| plugins { | ||
| alias(libs.plugins.acon.android.library) | ||
| } | ||
|
|
||
| android { | ||
| namespace = "com.acon.acon.core.launcher" | ||
| } |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Add project specific ProGuard rules here. | ||
| # You can control the set of applied configuration files using the | ||
| # proguardFiles setting in build.gradle. | ||
| # | ||
| # For more details, see | ||
| # http://developer.android.com/guide/developing/tools/proguard.html | ||
|
|
||
| # If your project uses WebView with JS, uncomment the following | ||
| # and specify the fully qualified class name to the JavaScript interface | ||
| # class: | ||
| #-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
| # public *; | ||
| #} | ||
|
|
||
| # Uncomment this to preserve the line number information for | ||
| # debugging stack traces. | ||
| #-keepattributes SourceFile,LineNumberTable | ||
|
|
||
| # If you keep the line number information, uncomment this to | ||
| # hide the original source file name. | ||
| #-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
core/launcher/src/androidTest/java/com/acon/acon/core/launcher/ExampleInstrumentedTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package com.acon.acon.core.launcher | ||
|
|
||
| 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.acon.acon.core.launcher.test", appContext.packageName) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
7 changes: 7 additions & 0 deletions
7
core/launcher/src/main/java/com/acon/acon/core/launcher/AppLauncher.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.acon.acon.core.launcher | ||
|
|
||
| import android.content.Context | ||
|
|
||
| interface AppLauncher { | ||
| fun restartApp(context: Context) | ||
| } |
2 changes: 1 addition & 1 deletion
2
...est/java/com/acon/acon/ExampleUnitTest.kt → ...con/acon/core/launcher/ExampleUnitTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package com.acon.acon | ||
| package com.acon.acon.core.launcher | ||
|
|
||
| import org.junit.Test | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기존에 여기에서 순환참조 문제가 발생했었나요?? 간단히 설명해주실 수 있나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기존에 Authenticator에서 SessionManager를 사용하던걸 그냥 UserRepository를 사용하는걸로 리팩토링했는데,
여기서 순환참조 발생하더라구여
UserRepository -> UserRemoteDataSource -> UserApi -> Retrofit -> OkHttpClient -> Authenticator -> UserRepository -> ...
그래서 다시 SessionHandler라는 이름으로 부활시켰습니다,,,