Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I am currently developping my Unit Test to check my developments.
I have an issue with a tAssert component, when I compare 2 integer which came from a tSetGlobalVar component.
I have this in my tAssert Expression field :
((Integer)globalMap.get("countRows"))==((Integer)globalMap.get("NbMunicipalityExtract"))
This assertion results always by a "Test logically failed" status.
I am 100% sure that I have exactly the same value in the 2 variables, because I have set this in the Description field of my tAssert :
"Check current count : " + ((Integer)globalMap.get("countRows")) + " == " + ((Integer)globalMap.get("NbMunicipalityExtract"))
And I can see that in the results :
Check current count : 382 == 382
How can I fix that ?
If I do this in the Expression field :
((Integer)globalMap.get("countRows"))==382
or
382==((Integer)globalMap.get("NbMunicipalityExtract")),
then the result of the assertion is OK.
Is that an issue with the component ?
I use Talend ESB 7.0.1.
Thanks for your help !
Hi,
there are many similar topics there, the answer is - for compare Integer you can not use ==
you could use equals() - https://stackoverflow.com/questions/1514910/how-to-properly-compare-two-integers-in-java
Hi,
there are many similar topics there, the answer is - for compare Integer you can not use ==
you could use equals() - https://stackoverflow.com/questions/1514910/how-to-properly-compare-two-integers-in-java
Thanks Vapukov for your help !