SONAR-3755 Add unit tests and fix quality flaw