I have a bit of a weird issue where I can build our code base without any issues via TeamCity. On the other hand when I trigger the build via Eclipse I get org.junit.ComparisonFailure.
Code that is failing is as follows:
@Test
public void prettyPrintTest() throws BunchOfExceptions {
InputStream formattedXml = DomUtilsTest.class.getResourceAsStream("/path/to/sample/file/formattedOutput.xml");
InputStream notFormattedXml = DomUtilsTest.class.getResourceAsStream("/path/to/sample/file/notFormattedInput.xml");
DocumentBuilder builder = ClassBeingTested.getDocumentBuilderFactory().newDocumentBuilder();
Document notFormattedDocument = builder.parse(notFormattedXml);
String prettyPrintedXmlContent = ClassBeingTested.prettyPrint(notFormattedDocument);
Assert.assertEquals(IOUtils.toString(formattedXml), prettyPrintedXmlContent);
}
The unit test is fine on TeamCity, and it is fine on my colleague's IntelliJ (he wrote this code). But I get the following error on my machine:
org.junit.ComparisonFailure:
expected:<<message>[
<header>
<messagetype>HelloWorld</messagetype>
</header>
<body>
<messageBody>HolaComoEstas!</messageBody>
</body>
</message>
]
> but was:<<message>[
<header>
<messagetype>HelloWorld</messagetype>
</header>
<body>
<messageBody>HolaComoEstas!</messageBody>
</body>
</message>
]
Any idea how I could configure Eclipse to run this in the same way that a TeamCity Unix host does it? Or is there a way to make this unit test platform independent?