@James,
I'm a little bit bored because I don't know if the following code works or
not. The test is passed but I don't know if assertEquals is executed.
@Test
public void testUnMarshallMessage() throws Exception {
resultEndpoint.expectedMessageCount(1);
for(Exchange exch : resultEndpoint.getExchanges()) {
models = (List<HashMap<String, Object>>) exch.getIn().getBody();
Iterator it = models.iterator();
double count = 0;
while(it.hasNext()){
modelObjects = (HashMap<String, Object>) it.next();
count++;
}
assertEquals(100, count);
}
resultEndpoint.assertIsSatisfied();
}
I have different questions :
- Can we mix mockendpoint assertion with junit assertions ?
- if this is not the case, How can I achieve what I would like to do in my
test ?
James.Strachan wrote:
>
> 2009/1/13 cmoulliard <[email protected]>:
>>
>> Ok. I continue to use Junit4.
>>
>> Can a mockendpoint iterates through the exchanges because the following
>> code
>> does not display anything ?
>>
>> @Test
>> public void testMarshallMessage() throws Exception {
>>
>> resultEndpoint.expectedBodiesReceived(models);
>
> You're missing the
>
> resultEndpoint.assertIsSatisfied() call.
>
> Adding an expectation doesn't cause an assertion failure
>
>
>
>>
>> List<Exchange> exchanges = resultEndpoint.getExchanges();
>>
>> for(Exchange exchange : exchanges) {
>> Object body = exchange.getIn().getBody();
>> System.out.println("Result : " + body);
>> }
>>
>>
>>
>> James.Strachan wrote:
>>>
>>> 2009/1/13 cmoulliard <[email protected]>:
>>>>
>>>> Indeed, I use junit4.
>>>>
>>>> Do you prefer that I switch to Junit3 for the test ?
>>>
>>> Ultimately I think we should switch Camel to JUnit 4 so feel free to
>>> go for it - I was really just mentioning that you can't copy/paste
>>> test cases to JUnit4 and expect them to run without adding @Test
>>>
>>> --
>>> James
>>> -------
>>> http://macstrac.blogspot.com/
>>>
>>> Open Source Integration
>>> http://fusesource.com/
>>>
>>>
>>
>>
>> -----
>> Charles Moulliard
>> SOA Architect
>>
>> My Blog : http://cmoulliard.blogspot.com/
>> http://cmoulliard.blogspot.com/
>> --
>> View this message in context:
>> http://www.nabble.com/only-testMocksAreValid-is-executed-by-Camel-Spring-unit-test-%21%21-tp21436628s22882p21438228.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>
>
-----
Charles Moulliard
SOA Architect
My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
--
View this message in context:
http://www.nabble.com/only-testMocksAreValid-is-executed-by-Camel-Spring-unit-test-%21%21-tp21436628s22882p21498424.html
Sent from the Camel - Users mailing list archive at Nabble.com.