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

Verify Generic Function/Method #279

Open
Peng-Qian opened this issue Sep 12, 2020 · 3 comments
Open

Verify Generic Function/Method #279

Peng-Qian opened this issue Sep 12, 2020 · 3 comments
Labels
type-question A question about expected behavior or functionality

Comments

@Peng-Qian
Copy link

Problem

Unable to verify generic function. The function has always been called 0.

verify(mockInstance.fn<T>());
@srawlins
Copy link
Member

You are required to call called after the verify function. Can you show a complete reproduction of the issue?

@wim07101993
Copy link

Could you give an example of how the called would look like in a generic function?
eg:

when(mockConverter<User, UserModel>(any)).thenReturn(mockUserModel);
await doLogic(mockUser);
verify(mockConverter<User, UserModel>(mockUser));

@srawlins
Copy link
Member

Sorry for the delay. Something like:

when(mockConverter<User, UserModel>(any)).thenReturn(mockUserModel);
await doLogic(mockUser);
verify(mockConverter<User, UserModel>(mockUser)).called(1);

@srawlins srawlins added the type-question A question about expected behavior or functionality label May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

3 participants