I am writing a Junit test in which the expected result is an XML string. What is the best way to present the expected string? Right now I have it like stringBuilder and I am doing the following. I want to argue that the actual and expected are the same. What would be the most efficient way to represent this expected string? Also, I don't want anyone to modify the expected string, so it should also be final.
@Before
public void setUp() {
expected.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
expected.append("<n-relationship guid=\"IEEBFAD40BC5711DFAE41F5F92790F896\" control=\"add\">");
expected.append("<n-relbase>ID17A8B10BC5711DFAE41F5F92790F896</n-relbase><n-reltype>IPLS</n-reltype>");
expected.append("<ip.content><pub.no>1234567</pub.no>");
expected.append("<event.date>2010-09-10</event.date><event.code>02394802323</event.code>");
expected.append("<event.treatment>+</event.treatment><event.description>OPPOSITION DISMISSED</event.description>");
expected.append("</ip.content></n-relpayload></n-relationship");
}
source
share