refactoring: force cast args
This commit is contained in:
@@ -2,7 +2,7 @@ package fr.postgresjson
|
||||
|
||||
import fr.postgresjson.connexion.Connection
|
||||
import fr.postgresjson.entity.IdEntity
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
@@ -46,4 +46,11 @@ class ConnectionTest(): TestAbstract() {
|
||||
assertTrue(objs[0].id == 1)
|
||||
assertTrue(objs[0].test!!.id == 1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun callRequestWithArgs() {
|
||||
val result: ObjTest? = connection.selectOne("select json_build_object('id', 1, 'name', ?::text)", listOf("myName"))
|
||||
assertNotNull(result)
|
||||
assertEquals("myName", result!!.name)
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class RequestTest: TestAbstract() {
|
||||
val objTest: ObjTest? = Requester(getConnextion())
|
||||
.addFunction(resources)
|
||||
.getFunction("test_function")
|
||||
.selectOne(listOf("ploop", "plip"))
|
||||
.selectOne(listOf("test", "plip"))
|
||||
assertEquals(objTest!!.id, 3)
|
||||
assertEquals(objTest.name, "test")
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ LANGUAGE plpgsql
|
||||
AS
|
||||
$$
|
||||
BEGIN
|
||||
result = json_build_object('id', 3, 'name', 'test');
|
||||
result = json_build_object('id', 3, 'name', name);
|
||||
END;
|
||||
$$
|
||||
Reference in New Issue
Block a user