-
Notifications
You must be signed in to change notification settings - Fork 0
feat(user): make use case classes internal and add test configurations #55
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
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| dependencies { | ||
| implementation(project(":domain")) | ||
| testImplementation(libs.h2) | ||
| testImplementation(libs.konsist) | ||
| testImplementation(libs.kotest.engine) | ||
| testImplementation(libs.kotest.assertions) | ||
| testImplementation(libs.kotest.runner) | ||
| } |
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
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
2 changes: 1 addition & 1 deletion
2
...ackend/bootstrap/CleanArchitectureTest.kt → ...kend/application/CleanArchitectureTest.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
31 changes: 31 additions & 0 deletions
31
.../test/kotlin/com/alleslocker/backend/application/integration/config/TestAdapterFactory.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,31 @@ | ||
| package com.alleslocker.backend.application.integration.config | ||
|
|
||
| import com.alleslocker.backend.application.common.adapter.Adapter | ||
| import com.alleslocker.backend.application.common.factory.AdapterFactory | ||
| import java.lang.reflect.Proxy | ||
| import kotlin.reflect.KClass | ||
|
|
||
| class TestAdapterFactory( | ||
| private val adapters: List<Adapter>, | ||
| ) : AdapterFactory { | ||
| override fun <T : Adapter> make(adapter: KClass<out T>): T { | ||
| val match = adapters.firstOrNull { adapter.isInstance(it) } | ||
| if (match != null) { | ||
| @Suppress("UNCHECKED_CAST") | ||
| return match as T | ||
| } | ||
|
|
||
| @Suppress("UNCHECKED_CAST") | ||
| return Proxy.newProxyInstance( | ||
| adapter.java.classLoader, | ||
| arrayOf(adapter.java), | ||
| ) { _, method, _ -> | ||
| when (method.returnType) { | ||
| Boolean::class.javaPrimitiveType -> false | ||
| Int::class.javaPrimitiveType -> 0 | ||
| Long::class.javaPrimitiveType -> 0L | ||
| else -> null | ||
| } | ||
| } as T | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
.../test/kotlin/com/alleslocker/backend/application/integration/config/TestGatewayFactory.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.alleslocker.backend.application.integration.config | ||
|
|
||
| import com.alleslocker.backend.application.common.factory.GatewayFactory | ||
| import com.alleslocker.backend.application.common.gateway.Gateway | ||
| import java.lang.reflect.Proxy | ||
| import kotlin.reflect.KClass | ||
|
|
||
| class TestGatewayFactory( | ||
| private val gateways: List<Gateway>, | ||
| ) : GatewayFactory { | ||
| override fun <T : Gateway> make(gateway: KClass<out T>): T { | ||
| val match = gateways.firstOrNull { gateway.isInstance(it) } | ||
| if (match != null) { | ||
| @Suppress("UNCHECKED_CAST") | ||
| return match as T | ||
| } | ||
|
|
||
| @Suppress("UNCHECKED_CAST") | ||
| return Proxy.newProxyInstance( | ||
| gateway.java.classLoader, | ||
| arrayOf(gateway.java), | ||
| ) { _, method, _ -> | ||
| when (method.returnType) { | ||
| Boolean::class.javaPrimitiveType -> false | ||
| Int::class.javaPrimitiveType -> 0 | ||
| Long::class.javaPrimitiveType -> 0L | ||
| else -> null | ||
| } | ||
| } as T | ||
| } | ||
|
|
||
| override fun migrate() {} | ||
| } |
33 changes: 33 additions & 0 deletions
33
...tion/src/test/kotlin/com/alleslocker/backend/application/integration/config/TestLogger.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.alleslocker.backend.application.integration.config | ||
|
|
||
| import com.alleslocker.backend.application.common.Logger | ||
| import com.alleslocker.backend.domain.auditlog.AuditLog | ||
|
|
||
| class TestLogger : Logger { | ||
| val auditLogs = mutableListOf<AuditLog>() | ||
| val infoMessages = mutableListOf<String>() | ||
| val errorMessages = mutableListOf<String>() | ||
|
|
||
| fun clear() { | ||
| auditLogs.clear() | ||
| infoMessages.clear() | ||
| errorMessages.clear() | ||
| } | ||
|
|
||
| override fun info(message: String) { | ||
| infoMessages.add(message) | ||
| } | ||
|
|
||
| override fun error( | ||
| message: String, | ||
| throwable: Throwable?, | ||
| ) { | ||
| errorMessages.add(message) | ||
| } | ||
|
|
||
| override fun audit(auditLog: AuditLog) { | ||
| auditLogs.add(auditLog) | ||
| } | ||
|
|
||
| override fun debug(message: String) {} | ||
| } |
15 changes: 15 additions & 0 deletions
15
.../test/kotlin/com/alleslocker/backend/application/integration/config/TestPasswordHasher.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,15 @@ | ||
| package com.alleslocker.backend.application.integration.config | ||
|
|
||
| import com.alleslocker.backend.application.common.security.PasswordHasher | ||
| import java.security.MessageDigest | ||
|
|
||
| class TestPasswordHasher : PasswordHasher { | ||
| private val digest = MessageDigest.getInstance("SHA-256") | ||
|
|
||
| override fun hash(raw: String): String = digest.digest(raw.toByteArray()).joinToString("") { "%02x".format(it) } | ||
|
|
||
| override fun verify( | ||
| raw: String, | ||
| hash: String, | ||
| ): Boolean = hash(raw) == hash | ||
| } | ||
17 changes: 17 additions & 0 deletions
17
...n/src/test/kotlin/com/alleslocker/backend/application/integration/config/TestPresenter.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.alleslocker.backend.application.integration.config | ||
|
|
||
| import com.alleslocker.backend.application.common.ErrorResponse | ||
| import com.alleslocker.backend.application.common.OutputBoundary | ||
|
|
||
| class TestPresenter<R> : OutputBoundary<R> { | ||
| var response: R? = null | ||
| var error: ErrorResponse? = null | ||
|
|
||
| override fun present(response: R) { | ||
| this.response = response | ||
| } | ||
|
|
||
| override fun presentFailure(error: ErrorResponse) { | ||
| this.error = error | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.