samedi 2 mai 2015

Why is fileToString not reading the contents of the file properly?

I was following the instructions for CLAVIN installation. When I tried to build the CLAVIN package, it would display a 'Build Failure' after the TextUtilsTest, which checks that the contents extracted from a file are exactly the same as an expected String. Here's the code of the TEST, and here's the method that reads contents from file. These are the details behind its failure:

<failure message="wrong output from fileToString expected:&lt;Line1 word2[&#10;Line2 word2 word3]&#10;Line3&gt; but was:&lt;Line1 word2[&#10;Line2 word2 word3&#13;]&#10;Line3&gt;" type="org.junit.ComparisonFailure"><![CDATA[org.junit.ComparisonFailure: wrong output from fileToString expected:<Line1 word2[
Line2 word2 word3]
Line3> but was:<Line1 word2[
Line2 word2 word3
]
Line3>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at com.bericotech.clavin.util.TextUtilsTest.testFileToString(TextUtilsTest.java:56)
]]></failure>

I checked the input file, and the contents are exactly the same as the provided string. I suspected that the problem is due to the encoding of the text file, I tried all other encodes, but it only made things worst. Would you suggest I ignore the exception, and move on to the next installation step?

Aucun commentaire:

Enregistrer un commentaire