package nl.hsac.fitnesse.fixture.util;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class XMLFormatterTest {
    private XMLFormatter formatter = new XMLFormatter();

    @Test
    public void testDefaultNamespacePreserved() {
        String response = FileUtil.loadFile("GetWeatherSoapResponse.xml");
        String expected = FileUtil.loadFile("GetWeatherSoapResponseFormatted.xml");

        String formatted = formatter.format(response);

        assertEquals(expected.replace("\r", ""), formatted.replace("\r", ""));

    }
}

@@ -554,11 +554,790 @@
 ;%0A%0A    %7D
+%0A%0A    @Test%0A    public void testTrimElements() %7B%0A        String expected = FileUtil.loadFile(%22GetWeatherSoapResponse.xml%22);%0A        String formatted = FileUtil.loadFile(%22GetWeatherSoapResponseFormatted.xml%22);%0A%0A        String trimmed = XMLFormatter.trimElements(formatted);%0A%0A        assertEquals(expected, trimmed);%0A        assertEquals(expected, XMLFormatter.trimElements(trimmed));%0A    %7D%0A%0A    @Test%0A    public void testTrim() %7B%0A        String expected = FileUtil.loadFile(%22GetWeatherSoapResponse.xml%22)%0A                            .replace(%22%3C?xml version=%5C%221.0%5C%22 encoding=%5C%22UTF-8%5C%22?%3E%22, %22%22);%0A        String formatted = FileUtil.loadFile(%22GetWeatherSoapResponseFormatted.xml%22);%0A%0A        String trimmed = XMLFormatter.trim(formatted);%0A%0A        assertEquals(expected, trimmed);%0A    %7D
 %0A%7D%0A

Add tests for trimming