fix some violations reported by sonar

improve test coverage