Massive refactoring of a common case in the plugin tests for DRY and clarity.