Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Used DEEP_STUBS for chained mocking #237

Open
nirikash opened this issue Dec 30, 2024 · 0 comments
Open

Used DEEP_STUBS for chained mocking #237

nirikash opened this issue Dec 30, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@nirikash
Copy link
Contributor

nirikash commented Dec 30, 2024

Description

In case if code has chain of mocking objects, more compact is using of DEEP_STUBS mockito setting.
In this case objects can be mocked using fluent API style, like:

    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
    private ISecurityService securityService;
...
        when(securityService.login()
                .from("REST")
                .authenticator(any())
                .with(any(IToken.class))).thenReturn(loginFinal);

Motivation

Compact and readable testing code

Proposed Solution (optional)

No response

@nirikash nirikash added the enhancement New feature or request label Dec 30, 2024
@nirikash nirikash self-assigned this Dec 30, 2024
nirikash added a commit that referenced this issue Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant