Group replicator logic and tests

Refactored the Utilities tests a bit so more of the logic hangs out in a
shared file and less is in Java and Android specific files.