You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Steve O'Hara <so...@pivotal-solutions.co.uk> on 2009/11/19 23:54:36 UTC

RE: Problems while testing templates with JUnit

Is it possible that the strings are not both the same character encoding
- they look the same in an editor but are not both Unicode?  Is that
even possible?  Just a thought.

Steve

-----Original Message-----
From:
user-return-21006-sohara=pivotal-solutions.co.uk@velocity.apache.org
[mailto:user-return-21006-sohara=pivotal-solutions.co.uk@velocity.apache
.org] On Behalf Of Kai Kousa
Sent: 27 October 2009 06:37
To: user@velocity.apache.org
Subject: Problems while testing templates with JUnit

Hi!

I'm using Velocity-1.6.2 to render some javascripts. To make sure it's 
working, I have written a test case that compares the generated string 
to the expected string.

I'm now at a point where the test case is failing but I cannot figure 
out why. Eclipse's JUnit plugin can't even show the difference between 
the generated and the expected strings. I've tried saving the results to

separate files and running diff on them. But even diff can't notice any 
difference between the two strings. However, when call length()-method 
on both string they return different results(563 and 571).

In a nutshell: the generated string doesn't seem to have any differences

between to expected string but the test still fails.

Any ideas what might cause this? Something to do with encodings or
similar?

Thanks,
Kai

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Problems while testing templates with JUnit

Posted by Will Glass-Husain <wg...@gmail.com>.
I'm guessing it's different platform style of newlines. In velocity we  
do a normalization in the strings before comparing. Another  
possibility is a tab or nonbreaking space (char a0) bring compared  
with a space.

Will

On Nov 19, 2009, at 2:54 PM, "Steve O'Hara" <sohara@pivotal-solutions.co.uk 
 > wrote:

> Is it possible that the strings are not both the same character  
> encoding
> - they look the same in an editor but are not both Unicode?  Is that
> even possible?  Just a thought.
>
> Steve
>
> -----Original Message-----
> From:
> user-return-21006-sohara=pivotal-solutions.co.uk@velocity.apache.org
> [mailto:user-return-21006-sohara=pivotal- 
> solutions.co.uk@velocity.apache
> .org] On Behalf Of Kai Kousa
> Sent: 27 October 2009 06:37
> To: user@velocity.apache.org
> Subject: Problems while testing templates with JUnit
>
> Hi!
>
> I'm using Velocity-1.6.2 to render some javascripts. To make sure it's
> working, I have written a test case that compares the generated string
> to the expected string.
>
> I'm now at a point where the test case is failing but I cannot figure
> out why. Eclipse's JUnit plugin can't even show the difference between
> the generated and the expected strings. I've tried saving the  
> results to
>
> separate files and running diff on them. But even diff can't notice  
> any
> difference between the two strings. However, when call length()-method
> on both string they return different results(563 and 571).
>
> In a nutshell: the generated string doesn't seem to have any  
> differences
>
> between to expected string but the test still fails.
>
> Any ideas what might cause this? Something to do with encodings or
> similar?
>
> Thanks,
> Kai
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org