Add more test for PermanentFileStorage.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
1e806e3658
commit
63715aab18
|
@ -55,9 +55,7 @@ class PermanentFileStorage(
|
|||
*/
|
||||
fun clearAll() {
|
||||
val storageDir = getStorageDir()
|
||||
if (storageDir.exists()) {
|
||||
storageDir.listFiles().forEach { if (it.isFile) it.delete() }
|
||||
}
|
||||
storageDir.listFiles().forEach { it.deleteRecursively() }
|
||||
}
|
||||
|
||||
private fun getFile(name: String) = File(getStorageDir(), "$name.ser")
|
||||
|
|
|
@ -64,4 +64,11 @@ class PermanentFileStorageTest : BaseStorageTest() {
|
|||
|
||||
storageDir.listFiles().size `should equal to` 0
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should return null if serialized file not available`() {
|
||||
val loadedItem = storage.load("some-name", musicFolderSerializer)
|
||||
|
||||
loadedItem `should equal` null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue