Skip to content

Commit

Permalink
generateRandomData to companion object, changed test source for delet…
Browse files Browse the repository at this point in the history
…ing data
  • Loading branch information
MOOOOOSER committed Nov 20, 2023
1 parent c96b861 commit 4d163fb
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/test/kotlin/sirius/biz/storage/layer1/ObjectStorageTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package sirius.biz.storage.layer1
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.CsvSource
import org.junit.jupiter.params.provider.ValueSource
import sirius.kernel.SiriusExtension
import sirius.kernel.commons.Streams
import sirius.kernel.di.std.Part
Expand All @@ -25,13 +26,6 @@ import kotlin.test.assertTrue
/**
* Tests the [ObjectStorage].
*/
fun generateRandomData(length: Int): ByteArray {
val rnd = Random()
val result = ByteArray(length)
rnd.nextBytes(result)
return result
}

@ExtendWith(SiriusExtension::class)
class ObjectStorageTest {
@ParameterizedTest
Expand Down Expand Up @@ -95,12 +89,7 @@ class ObjectStorageTest {
}

@ParameterizedTest
@CsvSource(
textBlock = """
fs-test | _
s3-test | _""",
delimiter = '|'
)
@ValueSource(strings = ["fs-test", "s3-test"])
fun `deleting data works as expected`(space: String) {
val testData = "test".toByteArray(StandardCharsets.UTF_8)
val objectSpace = storage.getSpace(space)
Expand All @@ -123,5 +112,11 @@ class ObjectStorageTest {
@JvmStatic
private lateinit var storage: ObjectStorage

private fun generateRandomData(length: Int): ByteArray {
val rnd = Random()
val result = ByteArray(length)
rnd.nextBytes(result)
return result
}
}
}

0 comments on commit 4d163fb

Please sign in to comment.