diff --git a/storage/lib/src/test/java/org/calyxos/backup/storage/backup/SmallFileBackupIntegrationTest.kt b/storage/lib/src/test/java/org/calyxos/backup/storage/backup/SmallFileBackupIntegrationTest.kt index 4d8214e4..ce2a4a77 100644 --- a/storage/lib/src/test/java/org/calyxos/backup/storage/backup/SmallFileBackupIntegrationTest.kt +++ b/storage/lib/src/test/java/org/calyxos/backup/storage/backup/SmallFileBackupIntegrationTest.kt @@ -77,7 +77,6 @@ internal class SmallFileBackupIntegrationTest { val outputStream2 = ByteArrayOutputStream() val chunkId = Random.nextBytes(KEY_SIZE_BYTES) - val cachedChunk = CachedChunk(chunkId.toHexString(), 0, 181, 0) val cachedFile2 = file2.toCachedFile(listOf(chunkId.toHexString()), 1) val backupFile = file2.toBackupFile(cachedFile2.chunks, cachedFile2.zipIndex) @@ -93,7 +92,14 @@ internal class SmallFileBackupIntegrationTest { every { mac.doFinal(any()) } returns chunkId every { chunksCache.get(any()) } returns null every { storagePlugin.getChunkOutputStream(any()) } returns outputStream2 - every { chunksCache.insert(cachedChunk) } just Runs + every { + chunksCache.insert(match { cachedChunk -> + cachedChunk.id == chunkId.toHexString() && + cachedChunk.refCount == 0L && + cachedChunk.size <= outputStream2.size() && + cachedChunk.version == 0.toByte() + }) + } just Runs every { filesCache.upsert(match { it.copy(lastSeen = cachedFile2.lastSeen) == cachedFile2