Fix analyser warnings in unit tests