Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White spaces (special chars) in JUnit tests #6

Open
Krzysztof1985 opened this issue Jan 13, 2015 · 1 comment
Open

White spaces (special chars) in JUnit tests #6

Krzysztof1985 opened this issue Jan 13, 2015 · 1 comment

Comments

@Krzysztof1985
Copy link

Hello!

I read a book and discover many errors in JUnit tests.
I think you should add some caption about white spaces.
For Example:
JUnit test from submodule
stereo-autoconfig
failed.
(CDPlayerTest)
But when I trimm the string as expected and as result works fine.
Could you fix this issue.

Kind regards
Krzysztof

@asukhyy
Copy link

asukhyy commented Jan 18, 2015

Hi, Krzysztof1985.
I realized that instead of "\n" platform depended line separator should be used call which returns platform's line separator - System.lineSeparator() - since 1.7.

For example in https://github.com/habuma/SpringInActionExamples/blob/master/Chapter_02/stereo-autoconfig/src/test/java/soundsystem/CDPlayerTest.java:

assertEquals(
        "Playing Sgt. Pepper's Lonely Hearts Club Band by The Beatles" + System.lineSeparator(), 
        log.getLog());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants