Rewrote test code to remove FRIEND_TEST

Moved test code into fixtures to avoid FRIEND_TEST declarations in
library code.