Issue 325 refactor unittests