Book-Microservices-v3 / chapter03

Learn Microservices with SpringBoot 3 (3rd edition) - Chapter 3
2 stars 2 forks source link

Chapter 03: ChallengeGeneratorServiceTest.java - @Mock can also be used, instead of @Spy #4

Open hannah23280 opened 10 months ago

hannah23280 commented 10 months ago

In the book, it mentions to use @Spy for random field in the ChallengeGeneratorServiceTest.java. But i am able to use @Mock, and the testing still passed. I am currently using spring boot 3.2.0. Any idea why?

In the book. it also mentions "since the basic Java classes implementing random generators do not work on interfaces (which you could then simply mock instead of spy), not sure if can elaborate on this, cos not sure what that mean.