MCPcopy Index your code
hub / github.com/alibaba/testable-mock

github.com/alibaba/testable-mock @v0.7.9

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.9 ↗ · + Follow
1,276 symbols 3,280 edges 213 files 311 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TestableMock

Write mock faster, make unit testing easier.

Any test framework, no initialization, no matter private method, static method, construction method, or any other method of any class, and no matter how the object created. Write a mock method, add an @MockInvoke annotation, everything is done.

Usage Document: https://alibaba.github.io/testable-mock/#/en-us/

Roadmap

TestableMock is still under heavy development, if you get sucked somehow, just go ahead raise an issue for it.

Directory Structure

|-- testable-parent       ➜ Provide parent pom file shared by other modules
|-- testable-all          ➜ Dependence aggration, for easily import all modules at once
|-- testable-processor    ➜ Compile-time code preprocessing module, provides test assist functions
|-- testable-agent        ➜ JavaAgent module, provides test mocking related functions
|-- testable-core         ➜ Basic function module, provides mock related class and annotation
|-- testable-maven-plugin ➜ Maven plugin module, for simplify JavaAgent injection
|-- tool                  ➜ Scripts for project maintain
|-- demo
|   |-- java-demo         ➜ Java code example
|   |-- kotlin-demo       ➜ Kotlin code example
|   |-- android-demo      ➜ Android app code example
|   `-- spock-demo        ➜ Spock framwork code example
`-- docs                  ➜ Source code of usage document

Build project

The project is built using JDK 1.6+ and Maven 3+, except for the demo sub-project requires JDK 1.8+.

mvn clean install

Generate document

docsify serve docs

TestableMock document is generated by docsify tool, please install nodejs before execution, and run npm install -g docsify command to install the tool required.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 1,022
Class 232
Interface 13
Enum 9

Languages

Java87%
Kotlin13%

Modules by API surface

demo/java-demo/src/main/java/com/alibaba/demo/lambda/InvokeVirtualDemo.java48 symbols
testable-core/src/main/java/com/alibaba/testable/core/matcher/InvocationMatcher.java39 symbols
demo/java-demo/src/main/java/com/alibaba/demo/lambda/LambdaDemo.java36 symbols
testable-core/src/test/java/com/alibaba/testable/core/util/ConstructionUtilTest.java28 symbols
testable-agent/src/main/java/com/alibaba/testable/agent/model/WrapperType.java27 symbols
testable-agent/src/main/java/com/alibaba/testable/agent/handler/SourceClassHandler.java24 symbols
testable-agent/src/main/java/com/alibaba/testable/agent/util/ClassUtil.java20 symbols
testable-agent/src/main/java/com/alibaba/testable/agent/handler/MockClassHandler.java20 symbols
testable-core/src/main/java/com/alibaba/testable/core/tool/OmniAccessor.java19 symbols
testable-processor/src/main/java/com/alibaba/testable/processor/translator/EnablePrivateAccessTranslator.java17 symbols
testable-agent/src/main/java/com/alibaba/testable/agent/transformer/TestableClassTransformer.java17 symbols
demo/kotlin-demo/src/test/kotlin/com/alibaba/demo/basic/DemoMockTest.kt17 symbols

For agents

$ claude mcp add testable-mock \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page