String filenameValidatorForInputFiles( String filename ) {
    Repository rep = getTransMeta().getRepository();
    if ( rep != null && rep.isConnected() && filename
      .contains( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) ) {
      return environmentSubstitute( filename.replace( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY,
        Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY ) );
    } else {
      return environmentSubstitute( filename );
    }
  }
@Test
  public void testFilenameValidatorForInputFilesConnectedToRep() {
    CsvInput csvInput = mock( CsvInput.class );

    String internalEntryVariable = "internalEntryVariable";
    String internalTransformationVariable = "internalTransformationVariable";

    String filename = Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ;
    csvInput.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, internalEntryVariable );
    csvInput.setVariable( Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY, internalTransformationVariable );

    TransMeta transmeta = mock( TransMeta.class );

    Repository rep = mock( Repository.class );

    when( csvInput.getTransMeta() ).thenReturn( transmeta );
    when( transmeta.getRepository() ).thenReturn( rep );
    when( rep.isConnected() ).thenReturn( true );

    when( csvInput.filenameValidatorForInputFiles( any() ) ).thenCallRealMethod();
    when( csvInput.environmentSubstitute( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY  ) ).thenReturn( internalEntryVariable );
    when( csvInput.environmentSubstitute( Const.INTERNAL_VARIABLE_TRANSFORMATION_FILENAME_DIRECTORY  ) ).thenReturn( internalTransformationVariable );


    String finalFilename = csvInput.filenameValidatorForInputFiles(filename);

    assertEquals( internalTransformationVariable, finalFilename );

  }