public final class MuleTestUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
MuleTestUtils.TestCallback |
| 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 org.mule.runtime.api.message.Error |
createErrorMock(Exception exception)
Creates an
Error mock that will return the provided exception when calling Error.getCause() |
static List<MessagingExceptionHandlerAcceptor> |
getExceptionListeners(MessagingExceptionHandler 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 Thread |
getRunningThreadByName(String name)
Returns a currently running
Thread of the given name |
static Flow |
getTestFlow(MuleContext context) |
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
org.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<MessagingExceptionHandlerAcceptor> getExceptionListeners(MessagingExceptionHandler 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.Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.