public abstract class TestSupport
extends org.junit.Assert
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
protected static String |
LS |
Constructor and Description |
---|
TestSupport() |
Modifier and Type | Method and Description |
---|---|
static <T> Collection<T> |
assertCollectionSize(Collection<T> list,
int size)
Asserts that a list is of the given size
|
static <T> Collection<T> |
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 |
assertDirectoryExists(String filename)
To be used to check is a directory is found in the file system
|
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 |
assertFileNotExists(String filename)
To be used to check is a file is not 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 <T> T |
assertIsInstanceOf(Class<T> expectedType,
Object value) |
static <T> List<T> |
assertListSize(List<T> list,
int size)
Asserts that a list is of the given size
|
static <T> List<T> |
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 <T> T |
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 <T> org.apache.camel.builder.ValueBuilder |
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 boolean |
deleteDirectory(File file)
Recursively delete a directory, useful to zapping test data
|
static boolean |
deleteDirectory(String file)
Recursively delete a directory, useful to zapping test data
|
static org.apache.camel.builder.ValueBuilder |
exchangeProperty(String name)
Returns a value builder for the given exchange property
|
static int |
getJavaMajorVersion()
Returns the current major Java version e.g 8.
|
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
|
org.junit.rules.TestName |
getTestName()
Gets the current test name
|
static org.apache.camel.builder.ValueBuilder |
header(String name)
Returns a value builder for the given header
|
static boolean |
isJava15()
Deprecated.
will be removed in the future as Camel requires JDK1.8+
|
static boolean |
isJava16()
Deprecated.
will be removed in the future as Camel requires JDK1.8+
|
static boolean |
isJava17()
Deprecated.
will be removed in the future as Camel requires JDK1.8+
|
static boolean |
isJava18()
Is this Java 1.8
|
static boolean |
isJava19()
Is this Java 1.9
|
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 |
property(String name)
Deprecated.
|
static org.apache.camel.Endpoint |
resolveMandatoryEndpoint(org.apache.camel.CamelContext context,
String uri)
Resolves an endpoint and asserts that it is found
|
static <T extends org.apache.camel.Endpoint> |
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
|
assertArrayEquals, assertArrayEquals, 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, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
protected static final String LS
protected org.slf4j.Logger log
public static org.apache.camel.builder.ValueBuilder header(String name)
@Deprecated public static org.apache.camel.builder.ValueBuilder property(String name)
exchangeProperty(String)
public static org.apache.camel.builder.ValueBuilder exchangeProperty(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 systemProperty(String name)
public static org.apache.camel.builder.ValueBuilder systemProperty(String name, String defaultValue)
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 messageorg.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 messageorg.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 boolean deleteDirectory(String file)
file
- the directory to be deletedpublic static boolean 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 assertDirectoryExists(String filename)
public static void assertFileExists(String filename)
public static void assertFileNotExists(String filename)
public static boolean isPlatform(String platform)
platform
- such as Windowspublic static boolean isJavaVendor(String vendor)
vendor
- such as IBM@Deprecated public static boolean isJava15()
@Deprecated public static boolean isJava16()
@Deprecated public static boolean isJava17()
public static boolean isJava18()
public static boolean isJava19()
public static int getJavaMajorVersion()
public org.junit.rules.TestName getTestName()
public String getTestMethodName()
Apache Camel