Replace copypasta with function calls to make tests intelligible.