diff --git a/src/main/kotlin/fr/postgresjson/connexion/Connection.kt b/src/main/kotlin/fr/postgresjson/connexion/Connection.kt index 6e82597..15b74ca 100644 --- a/src/main/kotlin/fr/postgresjson/connexion/Connection.kt +++ b/src/main/kotlin/fr/postgresjson/connexion/Connection.kt @@ -9,8 +9,8 @@ import com.github.jasync.sql.db.postgresql.PostgreSQLConnectionBuilder import com.github.jasync.sql.db.util.length import fr.postgresjson.serializer.Serializer import fr.postgresjson.utils.LoggerDelegate -import kotlin.jvm.Throws import org.slf4j.Logger +import kotlin.jvm.Throws import kotlin.random.Random import kotlin.reflect.full.hasAnnotation diff --git a/src/main/kotlin/fr/postgresjson/connexion/DataNotFoundException.kt b/src/main/kotlin/fr/postgresjson/connexion/DataNotFoundException.kt index 7a853df..afd4847 100644 --- a/src/main/kotlin/fr/postgresjson/connexion/DataNotFoundException.kt +++ b/src/main/kotlin/fr/postgresjson/connexion/DataNotFoundException.kt @@ -1,6 +1,6 @@ package fr.postgresjson.connexion -class DataNotFoundException(val queryExecuted: String): Exception() { +class DataNotFoundException(val queryExecuted: String) : Exception() { override val message: String get() = "No data return for the query" -} \ No newline at end of file +} diff --git a/src/main/kotlin/fr/postgresjson/connexion/Executable.kt b/src/main/kotlin/fr/postgresjson/connexion/Executable.kt index 83d4095..80e0d81 100644 --- a/src/main/kotlin/fr/postgresjson/connexion/Executable.kt +++ b/src/main/kotlin/fr/postgresjson/connexion/Executable.kt @@ -1,3 +1,3 @@ package fr.postgresjson.connexion -sealed interface Executable \ No newline at end of file +sealed interface Executable diff --git a/src/main/kotlin/fr/postgresjson/definition/Function.kt b/src/main/kotlin/fr/postgresjson/definition/Function.kt index 3b29280..4b1cdd1 100644 --- a/src/main/kotlin/fr/postgresjson/definition/Function.kt +++ b/src/main/kotlin/fr/postgresjson/definition/Function.kt @@ -31,14 +31,14 @@ class Function( .findAll(functionParameters) .mapIndexed { index, paramsMatch -> Parameter( - paramsMatch.groups["pname"]?.value?.trim() ?: """arg${index+1}""", + paramsMatch.groups["pname"]?.value?.trim() ?: """arg${index + 1}""", paramsMatch.groups["type"]?.value?.trim() ?: throw ArgumentNotFound(), paramsMatch.groups["direction"]?.value?.trim(), paramsMatch.groups["default"]?.value?.trim(), paramsMatch.groups["precision"]?.value?.trim()?.toInt(), paramsMatch.groups["scale"]?.value?.trim()?.toInt() ) - }.toList() + }.toList() } else { listOf() } diff --git a/src/main/kotlin/fr/postgresjson/functionGenerator/FunctionGenerator.kt b/src/main/kotlin/fr/postgresjson/functionGenerator/FunctionGenerator.kt index 583f0bf..c408f21 100644 --- a/src/main/kotlin/fr/postgresjson/functionGenerator/FunctionGenerator.kt +++ b/src/main/kotlin/fr/postgresjson/functionGenerator/FunctionGenerator.kt @@ -7,13 +7,13 @@ import fr.postgresjson.definition.Parameter.Direction.INOUT import fr.postgresjson.definition.Parameter.Direction.OUT import fr.postgresjson.utils.searchSqlFiles import fr.postgresjson.utils.toCamelCase -import java.io.File -import java.net.URI import org.slf4j.Logger import org.slf4j.LoggerFactory +import java.io.File +import java.net.URI class FunctionGenerator(private val functionsDirectories: List) { - constructor(functionsDirectories: URI): this(listOf(functionsDirectories)) + constructor(functionsDirectories: URI) : this(listOf(functionsDirectories)) private val logger: Logger = LoggerFactory.getLogger("sqlFilesSearch") diff --git a/src/test/kotlin/fr/postgresjson/ConnectionTest.kt b/src/test/kotlin/fr/postgresjson/ConnectionTest.kt index a619277..08d7478 100644 --- a/src/test/kotlin/fr/postgresjson/ConnectionTest.kt +++ b/src/test/kotlin/fr/postgresjson/ConnectionTest.kt @@ -8,6 +8,7 @@ import fr.postgresjson.serializer.deserialize import fr.postgresjson.serializer.toTypeReference import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.api.assertThrows import java.util.UUID import kotlin.reflect.full.hasAnnotation import kotlin.test.assertEquals @@ -15,7 +16,6 @@ import kotlin.test.assertFalse import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue -import org.junit.jupiter.api.assertThrows @TestInstance(TestInstance.Lifecycle.PER_CLASS) class ConnectionTest : TestAbstract() { diff --git a/src/test/kotlin/fr/postgresjson/SerializerTest.kt b/src/test/kotlin/fr/postgresjson/SerializerTest.kt index 047e289..5eabfbf 100644 --- a/src/test/kotlin/fr/postgresjson/SerializerTest.kt +++ b/src/test/kotlin/fr/postgresjson/SerializerTest.kt @@ -11,7 +11,7 @@ import java.util.UUID @TestInstance(TestInstance.Lifecycle.PER_CLASS) internal class SerializerTest { - private class ObjTest(var val1: String, var val2: Int,val id: UUID = UUID.fromString("1e5f5d41-6d14-4007-897b-0ed2616bec96")) + private class ObjTest(var val1: String, var val2: Int, val id: UUID = UUID.fromString("1e5f5d41-6d14-4007-897b-0ed2616bec96")) private class ObjTestDate(var val1: DateTime, val id: UUID = UUID.fromString("829b1a29-5db8-47f9-9562-961c561ac528")) private val serializer = Serializer() diff --git a/src/test/kotlin/fr/postgresjson/functionGenerator/FunctionGeneratorTest.kt b/src/test/kotlin/fr/postgresjson/functionGenerator/FunctionGeneratorTest.kt index 712bab0..8590080 100644 --- a/src/test/kotlin/fr/postgresjson/functionGenerator/FunctionGeneratorTest.kt +++ b/src/test/kotlin/fr/postgresjson/functionGenerator/FunctionGeneratorTest.kt @@ -92,4 +92,4 @@ class FunctionGeneratorTest : StringSpec({ generator.generate(Function(functionSql)) `should be equal to` expectedGenerated } -}) \ No newline at end of file +})