### Use TestableMock Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Guide on how to set up and start using TestableMock for Java mocking. ```en-us This section provides instructions on how to use TestableMock, covering initial setup and basic usage patterns. ``` -------------------------------- ### Generate Documentation Locally Source: https://github.com/alibaba/testable-mock/blob/master/README.md Serve the TestableMock documentation locally using the docsify tool. Ensure you have Node.js installed and have installed docsify globally via npm. This command will start a local server to view the documentation. ```bash docsify serve docs ``` -------------------------------- ### Upgrade Guide Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Instructions and considerations for upgrading to newer versions of TestableMock. ```en-us This guide provides steps and important notes for migrating from older versions of TestableMock to the latest release. ``` -------------------------------- ### Generate Documentation with Docsify Source: https://github.com/alibaba/testable-mock/blob/master/README_EN.md This command serves the documentation generated by Docsify. Ensure Node.js and Docsify are installed globally (`npm install -g docsify`). ```bash docsify serve docs ``` -------------------------------- ### Build TestableMock Plugin from Source Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/use-intellij-plugin.md Instructions to clone the repository, build the plugin using Gradle, and locate the packaged zip file for installation. ```Bash git clone https://github.com/zcbbpo/testable-idea cd testable-idea ./gradlew clean build ``` -------------------------------- ### Use IntelliJ Plugin Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Guide on integrating and using the TestableMock IntelliJ plugin for enhanced development experience. ```en-us This documentation covers the installation and usage of the IntelliJ plugin for TestableMock, providing IDE support. ``` -------------------------------- ### Build Project with Maven Source: https://github.com/alibaba/testable-mock/blob/master/README_EN.md This command cleans the project and installs all modules using Maven. It requires JDK 1.6+ and Maven 3+. ```bash mvn clean install ``` -------------------------------- ### Build Project with Maven Source: https://github.com/alibaba/testable-mock/blob/master/README.md Build the TestableMock project using Maven. This command cleans the project, installs dependencies, and builds the artifacts. The main project requires JDK 1.6+ and Maven 3+, while the demo subprojects require JDK 1.8+. ```bash mvn clean install ``` -------------------------------- ### OmniAccessor Get and Set Examples Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/omni-constructor.md Demonstrates how to retrieve and assign values to object members using OmniAccessor's get and set methods with path expressions. Handles complex object structures and array indexing. ```java OmniAccessor.get(parent, "{GrandChild}/content"); OmniAccessor.set(parent, "children[2]/*/value", 100); ``` -------------------------------- ### TestableMock Mock Scanning Log Example Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/troubleshooting.md An example of the log content generated by TestableMock, showing found test classes, mock classes, source classes, and mocked method invocations with line numbers. ```text [INFO] Start at Mon Jan 00 00:00:00 CST 0000 ... ... [INFO] Found test class com/alibaba/testable/demo/basic/DemoMockTest [INFO] Found 6 test cases [INFO] Found mock class com/alibaba/testable/demo/basic/DemoMockTest$Mock [INFO] Found 8 mock methods [INFO] Found source class com/alibaba/testable/demo/basic/DemoMock [INFO] Found method [INFO] Found method newFunc [INFO] Line 19, mock method "createBlackBox" used [INFO] Found method outerFunc [INFO] Line 27, mock method "innerFunc" used [INFO] Line 27, mock method "staticFunc" used [INFO] Found method commonFunc [INFO] Line 34, mock method "trim" used [INFO] Line 34, mock method "sub" used [INFO] Line 34, mock method "startsWith" used ... ... [INFO] Completed at Mon Jan 00 00:00:00 CST 0000 ``` -------------------------------- ### TestableMock Verbose Diagnosis Log Example Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/troubleshooting.md An example of detailed log output when `LogLevel.VERBOSE` is enabled for mock diagnosis, showing test cases, mock method signatures, and invocation details. ```text [INFO] Found test class com/alibaba/testable/demo/basic/DemoMockTest [TIP] Test case "should_mock_new_object" ... ... [TIP] Test case "should_set_mock_context" [INFO] Found 6 test cases [INFO] Found mock class com/alibaba/testable/demo/basic/DemoMockTest$Mock [TIP] Mock constructor "createBlackBox" as "com.alibaba.demo.basic.model.mock.BlackBox(java.lang.String)" [TIP] Mock method "innerFunc" as "com.alibaba.demo.basic.DemoMock::innerFunc(java.lang.String) : java.lang.String" ... ... [TIP] Mock method "callFromDifferentMethod" as "()Ljava/lang/String;" [INFO] Found 8 mock methods [INFO] Found source class com/alibaba/testable/demo/basic/DemoMock [INFO] Found method [TIP] Line 13, constructing "java.lang.Object()" [INFO] Found method newFunc [TIP] Line 19, constructing "com.alibaba.demo.basic.model.mock.BlackBox(java.lang.String)" [INFO] Line 19, mock method "createBlackBox" used [TIP] Line 19, invoking "com.alibaba.demo.basic.DemoMockTest$Mock::createBlackBox(java.lang.String) : com.alibaba.demo.basic.model.mock.BlackBox" [TIP] Line 20, invoking "com.alibaba.demo.basic.model.mock.BlackBox::get() : java.lang.String" [INFO] Found method outerFunc [TIP] Line 27, constructing "java.lang.StringBuilder()" [TIP] Line 27, invoking "java.lang.StringBuilder::append(java.lang.String) : java.lang.StringBuilder" [TIP] Line 27, invoking "com.alibaba.demo.basic.DemoMock::innerFunc(java.lang.String) : java.lang.String" [INFO] Line 27, mock method "innerFunc" used ... ... ``` -------------------------------- ### TestableMock Annotation Example Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/comparation.md Illustrates the primary annotation used in TestableMock for defining mock behavior. ```Java // Example usage of @MockInvoke annotation (conceptual) @MockInvoke public void mockedMethod() { // Mock implementation } ``` -------------------------------- ### OmniAccessor GetFirst Example Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/omni-constructor.md Illustrates the usage of OmniAccessor.getFirst() for directly obtaining a unique target object during exact path matching, equivalent to OmniAccessor.get(...).get(0). ```java OmniAccessor.getFirst(parent, "access path"); ``` -------------------------------- ### TestableMock Verbose Mock Diagnosis Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/troubleshooting.md Example of using the `@MockDiagnose` annotation with `LogLevel.VERBOSE` on a mock class to get detailed information about mock method signatures and invocation matching. ```java class BizServiceTest { @MockDiagnose(LogLevel.VERBOSE) public static class Mock { ... } } ``` -------------------------------- ### Frequently Asked Questions Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Answers to common questions regarding TestableMock usage and features. ```en-us A collection of frequently asked questions and their solutions related to TestableMock. ``` -------------------------------- ### Extract Slice from Array with slice Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/collection-tools.md Extracts a part of data from any type of array into a new array. Can specify start and end indices, or just a starting position. ```java import static com.alibaba.testable.core.tool.CollectionTool.slice; import static com.alibaba.testable.core.tool.CollectionTool.arrayOf; // Extract the elements of the specified string array from subscript 1 to 3 // the returned new array content are ["is", "a", "simple"] String[] fullWords = arrayOf("this", "is", "a", "simple", "example"); String[] partOfWords = slice(fullWords, 1, 3); // If only given the index of starting position, all elements after this position are extracted // the new array returned in the following example is [5, 8, 13, 21] Integer[] fibonacci = arrayOf(1, 1, 2, 3, 5, 8, 13, 21); Integer[] partOfFibonacci = slice(fibonacci, 4); ``` -------------------------------- ### Use Package Mapping Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Understand how to use package mapping with TestableMock for efficient mocking configurations. ```en-us Instructions on configuring package mappings to streamline the mocking process in TestableMock. ``` -------------------------------- ### How Mock Works Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Explanation of the underlying design and mechanism of TestableMock. ```en-us This document delves into the internal workings of TestableMock, explaining how it achieves mocking through bytecode manipulation or other techniques. ``` -------------------------------- ### Testable Maven Plugin Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Information on using the Testable Maven Plugin to integrate TestableMock into your build process. ```en-us Details about the Testable Maven Plugin, including configuration and usage for automated testing with TestableMock. ``` -------------------------------- ### Package Mapping and Configuration Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/release-note.md Improvements in package mapping rules and global configuration for easier mocking of third-party packages. ```java define package mapping rule according to order in config, to avoid a short path overwrite longer ones fix an issue cause mock class unrecognized after package-mapping support global package path mapping for easier mocking code of 3rd packages ``` -------------------------------- ### Java Import Path Change in TestableMock v0.6 Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/upgrade-guide.md Illustrates the package change for the PrivateAccessor class from 'com.alibaba.testable.core.accessor' to 'com.alibaba.testable.core.tool' when upgrading to TestableMock version 0.6. ```java import com.alibaba.testable.core.accessor.PrivateAccessor; // ... upgrade to 0.6 ... import com.alibaba.testable.core.tool.PrivateAccessor; ``` -------------------------------- ### Available Global Arguments Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md List and explanation of global arguments available for TestableMock's Java agent. ```en-us This section details the various global arguments that can be used to configure the TestableMock Java agent at runtime. ``` -------------------------------- ### Self-Help Troubleshooting Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Guidance on troubleshooting common issues encountered while using TestableMock. ```en-us This document offers solutions and steps for self-help troubleshooting of problems related to TestableMock. ``` -------------------------------- ### TestableMock Preprocessing Steps Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/design-and-mechanism.md Details the preprocessing steps taken by TestableMock when a unit test starts. This includes establishing associations between the class under test, test class, and mock container class, and modifying these classes to facilitate mocking. ```java For the class under test, replace the matched call with a call to the mock container method. For the test class, insert the mock context initialization code at the beginning of each test case. For the mock container class, add the `testableIns()` method to make the class become a singleton class, and insert codes to record the call at the beginning of each Mock method. ``` -------------------------------- ### Docsify Configuration Source: https://github.com/alibaba/testable-mock/blob/master/docs/index.html This snippet shows the configuration for Docsify, a documentation generator. It includes settings for the repository, sidebar, navbar, homepage, aliases, and plugins. ```javascript window.$docsify = { name: 'TestableMock', repo: 'https://github.com/alibaba/testable-mock', loadSidebar: "sidebar.md", loadNavbar: "navbar.md", mergeNavbar: true, homepage: '/zh-cn/README.md', alias: { '^/([^/]+)$': '/zh-cn/$1' }, plugins: [ function (hook, vm) { hook.beforeEach(function (html) { return html + '\n\n----\n\n' + 'Powered by 云效' }) } ] } ``` -------------------------------- ### Mocking Tool Comparison Table Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/comparation.md A comparative table outlining the features and limitations of various Java mocking tools. ```Markdown | Tool | Mechanism | Minimal mock unit | Limitation of method be mocked | Ease of use | IDE support | | ---- | ---- | ---- | ---- | ---- | ---- | | Mockito | Dynamic proxy | Class | Except private/static method and constructor | **Easy** | **Very well** | | Spock | Dynamic proxy | Class | Except private/static method and constructor | Complicate | Just so so | | PowerMock | Custom class loader | Class | **No limitation, any method works** | Complicate | **Good** | | JMockit | Runtime bytecode modification | Class | Except constructor (i.e. new operator) | Complicate | Just so so | | TestableMock | Runtime bytecode modification | Method | **No limitation, any method works** | **Very easy** | Just so so | ``` -------------------------------- ### TestableMock Core Functionality Source: https://github.com/alibaba/testable-mock/blob/master/README_EN.md Demonstrates the core concept of TestableMock using the `@MockInvoke` annotation. This annotation is applied to a method to define its mock behavior, allowing for the interception and modification of method calls without requiring complex setup or initialization. ```java import io.testable.mock.annotation.MockInvoke; public class Example { @MockInvoke(targetClass = "com.example.TargetClass", targetMethod = "targetMethod") public static Object mockMethod(Object... args) { // Mock implementation System.out.println("Mocked method called"); return "mocked result"; } } ``` -------------------------------- ### Mock Tools Comparison Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Comparison of TestableMock with other popular Java mocking frameworks. ```en-us An analysis comparing TestableMock's features, performance, and ease of use against alternatives like Mockito and EasyMock. ``` -------------------------------- ### Available Annotations Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Overview of all annotations provided by TestableMock for mocking and testing. ```en-us A comprehensive list and explanation of the annotations offered by TestableMock for defining mock behavior and test configurations. ``` -------------------------------- ### TestableMock v0.5 Mock Method Structure Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/upgrade-guide.md Demonstrates the required structural change for mock methods in Testable Mock version 0.5. Mock methods must be moved into a static inner class named 'Mock' within the test class. ```java public class DemoMockTest { public static class Mock { @MockMethod(targetClass = DemoMock.class) private String innerFunc(String text) { return "hello_" + text; } } @Test void should_mock_member_method() throws Exception { assertEquals("hello_world", demoMock.outerFunc()); verifyInvoked("innerFunc").with("world"); } } ``` -------------------------------- ### Android Project Testing with TestableMock Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/frequently-asked-questions.md Provides guidance on using TestableMock with Android projects. It highlights the differences in bytecode systems between Dalvik/ART and standard JVM, recommending the use of Roboelectric for Android unit tests on a standard JVM. ```java // Example setup for Android testing with Roboelectric and TestableMock // In your Android test class: // @RunWith(RobolectricTestRunner.class) // public class MyAndroidServiceTest { // // @Test // public void testAndroidService() { // MyAndroidService service = new MyAndroidService(); // // Use TestableMock for mocking Android SDK classes or your own classes // TestableMock.when(() -> service.getAndroidData()).thenReturn("mocked android data"); // assertEquals("mocked android data", service.getAndroidData()); // } // } ``` -------------------------------- ### Fast Mocking Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Learn how to achieve fast mocking with TestableMock, optimizing your testing process. ```en-us This guide focuses on techniques for implementing fast mocking using TestableMock, enhancing test execution speed. ``` -------------------------------- ### About Us Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Information about the creators and contributors of TestableMock. ```en-us Details about the team behind TestableMock, its development history, and community involvement. ``` -------------------------------- ### Add TestableMock Dependencies (Gradle) Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/setup.md Specifies the necessary dependencies for TestableMock in a Gradle build file. Includes the main library and the annotation processor for testing. ```groovy dependencies { testImplementation('com.alibaba.testable:testable-all:0.7.9') testAnnotationProcessor('com.alibaba.testable:testable-processor:0.7.9') } ``` -------------------------------- ### Use TestableMock In IDE Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Instructions on how to use TestableMock directly within your Integrated Development Environment (IDE). ```en-us This guide provides steps for integrating TestableMock into your IDE for a seamless mocking experience. ``` -------------------------------- ### Omni Constructor Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Explore the Omni Constructor feature in TestableMock for flexible object instantiation. ```en-us This documentation explains the Omni Constructor, a feature that allows for versatile object creation in TestableMock. ``` -------------------------------- ### Configure Testable Maven Plugin Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/use-maven-plugin.md This snippet shows how to add the testable-maven-plugin to your Maven project's pom.xml. It ensures the 'prepare' goal is executed, which is necessary for the mocking functionality. ```xml com.alibaba.testable testable-maven-plugin ${testable.version} prepare prepare ``` -------------------------------- ### Test Void Method Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Learn how to effectively test void methods using TestableMock. ```en-us Instructions and examples for testing void methods, which do not return a value, with TestableMock. ``` -------------------------------- ### Logging and Diagnostics Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/release-note.md Improvements in logging, including automatic generation of mock scanning log files for troubleshooting and using Kotlin-style method descriptors in verbose logs. ```java fix a log disorder issue of mock class handler generate mock scanning log file automatically, for self-troubleshooting use kotlin-style method descriptor in `VERBOSE` diagnose logs ``` -------------------------------- ### Core Functionality and Parameter Preparation Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/release-note.md Introduction of OmniConstructor and OmniAccessor for parameter preparation, and removal of the TestableNull class. ```java add `OmniConstructor` and `OmniAccessor` tool for parameter preparation `TestableNull` class removed, let `OmniConstructor` even lighter ``` -------------------------------- ### Feedback Channel Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Information on how to provide feedback or report issues for TestableMock. ```en-us This section outlines the preferred channels for users to submit feedback, suggestions, or bug reports for TestableMock. ``` -------------------------------- ### Maven Dependency and Plugin Configuration for TestableMock Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/setup.md This snippet shows how to add the TestableMock dependency to a Maven project's pom.xml and configure the maven-surefire-plugin to use the testable-agent. It also includes how to handle Jacoco integration. ```xml 0.7.9 com.alibaba.testable testable-all ${testable.version} test org.apache.maven.plugins maven-surefire-plugin -javaagent:${settings.localRepository}/com/alibaba/testable/testable-agent/${testable.version}/testable-agent-${testable.version}.jar @{argLine} -javaagent:${settings.localRepository}/com/alibaba/testable/testable-agent/${testable.version}/testable-agent-${testable.version}.jar ``` -------------------------------- ### Collection Utility Methods Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/release-note.md Introduction of the CollectionUtil class providing various utility methods for collection creation. ```java provide a `CollectionUtil` class which contains many utility collection creation methods move collection creation methods from `CollectionUtil` class to `CollectionTool` class ``` -------------------------------- ### Running Tests in Eclipse via Command Line Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/use-in-ide.md Demonstrates how to execute specific test classes or test cases using Maven commands within the Eclipse IDE's command line interface. This is useful when the `@EnablePrivateAccess` annotation is used. ```bash mvn test -Dtest= mvn test -Dtest=# ``` -------------------------------- ### OmniAccessor vs. Builder Pattern Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/omni-constructor.md Compares OmniAccessor's fail-fast mechanism with the Builder Pattern for complex object assignments, discussing trade-offs in IDE refactoring support and encapsulation. ```text OmniAccessor provides immediate NoSuchMemberError for unmatched access paths, aiding early test termination. However, it has weaker IDE refactoring support. Builder Pattern or Getter/Setter methods are recommended for complex assignments due to better encapsulation and refactoring friendliness. OmniAccessor should be a last resort when other methods are unsuitable. ``` -------------------------------- ### Use MockWith Annotation Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Learn how to apply the MockWith annotation in TestableMock for simplified mocking. ```en-us This guide details the usage of the MockWith annotation for declaring and configuring mocks in TestableMock. ``` -------------------------------- ### Configure Bytecode Version for Spock (Maven) Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/setup.md Sets the Maven compiler source and target properties to ensure compatibility with the Spock testing framework. This is crucial for projects using Spock and requires bytecode version 1.6 or higher. ```xml 1.6 1.6 ``` -------------------------------- ### Release Note Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Information about changes, new features, and bug fixes in different TestableMock releases. ```en-us This section provides detailed release notes for each version of TestableMock, outlining updates and improvements. ``` -------------------------------- ### JUnit 5 and Spock Framework Integration Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/release-note.md Enhanced compatibility and support for JUnit 5 features like `@Nested` and parameterized tests, as well as Spock framework. ```java support `@Nested` annotation of JUnit 5 support parameterized test of JUnit 5 fix a `Spock` test framework compatibility issue ``` -------------------------------- ### Effective Scope Of Mocking Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Understand the scope of mocking in TestableMock and how to manage it effectively. ```en-us This document explains the different scopes available for mocking with TestableMock and best practices for their usage. ``` -------------------------------- ### Configure Bytecode Version for Spock (Gradle) Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/setup.md Sets the Gradle sourceCompatibility property to ensure compatibility with the Spock testing framework. This requires a bytecode version of 1.6 or higher for Spock projects. ```groovy sourceCompatibility = '6' // or 7/8/9/... ``` -------------------------------- ### Annotation for Bytecode Dumping and Mock Container Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/release-note.md New annotations `@DumpTo` for dumping bytecode and `@MockContainer` for supporting multiply parents inheritance. ```java support `@DumpTo` annotation to dump bytecode of any transformed class add `@MockContainer` annotation to support multiply parents inheritance between mock classes ``` -------------------------------- ### Configure TestableMock Javaagent for Android (Gradle) Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/setup.md Provides the configuration for applying the TestableMock javaagent within an Android Gradle project's unit tests. This ensures the agent is active for Android unit testing environments. ```groovy android { testOptions { unitTests { all { jvmArgs "-javaagent:${classpath.find { it.name.contains("testable-agent") }.absolutePath}" } } } } ``` -------------------------------- ### Constructor Invocation Logging Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/troubleshooting.md Logs the invocation of a constructor, capturing the type name and its signature. This helps in understanding object creation during testing. ```APIDOC Constructor Invocation: Format: "" as "" Description: Records the invocation of a constructor, including the type name and its signature. Example: "MyClass" as "MyClass(param1: String, param2: Int)" ``` -------------------------------- ### Method Signature Format Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/troubleshooting.md Defines the format used for logging method signatures, inspired by Kotlin to clearly distinguish return types from invoker types. ```APIDOC Method Signature Format: Style: Kotlin-like method definition Purpose: To clearly distinguish between the type of method return value and the type of invoker. Example: `fun methodName(param1: Type1, param2: Type2): ReturnType` ``` -------------------------------- ### Configure TestableMock Javaagent (Gradle) Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/doc/setup.md Configures the TestableMock javaagent to be applied to the test task in a Gradle project. This is essential for the mocking framework to function correctly during tests. ```groovy test { jvmArgs "-javaagent:${classpath.find { it.name.contains("testable-agent") }.absolutePath}" } ``` -------------------------------- ### Collection Tools Source: https://github.com/alibaba/testable-mock/blob/master/docs/en-us/sidebar.md Utilize TestableMock's collection tools for easier manipulation and assertion of collections in tests. ```en-us This section covers the utility tools provided by TestableMock for working with collections like Lists, Sets, and Maps. ```