Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I had problems in some flow with unicode chars in some of my flows. So i fixed the flow and added a test.

assertEquals("Bj?rk", buyingOption.getArtist());

the buyingOption.getArtist() will return the same name that is on ,here is a snippet :

alt text

but junit will fail with the message :

junit.framework.ComparisonFailure: null 
Expected :Bj?rk
Actual   :Bj?rk
    at com.delver.update.system.AECSystemTest.basicOperationtsTest1(AECSystemTest.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
454 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is probably due to the default encoding used for your Java source files. The ? in the string literal in the JUnit source code is probably being converted to something else when the test is compiled.

To avoid this, use Unicode escapes (uxxxx) in the string literals in your JUnit source code:

assertEquals("Bju00F6rk", buyingOption.getArtist());

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...