Dexmaker is a set of libraries that enable runtime bytecode generation and mocking on Android, primarily to support Mockito test frameworks. It provides two mocking modes: a proxy-based approach (dexmaker-mockito) that generates subclasses via the Dalvik bytecode generation API, and an inline approach (dexmaker-mockito-inline) that uses a JVMTI agent to transform class bytecode at runtime, allowing mocking of final and static methods. The core module (dexmaker) offers a low-level, fluent API for constructing DEX files programmatically, including types, methods, fields, and bytecode instructions. This is complemented by a C++ library (slicer) that reads, writes, and instruments DEX files, used by the inline mock maker to inject hooks into methods. The project is deeply integrated with Android internals, using hidden APIs and native agents, and is actively maintained to keep up with Android platform changes. It serves as the primary mocking solution for Android instrumentation tests where Java bytecode-based mocks (like ByteBuddy) are not available.
OCMockito is an Objective-C mocking library modeled after Mockito for Java. It provides mock objects, stubbing, and verification for unit tests. The library is built as a framework or static library, targeting iOS, macOS, tvOS, watchOS, and visionOS. Its architecture is modular: Core (public API), Mocking (NSProxy-based mock classes), Stubbing (invocation containers and answer objects), Verifying (invocation checkers and verification modes), Invocation (invocation matcher, call stack analysis, printing), and Helpers (chain-of-responsibility for argument getters and return value setters). The primary entry point is the OCMockito.h header, which exposes macros like mock(), given(), verify(), etc. Dependencies include OCHamcrest for matchers and failure reporting, and XCTest for test integration. The codebase demonstrates solid software engineering with extensive unit tests (XCTest), though there are minor maintenance concerns such as duplicated public headers, hardcoded paths in examples, and reliance on global singleton swizzling state that may cause cross-test contamination. Overall, it is a well-maintained and widely used testing library.