public final class MuleTestUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
MuleTestUtils.TestCallback |
static class |
MuleTestUtils.TestDirectProcessingStrategy |
| Modifier and Type | Field and Description |
|---|---|
static String |
APPLE_FLOW |
static String |
APPLE_SERVICE |
| Constructor and Description |
|---|
MuleTestUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Flow |
createAndRegisterFlow(MuleContext context,
String flowName,
org.mule.runtime.api.component.location.ConfigurationComponentLocator mockComponentLocator)
Creates a new flow and registers it in the given
mockComponentLocator |
static org.mule.runtime.api.message.Error |
createErrorMock(Exception exception)
Creates an
Error mock that will return the provided exception when calling Error.getCause() |
static Flow |
createFlow(MuleContext context,
String flowName)
Creates an empty flow with the provided name.
|
static List<FlowExceptionHandler> |
getExceptionListeners(FlowExceptionHandler exceptionHandler)
Returns the exception listener configured on a messaging exception handler
Invokes
getExceptionListeners method on the provided exception handler to avoid exposing that method on the public
API. |
static List<Processor> |
getMessageProcessors(Object object)
Returns the object message processors
Invokes
getMessageProcessors method on the provided object to avoid exposing that method on the public API. |
static Thread |
getRunningThreadByName(String name)
Returns a currently running
Thread of the given name |
static Flow |
getTestFlow(MuleContext context)
Creates an empty flow named
APPLE_FLOW. |
static Injector |
spyInjector(MuleContext muleContext) |
static void |
testWithSystemProperties(Map<String,String> properties,
MuleTestUtils.TestCallback callback)
Executes callback with a given system properties set and replaces the system properties with their original values once done.
|
static void |
testWithSystemProperty(String propertyName,
String propertyValue,
MuleTestUtils.TestCallback callback)
Executes callback with a given system property set and replaces the system property with it's original value once done.
|
public static final String APPLE_SERVICE
public static final String APPLE_FLOW
public static org.mule.runtime.api.message.Error createErrorMock(Exception exception)
Error mock that will return the provided exception when calling Error.getCause()exception - the exception to use to create the mockErrorpublic static Injector spyInjector(MuleContext muleContext)
public static Flow getTestFlow(MuleContext context) throws org.mule.runtime.api.exception.MuleException
APPLE_FLOW.org.mule.runtime.api.exception.MuleExceptionpublic static Flow createFlow(MuleContext context, String flowName) throws org.mule.runtime.api.exception.MuleException
org.mule.runtime.api.exception.MuleExceptionpublic static Flow createAndRegisterFlow(MuleContext context, String flowName, org.mule.runtime.api.component.location.ConfigurationComponentLocator mockComponentLocator) throws org.mule.runtime.api.exception.MuleException
mockComponentLocatormockComponentLocator - a Mockito.mock(Class) ConfigurationComponentLocatororg.mule.runtime.api.exception.MuleExceptionpublic static void testWithSystemProperty(String propertyName, String propertyValue, MuleTestUtils.TestCallback callback) throws Exception
propertyName - Name of system property to setpropertyValue - Value of system propertycallback - Callback implementing the the test code and assertions to be run with system property set.Exception - any exception thrown by the execution of callbackpublic static void testWithSystemProperties(Map<String,String> properties, MuleTestUtils.TestCallback callback) throws Exception
public static Thread getRunningThreadByName(String name)
Thread of the given namepublic static List<FlowExceptionHandler> getExceptionListeners(FlowExceptionHandler exceptionHandler)
getExceptionListeners method on the provided exception handler to avoid exposing that method on the public
API.exceptionHandler - exception handler to inspectIllegalStateException - if the provided exception handler does not have the expect method or it cannot be invoked.public static List<Processor> getMessageProcessors(Object object)
getMessageProcessors method on the provided object to avoid exposing that method on the public API.object - the object owning the list of ProcessorsIllegalStateException - if the provided exception handler does not have the expect method or it cannot be invoked.Copyright © 2003–2018 MuleSoft, Inc.. All rights reserved.