### Question:
PluginFolder implements PluginFolderInterface { @Override public FileObject[] findJarFiles() throws KettleFileException { return findJarFiles( searchLibDir ); } PluginFolder( String folder, boolean pluginXmlFolder, boolean pluginAnnotationsFolder );  PluginFolder( String folder, boolean pluginXmlFolder, boolean pluginAnnotationsFolder,
    boolean searchLibDir ); @Override String toString(); static List<PluginFolderInterface> populateFolders( String xmlSubfolder ); @Override FileObject[] findJarFiles(); FileObject[] findJarFiles( final boolean includeLibJars ); @Override String getFolder(); void setFolder( String folder ); @Override boolean isPluginXmlFolder(); void setPluginXmlFolder( boolean pluginXmlFolder ); @Override boolean isPluginAnnotationsFolder(); void setPluginAnnotationsFolder( boolean pluginAnnotationsFolder );  }### Answer:
@Test public void testFindJarFiles_DirWithJarInNameNotAdded() throws IOException, KettleFileException { Files.createDirectories( PATH_TO_DIR_WITH_JAR_IN_NAME ); FileObject[] findJarFiles = plFolder.findJarFiles(); assertNotNull( findJarFiles ); assertEquals( 0, findJarFiles.length ); }
@Test public void testFindJarFiles_DirWithJarInNameNotAddedAndTxtFileNotAdded() throws IOException, KettleFileException { Files.createDirectories( PATH_TO_DIR_WITH_JAR_IN_NAME ); Files.createFile( PATH_TO_NOT_JAR_FILE ); FileObject[] findJarFiles = plFolder.findJarFiles(); assertNotNull( findJarFiles ); assertEquals( 0, findJarFiles.length ); }
@Test public void testFindJarFiles_SeveralJarsInDifferentDirs() throws IOException, KettleFileException { Files.createDirectories( PATH_TO_DIR_WITH_JAR_IN_NAME ); Files.createFile( PATH_TO_JAR_FILE1 ); Files.createFile( PATH_TO_NOT_JAR_FILE ); Files.createDirectories( PATH_TO_TEST_DIR_NAME ); Files.createFile( PATH_TO_JAR_FILE2 ); Files.createFile( PATH_TO_NOT_JAR_FILE_IN_TEST_DIR ); Files.createFile( Paths.get( BASE_TEMP_DIR, PLUGINS_DIR_NAME, JAR_FILE2_NAME ) ); Files.createFile( Paths.get( BASE_TEMP_DIR, PLUGINS_DIR_NAME, NOT_JAR_FILE_NAME ) ); FileObject[] findJarFiles = plFolder.findJarFiles(); assertNotNull( findJarFiles ); assertEquals( 3, findJarFiles.length ); }
@Test public void testFindJarFiles_DirWithKettleIgnoreFileIgnored() throws IOException, KettleFileException { Files.createDirectories( PATH_TO_TEST_DIR_NAME ); Files.createFile( PATH_TO_JAR_FILE2 ); Files.createFile( PATH_TO_KETTLE_IGNORE_FILE ); FileObject[] findJarFiles = plFolder.findJarFiles(); assertNotNull( findJarFiles ); assertEquals( 0, findJarFiles.length ); }
@Test public void testFindJarFiles_LibDirIgnored() throws IOException, KettleFileException { Files.createDirectories( Paths.get( BASE_TEMP_DIR, PLUGINS_DIR_NAME, "lib" ) ); Files.createFile( PATH_TO_JAR_IN_LIB_DIR ); FileObject[] findJarFiles = plFolder.findJarFiles(); assertNotNull( findJarFiles ); assertEquals( 0, findJarFiles.length ); }
@Test public void testFindJarFiles_ExceptionThrows() { String nullFolder = null; String expectedMessage = "Unable to list jar files in plugin folder '" + nullFolder + "'"; plFolder = new PluginFolder( nullFolder, false, true ); try { plFolder.findJarFiles(); fail( "KettleFileException was not occured but expected." ); } catch ( KettleFileException e ) { assertTrue( e instanceof KettleFileException ); assertTrue( e.getLocalizedMessage().trim().startsWith( expectedMessage ) ); } }