### Question:
OsgiUtils { public static Set<File> getClasspathCandidates( FileFilter filter ) { Set<File> candidates = new HashSet<>(); String separator = System.getProperty( "path.separator" ); String[] cpElements = System.getProperty( "java.class.path" ).split( separator ); for ( String element : cpElements ) { File candidate = new File( element ); if ( candidate.isFile() ) { if ( filter != null && filter.accept( candidate ) ) { candidates.add( candidate ); if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17003_ACCEPTED_CANDIDATE_WITH_FILTER, candidate.toString() ) ); } } else if ( filter == null && candidate.getName().endsWith( ".jar" ) ) { candidates.add( candidate ); if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17004_ACCEPTED_CANDIDATE_NO_FILTER, candidate.toString() ) ); } } else { if ( LOG.isInfoEnabled() ) { LOG.info( I18n.msg( I18n.MSG_17005_REJECTING_CANDIDATE, candidate.toString() ) ); } } } } return candidates; } private  OsgiUtils(); static Set<String> getAllBundleExports( FileFilter filter, Set<String> pkgs ); static Set<String> splitIntoPackages( String exports, Set<String> pkgs ); static Set<File> getClasspathCandidates( FileFilter filter ); static String getBundleExports( File bundle );  }### Answer:
@Test public void testGetClasspathCandidates() { Set<File> candidates = OsgiUtils.getClasspathCandidates( REJECTION_FILTER ); assertEquals( 0, candidates.size(), "Should have no results with REJECTION_FILTER" ); candidates = OsgiUtils.getClasspathCandidates( ONLY_ONE_FILTER ); assertEquals( 1, candidates.size(), "Should have one result with ONLY_ONE_FILTER" ); candidates = OsgiUtils.getClasspathCandidates( JUNIT_SLF4J_FILTER ); assertTrue( candidates.size() >= 4, "Should have at least 4 results with JUNIT_SLF4J_FILTER" ); candidates = OsgiUtils.getClasspathCandidates( null ); assertTrue( candidates.size() >= 4, "Should have at least 4 results with no filter" ); }