[skip ci] replace real file in test by resource file

This commit is contained in:
az 2022-09-01 21:02:06 +02:00
parent f7e67625f0
commit a7cf154695
2 changed files with 9 additions and 10 deletions

View file

@ -11,8 +11,8 @@ 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() {
//when // given
val validFileName = "iExist" val validFileName = "src/test/resources/existing_file"
File(validFileName).createNewFile()
val validFile: ApplicationFileName = // when
ApplicationFileName(File(validFileName).absolutePath) val validFile = ApplicationFileName(File(validFileName).path)
val repo: ApplicationFileRepository = DefaultApplicationFileRepository() val repo: ApplicationFileRepository = DefaultApplicationFileRepository()
// then
repo.assertExists(validFile) repo.assertExists(validFile)
File(validFileName).deleteOnExit() // then
// no exception is thrown
} }
} }

View file

@ -0,0 +1 @@
no content required