I have a basic question about Quarkus testing, I would like to execute the command ./mvnw clean test but I need to use a token to init the application.
I have configured application-test.properties file to store the token:
discord.token=XYZ
So, in my code I was expecting to be able to retrieve the value of the discord.token property:
@ConfigProperty(name = "discord.token")
private String token;
Is it possible? if not, how can I do this?
thanks
The
devprofile is used by dev mode (./mvnw quarkus:dev). If you want to define a property for your tests, you need to use thetestprofile.You can do that either with a suffixed file as you did (but with the
-testsuffix i.e.application-test.properties) or use%test.in front of your properties (%test.discord.token=XYZ) in the regularapplication.properties.See https://quarkus.io/guides/config-reference#profiles for more information.