public final class Mocker extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
ignored(@NotNull Class<T> interfaceType,
Class<?>... additional)
Creates a mocked instance of the specified interface that ignores all method invocations.
|
static <T> T |
intercepting(@NotNull Class<T> interfaceType,
@NotNull BiConsumer<String,Object[]> consumer,
T t)
Creates a mocked instance of the specified interface that intercepts method invocations using the provided
bi-consumer, and optionally delegates the intercepted invocations to the provided object.
|
static <T> T |
intercepting(@NotNull Class<T> interfaceType,
String description,
@NotNull Consumer<String> consumer)
Creates a mocked instance of the specified interface that intercepts method invocations using the provided consumer.
|
static <T> T |
intercepting(@NotNull Class<T> interfaceType,
@NotNull String description,
@NotNull Consumer<String> consumer,
T t)
Creates a mocked instance of the specified interface that intercepts method invocations
using the provided consumer,
and optionally delegates the intercepted invocations to the provided object.
|
static <T> T |
logging(@NotNull Class<T> interfaceType,
String description,
@NotNull PrintStream out)
Creates a mocked instance of the specified interface that logs method invocations to the provided PrintStream.
|
static <T> T |
logging(@NotNull Class<T> interfaceType,
String description,
@NotNull PrintWriter out)
Creates a mocked instance of the specified interface that logs method invocations to the provided PrintWriter.
|
static <T> T |
logging(@NotNull Class<T> interfaceType,
String description,
@NotNull StringWriter out)
Creates a mocked instance of the specified interface that logs method invocations to the provided StringWriter.
|
static <T> T |
queuing(@NotNull Class<T> interfaceType,
String description,
@NotNull BlockingQueue<String> queue)
Creates a mocked instance of the specified interface that enqueues method invocations to the provided BlockingQueue.
|
@NotNull
public static <T> T logging(@NotNull
@NotNull Class<T> interfaceType,
String description,
@NotNull
@NotNull PrintStream out)
T - the type of the classinterfaceType - the class to be mockeddescription - the description of the mocking behaviorout - the PrintStream to log the method invocations@NotNull
public static <T> T logging(@NotNull
@NotNull Class<T> interfaceType,
String description,
@NotNull
@NotNull PrintWriter out)
T - the type of the classinterfaceType - the class to be mockeddescription - the description of the mocking behaviorout - the PrintWriter to log the method invocations@NotNull
public static <T> T logging(@NotNull
@NotNull Class<T> interfaceType,
String description,
@NotNull
@NotNull StringWriter out)
T - the type of the classinterfaceType - the class to be mockeddescription - the description of the mocking behaviorout - the StringWriter to log the method invocations@NotNull
public static <T> T queuing(@NotNull
@NotNull Class<T> interfaceType,
String description,
@NotNull
@NotNull BlockingQueue<String> queue)
T - the type of the classinterfaceType - the class to be mockeddescription - the description of the mocking behaviorqueue - the BlockingQueue to enqueue the method invocations@NotNull
public static <T> T intercepting(@NotNull
@NotNull Class<T> interfaceType,
String description,
@NotNull
@NotNull Consumer<String> consumer)
T - the type of the classinterfaceType - the class to be mockeddescription - the description of the mocking behaviorconsumer - the consumer to intercept and handle the method invocations@NotNull
public static <T> T intercepting(@NotNull
@NotNull Class<T> interfaceType,
@NotNull
@NotNull String description,
@NotNull
@NotNull Consumer<String> consumer,
T t)
T - the type of the classinterfaceType - the class to be mockeddescription - the description of the mocking behaviorconsumer - the consumer to intercept and handle the method invocationst - the object to delegate the intercepted invocations, or null if no delegation is needed@NotNull
public static <T> T intercepting(@NotNull
@NotNull Class<T> interfaceType,
@NotNull
@NotNull BiConsumer<String,Object[]> consumer,
T t)
T - the type of the classinterfaceType - the class to be mockedconsumer - the bi-consumer to intercept and handle the method invocationst - the object to delegate the intercepted invocations, or null if no delegation is needed@NotNull
public static <T> T ignored(@NotNull
@NotNull Class<T> interfaceType,
Class<?>... additional)
T - the type of the classinterfaceType - the class to be mockedadditional - additional classes to add to the mocked instanceCopyright © 2024. All rights reserved.