PrivateKeyLoader implements EntityLoader { @Override public void load(Bundle bundle, File rootDir) { final File privateKeysDir = findConfigFileOrDir(rootDir, "privateKeys"); if (privateKeysDir != null && privateKeysDir.exists()) { final String[] privateKeyFiles = privateKeysDir.list(); if (privateKeyFiles != null && privateKeyFiles.length > 0) { final Map<String, SupplierWithIO<InputStream>> map = new HashMap<>(); Arrays.stream(privateKeyFiles).forEach(privateKey -> { if (checkPrivateKeyFormat(privateKey)) { map.put(getBaseName(privateKey), () -> new FileInputStream(new File(privateKeysDir, privateKey))); } else { throw new ConfigLoadException(privateKey + " must be a valid private key extension (.p12)."); } }); bundle.putAllPrivateKeyFiles(map); } } }  @Override void load(Bundle bundle, File rootDir); @Override void load(Bundle bundle, String name, String value); @Override Object loadSingle(String name, File entitiesFile); @Override Map<String, Object> load(File entitiesFile); @Override String getEntityType();  }
@Test void loadNoCerts() { CertificatesLoader loader = new CertificatesLoader(FileUtils.INSTANCE); Bundle bundle = new Bundle(); loader.load(bundle, rootProjectDir.getRoot()); assertTrue(bundle.getPrivateKeyFiles().isEmpty()); }