This code is repeated below - consider extracting to a test helper class or the like.