mvrx-mocking / com.airbnb.mvrx.mocking.printer

Package com.airbnb.mvrx.mocking.printer

Types

AutoValueTypePrinter

class AutoValueTypePrinter : TypePrinter<Any>

This looks for classes generated via AutoValue, indicated by the class prefix GENERATED_PREFIX. When an autovalue class is found, code to reconstruct it is generated by reflectively accessing the Builder and its setter functions.

ConstructorCodeGenerator

class ConstructorCodeGenerator<T : Any>

This utility is used to generate the code need to construct an object. It is useful for printing out a MavericksState instance's constructor code when setting up a test for that state.

MavericksMockPrinter

class MavericksMockPrinter : LifecycleObserver

This registers a Broadcast receiver on the MavericksView (only in debug mode) that listens for the intent action ACTION_COPY_MAVERICKS_STATE to copy mavericks state to files on device.

MockPrinterConfiguration

class MockPrinterConfiguration

Set configuration details for how mock state is generated.

TypePrinter

interface TypePrinter<T : Any>

This interface defines how to generate mock code for a custom object type.

Functions

typePrinter

fun <T : Any> typePrinter(transformImports: (List<String>) -> List<String> = { it }, codeGenerator: (instance: T, generateConstructor: (Any?) -> String) -> String): TypePrinter<T>

Helper for easily creating a TypePrinter.