This repository has been archived by the owner on Jan 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from k163377/more_coveradge
Add test case and refactor.
- Loading branch information
Showing
3 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 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,29 @@ | ||
package com.mapk.kmapper | ||
|
||
import org.junit.jupiter.api.DisplayName | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.assertDoesNotThrow | ||
import org.junit.jupiter.api.assertThrows | ||
|
||
@Suppress("UNUSED_VARIABLE") | ||
@DisplayName("BoundKMapperの初期化時にエラーを吐かせるテスト") | ||
internal class BoundKMapperInitTest { | ||
data class Dst1(val foo: Int, val bar: Short, val baz: Long) | ||
data class Dst2(val foo: Int, val bar: Short, val baz: Long = 0) | ||
|
||
data class Src(val foo: Int, val bar: Short) | ||
|
||
@Test | ||
@DisplayName("引数が足りない場合のエラーテスト") | ||
fun isError() { | ||
assertThrows<IllegalArgumentException> { | ||
val mapper: BoundKMapper<Src, Dst1> = BoundKMapper() | ||
} | ||
} | ||
|
||
@Test | ||
@DisplayName("足りないのがオプショナルな引数の場合エラーにならないテスト") | ||
fun isCollect() { | ||
assertDoesNotThrow { val mapper: BoundKMapper<Src, Dst2> = BoundKMapper(::Dst2) } | ||
} | ||
} |
This file contains 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