Improve the getData unit test

As a follow-up to PR #4795, this patch improves the `getData` unit test to ensure that the returned data is of the expected type and of the correct length.
Merge pull request #5330 from Snuffleupagus/better-getData-unittest

Improve the getData unit test