Skip to content

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

@hannah23280

Description

@hannah23280

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions