This project now contains: - A generic JVM document library (with Kotlin extensions on the JDBC `Connection` object) - A Groovy library which adds extension methods to the `Connection` object - A Scala library, which uses native Scala collections and adds Scala-style extension methods to the `Connection` object - A Kotlin library which uses `kotlinx.serialization` (no reflection, reified generic types) along with `Connection` extensions Reviewed-on: #1
46 lines
1.3 KiB
Kotlin
46 lines
1.3 KiB
Kotlin
package solutions.bitbadger.documents.kotlinx.tests.integration
|
|
|
|
import org.junit.jupiter.api.DisplayName
|
|
import org.junit.jupiter.api.assertThrows
|
|
import solutions.bitbadger.documents.DocumentException
|
|
import kotlin.test.Test
|
|
|
|
/**
|
|
* SQLite integration tests for the `Delete` object / `deleteBy*` connection extension functions
|
|
*/
|
|
@DisplayName("KotlinX | SQLite: Delete")
|
|
class SQLiteDeleteIT {
|
|
|
|
@Test
|
|
@DisplayName("byId deletes a matching ID")
|
|
fun byIdMatch() =
|
|
SQLiteDB().use(DeleteFunctions::byIdMatch)
|
|
|
|
@Test
|
|
@DisplayName("byId succeeds when no ID matches")
|
|
fun byIdNoMatch() =
|
|
SQLiteDB().use(DeleteFunctions::byIdNoMatch)
|
|
|
|
@Test
|
|
@DisplayName("byFields deletes matching documents")
|
|
fun byFieldsMatch() =
|
|
SQLiteDB().use(DeleteFunctions::byFieldsMatch)
|
|
|
|
@Test
|
|
@DisplayName("byFields succeeds when no documents match")
|
|
fun byFieldsNoMatch() =
|
|
SQLiteDB().use(DeleteFunctions::byFieldsNoMatch)
|
|
|
|
@Test
|
|
@DisplayName("byContains fails")
|
|
fun byContainsFails() {
|
|
assertThrows<DocumentException> { SQLiteDB().use(DeleteFunctions::byContainsMatch) }
|
|
}
|
|
|
|
@Test
|
|
@DisplayName("byJsonPath fails")
|
|
fun byJsonPathFails() {
|
|
assertThrows<DocumentException> { SQLiteDB().use(DeleteFunctions::byJsonPathMatch) }
|
|
}
|
|
}
|