Added unit tests and corrected issues found with the unit tests.

Signed-off-by: uhunkler <urs.hunkler@unodo.de>