collect_hw_data method was in a wrong namespace

(caused by misplaced `end` statement)

- added a test for it