This block of code is repeated several times in different tests. Please extract to a common method.