test case for hpfriends

and improved testability