I am writing Junit test for apache camel route. I have a mock endpoint here.
So instead of writing to a file I will get the body content to the mock end point.
In the test method I am using assertEquals to validate the body that I receive in mock endpoint.
Below is the code
private static final String EXPECTED_RESULT = "COMPANY\n" +
"\"CUSTOMER\",\"2018-12-11\"";
.....(Below is the test method)
@Test
public void testFileCreation() throws Exception{
.....
List<Exchange> exchanges = resultEndpoint.getExchanges();
//Expects the same body content as EXPECTED_RESULT
Assert.assertEquals(EXPECTED_RESULT,
exchanges.get(0).getIn().getBody().toString());
}
Note: In the above code resultEndPoint is the mock endpoint.
In the local when I do gradle build it's satisfying the assert statement and test is passing.
But when I commit to github then in drone the gradle build is failing at this assert statement.
I tried using the logs to display the value of exchanges.get(0).getIn().getBody().toString())
in drone build but the value is same as EXPECTED_RESULT.
Not sure why it is failing only in drone build. Any comments on this?
Thanks in advance..