@Test(expected = InvalidResourceLocation.class)
  public void should_throw_exception_for_non_existing_file_infered_from_class_level_annotation()
      throws Exception {
    // given
    TestEvent testEvent =
        new TestEvent(
            new UsingScriptAnnotatedOnClassLevelOnlyNonExistingFile(),
            UsingScriptAnnotatedOnClassLevelOnlyNonExistingFile.class.getMethod("shouldFail"));
    SqlScriptProvider<ApplyScriptBefore> scriptsProvider = createSqlScriptProviderFor(testEvent);

    // when
    List<SqlScriptResourceDescriptor> scriptDescriptors =
        new ArrayList<SqlScriptResourceDescriptor>(
            scriptsProvider.getDescriptorsDefinedFor(testEvent.getTestMethod()));

    // then
    // exception should be thrown
  }
  @Test(expected = InvalidResourceLocation.class)
  public void should_throw_exception_for_non_existing_file_defined_on_method_level_annotation()
      throws Exception {
    // given
    TestEvent testEvent =
        new TestEvent(
            new UsingScriptOnTestMethodLevelWithNonExistingFileAndDefaultLocation(),
            UsingScriptOnTestMethodLevelWithNonExistingFileAndDefaultLocation.class.getMethod(
                "shouldFailForNonExistingFile"));
    SqlScriptProvider<ApplyScriptBefore> scriptsProvider = createSqlScriptProviderFor(testEvent);

    // when
    List<SqlScriptResourceDescriptor> scriptDescriptors =
        new ArrayList<SqlScriptResourceDescriptor>(
            scriptsProvider.getDescriptorsDefinedFor(testEvent.getTestMethod()));

    // then
    // exception should be thrown
  }
  @Test
  public void should_find_file_in_default_location_if_not_specified_explicitly() throws Exception {
    // given
    FileSqlScriptResourceDescriptor expectedFile =
        new FileSqlScriptResourceDescriptor(
            defaultConfiguration.getDefaultSqlScriptLocation() + "/tables-in-scripts-folder.sql",
            defaultConfiguration.getCharset());
    TestEvent testEvent =
        new TestEvent(
            new UsingScriptOnTestMethodLevelWithNonExistingFileAndDefaultLocation(),
            UsingScriptOnTestMethodLevelWithNonExistingFileAndDefaultLocation.class.getMethod(
                "shouldPassForFileStoredInDefaultLocation"));
    SqlScriptProvider<ApplyScriptBefore> scriptsProvider = createSqlScriptProviderFor(testEvent);

    // when
    List<SqlScriptResourceDescriptor> dataSetDescriptors =
        new ArrayList<SqlScriptResourceDescriptor>(
            scriptsProvider.getDescriptorsDefinedFor(testEvent.getTestMethod()));

    // then
    assertThat(dataSetDescriptors).containsOnly(expectedFile);
  }
  @Test
  public void should_extract_all_scripts() throws Exception {
    // given
    FileSqlScriptResourceDescriptor one =
        new FileSqlScriptResourceDescriptor("one.sql", defaultConfiguration.getCharset());
    FileSqlScriptResourceDescriptor two =
        new FileSqlScriptResourceDescriptor("two.sql", defaultConfiguration.getCharset());
    FileSqlScriptResourceDescriptor three =
        new FileSqlScriptResourceDescriptor("three.sql", defaultConfiguration.getCharset());
    TestEvent testEvent =
        new TestEvent(
            new ApplyScriptBeforeAnnotatedClass(),
            ApplyScriptBeforeAnnotatedClass.class.getMethod("shouldPassWithMultipleFilesDefined"));
    SqlScriptProvider<ApplyScriptBefore> scriptsProvider = createSqlScriptProviderFor(testEvent);

    // when
    List<SqlScriptResourceDescriptor> scriptDescriptors =
        new ArrayList<SqlScriptResourceDescriptor>(
            scriptsProvider.getDescriptorsDefinedFor(testEvent.getTestMethod()));

    // then
    assertThat(scriptDescriptors).containsExactly(one, two, three);
  }