https://kotlinlang.org logo
#getting-started
Title
# getting-started
l

Lucas Marques

08/18/2021, 5:27 PM
Hi folks! I don't know if this is the best channel to ask you this, be here we go: I have an application built with Spring Boot and Gradle, which connects with Kafka and PostgreSQL. I'm using
resources/application.yml
as the config file. I want to create a specific package for each of this kinds of tests: unit, integration and end-to-end, but now I have a package only for unit tests. The problem is: every time I run the unit tests, my Spring Boot application try to connect with Kafka and Postgres (but for this purpose, I don't need them). How can I avoid to connect with these tools when running my unit tests? Also, do you know some blog post or documentation that shows how to create distinct packages for each kind of tests? Thanks in advance 🙂
k

Kirill Grouchnikov

08/18/2021, 6:33 PM
Anything related to Kotlin in here?
🚫 1
l

Lucas Marques

08/18/2021, 6:37 PM
The project was built with Kotlin, but since I'm kind of new to this Slack I don't know where I can ask this question. Do you know, @Kirill Grouchnikov? Or do you know some blog post that can help me with that? Thanks!!
h

hho

08/18/2021, 6:48 PM
Your question is about Spring Boot, not about Kotlin. That's why this Slack is not really the right place for the question. How about asking on Stackoverflow instead?
☝️ 1
l

Lucas Marques

08/18/2021, 6:56 PM
My bad 😅 thanks, @hho!
s

Saharath Kleips

08/18/2021, 9:08 PM
If you do run into the cross section of spring and kotlin in the future though, there is #spring
❤️ 1
f

frogger

08/19/2021, 6:22 AM
@*Lucas Marques* the idiomatic spring approach to you problem is to have multiple layers (controller, service, repository) and when you unit test e.g. the service the you mock the repository layer - hence to db / kafka connection anymore. To make it a kotlin answer: I recommend mockk for it.
👍 1