AMBARI-5679. Unit tests for steps 7 (with refactor). (onechiporenko)