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() {
|
fun clearAll() {
|
||||||
val storageDir = getStorageDir()
|
val storageDir = getStorageDir()
|
||||||
if (storageDir.exists()) {
|
storageDir.listFiles().forEach { it.deleteRecursively() }
|
||||||
storageDir.listFiles().forEach { if (it.isFile) it.delete() }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getFile(name: String) = File(getStorageDir(), "$name.ser")
|
private fun getFile(name: String) = File(getStorageDir(), "$name.ser")
|
||||||
|
|
|
@ -64,4 +64,11 @@ class PermanentFileStorageTest : BaseStorageTest() {
|
||||||
|
|
||||||
storageDir.listFiles().size `should equal to` 0
|
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