I created a spring boot project where I defined some conditional beans, which use the ConditionalOnProperty annotation. So, according to my properties file settings, some bean will be created, and some not (Because I have some back-ends for one thing, it can be set in properties file to choose one when in production situation).
But I wrote the unit tests for all beans, so the unit tests will not be success because in some cases, some beans will not be created at all, and I will get the UnsatisfiedDependencyException.
Is there any way that I can only test the created bean, I tried to add ConditionalOnProperty annotation on unit test method, but it does not work since it is about bean registration.
If there is not any good solution, I will split the project into some libs for every back-end, but it is just a small project.