You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jpalmer1026 <pa...@gmail.com> on 2011/04/11 19:57:49 UTC
Unit test is failing
Hi,
One of my unit tests is failing and I'm not really sure why. In the code
below, it's failing on the third line of the test
(mockFtp.allMessages().body().contains("Pilot");). The
expectedBodiesReceived() method in line 4 is working as expected so I'm not
really sure why the allMessages() method is failing. The error message I'm
getting is:
Assertion error at index 0 on mock mock://ftp with predicate: body contains
Pilot evaluated as: GenericFile[100.txt] contains Pilot on Exchange[100.txt]
My code is as folows:
@Test
public void testMovePilotFiles() throws Exception {
MockEndpoint mockFtp = getMockEndpoint(sterlingWomsFtpPath);
mockFtp.expectedMessageCount(2);
mockFtp.allMessages().body().contains("Pilot");
mockFtp.expectedBodiesReceived("Pilot store 1 file contents", "Pilot
store 2 file contents");
template.sendBodyAndHeader("Pilot store 1 file contents",
Exchange.FILE_NAME, "100.txt");
template.sendBodyAndHeader("Pilot store 2 file contents",
Exchange.FILE_NAME, "200.txt");
Thread.sleep(2000);
assertMockEndpointsSatisfied();
}
Any suggestions?
--
View this message in context: http://camel.465427.n5.nabble.com/Unit-test-is-failing-tp4296494p4296494.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Unit test is failing
Posted by Claus Ibsen <cl...@gmail.com>.
If you are using FTP endpoints and intercept those, then there was an
issue which has been fixed on trunk.
So that may work better in Camel 2.8.
Also you can try using .convertBodyTo(String.class) before you send
the message to the mock.
On Tue, Apr 12, 2011 at 4:01 PM, jpalmer1026 <pa...@gmail.com> wrote:
> I'm running Camel 2.7.0 with JDK 1.6 on MacOS 10.6.7
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unit-test-is-failing-tp4296494p4298269.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Unit test is failing
Posted by jpalmer1026 <pa...@gmail.com>.
I'm running Camel 2.7.0 with JDK 1.6 on MacOS 10.6.7
--
View this message in context: http://camel.465427.n5.nabble.com/Unit-test-is-failing-tp4296494p4298269.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Unit test is failing
Posted by Claus Ibsen <cl...@gmail.com>.
What OS, JDK and Camel version are you using?
On Mon, Apr 11, 2011 at 7:57 PM, jpalmer1026 <pa...@gmail.com> wrote:
> Hi,
>
> One of my unit tests is failing and I'm not really sure why. In the code
> below, it's failing on the third line of the test
> (mockFtp.allMessages().body().contains("Pilot");). The
> expectedBodiesReceived() method in line 4 is working as expected so I'm not
> really sure why the allMessages() method is failing. The error message I'm
> getting is:
>
> Assertion error at index 0 on mock mock://ftp with predicate: body contains
> Pilot evaluated as: GenericFile[100.txt] contains Pilot on Exchange[100.txt]
>
> My code is as folows:
>
> @Test
> public void testMovePilotFiles() throws Exception {
> MockEndpoint mockFtp = getMockEndpoint(sterlingWomsFtpPath);
> mockFtp.expectedMessageCount(2);
> mockFtp.allMessages().body().contains("Pilot");
> mockFtp.expectedBodiesReceived("Pilot store 1 file contents", "Pilot
> store 2 file contents");
>
> template.sendBodyAndHeader("Pilot store 1 file contents",
> Exchange.FILE_NAME, "100.txt");
> template.sendBodyAndHeader("Pilot store 2 file contents",
> Exchange.FILE_NAME, "200.txt");
>
> Thread.sleep(2000);
>
> assertMockEndpointsSatisfied();
> }
>
> Any suggestions?
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unit-test-is-failing-tp4296494p4296494.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/