How can I make a test case like this more readable?
@Test
public void test1() throws Exception {
assertEquals("{\"Root\":{\"Name\":\"Paul\",\"Age\":\"10\",\"Enabled\":\"true\"}}",
transformer.transformXmlToJson("<Root><Name>Paul</Name><Age>10</Age><Enabled>true</Enabled></Root>"));
}
Do I need to manually put line breaks in the String like,
@Test
public void test1() throws Exception {
assertEquals(
"{\"Root\":"
+ "{"
+ "\"Name\":\"Paul\","
+ "\"Age\":\"10\","
+ "\"Enabled\":\"true\""
+ "}"
+ "}",
transformer.transformXmlToJson(
"<Root>"
+ "<Name>Paul</Name>"
+ "<Age>10</Age>"
+ "<Enabled>true</Enabled>"
+ "</Root>"));
}
But when I format the class in eclipse, the whole formats goes for a toss.
Is there a good practice, we should follow, when writing these test cases to make it more readable?
Similarly, is there a way to write the JSON in a better format?