[skip ci] replace real file in test by resource file
This commit is contained in:
parent
f7e67625f0
commit
a7cf154695
2 changed files with 9 additions and 10 deletions
|
@ -12,7 +12,7 @@ internal class DefaultApplicationFileRepositoryKtTest {
|
||||||
@Test
|
@Test
|
||||||
fun assertExistsThrowsRuntimeException() {
|
fun assertExistsThrowsRuntimeException() {
|
||||||
// when
|
// when
|
||||||
val invalidFileName: ApplicationFileName = ApplicationFileName("iDontExist")
|
val invalidFileName = ApplicationFileName("iDontExist")
|
||||||
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
||||||
|
|
||||||
// then
|
// then
|
||||||
|
@ -27,17 +27,15 @@ internal class DefaultApplicationFileRepositoryKtTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun assertExistsPasses() {
|
fun assertExistsPasses() {
|
||||||
|
// given
|
||||||
|
val validFileName = "src/test/resources/existing_file"
|
||||||
|
|
||||||
// when
|
// when
|
||||||
val validFileName = "iExist"
|
val validFile = ApplicationFileName(File(validFileName).path)
|
||||||
File(validFileName).createNewFile()
|
|
||||||
|
|
||||||
val validFile: ApplicationFileName =
|
|
||||||
ApplicationFileName(File(validFileName).absolutePath)
|
|
||||||
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
||||||
|
|
||||||
// then
|
|
||||||
repo.assertExists(validFile)
|
repo.assertExists(validFile)
|
||||||
|
|
||||||
File(validFileName).deleteOnExit()
|
// then
|
||||||
|
// no exception is thrown
|
||||||
}
|
}
|
||||||
}
|
}
|
1
src/test/resources/existing_file
Normal file
1
src/test/resources/existing_file
Normal file
|
@ -0,0 +1 @@
|
||||||
|
no content required
|
Loading…
Reference in a new issue