|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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
|
protected static String |
LS
|
org.junit.rules.TestName |
testName
|
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 |
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
|
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 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 |
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()
Deprecated. will be removed in the near future as Camel now requires JDK1.6+ |
|
static boolean |
isJava16()
Is this Java 1.6 |
|
static boolean |
isJava17()
Is this Java 1.7 |
|
static boolean |
isJava18()
Is this Java 1.8 |
|
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)
Deprecated. |
|
static org.apache.camel.Channel |
unwrapChannel(org.apache.camel.Processor processor)
Deprecated. |
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, assertEquals, assertEquals, assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, assertNotEquals, 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 static final String LS
protected org.slf4j.Logger log
public org.junit.rules.TestName testName
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 parameter@Deprecated public static org.apache.camel.Processor unwrap(org.apache.camel.Processor processor)
@Deprecated public static org.apache.camel.Channel unwrapChannel(org.apache.camel.Processor processor)
public static boolean deleteDirectory(String file)
file
- the directory to be deleted
public static boolean deleteDirectory(File file)
file
- the directory to be deleted
public 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 void assertFileNotExists(String filename)
public static boolean isPlatform(String platform)
platform
- such as Windows
public static boolean isJavaVendor(String vendor)
vendor
- such as IBM
@Deprecated public static boolean isJava15()
public static boolean isJava16()
public static boolean isJava17()
public static boolean isJava18()
public String getTestMethodName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |