ConfigurationMngrImpl implements IConfigurationMngr { @Override public File findIconFromPath( String urlPath ) { Map.Entry<String,String> entry = IconUtils.decodeIconUrl( urlPath ); return ConfigurationUtils.findIcon( entry.getKey(), entry.getValue(), this.workingDirectory ); } ConfigurationMngrImpl(); @Override File getWorkingDirectory(); @Override void setWorkingDirectory( File workingDirectory ); @Override File findIconFromPath( String urlPath );  }
@Test public void testFindIconFromPath() throws Exception { File dir = this.folder.newFolder(); this.mngr.setWorkingDirectory( dir ); Assert.assertEquals( dir, this.mngr.getWorkingDirectory()); File appDir = ConfigurationUtils.findApplicationDirectory( "app", this.mngr.getWorkingDirectory()); File descDir = new File( appDir, Constants.PROJECT_DIR_DESC ); Assert.assertTrue( descDir.mkdirs()); File trickFile = new File( descDir, "directory.jpg" ); Assert.assertTrue( trickFile.mkdirs()); Assert.assertNull( this.mngr.findIconFromPath( "/app/whatever.jpg" )); File singleJpgFile = new File( descDir, "whatever.jpg" ); Assert.assertTrue( singleJpgFile.createNewFile()); Assert.assertEquals( singleJpgFile, this.mngr.findIconFromPath( "/app/whatever.jpg" )); Assert.assertEquals( singleJpgFile, this.mngr.findIconFromPath( "/app/whatever.png" )); Assert.assertEquals( singleJpgFile, this.mngr.findIconFromPath( "/app/whatever.cool" )); }