Problems while testing templates with JUnit

View: New views
3 Messages — Rating Filter:   Alert me  

Problems while testing templates with JUnit

by Kai Kousa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
For additional commands, e-mail: user-help@...


RE: Problems while testing templates with JUnit

by Steve O'Hara :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
[mailto:user-return-21006-sohara=pivotal-solutions.co.uk@...
.org] On Behalf Of Kai Kousa
Sent: 27 October 2009 06:37
To: user@...
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@...
For additional commands, e-mail: user-help@...



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


Re: Problems while testing templates with JUnit

by wglass :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
 > 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@...
> [mailto:user-return-21006-sohara=pivotal-
> solutions.co.uk@...
> .org] On Behalf Of Kai Kousa
> Sent: 27 October 2009 06:37
> To: user@...
> 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@...
> For additional commands, e-mail: user-help@...
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>

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