[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
|
@ -11,8 +11,8 @@ internal class DefaultApplicationFileRepositoryKtTest {
|
|||
|
||||
@Test
|
||||
fun assertExistsThrowsRuntimeException() {
|
||||
//when
|
||||
val invalidFileName: ApplicationFileName = ApplicationFileName("iDontExist")
|
||||
// when
|
||||
val invalidFileName = ApplicationFileName("iDontExist")
|
||||
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
||||
|
||||
// then
|
||||
|
@ -27,17 +27,15 @@ internal class DefaultApplicationFileRepositoryKtTest {
|
|||
|
||||
@Test
|
||||
fun assertExistsPasses() {
|
||||
//when
|
||||
val validFileName = "iExist"
|
||||
File(validFileName).createNewFile()
|
||||
// given
|
||||
val validFileName = "src/test/resources/existing_file"
|
||||
|
||||
val validFile: ApplicationFileName =
|
||||
ApplicationFileName(File(validFileName).absolutePath)
|
||||
// when
|
||||
val validFile = ApplicationFileName(File(validFileName).path)
|
||||
val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
|
||||
|
||||
// then
|
||||
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