Hello everyone. I don't have a java/kotlin backgro...
# codereview
d
Hello everyone. I don't have a java/kotlin background but I'd like to get your opinion on theses factory classes (used with the faker library). They are used for creating fake data when testing. I don't know if it makes sens for a kotlin dev. Or is there something better ? But here is the UserFactory: https://github.com/danygiguere/spring-boot-3-reactive-with-kotlin-coroutines/blob/main/src/main/kotlin/factory/UserFactory.kt and how I use it in a test: https://github.com/danygiguere/spring-boot-3-reactive-with-kotlin-coroutines/blob/[…]/kotlin/com/example/demo/factory/integration/UserFactoryTest.kt. Does it make sens or do you think Fixtures are better ?
c
That looks good to me!
The only thing I'd change is replace
runBlocking
by
runTest
👍 1
d
@CLOVIS I do not have access to runTest though. Is it a function that you wrote yourself ?
also instead of
Copy code
fun makeOne(userId: Long? = null) {
    userId ?: 1L
it would be better to
Copy code
fun makeOne(userId: Long = 1L) {
👍 1
2