@Test
public void failOnError() throws IOException {

    Scanner scanner = new ScannerImpl(configuration, emptyMap(), context, scannerPluginRepository);
    stubExceptionDuringScan(scanner);
    try {
        scanner.scan("test", "test", scope);
        fail("Expecting an " + UnrecoverableScannerException.class.getName());
    } catch (UnrecoverableScannerException e) {
        String message = e.getMessage();
        assertThat(message, containsString("test"));
    }
    verify(store).beginTransaction();
    verify(store).rollbackTransaction();
    verify(store, never()).commitTransaction();
    assertThat(transaction, equalTo(false));
}