consolidate service creation code in tests