lundi 27 avril 2015

Unit test: How to Ignore the white Spaces while compare two files? [Java]

I want to create a Unit test method. Version of Java - 1.6

@Test
public void TestCreateHtml() throws IOException{

    final File output = parser.createHtml();
    final File expected = new File("src/main/resources/head.jsp");

  assertEquals("The files differ!", FileUtils.readLines(expected), FileUtils.readLines(output));
}

This test method doesn't work. The contents of both files are equals, but they have different number of white spaces.

How can I ignore the white spaces?

Aucun commentaire:

Enregistrer un commentaire