refactoring: move Query/Function logic into Requester class
This commit is contained in:
28
src/test/kotlin/fr/postgresjson/TestAbstract.kt
Normal file
28
src/test/kotlin/fr/postgresjson/TestAbstract.kt
Normal file
@@ -0,0 +1,28 @@
|
||||
package fr.postgresjson
|
||||
|
||||
import fr.postgresjson.connexion.Connection
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS
|
||||
import java.io.File
|
||||
|
||||
@TestInstance(PER_CLASS)
|
||||
abstract class TestAbstract {
|
||||
protected fun getConnextion(): Connection {
|
||||
return Connection(database = "test", username = "test", password = "test")
|
||||
}
|
||||
|
||||
@BeforeAll
|
||||
fun beforeAll() {
|
||||
val initSQL = File(this::class.java.getResource("/fixtures/init.sql").toURI())
|
||||
val promise = getConnextion().connect().sendQuery(initSQL.readText())
|
||||
promise.join()
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
fun afterAll() {
|
||||
val downSQL = File(this::class.java.getResource("/fixtures/down.sql").toURI())
|
||||
getConnextion().connect().sendQuery(downSQL.readText()).join()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user