|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.junit.Assert
org.apache.camel.test.junit4.TestSupport
public abstract class TestSupport
A bunch of useful testing methods
Field Summary | |
---|---|
protected org.slf4j.Logger |
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(org.apache.camel.Endpoint endpoint,
String uri)
|
|
static Object |
assertExpression(org.apache.camel.Expression expression,
org.apache.camel.Exchange exchange,
Object expected)
Asserts that the given expression when evaluated returns the given answer |
|
static void |
assertFileExists(String filename)
To be used to check is a file is found in the file system |
|
static void |
assertInMessageBodyEquals(org.apache.camel.Exchange exchange,
Object expected)
Asserts that the given exchange has an OUT message of the given body value |
|
static Object |
assertInMessageHeader(org.apache.camel.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(org.apache.camel.Message message,
String name,
Object expected)
|
|
static
|
assertOneElement(List<T> list)
|
|
static void |
assertOutMessageBodyEquals(org.apache.camel.Exchange exchange,
Object expected)
Asserts that the given exchange has an OUT message of the given body value |
|
static Object |
assertOutMessageHeader(org.apache.camel.Exchange exchange,
String name,
Object expected)
Asserts the Out message on the exchange contains the expected value |
|
static boolean |
assertPredicate(org.apache.camel.Predicate predicate,
org.apache.camel.Exchange exchange,
boolean expected)
Asserts that the predicate returns the expected value on the exchange |
|
static void |
assertPredicateDoesNotMatch(org.apache.camel.Predicate predicate,
org.apache.camel.Exchange exchange)
Asserts that the predicate returns the expected value on the exchange |
|
static void |
assertPredicateMatches(org.apache.camel.Predicate predicate,
org.apache.camel.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 org.apache.camel.builder.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 org.apache.camel.Exchange |
createExchangeWithBody(org.apache.camel.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 org.apache.camel.builder.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<org.apache.camel.Route> |
getRouteList(org.apache.camel.builder.RouteBuilder builder)
A helper method to create a list of Route objects for a given route builder |
|
String |
getTestMethodName()
Gets the current test method name |
|
static org.apache.camel.builder.ValueBuilder |
header(String name)
Returns a value builder for the given header |
|
static boolean |
isJava15()
Is this Java 1.5 |
|
static boolean |
isJavaVendor(String vendor)
Is this Java by the given vendor. |
|
static boolean |
isPlatform(String platform)
Is this OS the given platform. |
|
static org.apache.camel.builder.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 org.apache.camel.builder.ValueBuilder |
property(String name)
Returns a value builder for the given property |
|
static org.apache.camel.Endpoint |
resolveMandatoryEndpoint(org.apache.camel.CamelContext context,
String uri)
Resolves an endpoint and asserts that it is found |
|
static
|
resolveMandatoryEndpoint(org.apache.camel.CamelContext context,
String uri,
Class<T> endpointType)
Resolves an endpoint and asserts that it is found |
|
static org.apache.camel.builder.ValueBuilder |
systemProperty(String name)
Returns a value builder for the given system property |
|
static org.apache.camel.builder.ValueBuilder |
systemProperty(String name,
String defaultValue)
Returns a value builder for the given system property |
|
static org.apache.camel.Processor |
unwrap(org.apache.camel.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 org.apache.camel.Channel |
unwrapChannel(org.apache.camel.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 org.junit.Assert |
---|
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient org.slf4j.Logger log
Constructor Detail |
---|
public TestSupport()
Method Detail |
---|
public static org.apache.camel.builder.ValueBuilder header(String name)
public static org.apache.camel.builder.ValueBuilder property(String name)
public static org.apache.camel.builder.ValueBuilder body()
public static <T> org.apache.camel.builder.ValueBuilder bodyAs(Class<T> type)
public static org.apache.camel.builder.ValueBuilder outBody()
public static <T> org.apache.camel.builder.ValueBuilder outBodyAs(Class<T> type)
public static org.apache.camel.builder.ValueBuilder faultBody()
public static <T> org.apache.camel.builder.ValueBuilder faultBodyAs(Class<T> type)
public static org.apache.camel.builder.ValueBuilder systemProperty(String name)
public static org.apache.camel.builder.ValueBuilder systemProperty(String name, String defaultValue)
public static <T> T assertIsInstanceOf(Class<T> expectedType, Object value)
public static void assertEndpointUri(org.apache.camel.Endpoint endpoint, String uri)
public static Object assertInMessageHeader(org.apache.camel.Exchange exchange, String name, Object expected)
public static Object assertOutMessageHeader(org.apache.camel.Exchange exchange, String name, Object expected)
public static void assertInMessageBodyEquals(org.apache.camel.Exchange exchange, Object expected) throws org.apache.camel.InvalidPayloadException
exchange
- the exchange which should have an OUT messageexpected
- the expected value of the OUT message
org.apache.camel.InvalidPayloadException
- is thrown if the payload is not the expected class typepublic static void assertOutMessageBodyEquals(org.apache.camel.Exchange exchange, Object expected) throws org.apache.camel.InvalidPayloadException
exchange
- the exchange which should have an OUT messageexpected
- the expected value of the OUT message
org.apache.camel.InvalidPayloadException
- is thrown if the payload is not the expected class typepublic static Object assertMessageHeader(org.apache.camel.Message message, String name, Object expected)
public static Object assertExpression(org.apache.camel.Expression expression, org.apache.camel.Exchange exchange, Object expected)
public static void assertPredicateMatches(org.apache.camel.Predicate predicate, org.apache.camel.Exchange exchange)
public static void assertPredicateDoesNotMatch(org.apache.camel.Predicate predicate, org.apache.camel.Exchange exchange)
public static boolean assertPredicate(org.apache.camel.Predicate predicate, org.apache.camel.Exchange exchange, boolean expected)
public static org.apache.camel.Endpoint resolveMandatoryEndpoint(org.apache.camel.CamelContext context, String uri)
public static <T extends org.apache.camel.Endpoint> T resolveMandatoryEndpoint(org.apache.camel.CamelContext context, String uri, Class<T> endpointType)
protected org.apache.camel.Exchange createExchangeWithBody(org.apache.camel.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<org.apache.camel.Route> getRouteList(org.apache.camel.builder.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 org.apache.camel.Processor unwrap(org.apache.camel.Processor processor)
public static org.apache.camel.Channel unwrapChannel(org.apache.camel.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 createdpublic static void assertDirectoryEquals(String expected, String actual)
public static void assertDirectoryEquals(String message, String expected, String actual)
public static void assertFileExists(String filename)
public static boolean isPlatform(String platform)
platform
- such as Windows
public static boolean isJavaVendor(String vendor)
vendor
- such as IBM
public static boolean isJava15()
public String getTestMethodName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |