I would like to create Tests for a SpringBoot application. I am reading an example and I cannot understard what should I do when I have multiple MyBean
to test. Should I create a new Test
file? Should I Autowire
all of my beans into one class?
What I exactly want to do is to test some RestController
classes.
Asked
Active
Viewed 81 times
0

LiTTle
- 1,811
- 1
- 20
- 37
-
Do you mean you have multiple beans you want to test in the same test file? – sksamuel Aug 03 '18 at 18:35
-
If you are writing unit tests, it's better to make each of these their own test file. Additionally, you can either inject each `RestController` by name eg `MyRestController`, or you can inject a `List
`, but I'm really not sure what a list of rest controllers gains you. – Bwvolleyball Aug 08 '18 at 18:13