@Test public void testDump() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); iSOAmount.dump(new PrintStream(baos), ":-o"); // then String lineSep = System.getProperty("line.separator"); String expected = ":-o<field id=\"28\" currency=\"840\" type=\"amount\" value=\"10.00\"/>" + lineSep; assertThat(baos.toString(), is(expected)); }