|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.camel.test.TestSupport
public abstract class TestSupport
A bunch of useful testing methods
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
log
|
| Constructor Summary | |
|---|---|
TestSupport()
|
|
| Method Summary | ||
|---|---|---|
static
|
assertCollectionSize(Collection<T> list,
int size)
Asserts that a list is of the given size |
|
static
|
assertCollectionSize(String message,
Collection<T> list,
int size)
Asserts that a list is of the given size |
|
static void |
assertDirectoryEquals(String expected,
String actual)
To be used for folder/directory comparison that works across different platforms such as Window, Mac and Linux. |
|
static void |
assertDirectoryEquals(String message,
String expected,
String actual)
To be used for folder/directory comparison that works across different platforms such as Window, Mac and Linux. |
|
static void |
assertEndpointUri(Endpoint endpoint,
String uri)
|
|
static Object |
assertExpression(Expression expression,
Exchange exchange,
Object expected)
Asserts that the given expression when evaluated returns the given answer |
|
static void |
assertInMessageBodyEquals(Exchange exchange,
Object expected)
Asserts that the given exchange has an OUT message of the given body value |
|
static Object |
assertInMessageHeader(Exchange exchange,
String name,
Object expected)
Asserts the In message on the exchange contains the expected value |
|
static
|
assertIsInstanceOf(Class<T> expectedType,
Object value)
|
|
static
|
assertListSize(List<T> list,
int size)
Asserts that a list is of the given size |
|
static
|
assertListSize(String message,
List<T> list,
int size)
Asserts that a list is of the given size |
|
static Object |
assertMessageHeader(Message message,
String name,
Object expected)
|
|
static
|
assertOneElement(List<T> list)
|
|
static void |
assertOutMessageBodyEquals(Exchange exchange,
Object expected)
Asserts that the given exchange has an OUT message of the given body value |
|
static Object |
assertOutMessageHeader(Exchange exchange,
String name,
Object expected)
Asserts the Out message on the exchange contains the expected value |
|
static boolean |
assertPredicate(Predicate predicate,
Exchange exchange,
boolean expected)
Asserts that the predicate returns the expected value on the exchange |
|
static void |
assertPredicateDoesNotMatch(Predicate predicate,
Exchange exchange)
Asserts that the predicate returns the expected value on the exchange |
|
static void |
assertPredicateMatches(Predicate predicate,
Exchange exchange)
Asserts that the predicate returns the expected value on the exchange |
|
static void |
assertStringContains(String text,
String containedText)
Asserts that the text contains the given string |
|
static ValueBuilder |
body()
Returns a predicate and value builder for the inbound body on an exchange |
|
static
|
bodyAs(Class<T> type)
Returns a predicate and value builder for the inbound message body as a specific type |
|
static void |
createDirectory(String file)
create the directory |
|
protected Exchange |
createExchangeWithBody(CamelContext camelContext,
Object body)
Creates an exchange with the given body |
|
static void |
deleteDirectory(File file)
Recursively delete a directory, useful to zapping test data |
|
static void |
deleteDirectory(String file)
Recursively delete a directory, useful to zapping test data |
|
static ValueBuilder |
faultBody()
Returns a predicate and value builder for the fault body on an exchange |
|
static
|
faultBodyAs(Class<T> type)
Returns a predicate and value builder for the fault message body as a specific type |
|
static List<Route> |
getRouteList(RouteBuilder builder)
A helper method to create a list of Route objects for a given route builder |
|
static ValueBuilder |
header(String name)
Returns a value builder for the given header |
|
static ValueBuilder |
outBody()
Returns a predicate and value builder for the outbound body on an exchange |
|
static
|
outBodyAs(Class<T> type)
Returns a predicate and value builder for the outbound message body as a specific type |
|
static ValueBuilder |
property(String name)
Returns a value builder for the given property |
|
static Endpoint |
resolveMandatoryEndpoint(CamelContext context,
String uri)
Resolves an endpoint and asserts that it is found |
|
static
|
resolveMandatoryEndpoint(CamelContext context,
String uri,
Class<T> endpointType)
Resolves an endpoint and asserts that it is found |
|
static ValueBuilder |
systemProperty(String name)
Returns a value builder for the given system property |
|
static ValueBuilder |
systemProperty(String name,
String defaultValue)
Returns a value builder for the given system property |
|
static Processor |
unwrap(Processor processor)
If a processor is wrapped with a bunch of DelegateProcessor or DelegateAsyncProcessor objects this call will drill through them and return the wrapped Processor. |
|
static Channel |
unwrapChannel(Processor processor)
If a processor is wrapped with a bunch of DelegateProcessor or DelegateAsyncProcessor objects this call will drill through them and return the Channel. |
|
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected transient org.apache.commons.logging.Log log
| Constructor Detail |
|---|
public TestSupport()
| Method Detail |
|---|
public static ValueBuilder header(String name)
public static ValueBuilder property(String name)
public static ValueBuilder body()
public static <T> ValueBuilder bodyAs(Class<T> type)
public static ValueBuilder outBody()
public static <T> ValueBuilder outBodyAs(Class<T> type)
public static ValueBuilder faultBody()
public static <T> ValueBuilder faultBodyAs(Class<T> type)
public static ValueBuilder systemProperty(String name)
public static ValueBuilder systemProperty(String name,
String defaultValue)
public static <T> T assertIsInstanceOf(Class<T> expectedType,
Object value)
public static void assertEndpointUri(Endpoint endpoint,
String uri)
public static Object assertInMessageHeader(Exchange exchange,
String name,
Object expected)
public static Object assertOutMessageHeader(Exchange exchange,
String name,
Object expected)
public static void assertInMessageBodyEquals(Exchange exchange,
Object expected)
throws InvalidPayloadException
exchange - the exchange which should have an OUT messageexpected - the expected value of the OUT message
InvalidPayloadException - is thrown if the payload is not the expected class type
public static void assertOutMessageBodyEquals(Exchange exchange,
Object expected)
throws InvalidPayloadException
exchange - the exchange which should have an OUT messageexpected - the expected value of the OUT message
InvalidPayloadException - is thrown if the payload is not the expected class type
public static Object assertMessageHeader(Message message,
String name,
Object expected)
public static Object assertExpression(Expression expression,
Exchange exchange,
Object expected)
public static void assertPredicateMatches(Predicate predicate,
Exchange exchange)
public static void assertPredicateDoesNotMatch(Predicate predicate,
Exchange exchange)
public static boolean assertPredicate(Predicate predicate,
Exchange exchange,
boolean expected)
public static Endpoint resolveMandatoryEndpoint(CamelContext context,
String uri)
public static <T extends Endpoint> T resolveMandatoryEndpoint(CamelContext context,
String uri,
Class<T> endpointType)
protected Exchange createExchangeWithBody(CamelContext camelContext,
Object body)
public static <T> T assertOneElement(List<T> list)
public static <T> List<T> assertListSize(List<T> list,
int size)
public static <T> List<T> assertListSize(String message,
List<T> list,
int size)
public static <T> Collection<T> assertCollectionSize(Collection<T> list,
int size)
public static <T> Collection<T> assertCollectionSize(String message,
Collection<T> list,
int size)
public static List<Route> getRouteList(RouteBuilder builder)
throws Exception
Exception
public static void assertStringContains(String text,
String containedText)
text - the text to comparecontainedText - the text which must be contained inside the other text parameterpublic static Processor unwrap(Processor processor)
public static Channel unwrapChannel(Processor processor)
public static void deleteDirectory(String file)
file - the directory to be deletedpublic static void deleteDirectory(File file)
file - the directory to be deletedpublic static void createDirectory(String file)
file - the directory to be created
public static void assertDirectoryEquals(String expected,
String actual)
public static void assertDirectoryEquals(String message,
String expected,
String actual)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||