@ContextConfiguration(locations="classpath:/META-INF/test_camel.xml") @DirtiesContext(classMode=AFTER_EACH_TEST_METHOD) public abstract class AbstractTest extends Object
| Constructor and Description |
|---|
AbstractTest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
assertErrorCode(ErrorExtEnum error,
ErrorExtEnum expError)
Asserts
error codes. |
static void |
assertXMLEqualWithInnerXML(String control,
String test,
String innerXmlXpathLocation)
Same as
XMLAssert.assertXMLEqual(String, String),
but with the specified node verified as XML using the same similarity technique,
not as text (which would have to match completely). |
void |
configureXmlUnit() |
static <T extends org.joda.time.ReadableInstant> |
equalDateTime(T expected)
Creates a matcher that compares JodaTime
ReadableInstant objects based on their millis only,
not Chronology as the default equals() does. |
protected org.springframework.context.ApplicationContext |
getApplicationContext()
Gets Spring context.
|
protected org.apache.camel.model.ModelCamelContext |
getCamelContext()
Gets Camel context.
|
void |
initRoutes()
Initializes selected routes for specific test.
|
static <T extends org.joda.time.ReadableInstant> |
isDateTime(T expected)
Shorthand for
is
(equalDateTime(expected)). |
protected org.apache.camel.component.mock.MockEndpoint |
mockDirect(String uri)
Mocks a hand-over-type endpoint (direct, direct-vm, seda or vm)
by simply providing the other (consumer=From) side connected to a mock.
|
protected org.apache.camel.component.mock.MockEndpoint |
mockDirect(String uri,
String routeId)
Same as
mockDirect(String), except with route ID to be able to override an existing route with the mock. |
static void |
setInitAllRoutes(boolean initAllRoutes)
Sets
true if all routes should be initialized (=added into Camel context). |
static void |
setPrivateField(Object target,
String name,
Object value)
Sets value of private field.
|
protected static org.apache.camel.Processor |
throwException(Exception exc)
Returns processor that throws specified exception.
|
void |
validateMockito() |
public void configureXmlUnit()
public void validateMockito()
public static void setInitAllRoutes(boolean initAllRoutes)
true if all routes should be initialized (=added into Camel context).
By default the value is false - only routes defined in ActiveRoutes annotation are initialized.
Use BeforeClass annotation for setting this parameter.initAllRoutes - true for initialization of all routes, otherwise falsepublic void initRoutes()
throws Exception
ActiveRoutes annotation.Exception - when init failsprotected final org.apache.camel.model.ModelCamelContext getCamelContext()
protected final org.springframework.context.ApplicationContext getApplicationContext()
public static void setPrivateField(Object target, String name, Object value)
target - the target objectname - the field namevalue - the value for setting to the fieldpublic static void assertXMLEqualWithInnerXML(String control, String test, String innerXmlXpathLocation) throws SAXException, IOException
XMLAssert.assertXMLEqual(String, String),
but with the specified node verified as XML using the same similarity technique,
not as text (which would have to match completely).control - the expected XMLtest - the actual XML being verifiedinnerXmlXpathLocation - the XPath location of the element, that should be verified as XML, not as textSAXException - can be thrown when creating Diff (e.g., if the provided XML is invalid)IOException - can be thrown when creating Diffpublic static <T extends org.joda.time.ReadableInstant> org.hamcrest.Matcher<T> isDateTime(T expected)
is
(equalDateTime(expected)).public static <T extends org.joda.time.ReadableInstant> org.hamcrest.Matcher<T> equalDateTime(T expected)
ReadableInstant objects based on their millis only,
not Chronology as the default equals() does.
This comparison uses ReadableInstant.isEqual(org.joda.time.ReadableInstant)
instead of default ReadableInstant.equals(Object).T - any class implementing ReadableInstantexpected - the expected ReadableInstantCoreMatchers.equalTo(Object),
ReadableInstant.equals(Object),
ReadableInstant.isEqual(org.joda.time.ReadableInstant)protected static org.apache.camel.Processor throwException(Exception exc)
exc - the exceptionprotected org.apache.camel.component.mock.MockEndpoint mockDirect(String uri) throws Exception
uri - the URI a new mock should consume fromExceptionprotected org.apache.camel.component.mock.MockEndpoint mockDirect(String uri, String routeId) throws Exception
mockDirect(String), except with route ID to be able to override an existing route with the mock.uri - the URI a new mock should consume fromrouteId - the route ID for the new mock route
(existing route with this ID will be overridden by this new route)Exceptionprotected void assertErrorCode(ErrorExtEnum error, ErrorExtEnum expError)
error codes.error - the actual error codeexpError - the expected error codeCopyright © 2016. All rights reserved.