@Test
public void throwsExceptionIfSuitableActionIsNotFound() {

    final String generatedCodeForAction = "generaated";
    ApplicationActionConfiguration applicationActionConfiguration = mock(ApplicationActionConfiguration.class);
    when(applicationActionConfiguration.getName()).thenReturn(SOME_EVENT);
    List<ApplicationActionConfiguration> applicationActionConfigurations = new ArrayList<>();
    applicationActionConfigurations.add(applicationActionConfiguration);
    ApplicationConfiguration applicationConfiguration = mock(ApplicationConfiguration.class);
    when(applicationConfiguration.getApplicationActionConfigurationList()).thenReturn(applicationActionConfigurations);
    Map<String, String> testCaseStep = new HashMap<>();
    testCaseStep.put(EVENT, "blabla");
    TestScenarioSteps testCaseSteps = new TestScenarioSteps();
    testCaseSteps.add(testCaseStep);
    StepsAndConfiguration stepsAndConfiguration = mock(StepsAndConfiguration.class);
    when(stepsAndConfiguration.getTestCaseSteps()).thenReturn(testCaseSteps);
    when(stepsAndConfiguration.getApplicationConfiguration()).thenReturn(applicationConfiguration);
    StepAndActionConfiguration stepAndActionConfiguration = mock(StepAndActionConfiguration.class);
    JavascriptGenerator<StepAndActionConfiguration> generatorByStepAndActionConfiguration = mock(JavascriptGenerator.class);
    when(generatorByStepAndActionConfiguration.generate(stepAndActionConfiguration)).thenReturn(generatedCodeForAction);
    StepAndActionConfigurationSupplier stepAndActionConfigurationSupplier = mock(StepAndActionConfigurationSupplier.class);
    when(stepAndActionConfigurationSupplier.get(eq(testCaseStep), anyInt(), eq(applicationActionConfiguration))).thenReturn(stepAndActionConfiguration);
    ReplayingJavascriptGenerator replayingJavascriptGenerator = new ReplayingJavascriptGenerator(baseTemplate,
            generatorByStepAndActionConfiguration, stepAndActionConfigurationSupplier);
    expectedException.expect(IllegalStateException.class);
    String actual = replayingJavascriptGenerator.generate(stepsAndConfiguration);
}