awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
mockito avatar

mockito/mockito

0
View on GitHub↗
15,432 stars·2,656 forks·Java·MIT·26 viewsmockito.org↗

Mockito

Mockito is a Java mocking framework and JUnit testing library used to create simulated objects and stub method calls to isolate components during unit tests. It functions as a dynamic proxy generator and bytecode instrumentation tool, allowing for the creation of runtime substitutes that mimic the behavior of real classes.

The framework distinguishes itself by providing the ability to mock final classes and methods, bypassing standard language restrictions through bytecode modification. This capability enables the testing of legacy code that lacks interfaces.

The toolset covers behavioral mocking to define specific method responses and interaction verification to ensure methods were called with the correct arguments. It provides mechanisms for mock object generation and the recording of method interaction history for post-execution verification.

Features

  • Unit Testing Frameworks - Serves as a primary library for creating simulated objects to isolate Java code units during testing.
  • Proxy Objects - Generates runtime proxy objects that intercept and redefine method operations to mimic real classes.
  • Behavioral Configuration - Allows the definition of specific return values and behaviors for mocks based on provided arguments.
  • Method Interception Proxies - Provides a dynamic proxy mechanism to intercept method calls and inject simulated behaviors.
  • Method Call Verification - Records and validates the execution flow and arguments of method calls for interaction verification.
  • Interaction Verification Utilities - Provides tools for recording and asserting method call sequences and arguments to verify component interactions.
  • Mock Interaction Recorders - Captures detailed records of method invocations on mocks for post-execution interaction verification.
  • Mocking Frameworks - Provides a comprehensive framework for creating simulated objects and stubbing method calls in Java.
  • Dynamic Mock Objects - Generates runtime proxy objects to simulate dependencies and track interactions during unit tests.
  • Method Stubbing Utilities - Provides utilities for defining stubbed behaviors and return values for mock objects.
  • Runtime Bytecode Instrumentation - Implements runtime bytecode modification to bypass final modifiers for mocking restricted Java classes.
  • Legacy Code Isolation Tools - Provides isolation tools for legacy Java code by mocking final classes and methods.
  • Final Member Mocks - Bypasses language restrictions to create mock objects for final classes and methods via instrumentation.
  • Test Suite Integrations - Integrates mock lifecycles with JUnit and other Java test suites for project-wide verification.
  • Testing Frameworks - Mocking framework for unit tests.

Star history

Star history chart for mockito/mockitoStar history chart for mockito/mockito

How this analysis was created: This summary and feature list were written by an AI model that read the project's README and public documentation pages. Each feature links to the documentation it came from; stars, license and language come straight from the GitHub API. The model does not read the source code, and the analysis is refreshed when the project is re-analysed. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Frequently asked questions

What does mockito/mockito do?

Mockito is a Java mocking framework and JUnit testing library used to create simulated objects and stub method calls to isolate components during unit tests. It functions as a dynamic proxy generator and bytecode instrumentation tool, allowing for the creation of runtime substitutes that mimic the behavior of real classes.

What are the main features of mockito/mockito?

The main features of mockito/mockito are: Unit Testing Frameworks, Proxy Objects, Behavioral Configuration, Method Interception Proxies, Method Call Verification, Interaction Verification Utilities, Mock Interaction Recorders, Mocking Frameworks.

What are some open-source alternatives to mockito/mockito?

Open-source alternatives to mockito/mockito include: mockery/mockery — Mockery is a PHP framework designed for creating test doubles, stubs, and spies to facilitate isolated unit testing.… phpspec/prophecy — Prophecy is a PHP mocking framework and test double library used to simulate object dependencies during unit testing.… sinonjs/sinon — Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit… powermock/powermock — Powermock is a Java mocking framework and unit testing tool that uses bytecode manipulation to mock static methods,… sebastianbergmann/phpunit-mock-objects — This project is a mocking framework and library designed for creating simulated objects to isolate code and verify… thomhurst/tunit — TUnit is a comprehensive C# testing framework, mocking library, and fluent assertion tool. It utilizes source…

Open-source alternatives to Mockito

Similar open-source projects, ranked by how many features they share with Mockito.
  • mockery/mockerymockery avatar

    mockery/mockery

    10,724View on GitHub↗

    Mockery is a PHP framework designed for creating test doubles, stubs, and spies to facilitate isolated unit testing. It serves as a utility for simulating class behavior, intercepting method calls, and validating arguments, allowing developers to replace real dependencies with mock objects to verify that code components interact as intended. The framework distinguishes itself through advanced capabilities for handling complex testing scenarios, such as bypassing constructors, mocking protected methods, and intercepting static calls or internal object instantiations. It provides a fluent inter

    PHPmockmockerymocking
    View on GitHub↗10,724
  • phpspec/prophecyphpspec avatar

    phpspec/prophecy

    8,480View on GitHub↗

    Prophecy is a PHP mocking framework and test double library used to simulate object dependencies during unit testing. It serves as a behavioral testing tool for creating mocks, stubs, and dummies to isolate code and ensure predictable test results. The framework enables interaction verification by tracking method call counts and arguments to validate that specific interactions occurred. It supports defining specific return values or custom logic for method calls to simulate various execution scenarios. The library provides capabilities for argument matching based on type or value, interactio

    PHP
    View on GitHub↗8,480
  • sinonjs/sinonsinonjs avatar

    sinonjs/sinon

    9,753View on GitHub↗

    Sinon is a JavaScript test double library and mocking framework used to isolate code and verify behavior during unit testing. It provides a collection of spies, stubs, and mocks that replace real function implementations and object methods with controlled substitutes. The project includes a specialized fake timer library for overriding the system clock, allowing the simulation of time progression to trigger timeouts and intervals without waiting for real-time delays. It also features a test sandbox mechanism to group multiple fakes together, ensuring the original state is restored between tes

    JavaScript
    View on GitHub↗9,753
  • powermock/powermockpowermock avatar

    powermock/powermock

    4,174View on GitHub↗

    Powermock is a Java mocking framework and unit testing tool that uses bytecode manipulation to mock static methods, final classes, and private constructors. It includes a Java agent instrumentation tool and a reflection-based testing utility to bypass encapsulation and modify class behavior at runtime. The project distinguishes itself by providing the ability to intercept the instantiation of objects via the new keyword and simulate the behavior of core Java system classes and native methods. It can override final modifiers on classes and methods and bypass signature restrictions for classes

    Java
    View on GitHub↗4,174
  • See all 30 alternatives to Mockito→