Moving some test code to its own method.