reactor/lite-rx-api-hands-on

Avoid platform-dependent line separator in part 06 assertions

Closed this issue · 1 comments

In Part06Request there are two tests that assert multiple lines of logs as a single String.
The expected String in these assertions thus includes line separators, which happen to be platform dependent (explicit "\n" included).

The tests should be rewritten to avoid that, and the best way of doing so is to assert the logs as a List<String> (one per line) instead of a multi-line single String.

In the case of experimentWithLog():

  • split the stream's input on System.lineSeparator() rather than \n
  • don't join the filtered stream but collect to Collectors.toList(), thus turning the log variable into a List<String>
  • assert the list containsExactly each line of log (multiple strings without a \n)

In the case of experimentWithDoOn():

  • assert a splitted logConsole.toString(), on System.lineSeparator(), rather than a single unsplitted String`
  • assert it containsExactly 6 strings (one per line, without referring to the \n)

This change can be made on master and will be easily forward-merged to solution and techio_course, although it should be tested on solution locally.

closed by #83
(mistakenly mentioning it fixes #86 instead 😢)