SignatureManagerImpl implements SignatureManager { @Override public SignatureFileInfo downloadLatest(final SignatureType type) throws SignatureManagerException { final Path sigFileDir; switch (type) { case BINARY: sigFileDir = config.getSignatureFileDir(); break; case CONTAINER: sigFileDir = config.getContainerSignatureDir(); break; case TEXT: sigFileDir = config.getTextSignatureFileDir(); break; default: throw new IllegalArgumentException("Invalid signature type : " + type); } try { SignatureFileInfo info = signatureUpdateServices.get(type).importSignatureFile(sigFileDir); final boolean autoSetDefaultSigFile = config.getBooleanProperty(DroidGlobalProperty.UPDATE_AUTOSET_DEFAULT); if (autoSetDefaultSigFile) { PropertiesConfiguration props = config.getProperties(); props.setProperty(defaultVersionProperties.get(type).getName(), FilenameUtils.getBaseName(FileUtil.fileName(info.getFile()))); try { config.getProperties().save(); } catch (ConfigurationException e) { log.error(e.getMessage(), e); throw new SignatureManagerException(e); } } return info; } catch (SignatureServiceException e) { throw new SignatureManagerException(e); } } SignatureManagerImpl();  SignatureManagerImpl(DroidGlobalConfig config, Map<SignatureType, SignatureUpdateService> updateServices); void init(); @Override Map<SignatureType, SortedMap<String, SignatureFileInfo>> getAvailableSignatureFiles(); void setConfig(DroidGlobalConfig config); @Override Map<SignatureType, SignatureFileInfo> getLatestSignatureFiles(); void setSignatureUpdateServices(Map<SignatureType, SignatureUpdateService> signatureUpdateServices); @Override SignatureFileInfo downloadLatest(final SignatureType type); @Override Map<SignatureType, SignatureFileInfo> getDefaultSignatures(); @Override SignatureFileInfo install(final SignatureType type, final Path signatureFile, final boolean setDefault);  }
@Test public void testDownloadLatest() throws Exception { signatureManager.downloadLatest(SignatureType.BINARY); verify(signatureService).importSignatureFile(config.getSignatureFileDir()); }