[ 
https://issues.apache.org/jira/browse/IMAGING-252?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Lucas updated IMAGING-252:
-------------------------------
    Description: 
When performing a maven verify under a Windows OS, the unit test for 
TestImageInfo.java fails. The problem is due to the fact that the toString() 
method used for the test data format (BMP, I think) returns a multi-line 
product. Under windows, the PrintWriter class that is used internally to format 
the string introduces carriage returns.  But the "expected" string that the 
TestImageInfo class uses has  line feeds but no carriage returns.  So the 
assertEquals() test fails.

By tradition, Windows text includes a carriage-return/line-feed at the end of 
each line of text while Linux text has just a line-feed. So if these unit tests 
are performed on Linux, they pass. Only Windows is an issue.

Recommend including a line of code to remove the carriage-returns from the 
return String from the ImageInfo.toString() method call.   Instead of:
{quote}assertEquals(expected, imageInfo.toString());
{quote}
use:

 
{quote}String test = imageInfo.toString().replaceAll("\\r", "");

assertEquals(expected, test);
{quote}
 

 

  was:
When performing a maven verify under a Windows OS, the unit test for 
TestImageInfo.java fails. The problem is due to the fact that the toString() 
method used for the test data format (BMP, I think) returns a multi-line 
product. Under windows, the PrintWriter class that is used internally to format 
the string introduces carriage returns.  But the "expected" string that the 
TestImageInfo class uses has  line feeds but no carriage returns.  So the 
assertEquals() test fails.

By tradition, Windows text includes a carriage-return/line-feed at the end of 
each line of text while Linux text has just a line-feed. So if these unit tests 
are performed on Linux, they pass. Only Windows is an issue.

Recommend including a line of code to remove the carriage-returns from the 
return String from the ImageInfo.toString() method call.   Instead of:
{quote}assertEquals(expected, imageInfo.toString());
{quote}
use:

 
{quote}String test = imageInfo.toString().replaceAll("\\r", "");

assertEquals(expected, test);
{quote}
 

 


> Unit Tests Fail when running under Windows
> ------------------------------------------
>
>                 Key: IMAGING-252
>                 URL: https://issues.apache.org/jira/browse/IMAGING-252
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: imaging.*
>    Affects Versions: 1.0-alpha1
>            Reporter: Gary Lucas
>            Priority: Major
>
> When performing a maven verify under a Windows OS, the unit test for 
> TestImageInfo.java fails. The problem is due to the fact that the toString() 
> method used for the test data format (BMP, I think) returns a multi-line 
> product. Under windows, the PrintWriter class that is used internally to 
> format the string introduces carriage returns.  But the "expected" string 
> that the TestImageInfo class uses has  line feeds but no carriage returns.  
> So the assertEquals() test fails.
> By tradition, Windows text includes a carriage-return/line-feed at the end of 
> each line of text while Linux text has just a line-feed. So if these unit 
> tests are performed on Linux, they pass. Only Windows is an issue.
> Recommend including a line of code to remove the carriage-returns from the 
> return String from the ImageInfo.toString() method call.   Instead of:
> {quote}assertEquals(expected, imageInfo.toString());
> {quote}
> use:
>  
> {quote}String test = imageInfo.toString().replaceAll("\\r", "");
> assertEquals(expected, test);
> {quote}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to