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

Remove type parameter from Mockito#clearInvocations #3215

Open
onacit opened this issue Dec 30, 2023 · 0 comments
Open

Remove type parameter from Mockito#clearInvocations #3215

onacit opened this issue Dec 30, 2023 · 0 comments

Comments

@onacit
Copy link

onacit commented Dec 30, 2023

Remove type parameter <T> from Mockito#clearInvocations.

I don't see any usage of the type parameter <T> but just got a warning of unchecked generic array creation.

final var mock = Mockito.mock(Some.class);
// ...
Mockito.clearInvocation(mock); // unchecked generic array creation

Moreover, why don't we give a shot like this?

    public static void clearInvocations(Object mock, Object... otherMocks) {
        MOCKITO_CORE.clearInvocations(mock);
        for (Object otherMock : otherMocks) {
            MOCKITO_CORE.clearInvocations(otherMock);
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant