Extract handler as constructor parameter, so the test can mock it out