Extended tests to statement ranks.
Made StatementGroupBuilder public to allow its use in tests.