Seems like this and the cleanup, which is done three times, could be moved to a method to help trim this test down a bit.