9

In my Quarkus-Application an Observer of StartupEvent inserts default data into my database if a specific config-property is true. For one particular UnitTest I want my database to be empty.

I would think that there is some way to override configuration values for one unittest. Is that true, or is there a better way?

Obyoxar
  • 103
  • 2
  • 6

2 Answers2

2

Have you tried out by using a test profile for that property in your application.properties ?

Something like this:

—default value is A

myProp=A

—this is the test profile, which overrides the default value

%tst.myProp=B

Serkan
  • 639
  • 5
  • 14
  • 2
    This is the way I am handling it right now. But the problem is that this property would then be set for all of my tests and not just for a single one. – Obyoxar Nov 17 '19 at 15:33
2

I would suggest using test profiles

https://quarkus.io/blog/quarkus-test-profiles/

gaetanc
  • 116
  • 5
  • Thanks a lot. This indeed seems to be the way to go about this nowadays... I will mark this as accepted even though I cannot verify if this one actually solves the problem as that particular project is long done. If someone else has anything to add that would be very welcome. – Obyoxar Jun 03 '21 at 08:16