Cleaner code

This commit is contained in:
2020-07-01 00:12:56 +02:00
parent 0993d93ccc
commit e03e12110b
31 changed files with 223 additions and 223 deletions
@@ -1,8 +1,8 @@
package integration.routing
import be.vandewalleh.Config
import be.vandewalleh.auth.SimpleJWT
import be.vandewalleh.entities.User
import be.vandewalleh.features.Config
import be.vandewalleh.features.PasswordHash
import be.vandewalleh.mainModule
import be.vandewalleh.module
@@ -4,8 +4,8 @@ import am.ik.yavi.builder.ValidatorBuilder
import am.ik.yavi.core.CustomConstraint
import am.ik.yavi.core.Validator
import be.vandewalleh.entities.Note
import be.vandewalleh.features.Migration
import be.vandewalleh.mainModule
import be.vandewalleh.migrations.Migration
import be.vandewalleh.services.NoteService
import be.vandewalleh.services.UserService
import com.fasterxml.jackson.databind.DeserializationFeature
@@ -34,7 +34,7 @@ class NoteServiceTest {
private val kodein = Kodein {
import(mainModule, allowOverride = true)
bind<DataSource>(overrides = true) with singleton { mariadb.datasource() }
bind(overrides = true) from singleton { mariadb.datasource() }
}
init {
@@ -216,7 +216,7 @@ class NoteServiceTest {
disable(DeserializationFeature.ACCEPT_FLOAT_AS_INT)
dateFormat = StdDateFormat()
}
val note: Note = objectMapper.readValue("""{"uuid": "c6d80-5fe6-4a30-b034-da63f6663c2c"}""")
val note: Note = objectMapper.readValue("""{"uuid": "2007e4d7-2986-4188-bde1-b99916d94bad"}""")
println(note.uuid)
println(note.uuid::class.qualifiedName)
println(note.uuid.leastSignificantBits)
@@ -1,8 +1,9 @@
package integration.services
import be.vandewalleh.features.Migration
import be.vandewalleh.mainModule
import be.vandewalleh.migrations.Migration
import be.vandewalleh.services.UserService
import com.zaxxer.hikari.HikariDataSource
import kotlinx.coroutines.runBlocking
import org.amshove.kluent.*
import org.junit.jupiter.api.*
@@ -22,17 +23,16 @@ class UserServiceTest {
private val kodein = Kodein {
import(mainModule, allowOverride = true)
bind<DataSource>(overrides = true) with singleton { mariadb.datasource() }
}
private val migration by kodein.instance<Migration>()
init {
migration.migrate()
bind(overrides = true) from singleton { mariadb.datasource() }
}
private val userService by kodein.instance<UserService>()
init {
val migration by kodein.instance<Migration>()
migration.migrate()
}
@Test
@Order(1)
fun `test create user`() {