@Test
public void buildPreprocessedInput() {

    SecurityAnalysisExecutionInput executionInput = new SecurityAnalysisExecutionInput()
            .setNetworkVariant(mock(Network.class), "")
            .setParameters(new SecurityAnalysisParameters());
    SecurityAnalysisPreprocessor preprocessor = mock(SecurityAnalysisPreprocessor.class);
    SecurityAnalysisPreprocessorFactory factory = mock(SecurityAnalysisPreprocessorFactory.class);
    when(factory.newPreprocessor(any())).thenReturn(preprocessor);
    SecurityAnalysisInput input = SecurityAnalysisTool.buildPreprocessedInput(executionInput, LimitViolationFilter::new, factory);
    assertSame(executionInput.getParameters(), input.getParameters());
    assertSame(executionInput.getNetworkVariant(), input.getNetworkVariant());
    verify(factory, times(0)).newPreprocessor(any());
    executionInput.setContingenciesSource(ByteSource.empty());
    SecurityAnalysisTool.buildPreprocessedInput(executionInput, LimitViolationFilter::new, factory);
    verify(factory, times(1)).newPreprocessor(any());
    verify(preprocessor, times(1)).preprocess(any());
}