mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-04-30 06:37:29 +00:00
test(config): 完善 AppPaths 类的单元测试.
补充分支测试内容.
This commit is contained in:
parent
215a4670db
commit
ae64de00e7
@ -126,6 +126,25 @@ internal class AppPathsTest {
|
|||||||
verify(exactly = 0) { mkdirs() }
|
verify(exactly = 0) { mkdirs() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mockk<File> {
|
||||||
|
every { exists() }.returns(false)
|
||||||
|
every { canonicalPath }.answers { alreadyExistsFile.canonicalPath }
|
||||||
|
every { createNewFile() }.answers { false }
|
||||||
|
every { mkdirs() }.answers { false }
|
||||||
|
every { mkdir() }.answers { false }
|
||||||
|
}.apply {
|
||||||
|
mockk<AppPaths> {
|
||||||
|
every { file }.returns(this@apply)
|
||||||
|
every { path }.returns(this@apply.canonicalPath)
|
||||||
|
every { initial() }.answers {
|
||||||
|
defaultInitializerMethod.invoke(null, this@mockk)
|
||||||
|
}
|
||||||
|
}.initial()
|
||||||
|
verify(exactly = 1) { createNewFile() }
|
||||||
|
verify(exactly = 0) { mkdir() }
|
||||||
|
verify(exactly = 0) { mkdirs() }
|
||||||
|
}
|
||||||
|
|
||||||
defaultInitializerMethod.isAccessible = false
|
defaultInitializerMethod.isAccessible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user