public class MuleContextUtils extends Object
MuleContexts in unit tests.| Modifier and Type | Method and Description |
|---|---|
static <B extends CoreEvent.Builder> |
eventBuilder()
Creates a basic event builder with its context already set.
|
static <B extends CoreEvent.Builder> |
eventBuilder(MuleContext muleContext)
Creates a basic event builder with its context built from the provided
muleContext. |
static <T> Transformer |
lookupTransformer(MuleContextWithRegistries context,
org.mule.runtime.api.metadata.DataType source,
org.mule.runtime.api.metadata.DataType result)
Will find a transformer that is the closest match to the desired input and output.
|
static MuleContextWithRegistries |
mockContextWithServices()
Creates and configures a mock
MuleContext to return testing services implementations. |
static MuleContextWithRegistries |
mockMuleContext() |
static void |
mockRegistry(MuleContextWithRegistries context)
Adds a mock registry to the provided
context. |
static <T> void |
registerIntoMockContext(MuleContextWithRegistries context,
Class<T> clazz,
T value)
Configures the registry in the provided
context to return the given value for the given clazz. |
static void |
registerIntoMockContext(MuleContextWithRegistries context,
String key,
Object value)
Configures the registry in the provided
context to return the given value for the given key. |
public static MuleContextWithRegistries mockMuleContext()
public static MuleContextWithRegistries mockContextWithServices()
MuleContext to return testing services implementations.muleContext.public static void mockRegistry(MuleContextWithRegistries context)
context. If the context is not a mock, it is Mockito.spy(Class)ied.public static void registerIntoMockContext(MuleContextWithRegistries context, String key, Object value)
context to return the given value for the given key.public static <T> void registerIntoMockContext(MuleContextWithRegistries context, Class<T> clazz, T value)
context to return the given value for the given clazz.public static <T> Transformer lookupTransformer(MuleContextWithRegistries context, org.mule.runtime.api.metadata.DataType source, org.mule.runtime.api.metadata.DataType result) throws TransformerException
source - The desired input type for the transformerresult - the desired output type for the transformerTransformerException - will be thrown if there is more than one matchpublic static <B extends CoreEvent.Builder> B eventBuilder() throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleExceptionpublic static <B extends CoreEvent.Builder> B eventBuilder(MuleContext muleContext) throws org.mule.runtime.api.exception.MuleException
muleContext.org.mule.runtime.api.exception.MuleExceptionCopyright © 2003–2022 MuleSoft, Inc.. All rights reserved.