@Before public void inContext() throws IOException { changeDetector = mock(ChangeDetector.class); when(changeDetector.findChangedFiles()).thenThrow(new IOException()); changeDetector.clear(); testDetector = new StubTestDetector(); core = createCore(changeDetector, testDetector); }