Improve generated tests: use shared examples to hide implementation details