Skip to content

The future of inline mock maker #1728

@arturdryomov

Description

@arturdryomov

I‘ve been looking through MockMaker subclasses and noticed an interesting comment in org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker.

/**
 * ByteBuddy MockMaker.
 *
 * This class will serve as the programmatic entry point to all mockito internal MockMakers.
 * Currently the default and only mock maker is the subclassing engine, but with enough feedback we can later
 * promote the inlining engine for features like final class/methods mocks.
 *
 * The programmatic API could look like {@code mock(Final.class, withSettings().finalClasses())}.
 */

I wonder — does this still hold true? I’m asking mostly from experience described in #1532 and #1533. This lead to #1614 and an awkward API:

@After fun clearMocks() {
    Mockito.framework().clearInlineMocks()
}

If there are plans to make it default anyway it would be great to still make it opt-in or easily opt-out.

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