Use unit tests instead of integration tests.

This provides a faster feedback cycle and the JUnit messages for failed
assertions are more meaningful.
Extract SectionSorter.

Start to make the code more explanatory.
[MOJO-1981] Fixed rendering of new line between groups.